From b8679d9e9cb6c1676d5f1b242f4e3bd261c6dbd4 Mon Sep 17 00:00:00 2001 From: Joeri van Veen Date: Tue, 3 Dec 2024 17:36:31 +0100 Subject: [PATCH 1/8] fix(ordermode): show barcode when printed from backoffice INT-627 --- .../Shipment/UpdateShipmentsAction.php | 5 +- .../Order/Collection/PdkOrderCollection.php | 1 - .../Repository/AbstractPdkOrderRepository.php | 14 +++ .../Hook/ShipmentStatusChangeWebhook.php | 13 ++- tests/Bootstrap/MockPdkOrderRepository.php | 5 + .../AbstractPdkOrderRepositoryTest.php | 31 ++++++ .../Hook/ShipmentStatusChangeWebhookTest.php | 95 +++++++++++++++++++ 7 files changed, 160 insertions(+), 4 deletions(-) create mode 100644 tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php diff --git a/src/App/Action/Backend/Shipment/UpdateShipmentsAction.php b/src/App/Action/Backend/Shipment/UpdateShipmentsAction.php index c380bb30a..f0b953321 100644 --- a/src/App/Action/Backend/Shipment/UpdateShipmentsAction.php +++ b/src/App/Action/Backend/Shipment/UpdateShipmentsAction.php @@ -55,6 +55,10 @@ public function handle(Request $request): Response $orders = $this->pdkOrderRepository->getMany($this->getOrderIds($request)); $shipments = $this->shipmentRepository->getShipments($this->getShipmentIds($request, $orders)); + if ($request->get('linkFirstShipmentToFirstOrder')) { + $shipments->first()->orderId = $orders->first()->getExternalIdentifier(); + } + if ($orders->isNotEmpty()) { $orders->updateShipments($shipments); $this->pdkOrderRepository->updateMany($orders); @@ -103,4 +107,3 @@ private function addBarcodeNotes(ShipmentCollection $shipments): void }); } } - diff --git a/src/App/Order/Collection/PdkOrderCollection.php b/src/App/Order/Collection/PdkOrderCollection.php index e882f3e7b..8b8ba22bd 100644 --- a/src/App/Order/Collection/PdkOrderCollection.php +++ b/src/App/Order/Collection/PdkOrderCollection.php @@ -170,4 +170,3 @@ private function mergeShipmentsByOrder(ShipmentCollection $shipments, PdkOrder $ return $merged; } } - diff --git a/src/App/Order/Repository/AbstractPdkOrderRepository.php b/src/App/Order/Repository/AbstractPdkOrderRepository.php index bf44078a6..b97a8506d 100644 --- a/src/App/Order/Repository/AbstractPdkOrderRepository.php +++ b/src/App/Order/Repository/AbstractPdkOrderRepository.php @@ -9,6 +9,7 @@ use MyParcelNL\Pdk\App\Order\Model\PdkOrder; use MyParcelNL\Pdk\Base\Repository\Repository; use MyParcelNL\Pdk\Base\Support\Utils; +use MyParcelNL\Pdk\Facade\Logger; abstract class AbstractPdkOrderRepository extends Repository implements PdkOrderRepositoryInterface { @@ -19,6 +20,19 @@ abstract class AbstractPdkOrderRepository extends Repository implements PdkOrder */ abstract public function get($input): PdkOrder; + // TODO: v3.0.0 make method abstract to force implementation + public function getByApiIdentifier(string $uuid): ?PdkOrder + { + Logger::notice( + 'Implement getByApiIdentifier, in PDK v3 it will be required.', + [ + 'class' => self::class, + ] + ); + + return $this->get(['order_id' => $uuid]); + } + /** * @param string|string[] $orderIds * diff --git a/src/App/Webhook/Hook/ShipmentStatusChangeWebhook.php b/src/App/Webhook/Hook/ShipmentStatusChangeWebhook.php index 3a1e688e0..c338f9ef4 100644 --- a/src/App/Webhook/Hook/ShipmentStatusChangeWebhook.php +++ b/src/App/Webhook/Hook/ShipmentStatusChangeWebhook.php @@ -5,7 +5,9 @@ namespace MyParcelNL\Pdk\App\Webhook\Hook; use MyParcelNL\Pdk\App\Api\Backend\PdkBackendActions; +use MyParcelNL\Pdk\App\Order\Contract\PdkOrderRepositoryInterface; use MyParcelNL\Pdk\Facade\Actions; +use MyParcelNL\Pdk\Facade\Pdk; use MyParcelNL\Pdk\Webhook\Model\WebhookSubscription; use Symfony\Component\HttpFoundation\Request; @@ -20,9 +22,16 @@ public function handle(Request $request): void { $content = $this->getHookBody($request); + // translate order_id (which is api identifier / uuid) to local order id for db + $order = Pdk::get(PdkOrderRepositoryInterface::class)->getByApiIdentifier($content['order_id']); + if ($order) { + $content['order_id'] = $order->getExternalIdentifier(); + } + Actions::execute(PdkBackendActions::UPDATE_SHIPMENTS, [ - 'orderIds' => [$content['shipment_reference_identifier']], - 'shipmentIds' => [$content['shipment_id']], + 'orderIds' => [$content['order_id']], + 'shipmentIds' => [$content['shipment_id']], + 'linkFirstShipmentToFirstOrder' => true, ]); } diff --git a/tests/Bootstrap/MockPdkOrderRepository.php b/tests/Bootstrap/MockPdkOrderRepository.php index f0325dfd3..0cb85da61 100644 --- a/tests/Bootstrap/MockPdkOrderRepository.php +++ b/tests/Bootstrap/MockPdkOrderRepository.php @@ -43,6 +43,11 @@ public function get($input): PdkOrder }); } + public function getByApiIdentifier(string $uuid): ?PdkOrder + { + return new PdkOrder(['externalIdentifier' => 197]); + } + protected function getKeyPrefix(): string { return static::class; diff --git a/tests/Unit/App/Order/Repository/AbstractPdkOrderRepositoryTest.php b/tests/Unit/App/Order/Repository/AbstractPdkOrderRepositoryTest.php index 5d760bfa7..222868464 100644 --- a/tests/Unit/App/Order/Repository/AbstractPdkOrderRepositoryTest.php +++ b/tests/Unit/App/Order/Repository/AbstractPdkOrderRepositoryTest.php @@ -8,7 +8,9 @@ use MyParcelNL\Pdk\App\Order\Contract\PdkOrderRepositoryInterface; use MyParcelNL\Pdk\App\Order\Model\PdkOrder; use MyParcelNL\Pdk\Facade\Pdk; +use MyParcelNL\Pdk\Storage\Contract\StorageInterface; use MyParcelNL\Pdk\Tests\Uses\UsesMockPdkInstance; +use Psr\Log\LoggerInterface; use function MyParcelNL\Pdk\Tests\usesShared; usesShared(new UsesMockPdkInstance()); @@ -44,3 +46,32 @@ expect($newOrder)->toBeInstanceOf(PdkOrder::class); }); + +it('gets order by api identifier', function () { + /** @var \MyParcelNL\Pdk\Tests\Bootstrap\MockLogger $logger */ + $logger = Pdk::get(LoggerInterface::class); + class MockPdkOrderRepository extends AbstractPdkOrderRepository + { + public function get($input): PdkOrder + { + return new PdkOrder(); + } + } + $repository = new MockPdkOrderRepository(Pdk::get(StorageInterface::class)); + $order = $repository->getByApiIdentifier('123'); + + expect($order) + ->toBeInstanceOf(PdkOrder::class) + ->and($logger->getLogs()) + ->toEqual([ + [ + 'level' => 'notice', + 'message' => '[PDK]: Implement getByApiIdentifier, in PDK v3 it will be required.', + 'context' => + [ + 'class' => 'MyParcelNL\\Pdk\\App\\Order\\Repository\\AbstractPdkOrderRepository', + ], + ], + ] + ); +}); diff --git a/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php b/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php new file mode 100644 index 000000000..afc1d57e0 --- /dev/null +++ b/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php @@ -0,0 +1,95 @@ +group('webhook'); + +usesShared(new UsesMockPdkInstance(), new UsesMockEachCron(), new UsesMockEachLogger()); + +it('handles an api request', function (string $hook, string $expectedClass, array $hookBody) { + /** @var PdkWebhooksRepositoryInterface $repository */ + $repository = Pdk::get(PdkWebhooksRepositoryInterface::class); + /** @var PdkWebhookManagerInterface $webhookManager */ + $webhookManager = Pdk::get(PdkWebhookManagerInterface::class); + /** @var \MyParcelNL\Pdk\Tests\Bootstrap\MockCronService $cronService */ + $cronService = Pdk::get(CronServiceInterface::class); + /** @var \MyParcelNL\Pdk\Tests\Bootstrap\MockLogger $logger */ + $logger = Pdk::get(LoggerInterface::class); + + $repository->storeHashedUrl('https://example.com/hook/1234567890abcdef'); + $repository->store(new WebhookSubscriptionCollection([['hook' => $hook, 'url' => $repository->getHashedUrl()]])); + MockApi::enqueue(new ExampleGetShipmentsResponse()); + + $request = Request::create( + $repository->getHashedUrl(), + Request::METHOD_POST, + [], + [], + [], + ['HTTP_X_MYPARCEL_HOOK' => $hook], + json_encode([ + 'data' => [ + 'hooks' => [ + array_merge(['event' => $hook], $hookBody), + ], + ], + ]) + ); + + $webhookManager->call($request); + $cronService->executeScheduledTask(); + + $logs = (new Collection($logger->getLogs()))->map(function (array $log) { + // Omit the request from the logs. + unset($log['context']['request']); + return $log; + }); + // Omit the shipment response from the logs. + unset($logs[1]); + + expect(array_values($logs->toArray()))->toBe([ + [ + 'level' => 'debug', + 'message' => '[PDK]: Webhook received', + 'context' => [], + ], + [ + 'level' => 'debug', + 'message' => '[PDK]: Webhook processed', + 'context' => ['hook' => $expectedClass], + ], + ]); +})->with([ + 'shipment updated' => [ + 'hook' => WebhookSubscription::SHIPMENT_STATUS_CHANGE, + 'class' => ShipmentStatusChangeWebhook::class, + 'body' => [ + 'shipment_id' => 192031595, + 'account_id' => 162450, + 'order_id' => 'api-uuid-string', + 'shop_id' => 83287, + 'status' => 2, + 'barcode' => '3SHOHR763563926', + 'shipment_reference_identifier' => '', + ], + ], +]); From ffa5afddbf360c8a19d07ab16cb2f311f8b9d092 Mon Sep 17 00:00:00 2001 From: Joeri van Veen Date: Wed, 11 Dec 2024 21:08:22 +0100 Subject: [PATCH 2/8] fix: implement feedback --- src/App/Action/Backend/Shipment/UpdateShipmentsAction.php | 5 ++++- src/App/Order/Repository/AbstractPdkOrderRepository.php | 8 +++++++- src/App/Webhook/Hook/ShipmentStatusChangeWebhook.php | 7 ++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/App/Action/Backend/Shipment/UpdateShipmentsAction.php b/src/App/Action/Backend/Shipment/UpdateShipmentsAction.php index f0b953321..648c28609 100644 --- a/src/App/Action/Backend/Shipment/UpdateShipmentsAction.php +++ b/src/App/Action/Backend/Shipment/UpdateShipmentsAction.php @@ -55,7 +55,10 @@ public function handle(Request $request): Response $orders = $this->pdkOrderRepository->getMany($this->getOrderIds($request)); $shipments = $this->shipmentRepository->getShipments($this->getShipmentIds($request, $orders)); - if ($request->get('linkFirstShipmentToFirstOrder')) { + if ($request->get('linkFirstShipmentToFirstOrder') + && $orders->isNotEmpty() + && $shipments->isNotEmpty() + ) { $shipments->first()->orderId = $orders->first()->getExternalIdentifier(); } diff --git a/src/App/Order/Repository/AbstractPdkOrderRepository.php b/src/App/Order/Repository/AbstractPdkOrderRepository.php index b97a8506d..0d77f771d 100644 --- a/src/App/Order/Repository/AbstractPdkOrderRepository.php +++ b/src/App/Order/Repository/AbstractPdkOrderRepository.php @@ -20,7 +20,13 @@ abstract class AbstractPdkOrderRepository extends Repository implements PdkOrder */ abstract public function get($input): PdkOrder; - // TODO: v3.0.0 make method abstract to force implementation + /** + * TODO: v3.0.0 make method abstract to force implementation + * + * @param string $uuid + * + * @return null|\MyParcelNL\Pdk\App\Order\Model\PdkOrder + */ public function getByApiIdentifier(string $uuid): ?PdkOrder { Logger::notice( diff --git a/src/App/Webhook/Hook/ShipmentStatusChangeWebhook.php b/src/App/Webhook/Hook/ShipmentStatusChangeWebhook.php index c338f9ef4..366c7d48b 100644 --- a/src/App/Webhook/Hook/ShipmentStatusChangeWebhook.php +++ b/src/App/Webhook/Hook/ShipmentStatusChangeWebhook.php @@ -24,12 +24,13 @@ public function handle(Request $request): void // translate order_id (which is api identifier / uuid) to local order id for db $order = Pdk::get(PdkOrderRepositoryInterface::class)->getByApiIdentifier($content['order_id']); - if ($order) { - $content['order_id'] = $order->getExternalIdentifier(); + + if (! $order) { + return; } Actions::execute(PdkBackendActions::UPDATE_SHIPMENTS, [ - 'orderIds' => [$content['order_id']], + 'orderIds' => [$order->getExternalIdentifier()], 'shipmentIds' => [$content['shipment_id']], 'linkFirstShipmentToFirstOrder' => true, ]); From 9ec84fe5ecf4a648ac21eb81b6e4cfd969577ebe Mon Sep 17 00:00:00 2001 From: Joeri van Veen Date: Wed, 11 Dec 2024 21:13:56 +0100 Subject: [PATCH 3/8] refactor: empty lines --- src/App/Order/Collection/PdkOrderCollection.php | 1 + src/App/Order/Repository/AbstractPdkOrderRepository.php | 1 + src/App/Webhook/Hook/ShipmentStatusChangeWebhook.php | 1 + 3 files changed, 3 insertions(+) diff --git a/src/App/Order/Collection/PdkOrderCollection.php b/src/App/Order/Collection/PdkOrderCollection.php index 8b8ba22bd..7ece5334d 100644 --- a/src/App/Order/Collection/PdkOrderCollection.php +++ b/src/App/Order/Collection/PdkOrderCollection.php @@ -154,6 +154,7 @@ private function mergeShipmentsById(ShipmentCollection $shipments, PdkOrder $ord return $orderShipments->values(); } + /** * @param \MyParcelNL\Pdk\Shipment\Collection\ShipmentCollection $shipments * @param \MyParcelNL\Pdk\App\Order\Model\PdkOrder $order diff --git a/src/App/Order/Repository/AbstractPdkOrderRepository.php b/src/App/Order/Repository/AbstractPdkOrderRepository.php index 0d77f771d..cf054903c 100644 --- a/src/App/Order/Repository/AbstractPdkOrderRepository.php +++ b/src/App/Order/Repository/AbstractPdkOrderRepository.php @@ -59,6 +59,7 @@ public function update(PdkOrder $order): PdkOrder return $this->save($order->externalIdentifier, $order); } + /** * @param \MyParcelNL\Pdk\App\Order\Collection\PdkOrderCollection $collection * diff --git a/src/App/Webhook/Hook/ShipmentStatusChangeWebhook.php b/src/App/Webhook/Hook/ShipmentStatusChangeWebhook.php index 366c7d48b..1b1b0fd49 100644 --- a/src/App/Webhook/Hook/ShipmentStatusChangeWebhook.php +++ b/src/App/Webhook/Hook/ShipmentStatusChangeWebhook.php @@ -36,6 +36,7 @@ public function handle(Request $request): void ]); } + /** * @return string */ From d65840ddf1a6603acb5c6e3a80a69315eb212723 Mon Sep 17 00:00:00 2001 From: Joeri van Veen Date: Wed, 11 Dec 2024 21:16:29 +0100 Subject: [PATCH 4/8] refactor: empty lines --- tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php b/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php index afc1d57e0..541247e0d 100644 --- a/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php +++ b/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php @@ -22,7 +22,6 @@ use function MyParcelNL\Pdk\Tests\usesShared; uses()->group('webhook'); - usesShared(new UsesMockPdkInstance(), new UsesMockEachCron(), new UsesMockEachLogger()); it('handles an api request', function (string $hook, string $expectedClass, array $hookBody) { From 061c9e62678fd64017bab1d6073c8d1dc9a31974 Mon Sep 17 00:00:00 2001 From: Joeri van Veen Date: Wed, 11 Dec 2024 21:20:09 +0100 Subject: [PATCH 5/8] refactor: empty lines --- .../App/Order/Repository/AbstractPdkOrderRepositoryTest.php | 2 +- tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Unit/App/Order/Repository/AbstractPdkOrderRepositoryTest.php b/tests/Unit/App/Order/Repository/AbstractPdkOrderRepositoryTest.php index 222868464..6c2e41ca5 100644 --- a/tests/Unit/App/Order/Repository/AbstractPdkOrderRepositoryTest.php +++ b/tests/Unit/App/Order/Repository/AbstractPdkOrderRepositoryTest.php @@ -47,7 +47,7 @@ expect($newOrder)->toBeInstanceOf(PdkOrder::class); }); -it('gets order by api identifier', function () { +it('gets order by apiIdentifier', function () { /** @var \MyParcelNL\Pdk\Tests\Bootstrap\MockLogger $logger */ $logger = Pdk::get(LoggerInterface::class); class MockPdkOrderRepository extends AbstractPdkOrderRepository diff --git a/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php b/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php index 541247e0d..afc1d57e0 100644 --- a/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php +++ b/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php @@ -22,6 +22,7 @@ use function MyParcelNL\Pdk\Tests\usesShared; uses()->group('webhook'); + usesShared(new UsesMockPdkInstance(), new UsesMockEachCron(), new UsesMockEachLogger()); it('handles an api request', function (string $hook, string $expectedClass, array $hookBody) { From d80f7168319ecb36f48d7be1c1e66c3f35daae1c Mon Sep 17 00:00:00 2001 From: Joeri van Veen Date: Wed, 11 Dec 2024 21:22:43 +0100 Subject: [PATCH 6/8] refactor: empty lines --- .../App/Order/Repository/AbstractPdkOrderRepositoryTest.php | 2 +- tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Unit/App/Order/Repository/AbstractPdkOrderRepositoryTest.php b/tests/Unit/App/Order/Repository/AbstractPdkOrderRepositoryTest.php index 6c2e41ca5..222868464 100644 --- a/tests/Unit/App/Order/Repository/AbstractPdkOrderRepositoryTest.php +++ b/tests/Unit/App/Order/Repository/AbstractPdkOrderRepositoryTest.php @@ -47,7 +47,7 @@ expect($newOrder)->toBeInstanceOf(PdkOrder::class); }); -it('gets order by apiIdentifier', function () { +it('gets order by api identifier', function () { /** @var \MyParcelNL\Pdk\Tests\Bootstrap\MockLogger $logger */ $logger = Pdk::get(LoggerInterface::class); class MockPdkOrderRepository extends AbstractPdkOrderRepository diff --git a/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php b/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php index afc1d57e0..22781f875 100644 --- a/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php +++ b/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php @@ -25,6 +25,7 @@ usesShared(new UsesMockPdkInstance(), new UsesMockEachCron(), new UsesMockEachLogger()); + it('handles an api request', function (string $hook, string $expectedClass, array $hookBody) { /** @var PdkWebhooksRepositoryInterface $repository */ $repository = Pdk::get(PdkWebhooksRepositoryInterface::class); From 494f7de25e9fb2766d5b0ad3202c96601143c2c2 Mon Sep 17 00:00:00 2001 From: Joeri van Veen Date: Wed, 11 Dec 2024 21:24:31 +0100 Subject: [PATCH 7/8] refactor: empty lines --- .../App/Order/Repository/AbstractPdkOrderRepositoryTest.php | 1 + tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Unit/App/Order/Repository/AbstractPdkOrderRepositoryTest.php b/tests/Unit/App/Order/Repository/AbstractPdkOrderRepositoryTest.php index 222868464..a04337fc8 100644 --- a/tests/Unit/App/Order/Repository/AbstractPdkOrderRepositoryTest.php +++ b/tests/Unit/App/Order/Repository/AbstractPdkOrderRepositoryTest.php @@ -75,3 +75,4 @@ public function get($input): PdkOrder ] ); }); + diff --git a/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php b/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php index 22781f875..69fd1a747 100644 --- a/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php +++ b/tests/Unit/App/Webhook/Hook/ShipmentStatusChangeWebhookTest.php @@ -25,7 +25,6 @@ usesShared(new UsesMockPdkInstance(), new UsesMockEachCron(), new UsesMockEachLogger()); - it('handles an api request', function (string $hook, string $expectedClass, array $hookBody) { /** @var PdkWebhooksRepositoryInterface $repository */ $repository = Pdk::get(PdkWebhooksRepositoryInterface::class); @@ -94,3 +93,4 @@ ], ], ]); + From 5f869e279caecb93c024bcdc19a92c747e10e4f2 Mon Sep 17 00:00:00 2001 From: Joeri van Veen Date: Wed, 11 Dec 2024 21:30:31 +0100 Subject: [PATCH 8/8] refactor: prevent unnecessary early return --- .../Webhook/Hook/ShipmentStatusChangeWebhook.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/App/Webhook/Hook/ShipmentStatusChangeWebhook.php b/src/App/Webhook/Hook/ShipmentStatusChangeWebhook.php index 1b1b0fd49..ca6c1c415 100644 --- a/src/App/Webhook/Hook/ShipmentStatusChangeWebhook.php +++ b/src/App/Webhook/Hook/ShipmentStatusChangeWebhook.php @@ -25,15 +25,13 @@ public function handle(Request $request): void // translate order_id (which is api identifier / uuid) to local order id for db $order = Pdk::get(PdkOrderRepositoryInterface::class)->getByApiIdentifier($content['order_id']); - if (! $order) { - return; + if ($order) { + Actions::execute(PdkBackendActions::UPDATE_SHIPMENTS, [ + 'orderIds' => [$order->getExternalIdentifier()], + 'shipmentIds' => [$content['shipment_id']], + 'linkFirstShipmentToFirstOrder' => true, + ]); } - - Actions::execute(PdkBackendActions::UPDATE_SHIPMENTS, [ - 'orderIds' => [$order->getExternalIdentifier()], - 'shipmentIds' => [$content['shipment_id']], - 'linkFirstShipmentToFirstOrder' => true, - ]); }