Created
July 31, 2023 14:38
-
-
Save Frank-Magmodules/896e4aac3c4f7c2cbb475f0c570510c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Observer/LockUnlockOrder.php b/Observer/LockUnlockOrder.php | |
index e1bf878..f43321a 100644 | |
--- a/Observer/LockUnlockOrder.php | |
+++ b/Observer/LockUnlockOrder.php | |
@@ -7,7 +7,7 @@ use Magento\Framework\Event\ObserverInterface; | |
use Magento\Framework\Exception\LocalizedException; | |
use Magento\Sales\Api\Data\OrderInterface; | |
use Magento\Sales\Api\Data\ShipmentInterface; | |
-use Mollie\Payment\Config; | |
+use Mollie\Payment\Observer\SalesOrderShipmentSaveBefore\CreateMollieShipment; | |
use Mollie\Payment\Service\LockService; | |
class LockUnlockOrder implements ObserverInterface | |
@@ -16,18 +16,17 @@ class LockUnlockOrder implements ObserverInterface | |
* @var LockService | |
*/ | |
private $lockService; | |
- | |
/** | |
- * @var Config | |
+ * @var CreateMollieShipment | |
*/ | |
- private $config; | |
+ private $createMollieShipment; | |
public function __construct( | |
- Config $config, | |
- LockService $lockService | |
+ LockService $lockService, | |
+ CreateMollieShipment $createMollieShipment | |
) { | |
$this->lockService = $lockService; | |
- $this->config = $config; | |
+ $this->createMollieShipment = $createMollieShipment; | |
} | |
public function execute(Observer $observer) | |
@@ -42,6 +41,7 @@ class LockUnlockOrder implements ObserverInterface | |
} | |
$this->lockService->lock($key); | |
+ $this->createMollieShipment->execute($observer); | |
} | |
if (strpos($name, 'save_after') !== false) { | |
diff --git a/etc/events.xml b/etc/events.xml | |
index e55328d..2bfbd78 100644 | |
--- a/etc/events.xml | |
+++ b/etc/events.xml | |
@@ -9,7 +9,8 @@ | |
<event name="sales_order_shipment_save_before"> | |
<!-- Order of execution is important --> | |
<observer name="mollie_aaaa_lock_unlock_order" instance="Mollie\Payment\Observer\LockUnlockOrder" /> | |
- <observer name="mollie_create_shipment" instance="Mollie\Payment\Observer\SalesOrderShipmentSaveBefore\CreateMollieShipment"/> | |
+<!-- This event is not in here (anymore), but is called directly from the LockUnlockOrder event, to make sure it executes in the correct order --> | |
+<!-- <observer name="mollie_create_shipment" instance="Mollie\Payment\Observer\SalesOrderShipmentSaveBefore\CreateMollieShipment"/>--> | |
</event> | |
<event name="sales_order_shipment_save_after"> | |
<observer name="mollie_lock_unlock_order" instance="Mollie\Payment\Observer\LockUnlockOrder" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment