Skip to content

Commit

Permalink
Fix UpdatePayPalOrderCommandHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt75 committed Aug 14, 2024
1 parent df8febf commit e55ea91
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
4 changes: 1 addition & 3 deletions src/PayPal/Order/Exception/PayPalOrderException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit e55ea91

Please sign in to comment.