From 1dd98a48c4271954fbf8ea3a6dd668eb064df0f8 Mon Sep 17 00:00:00 2001 From: jcuervas Date: Tue, 13 Jun 2023 19:17:44 +0200 Subject: [PATCH 1/8] Revert "set state to new when payment succeeded in SetOrderStatusAndState.php" This reverts commit 1c293c31cd4653c23ae3f22fee88fee5870dd6dc. --- Service/SetOrderStatusAndState.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Service/SetOrderStatusAndState.php b/Service/SetOrderStatusAndState.php index 99da465..2c41d17 100644 --- a/Service/SetOrderStatusAndState.php +++ b/Service/SetOrderStatusAndState.php @@ -74,7 +74,7 @@ public function execute(array $data): bool break; case Monei::ORDER_STATUS_SUCCEEDED: $orderStatus = Monei::STATUS_MONEI_SUCCEDED; - $orderState = Order::STATE_NEW; + $orderState = Order::STATE_PROCESSING; break; case Monei::ORDER_STATUS_PARTIALLY_REFUNDED: $orderStatus = Monei::STATUS_MONEI_PARTIALLY_REFUNDED; From c04fb79e29de08e0e8a50314aba6835b5fa3f272 Mon Sep 17 00:00:00 2001 From: jcuervas Date: Tue, 13 Jun 2023 19:17:54 +0200 Subject: [PATCH 2/8] Revert "change confirmed status in system.xml" This reverts commit 526c01199b4b561bf319482e89c0b55dce09ec8e. --- etc/adminhtml/system.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index d09299c..c9e956e 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -79,7 +79,7 @@ - Magento\Sales\Model\Config\Source\Order\Status\NewStatus + Magento\Sales\Model\Config\Source\Order\Status\Processing Selectable with all the processing order statuses 1 From be9253fffb704ad991f9a798ab9ed0a4ecfa5614 Mon Sep 17 00:00:00 2001 From: jcuervas Date: Tue, 13 Jun 2023 19:18:18 +0200 Subject: [PATCH 3/8] Revert "remove data from sales_order_status_state on update" This reverts commit 13c3d0334e89bebc679d9a6b6bafd58bb5ff87b5. --- Setup/Patch/Data/SetupSales.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Setup/Patch/Data/SetupSales.php b/Setup/Patch/Data/SetupSales.php index 9dc993c..d1470f4 100644 --- a/Setup/Patch/Data/SetupSales.php +++ b/Setup/Patch/Data/SetupSales.php @@ -121,10 +121,6 @@ public function apply(): void 'state' => $stateCode, 'is_default' => $isDefault, ]; - $this->moduleDataSetup->getConnection()->delete( - $this->moduleDataSetup->getTable('sales_order_status_state'), - ["state" => $stateCode] - ); } } From ff29462f1d724eeb72f9ef3f3f9e46d44fe7b638 Mon Sep 17 00:00:00 2001 From: jcuervas Date: Tue, 13 Jun 2023 19:18:26 +0200 Subject: [PATCH 4/8] Revert "insertOnDuplicate for SetupSales" This reverts commit c940565462a9035d8b2b5c28c44eb372c818323f. --- Setup/Patch/Data/SetupSales.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Setup/Patch/Data/SetupSales.php b/Setup/Patch/Data/SetupSales.php index d1470f4..1a24b4c 100644 --- a/Setup/Patch/Data/SetupSales.php +++ b/Setup/Patch/Data/SetupSales.php @@ -89,8 +89,8 @@ public function apply(): void } $this->moduleDataSetup->getConnection()->insertOnDuplicate( $this->moduleDataSetup->getTable('sales_order_status'), - $data, - ['status', 'label'] + ['status', 'label'], + $data ); $data = []; @@ -126,8 +126,8 @@ public function apply(): void $this->moduleDataSetup->getConnection()->insertOnDuplicate( $this->moduleDataSetup->getTable('sales_order_status_state'), - $data, - ['status', 'state', 'is_default'] + ['status', 'state', 'is_default'], + $data ); $this->moduleDataSetup->getConnection()->endSetup(); From ebe095f37107adf39916ef0ae3ce21d919260cfc Mon Sep 17 00:00:00 2001 From: jcuervas Date: Tue, 13 Jun 2023 19:18:30 +0200 Subject: [PATCH 5/8] Revert "insert on duplicate for SetupSales" This reverts commit 487f075e2b6ea116f33489566062cbd1304a5af4. --- Setup/Patch/Data/SetupSales.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Setup/Patch/Data/SetupSales.php b/Setup/Patch/Data/SetupSales.php index 1a24b4c..1ae9403 100644 --- a/Setup/Patch/Data/SetupSales.php +++ b/Setup/Patch/Data/SetupSales.php @@ -87,7 +87,7 @@ public function apply(): void foreach ($statuses as $code => $info) { $data[] = ['status' => $code, 'label' => $info]; } - $this->moduleDataSetup->getConnection()->insertOnDuplicate( + $this->moduleDataSetup->getConnection()->insertArray( $this->moduleDataSetup->getTable('sales_order_status'), ['status', 'label'], $data From 3e0bfeaecd5fefe9f1c004d2ac6a11c314d4a059 Mon Sep 17 00:00:00 2001 From: jcuervas Date: Tue, 13 Jun 2023 19:18:33 +0200 Subject: [PATCH 6/8] Revert "insert on duplicate for SetupSales" This reverts commit 27804f77ce3f8ca78459420b1be7664c2bd0deaa. --- Setup/Patch/Data/SetupSales.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Setup/Patch/Data/SetupSales.php b/Setup/Patch/Data/SetupSales.php index 1ae9403..9bf8ea8 100644 --- a/Setup/Patch/Data/SetupSales.php +++ b/Setup/Patch/Data/SetupSales.php @@ -124,7 +124,7 @@ public function apply(): void } } - $this->moduleDataSetup->getConnection()->insertOnDuplicate( + $this->moduleDataSetup->getConnection()->insertArray( $this->moduleDataSetup->getTable('sales_order_status_state'), ['status', 'state', 'is_default'], $data From 1767355293af336cb4b956455e510cbb1b18c55c Mon Sep 17 00:00:00 2001 From: jcuervas Date: Tue, 13 Jun 2023 19:18:38 +0200 Subject: [PATCH 7/8] Revert "state set to new after successful payment" This reverts commit cbee7051566acd9e294368171f268a6c0cf59d53. --- Observer/SetOrderStatusAfterInvoice.php | 2 +- Setup/Patch/Data/SetupSales.php | 15 ++++++--------- etc/module.xml | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Observer/SetOrderStatusAfterInvoice.php b/Observer/SetOrderStatusAfterInvoice.php index 7a1af86..a836d23 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_NEW; + $orderState = Order::STATE_PROCESSING; $order->setStatus($orderStatus)->setState($orderState); $this->orderRepository->save($order); } diff --git a/Setup/Patch/Data/SetupSales.php b/Setup/Patch/Data/SetupSales.php index 9bf8ea8..6fb1d65 100644 --- a/Setup/Patch/Data/SetupSales.php +++ b/Setup/Patch/Data/SetupSales.php @@ -6,7 +6,6 @@ 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; @@ -52,7 +51,7 @@ public function getAliases(): array */ public static function getVersion(): string { - return '1.2.0'; + return '1.1.4'; } public function apply(): void @@ -95,23 +94,21 @@ public function apply(): void $data = []; $statuses = [ - Order::STATE_PENDING_PAYMENT => [ + 'pending_payment' => [ Monei::STATUS_MONEI_PENDING => false, Monei::STATUS_MONEI_AUTHORIZED => false, ], - Order::STATE_CANCELED => [ + 'canceled' => [ Monei::STATUS_MONEI_EXPIRED => false, Monei::STATUS_MONEI_FAILED => false, ], - Order::STATE_PROCESSING => [ + 'processing' => [ + Monei::STATUS_MONEI_SUCCEDED => false, Monei::STATUS_MONEI_PARTIALLY_REFUNDED => false, ], - Order::STATE_COMPLETE => [ + '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 d6e3c54..67bcd6b 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -4,7 +4,7 @@ ~ @copyright Copyright © Monei (https://monei.com) --> - + From 0da05d6c486ab662d231876a3e91cd9a0ef19e3c Mon Sep 17 00:00:00 2001 From: jcuervas Date: Tue, 13 Jun 2023 19:25:02 +0200 Subject: [PATCH 8/8] updated label for pre-authorized reverted previous changes --- Setup/Patch/Data/SetupSales.php | 2 +- etc/module.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Setup/Patch/Data/SetupSales.php b/Setup/Patch/Data/SetupSales.php index 6fb1d65..1b30bb1 100644 --- a/Setup/Patch/Data/SetupSales.php +++ b/Setup/Patch/Data/SetupSales.php @@ -76,7 +76,7 @@ public function apply(): void $statuses = [ Monei::STATUS_MONEI_PENDING => __('Monei - pending'), - Monei::STATUS_MONEI_AUTHORIZED => __('Monei - Preauthorized'), + Monei::STATUS_MONEI_AUTHORIZED => __('Monei - pre-authorized'), Monei::STATUS_MONEI_EXPIRED => __('Monei - expired'), Monei::STATUS_MONEI_FAILED => __('Monei - failed'), Monei::STATUS_MONEI_SUCCEDED => __('Monei - succeeded'), diff --git a/etc/module.xml b/etc/module.xml index 67bcd6b..de08c0c 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -4,7 +4,7 @@ ~ @copyright Copyright © Monei (https://monei.com) --> - +