Closed kionez closed 2 years ago
I do a quick search between some other payment modules, many of them use restoreQuote()
from session object to restore the old quote after failed payment, keeping the same quote_id in user's session
Hello @kionez ,
Just wanted to touch base with you again and let you know we are planning a minor release before the general availability of Magento 2.4.4 next week, and I believe we currently intend to include this fix. If anything changes I'll let you know, thanks again for the contribution!
Spencer
issue solved by https://github.com/amzn/amazon-payments-magento-2-plugin/releases/tag/5.12.0
Please reopen if you still experience this issue.
Thanks a lot Best
Christian
What I expected \ Steps to reproduce the issue
What happened instead
When the point 2 fails, the payment gateway (i.e. easynolo/axerve-ecommerce-solutions, but many other works in the same way) cancel the current order and restores the quote, creating a duplicate. When AmazonPay's module checks for duplicated quote_id with canSubmitQuote, it fails reporting an error to customer and placing an open transaction without order_id on sellerscentral.
My proposed solution
As reported in https://github.com/amzn/amazon-payments-magento-2-plugin/issues/1107#issuecomment-1081549618 I think that the canSubmitQuote method in Model/CheckoutSessionManagement.php don't work well with other payment gateway which restores quote after failing.
I think that the module should check for active duplicate quote_id only, excluding canceled ones, so I'm testing a solution excluding canceled order from duplicated quote_id count adding:
->addFieldToFilter('status', ['neq' => \Magento\Sales\Model\Order::STATE_CANCELED]);
to canSubmitQuote query. I write a new module which overrides the method and seems working fine, but I prefer to have an official confirmation that my idea is a good one and as I don't have much experience with the quote mechanism, there is probably a better solution :)Your setup