oc-shopaholic / oc-shopaholic-plugin

🛍️ No. 1 e-commerce platform for October CMS
https://shopaholic.one
GNU General Public License v3.0
425 stars 52 forks source link

[Feature request] order confirmation email sending encapsulation #258

Open hirisov opened 4 years ago

hirisov commented 4 years ago

Currently if enabled, emails got sent when the order is created. This is problematic when using payment gateways, as at the moment of order creation (and thus email sending) the payment process is not finished, so we don't know if the payment was successful or not. Most likely we want to send a different email (or no email at all) when payment is not successful, than what we send normally.

Also many payment providers wants us to show the technical details of the payment transaction in the order confirmation email, which is now impossible, due to these reasons.

If the email sending (which is currenlty in Lovata\OrdersShopaholic\Classes\Event\Order\OrderModelHandler::sendUserEmailAfterCreating() ) would be encapsulated in some helper we can call after the payment process is complete, then we would have more control over it, and could add the transaction data, or decide not to send email at all when the payment was failed (depending on what the regulation rules are, etc).

AndyK001 commented 4 years ago

Guys, this feature would really be useful, please add as soon as possible