From 4c6218adcb92153586394b4d5ddd8c5cc6f9a54e Mon Sep 17 00:00:00 2001 From: Laurynas Date: Tue, 13 Feb 2024 13:20:13 +0200 Subject: [PATCH] Fixed regex and wrong customerId type --- .../Query/GetCustomerPaymentMethodTokensQuery.php | 2 +- .../Query/GetCustomerPaymentMethodTokensQueryHandler.php | 2 +- src/PaymentMethodToken/ValueObject/PaymentMethodTokenId.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PaymentMethodToken/Query/GetCustomerPaymentMethodTokensQuery.php b/src/PaymentMethodToken/Query/GetCustomerPaymentMethodTokensQuery.php index 02b7f95bf..8da98dd2a 100644 --- a/src/PaymentMethodToken/Query/GetCustomerPaymentMethodTokensQuery.php +++ b/src/PaymentMethodToken/Query/GetCustomerPaymentMethodTokensQuery.php @@ -26,7 +26,7 @@ class GetCustomerPaymentMethodTokensQuery { /** - * @var PayPalCustomerId + * @var CustomerId */ private $customerId; diff --git a/src/PaymentMethodToken/Query/GetCustomerPaymentMethodTokensQueryHandler.php b/src/PaymentMethodToken/Query/GetCustomerPaymentMethodTokensQueryHandler.php index c0cc983ea..8c735cd5a 100644 --- a/src/PaymentMethodToken/Query/GetCustomerPaymentMethodTokensQueryHandler.php +++ b/src/PaymentMethodToken/Query/GetCustomerPaymentMethodTokensQueryHandler.php @@ -55,7 +55,7 @@ public function __construct(PayPalCustomerRepository $customerRepository, Paymen */ public function handle(GetCustomerPaymentMethodTokensQuery $query) { - $customerIdPayPal = $query->getCustomerId() ? $this->customerRepository->findPayPalCustomerIdByCustomerId($query->getCustomerId()) : null; + $customerIdPayPal = $query->getCustomerId()->getValue() ? $this->customerRepository->findPayPalCustomerIdByCustomerId($query->getCustomerId()) : null; $paymentTokens = $this->paymentMethodTokenRepository->findByCustomerId($customerIdPayPal, $query->getPageSize(), $query->getPageNumber()); if ($query->isTotalCountRequired()) { diff --git a/src/PaymentMethodToken/ValueObject/PaymentMethodTokenId.php b/src/PaymentMethodToken/ValueObject/PaymentMethodTokenId.php index 63a6ac6f2..d08c35dae 100644 --- a/src/PaymentMethodToken/ValueObject/PaymentMethodTokenId.php +++ b/src/PaymentMethodToken/ValueObject/PaymentMethodTokenId.php @@ -67,7 +67,7 @@ private function assertIsValid($id) throw new InvalidArgumentException('PayPal Vault ID must be between 1 and 36 characters long.'); } - if (preg_match('^[0-9a-zA-Z_-]+$', $id) !== 1) { + if (preg_match('/^[0-9a-zA-Z_-]+$/', $id) !== 1) { throw new InvalidArgumentException('PayPal Vault ID must be alphanumeric.'); } }