Skip to content

Commit

Permalink
Fixed regex and wrong customerId type
Browse files Browse the repository at this point in the history
  • Loading branch information
L3RAZ committed Feb 13, 2024
1 parent c3083e4 commit 4c6218a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class GetCustomerPaymentMethodTokensQuery
{
/**
* @var PayPalCustomerId
* @var CustomerId
*/
private $customerId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}
}
Expand Down

0 comments on commit 4c6218a

Please sign in to comment.