After the order is placed successfully, the order confirmation email is sent, and the field email_sent is set to true.
Actual result
The order confirmation email was sent, but the field email_sent remains NULL.
Additional information
This bug was caused by this line $this->orderHelper->save($order) run after $this->orderHelper->notify($order->getId());
(see \Alma\MonthlyPayments\Helpers\PaymentValidation::processOrder)
public function processOrder(Order $order, AlmaPayment $almaPayment): void
{
$order->setCanSendNewEmailFlag(true);
$order->setState(Order::STATE_PROCESSING);
$newStatus = $order->getConfig()->getStateDefaultStatus(Order::STATE_PROCESSING);
$order->setStatus($newStatus);
// Register successful capture to update order state and generate invoice
$payment = $order->getPayment();
$this->addTransactionToPayment($payment, $order, $almaPayment);
$this->paymentProcessor->registerCaptureNotification($payment, $payment->getBaseAmountAuthorized());
$this->orderHelper->notify($order->getId());
// TODO : Paylater / PnX
$order = $this->addCommentToOrder($order, __('First instalment captured successfully'), $newStatus);
foreach ($order->getInvoiceCollection() as $invoice) {
$invoice->setTransactionId($payment->getLastTransId());
}
$this->orderHelper->save($order);
$this->inactiveQuoteById($order->getQuoteId());
}
Needs correcting to:
public function processOrder(Order $order, AlmaPayment $almaPayment): void
{
$order->setCanSendNewEmailFlag(true);
$order->setState(Order::STATE_PROCESSING);
$newStatus = $order->getConfig()->getStateDefaultStatus(Order::STATE_PROCESSING);
$order->setStatus($newStatus);
// Register successful capture to update order state and generate invoice
$payment = $order->getPayment();
$this->addTransactionToPayment($payment, $order, $almaPayment);
$this->paymentProcessor->registerCaptureNotification($payment, $payment->getBaseAmountAuthorized());
// $this->orderHelper->notify($order->getId());
// TODO : Paylater / PnX
$order = $this->addCommentToOrder($order, __('First instalment captured successfully'), $newStatus);
foreach ($order->getInvoiceCollection() as $invoice) {
$invoice->setTransactionId($payment->getLastTransId());
}
$this->orderHelper->save($order);
$this->inactiveQuoteById($order->getQuoteId());
$this->orderHelper->notify($order->getId());
}
Preconditions and environment
Steps to reproduce
Place an order using the Alma payment method,
Expected result
After the order is placed successfully, the order confirmation email is sent, and the field email_sent is set to true.
Actual result
The order confirmation email was sent, but the field email_sent remains NULL.
Additional information
This bug was caused by this line
$this->orderHelper->save($order)
run after$this->orderHelper->notify($order->getId());
(see\Alma\MonthlyPayments\Helpers\PaymentValidation::processOrder
)Needs correcting to: