From 9730b32099f5255fe2eb56c73251faec97d14bff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20L=C3=B8vgaard?= Date: Thu, 21 Dec 2023 10:02:32 +0100 Subject: [PATCH] Make order identification more robust --- src/Model/GiftCard.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Model/GiftCard.php b/src/Model/GiftCard.php index 31aef9c1..92c99521 100644 --- a/src/Model/GiftCard.php +++ b/src/Model/GiftCard.php @@ -235,9 +235,17 @@ public function getOrderIdentification(): ?array return null; } + /** @var mixed $orderId */ + $orderId = $order->getId(); + $orderNumber = $order->getNumber(); + + if (null === $orderId || null === $orderNumber) { + return null; + } + return [ - 'id' => $order->getId(), - 'number' => $order->getNumber(), + 'id' => $orderId, + 'number' => $orderNumber, ]; }