Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in webhook while reimbursing an order #151

Open
lmeyer1 opened this issue Nov 25, 2022 · 0 comments
Open

Exception in webhook while reimbursing an order #151

lmeyer1 opened this issue Nov 25, 2022 · 0 comments
Assignees
Labels

Comments

@lmeyer1
Copy link

lmeyer1 commented Nov 25, 2022

Describe the bug and add screenshots

There was a communication problem between paypal and PrestaShop through the webhooks that raised exceptions. The final behavior was expected.

The following exceptions occurred:

ErrorException
Notice: Trying to get property 'authorization_id' of non-object
/modules/paypal/classes/Webhook/WebhookEventHandler.php dans PaypalAddons\classes\Webhook\WebhookEventHandler::getAuthorizationId à la ligne 210
/modules/paypal/classes/Webhook/WebhookEventHandler.php dans PaypalAddons\classes\Webhook\WebhookEventHandler::isCaptureAuthorization à la ligne 196
/modules/paypal/classes/Webhook/WebhookEventHandler.php dans PaypalAddons\classes\Webhook\WebhookEventHandler::handle à la ligne 109
/modules/paypal/controllers/front/webhookhandler.php dans PaypalWebhookhandlerModuleFrontController::run à la ligne 76
/classes/Dispatcher.php dans DispatcherCore::dispatch à la ligne 530
/index.php à la ligne 28

ErrorException
Notice: Trying to get property 'authorization_id' of non-object
/modules/paypal/classes/Webhook/WebhookEventHandler.php dans PaypalAddons\classes\Webhook\WebhookEventHandler::getAuthorizationId à la ligne 210
/modules/paypal/classes/Webhook/WebhookEventHandler.php dans PaypalAddons\classes\Webhook\WebhookEventHandler::isCaptureAuthorization à la ligne 196
/modules/paypal/classes/Webhook/WebhookEventHandler.php dans PaypalAddons\classes\Webhook\WebhookEventHandler::getTransactionRef à la ligne 173
/modules/paypal/classes/Webhook/WebhookEventHandler.php dans PaypalAddons\classes\Webhook\WebhookEventHandler::initPaypalOrder à la ligne 162
/modules/paypal/classes/Webhook/WebhookEventHandler.php dans PaypalAddons\classes\Webhook\WebhookEventHandler::handle à la ligne 73
/modules/paypal/controllers/front/webhookhandler.php dans PaypalWebhookhandlerModuleFrontController::run à la ligne 76
/classes/Dispatcher.php dans DispatcherCore::dispatch à la ligne 530
/index.php à la ligne 28

ErrorException
Notice: Trying to get property 'authorization_id' of non-object
/modules/paypal/classes/Webhook/WebhookEventHandler.php dans PaypalAddons\classes\Webhook\WebhookEventHandler::getAuthorizationId à la ligne 210
/modules/paypal/classes/Webhook/WebhookEventHandler.php dans PaypalAddons\classes\Webhook\WebhookEventHandler::isCaptureAuthorization à la ligne 196
/modules/paypal/classes/Webhook/WebhookEventHandler.php dans PaypalAddons\classes\Webhook\WebhookEventHandler::getTransactionRef à la ligne 173
/modules/paypal/classes/Webhook/WebhookEventHandler.php dans PaypalAddons\classes\Webhook\WebhookEventHandler::initPaypalOrder à la ligne 162
/modules/paypal/classes/Webhook/WebhookEventHandler.php dans PaypalAddons\classes\Webhook\WebhookEventHandler::getPaymentTotal à la ligne 336
/modules/paypal/classes/Webhook/WebhookEventHandler.php dans PaypalAddons\classes\Webhook\WebhookEventHandler::getPsOrderStatus à la ligne 324
/modules/paypal/classes/Webhook/WebhookEventHandler.php dans PaypalAddons\classes\Webhook\WebhookEventHandler::handle à la ligne 103
/modules/paypal/controllers/front/webhookhandler.php dans PaypalWebhookhandlerModuleFrontController::run à la ligne 76
/classes/Dispatcher.php dans DispatcherCore::dispatch à la ligne 530
/index.php à la ligne 28

The order detail in Prestashop show the communication details and seem normal:

2022-11-23 11:17:51 The refund request has been sent with success. Waiting for a webhook message.Refund Transaction Id: 6P382105Y3635024F; Total amount: 20.30; Status: COMPLETED; Transaction date: 2022-11-23 02:17:50;
2022-11-23 11:19:24 Webhook event : {"event_type":"PAYMENT.CAPTURE.REFUNDED","webhook_id":"WH-08C19637J97027053-21F15634FN5256927","data":{"id":"WH-08C19637J97027053-21F15634FN5256927","create_time":"2022-11-23T10:17:54.686Z","resource_type":"refund","event_type":"PAYMENT.CAPTURE.REFUNDED","summary":"A EUR 20.3 EUR capture payment was refunded","resource":{"seller_payable_breakdown":{"gross_amount":{"currency_code":"EUR","value":"20.30"},"paypal_fee":{"currency_code":"EUR","value":"0.00"},"net_amount":{"currency_code":"EUR","value":"20.30"},"total_refunded_amount":{"currency_code":"EUR","value":"20.30"}},"amount":{"currency_code":"EUR","value":"20.30"},"update_time":"2022-11-23T02:17:50-08:00","create_time":"2022-11-23T02:17:50-08:00","custom_id":"Cart ID: 634618.Shop name: Certitude","links":[{"href":"https:\/\/api.paypal.com\/v2\/payments\/refunds\/6P382105Y3635024F","rel":"self","method":"GET"},{"href":"https:\/\/api.paypal.com\/v2\/payments\/captures\/2VR98229FX327810M","rel":"up","method":"GET"}],"i

Expected behavior

No exception should be raised.

Steps to reproduce

We are tracing exceptions with sentry, this is how we noticed the exception happening.

  1. In the BO, open an order payed with paypal
  2. Choose the order state "Remboursé" (Reimbursed), click "Mettre à jour l'état" (Update order state)
  3. There is a message telling that the order will be refunded in paypal, and that PrestaShop is waiting for the confirmation from paypal
  4. The order was Reimbursed in Paypay and in Prestashop, so form the user perspective everything worked as expected.

PrestaShop version(s) where the bug happened

1.7.8.7, paypal version 5.7.2

PHP version(s) where the bug happened

7.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants