public function createOrReverse(
        Model\InStore\Order $order,
        Model\InStore\Reversal $orderReversal = null,
        HandlerStack $stack = null
    ) {
        try {
            return $this->create($order, $stack);
        } catch (ApiException $orderException) {
            // http://docs.afterpay.com.au/instore-api-v1.html#create-order
            // Should a success or error response (with exception to 409 conflict) not be received,
            // the POS should queue the request ID for reversal
            if ($orderException->getErrorResponse()->getErrorCode() === self::ERROR_CONFLICT) {
                throw $orderException;
            }
            $errorResponse = $orderException->getErrorResponse();
        } catch (RequestException $orderException) {
            // a timeout or other exception has occurred. attempt a reversal
            $errorResponse = new Model\ErrorResponse();

            $errorResponse->setHttpStatusCode(
                $orderException->getResponse() ? $orderException->getResponse()->getStatusCode() : self::ERROR_INTERNAL_ERROR
            );

            $errorResponse->setMessage($orderException->getMessage());
        }

        if ($orderReversal === null) {
            $orderReversal = new Model\InStore\Reversal();
            $orderReversal->setReversingRequestId($order->getRequestId());
            $orderReversal->setRequestedAt(new DateTime());
        }

        try {
            $reversal = $this->reverse($orderReversal, $stack);
            $reversal->setErrorReason($errorResponse);

            return $reversal;
        } catch (ApiException $reversalException) {
            $reversalErrorResponse = $reversalException->getErrorResponse();
            if ($reversalErrorResponse->getErrorCode() === self::ERROR_MSG_PRECONDITION_FAILED) {
                // there was trouble reversing probably because the order failed
                throw $orderException;
            }

            throw $reversalException;
        }
    }