I am using a plugin to handle payments for my shop through Mollie (Dutch PSP). After direct payment, the payment status of the order reaches the ‘paid’ state. However, the corresponding e-mail is not sent. It’s not in the log and my current template contains no errors. We don’t see any errors in the logs either. I have allocated the mailtemplate to the right saleschannel. When I manually change the state of an order, the linked e-mail does get sent.
I have two questions:
Is my assumption that the mentioned e-mail should be triggered automatically by the fact the payment status of the order reaches the paid state correct? If not, how and where should I build such a trigger?
If my assumption in 1. is correct, what could I check to see what is going wrong here? The developer who’s built the payment plugin suggest that this is something that would be happening outside of their plugin / is something the can’t influence.
Please let me know if any additional information is needed. Thanks in advance for your responses.
Just make sure there is a mail template with type ‘Bestellbestätigung’ or in englisch ‘order confirmation’ and also make sure the Sales channel is selected.
If both things are set and there are no errors in your content then the mail will be sent
Thanks for your response. This e-mail does get sent with other payment methods (like pay later), or when I change the payment status of an order manually. This means the template is there, the saleschannel is allocated, and there are no errors in the content of the mail.
However, the issue here is that the e-mail does not get triggered when a payment is made with iDEAL through Mollie (Dutch PSP).
It seems that the e-mail is not sent as a result of a change of the payment status, but that the trigger is a separate process. Is this correct? Then I would like to know how and where to create this trigger.
If the e-mail should be triggered as a result of a change of the payment status I am wondering what I could do to find out what is going wrong here.
Hopefully this clarifies my question and someone is able to give directions.
Okay, that is exactly the issue I’m running into. Relieved to see I’m not the only one. Hopefully someone is able to tell whether this goes wrong in the plugin or on the Shopware side and thus where we should search for a solution.
It will be possible to define whether to send a confirmation mail when the order is placed or a payment confirmation when the payment is compleded (or both). It’s already on the external roadmap. Currently the change to paid when it’s done by a plugin won’t be send.
It is a little late, but I found some solution for my case.
I have found a solution that helped me to trigger „OrderPlaced“ event.
I used „\Shopware\Core\Content\Test\Flow\FlowDispatcherTest“ for that.
Some things like this:
$event = new CheckoutOrderPlacedEvent(Context::createDefaultContext(), $this->getOrderEntity(), $this->getSalesChannel()->getId());
$this->getShopwareContainer()->get('event_dispatcher')->dispatch($event);