diff --git a/Observer/SetOrderStatusAfterInvoice.php b/Observer/SetOrderStatusAfterInvoice.php index a836d23..7a1af86 100644 --- a/Observer/SetOrderStatusAfterInvoice.php +++ b/Observer/SetOrderStatusAfterInvoice.php @@ -43,7 +43,7 @@ public function execute(Observer $observer): void $invoice = $observer->getInvoice(); if ($order->getData('monei_payment_id') !== null && $invoice->getIsPaid() === true) { $orderStatus = Monei::STATUS_MONEI_SUCCEDED; - $orderState = Order::STATE_PROCESSING; + $orderState = Order::STATE_NEW; $order->setStatus($orderStatus)->setState($orderState); $this->orderRepository->save($order); } diff --git a/Setup/Patch/Data/SetupSales.php b/Setup/Patch/Data/SetupSales.php index 6fb1d65..9bf8ea8 100644 --- a/Setup/Patch/Data/SetupSales.php +++ b/Setup/Patch/Data/SetupSales.php @@ -6,6 +6,7 @@ use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Framework\Setup\Patch\DataPatchInterface; + use Magento\Sales\Model\Order; use Monei\MoneiPayment\Model\Payment\Monei; use Magento\Sales\Setup\SalesSetup; @@ -51,7 +52,7 @@ public function getAliases(): array */ public static function getVersion(): string { - return '1.1.4'; + return '1.2.0'; } public function apply(): void @@ -94,21 +95,23 @@ public function apply(): void $data = []; $statuses = [ - 'pending_payment' => [ + Order::STATE_PENDING_PAYMENT => [ Monei::STATUS_MONEI_PENDING => false, Monei::STATUS_MONEI_AUTHORIZED => false, ], - 'canceled' => [ + Order::STATE_CANCELED => [ Monei::STATUS_MONEI_EXPIRED => false, Monei::STATUS_MONEI_FAILED => false, ], - 'processing' => [ - Monei::STATUS_MONEI_SUCCEDED => false, + Order::STATE_PROCESSING => [ Monei::STATUS_MONEI_PARTIALLY_REFUNDED => false, ], - 'complete' => [ + Order::STATE_COMPLETE => [ Monei::STATUS_MONEI_REFUNDED => false, ], + Order::STATE_NEW => [ + Monei::STATUS_MONEI_SUCCEDED => false, + ] ]; foreach ($statuses as $stateCode => $status) { diff --git a/etc/module.xml b/etc/module.xml index 67bcd6b..d6e3c54 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -4,7 +4,7 @@ ~ @copyright Copyright © Monei (https://monei.com) --> - +