From c4fef3f0447d8811582fffc014fa458f18ba6186 Mon Sep 17 00:00:00 2001 From: jdeveloper Date: Wed, 11 Nov 2020 16:44:13 +0100 Subject: [PATCH 1/2] Check order has a shipping address in the PayPalAddressProcessor --- src/Processor/PayPalAddressProcessor.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Processor/PayPalAddressProcessor.php b/src/Processor/PayPalAddressProcessor.php index defb813b..7e48d29c 100644 --- a/src/Processor/PayPalAddressProcessor.php +++ b/src/Processor/PayPalAddressProcessor.php @@ -24,9 +24,13 @@ public function __construct(ObjectManager $objectManager) */ public function process(array $address, OrderInterface $order): void { - /** @var AddressInterface $orderAddress */ + /** @var ?AddressInterface $orderAddress */ $orderAddress = $order->getShippingAddress(); + if (null == $orderAddress) { + return; + } + Assert::keyExists($address, 'admin_area_2'); Assert::keyExists($address, 'address_line_1'); Assert::keyExists($address, 'postal_code'); From 053adf0bd101df232c31c75ef5056e4b61f8bb5e Mon Sep 17 00:00:00 2001 From: jdeveloper Date: Thu, 12 Nov 2020 09:29:05 +0100 Subject: [PATCH 2/2] Use strict comparsion --- src/Processor/PayPalAddressProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Processor/PayPalAddressProcessor.php b/src/Processor/PayPalAddressProcessor.php index 7e48d29c..a8569f69 100644 --- a/src/Processor/PayPalAddressProcessor.php +++ b/src/Processor/PayPalAddressProcessor.php @@ -27,7 +27,7 @@ public function process(array $address, OrderInterface $order): void /** @var ?AddressInterface $orderAddress */ $orderAddress = $order->getShippingAddress(); - if (null == $orderAddress) { + if (null === $orderAddress) { return; }