Adyen / adyen-magento2

Adyen Payment plugin for Magento2
MIT License
155 stars 211 forks source link

[PW-8539] Store credit reverted twice (doubling the og amount) when an order is refused #2035

Open digitalpianism opened 1 year ago

digitalpianism commented 1 year ago

Describe the bug For some payment methods like Afterpay, the order is created before the success page. If such payment is refused, the module will cancel the order and restore the quote which will trigger the revert store credit observer twice.

To Reproduce Steps to reproduce the behavior:

  1. Login to the frontend with a customer that has got store credit
  2. Add something to your cart
  3. Go to the checkout
  4. Use your store credit
  5. Select Afterpay
  6. Use a refused afterpay credit card when on the afterpay site (with the Test mode you can use 4111 1111 1111 1111 expiry: 01/25 cvv:051)
  7. Confirm (8. you can potentially face this Magento bug when coming back from afterpay but it's unrelated to the current problem: https://magento.stackexchange.com/questions/242146/magento-2-order-cancel-foreign-key-constraint-error )
  8. Store credit has now doubled.

Expected behavior Store credit is reverted and not doubled.

Magento version 2.4.4-p3

Plugin version 8.11.1

Additional context Trace that triggers the issue :

candemiralp commented 1 year ago

Hello @digitalpianism,

Thank you for raising this issue. We created an internal investigation ticket to reproduce the issue and create solution. We will update you when the investigation is done.

Best Regards, Can

raoulritter commented 11 months ago

Hi @digitalpianism,

Apologies for taking so long to come back to this issue. We have fixed the store credit issue in #2366 and #2365 to prevent returning the amount twice and have tested this functionality on magento cloud successfully. Thanks for bringing this to our attention. Hope this solution is satisfactory.

Kind regards,

Raoul