diff --git a/Controller/Webhooks/Index.php b/Controller/Webhooks/Index.php index 6299bc9..6f97956 100644 --- a/Controller/Webhooks/Index.php +++ b/Controller/Webhooks/Index.php @@ -134,7 +134,11 @@ public function handlePending($params): array if (empty($order->getData())) { return [['message' => 'Order does not exist', 'error' => 0], 200]; } + $order->setState(Order::STATE_PAYMENT_REVIEW); $order->setStatus(Order::STATE_PAYMENT_REVIEW); + $order->addStatusHistoryComment( + __('Mondu: Order Status changed to Payment Review by a webhook') + ); $order->save(); $this->_monduLogger->updateLogMonduData($monduId, $params['order_state']); @@ -163,7 +167,11 @@ public function handleConfirmed($params): array return [['message' => 'Order does not exist', 'error' => 0], 200]; } + $order->setState(Order::STATE_PROCESSING); $order->setStatus(Order::STATE_PROCESSING); + $order->addStatusHistoryComment( + __('Mondu: Order Status changed to Processing by a webhook') + ); $order->save(); $this->_monduLogger->updateLogMonduData($monduId, $params['order_state'], $viban); @@ -192,6 +200,10 @@ public function handleDeclinedOrCanceled($params): array return [['message' => 'Order does not exist', 'error' => 0], 200]; } + $order->addStatusHistoryComment( + __('Mondu: Order has been declined') + ); + if ($orderState === 'canceled') { $order->setStatus(Order::STATE_CANCELED)->save(); } elseif ($orderState === 'declined') {