OFFLINE-GmbH / oc-mall-plugin

:convenience_store: E-commerce solution for October CMS
https://offline-gmbh.github.io/oc-mall-plugin
MIT License
169 stars 114 forks source link

Double payment confirmation notification to client, but intermittently no order confirmation notification to admin #877

Closed chocolata closed 2 years ago

chocolata commented 2 years ago

Hi @tobias-kuendig

We're encountering some strange issues regarding the email notifications that are being sent by the platform. We've enabled all the email notifications in the settings, but we're seeing that the end user sometimes gets his payment confirmation two times, and in such cases, no order confirmation is being sent to the administator (which is essential for the handling of the orders).

I've tried to narrow the issue down, but it seems regardless of products, payment methods, shipping methods... Also, I've tried to disable all the custom functionalities I've built in separate plugins, all to no avail.

Also, I've checked in SendGrid, but the emails never appear there. It seems like they are never sent in such cases.

Do you kindly have any idea what might go wrong with the email confirmations and notifications?

P.S.: This is an intermittent issue, so I really have no clue at the moment what might cause it... Thanks for looking into it.

chocolata commented 2 years ago

After thorough investigation this turned out to be an issue in the third party Mollie Payments plugin that did not fire the associated event:

Event::fire('mall.checkout.succeeded', [$result]);

It is being worked on here.

So if you're creating a payment plugin for the OFFLINE Mall plugin, be sure to manually fire the mall.checkout.succeeded event upon successful payment, in order to make sure that the admins get their notifications.

CarolinePublipresse commented 1 year ago

Have you found a solution to the Double payment confirmation notification to client ? I'm having the same problem, and this makes Gmail block some mails in spam, before the client mailbox... So not in the client mailbox at all, even in spams section.

chocolata commented 1 year ago

Hi @CarolinePublipresse,

Sorry for my late reply. It's a very busy period here.

I didn't solve it unfortunately. I've been struggling a bit with the logic. In the handlePaymentResultmethod in plugins/offline/mall/classes/payments/paymentredirector.php I see that the mall.checkout.succeeded mail is only triggered when the payment is completed immediately (but not for payments that are completed later... like a SEPA banktransfer that relies on a webhook).

So the admin then never gets the admin notification of a new order. Also, the orders are always created regardless of the client cancelling the order on the external payment page of the payment provider.

So I'm unsure of how to proceed with this. I understand why the system has been built as it is, but I'm trying to find a solution in which the admins keep getting the necessary notifications to do adequate follow-up (without them by default getting multiple mall.checkout.succeeded mails.

What is your experience with this? Did you manage to solve it?

CarolinePublipresse commented 1 year ago

PubliAlex posted a solution that might interest you : https://github.com/OFFLINE-GmbH/oc-mall-plugin/issues/979 It solved the problem for me.