Closed Gugiman closed 3 years ago
To be a bit more precise.
The screenshot shows a xdebug session where I stopped right after creating an order. The Shopware_Modules_Order_SendMail_Send event just dispatched.
1) The way adyen searches for the orderId results in null (1.1) 2) I wrote a method searching for the orderId by using the ordernumber. Which works (2.1) 3) But although i have an orderId now, it would never find something in s_plugin_adyen_order_payment_info because the order is saved with id -1 in that specific moment.
So the mail variables are not stored and therefore no mail is send later when the notification comes in.
Hello @Gugiman, thanks for opening this issue.
Could you verify if https://github.com/Adyen/adyen-shopware5/pull/125 solves the problem? We found out that the OrderId is not present at that moment of the order flow as you suggested, so a fallback to the ordernumber was added.
Cheers, Ángel
Hi Column "ordermail_variables" gets correctly filled now. But who is responsible for calling /process/return Action for actually sending the mail?
Hello @Gugiman,
Payments will finish in /process/return
and the email will be sent based on resultCode
(e.g. redirect methods https://github.com/adyen/adyen-shopware5/blob/master/Controllers/Frontend/Transparent.php#L34). For payments that can't confirm the order being fully paid then the trigger will be a notification.
Thanks for checking this. So if understand correctly the email does get sent when the notification is received but the ordermail_variables column is not cleared?
Last thing was an error on my own. On *PostDispatch_Frontend_Checkout we alter the sOrderNumber variable. Therefore you can't find the right paymentInfo for sending.
But we fix this on our site. Thank you!
Thanks for checking @Gugiman.
I also believe that I made a mistake, as the notifications are not supposed to trigger the confirmation email after all https://github.com/Adyen/adyen-shopware5/pull/46 it is only based on the payments resultCode
.
Hi,
please see this line for reference:
https://github.com/Adyen/adyen-shopware5/blob/7848a158771b244b8dd7b9c80e8bbfecad6101c4/Subscriber/OrderEmailSubscriber.php#L50
When looking into the Shopware 5 code where this event is thrown i don't think there is an orderId accessible:
https://github.com/shopware/shopware/blob/b206fe23b16f8a4eaa91bf825a1f61bba1c3a469/engine/Shopware/Core/sOrder.php#L976
Therefore the orderId is always null, mailtemplate vars are always empty and no mail is sended anyway.
And just a few lines further:
https://github.com/Adyen/adyen-shopware5/blob/develop/Subscriber/OrderEmailSubscriber.php#L59
I saw (via xDebug) that at this specific moment the orderId in s_plugin_adyen_order_payment_info is -1 That means that when we could get the right orderId, we wouldn't find anything.