You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So in this case, when a user places an order with AmazonPay, they will always receive the order confirmation email without the payment status being checked.
Solution:
I have created a beforeExecute plugin for the observer (sales_model_service_quote_submit_success) to prevent the order confirmation email from being triggered before the payment is completed by AmazonPay.
Thanks for raising the issue @mohit-sharma-rp , this is a problem we're aware of and have a fix ready for an upcoming release. You've suggested a different approach though, we'll compare the two and see if this looks like a better solution!
What I expected
Order confirmation email should send only if payment is confirmed.
What happened instead
Customer receiving order confirmation email for declined payment.
Steps to reproduce the issue
Your setup
More details about the issue:
The issue is happening due to the AmazonPay module is placing an order before the payment is initialized here
amazon-payments-magento-2-plugin/Model/CheckoutSessionManagement.php
Line 873 in 658f831
It uses Magento's placeOrder method to place the order, and I found that Magento triggers the order confirmation email after the order is placed via the event sales_model_service_quote_submit_success through the observer https://github.com/magento/magento2/blob/df07984301dc3aa80958544f20d1c28141a1e105/app/code/Magento/Quote/Observer/SubmitObserver.php#L62
So in this case, when a user places an order with AmazonPay, they will always receive the order confirmation email without the payment status being checked.
Solution:
I have created a beforeExecute plugin for the observer (sales_model_service_quote_submit_success) to prevent the order confirmation email from being triggered before the payment is completed by AmazonPay.
Trigger an order confirmation email after payment confirmed here
amazon-payments-magento-2-plugin/Model/CheckoutSessionManagement.php
Line 642 in 658f831
The text was updated successfully, but these errors were encountered: