202ecommerce / paypal

This repository is for developpers only. To install and upgrade the module in a production shop please install the package via PrestaShop Marketplace by following this link:
https://addons.prestashop.com/fr/paiement-carte-wallet/1748-paypal-officiel.html
Academic Free License v3.0
20 stars 31 forks source link

Module doesn't change statut with hook #353

Open BenTen opened 1 month ago

BenTen commented 1 month ago

Describe the bug and add screenshots

When a customer make an order by paying with Paypal, the module add the statut "awaiting PayPal payment" with the hook hookActionOrderStatusPostUpdate.

But when the module receive the information of the paypal's webhook, the statut "payment accepted" is not add by using this hook.

So if another module read this hook, it can't be able to know the new statut.

Expected behavior

The PayPal module need to change each statut by using the hook hookActionOrderStatusPostUpdate.

Steps to reproduce

PrestaShop version(s) where the bug happened

1.7.5

PHP version(s) where the bug happened

7.2

Module version(s) where the bug happened

6.4.1 (addon version)

bogdan202 commented 1 month ago

Hello @BenTen, The module 'paypal' uses Order::setCurrentState() to change an order state. https://github.com/202ecommerce/paypal/blob/6.4.0/classes/Webhook/WebhookEventHandler.php#L147 Hook 'actionOrderStatusPostUpdate' is triggered in the method OrderHistory::changeIdOrderState() that is performed inside the method Order::setCurrentState(). https://github.com/PrestaShop/PrestaShop/blob/1.7.5.0/classes/order/OrderHistory.php#L411 https://github.com/PrestaShop/PrestaShop/blob/1.7.5.0/classes/order/Order.php#L1668 Given all above, your problem seems to be not in the module 'paypal'. Perhaps, you have an overrides for Order or OrderHistory

BenTen commented 1 month ago

Thank you @bogdan202 to clarify the process

But when the module receive the information of the paypal's webhook, the statut "payment accepted" is not add by using this hook.

Maybe this sentence was not clear.

I mean, the statut seems not add by using this hook BUT the statut is adding

I don't have override for this files but modification has been made to apply 4 years ago:

who was trouble with Werbservice of PS 1.7.5 in our case. But It seems not related with this actual issue we are facing on PayPal module.

Here the statut is updated but can't see it on the hookActionOrderStatusPostUpdate