diff --git a/src/PayPal/Order/CommandHandler/UpdatePayPalOrderCommandHandler.php b/src/PayPal/Order/CommandHandler/UpdatePayPalOrderCommandHandler.php index e59ad0d5c..2aa82c152 100644 --- a/src/PayPal/Order/CommandHandler/UpdatePayPalOrderCommandHandler.php +++ b/src/PayPal/Order/CommandHandler/UpdatePayPalOrderCommandHandler.php @@ -90,11 +90,14 @@ public function handle(UpdatePayPalOrderCommand $command) } $response = $this->httpClient->updateOrder($builder->presentPayload()->getArray()); - $order = json_decode($response->getBody(), true); + + if ($response->getStatusCode() !== 204) { + throw new PayPalOrderException('Failed to update PayPal Order', PayPalOrderException::PAYPAL_ORDER_UPDATE_FAILED); + } $this->eventDispatcher->dispatch(new PayPalOrderUpdatedEvent( - $order['id'], - $order, + $command->getPayPalOrderId()->getValue(), + $builder->presentPayload()->getArray(), $command->getCartId()->getValue(), $command->isHostedFields(), $command->isExpressCheckout(), diff --git a/src/PayPal/Order/Exception/PayPalOrderException.php b/src/PayPal/Order/Exception/PayPalOrderException.php index b4de3faf4..949e62cb1 100644 --- a/src/PayPal/Order/Exception/PayPalOrderException.php +++ b/src/PayPal/Order/Exception/PayPalOrderException.php @@ -27,7 +27,5 @@ class PayPalOrderException extends PsCheckoutException const INVALID_ID = 1; const CANNOT_RETRIEVE_ORDER = 2; const EMPTY_ORDER_DATA = 3; - const CANNOT_CAPTURE_ORDER = 4; - const SESSION_EXCEPTION = 5; - const CACHE_EXCEPTION = 6; + const PAYPAL_ORDER_UPDATE_FAILED = 4; }