- /**
- * 2016-05-06
- * https://mage2.pro/t/1543
- * 2016-07-15
- * Usually, when you have received a payment confirmation from a payment system,
- * you should use @see df_order_send_email() instead of @see df_invoice_send_email()
- * What is the difference between InvoiceSender and OrderSender? https://mage2.pro/t/1872
- * @param Order $order
- * @return void
- */
- function df_order_send_email(Order $order) {
- /** @var OrderSender $sender */
- $sender = df_o(OrderSender::class);
- $sender->send($order);
- /** @var History|IHistory $history */
- $history = $order->addStatusHistoryComment(__(
- 'You have confirmed the order to the customer via email.'
- ));
- $history->setIsCustomerNotified(true);
- $history->save();
- }