From ecc3b5c56b28955b6b6fda14c07d77e935f84608 Mon Sep 17 00:00:00 2001 From: Thomas Off Date: Tue, 31 Oct 2023 11:13:10 +0100 Subject: [PATCH] Prevent PHP error if response is missing data. (#428) --- src/Service/PaymentMethodsFilterService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Service/PaymentMethodsFilterService.php b/src/Service/PaymentMethodsFilterService.php index 561f1587..46f44016 100644 --- a/src/Service/PaymentMethodsFilterService.php +++ b/src/Service/PaymentMethodsFilterService.php @@ -211,7 +211,7 @@ public function getAvailableGiftcards( public function filterAdyenPaymentMethodsByType(array $paymentMethodsResponse, string $type): array { - return array_filter($paymentMethodsResponse['paymentMethods'], function ($item) use ($type) { + return array_filter($paymentMethodsResponse['paymentMethods'] ?? [], function ($item) use ($type) { return $item['type'] === $type; }); }