amzn / amazon-payments-magento-2-plugin

Extension to enable Amazon Pay on Magento 2
https://amzn.github.io/amazon-payments-magento-2-plugin/
Apache License 2.0
109 stars 77 forks source link

Incompatibility with Mollie #1245

Open KathiD303 opened 2 months ago

KathiD303 commented 2 months ago

When choosing a Mollie payment in payment methods and then deciding to complete checkout with Amazon Pay (option "Amazon Pay in final checkout step" in Amazon Pay module enabled) the checkout fails with:

[2024-09-19T08:50:09.892439+00:00] amazonClientLogger.INFO: Quote is already associated with an order. QuoteId: 211 OrderIds: B000000073 [] [] [2024-09-19T08:50:09.894330+00:00] amazonClientLogger.ERROR: Unable to complete Amazon Pay checkout. Can't submit quote id: 211 [] [] [2024-09-19T08:50:09.894392+00:00] amazonClientLogger.ERROR: Unable to complete Amazon Pay checkout Unable to complete Amazon Pay checkout [] []

(please note that the first logging message was added by us to get further insights into the problem)

What I expected

Amazon checkout can be completed.

What happened instead

Amazon checkout fails with message "Unable to complete Amazon Pay checkout"

Steps to reproduce the issue

Your setup

sgabhart22 commented 2 months ago

Hello @KathiD303 ,

Thanks for the report, the additional logging is actually extremely helpful here; at one point we had merchants occasionally seeing duplicated orders, apparently due to a possible race condition in some versions of Magento that made it possible for multiple quotes to be associated with the same order ID. The module's canSubmitQuote() function was added to prevent this. It ignores orders that were created and subsequently cancelled, which seems like (maybe?) what should be happening here... I have little to no familiarity with the Mollie Payments plugin, but I'll see if I can get it set up on a local 2.4.5-p9 instance with the latest version of the AP module and find out what the troublesome orders look like.

Thanks, Spencer

sgabhart22 commented 2 months ago

Hello again @KathiD303 ,

I was not able to reproduce the exact issue you described in sandbox/test mode, but by looking at the Mollie module's configuration options + javascript at checkout , I think it may be creating orders in Magento before redirecting buyers to their selected payment gateway (config option Stores > Configuration > Mollie > Advanced > Statuses). If this is correct, there should be an order on the live site in 'Pending' status for a Mr. Spencer Test using the mollie_methods_paypal payment method.

Ideally, a created Magento order would be cancelled if the customer returns to the store before submitting payment, but maybe in this case we could add an allowance in the previously mentioned canSubmitQuote() function to also exclude pending orders with a mollie_methods_ prefix. Feels a bit like treating a symptom and not a cause, and also potentially defeating much of the original purpose of that function, but I'm not immediately aware of a more elegant way to handle the situation from the Amazon Pay module's perspective.

If I'm completely off base with the above theory, then I may have to request some access to staging site in order for us to investigate the problem more closely and realistically. We can open an internal ticket if so, please let me know!

Thanks, Spencer