From 4f35322f914a42f216b9d684b756420eba1af606 Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Wed, 26 May 2021 15:37:17 -0400 Subject: [PATCH 1/2] Fixes error when Omnipay\Common\CreditCard is passed to a request --- src/GlobalPayments/Message/AbstractRequest.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/GlobalPayments/Message/AbstractRequest.php b/src/GlobalPayments/Message/AbstractRequest.php index 174b92c..9aecdad 100644 --- a/src/GlobalPayments/Message/AbstractRequest.php +++ b/src/GlobalPayments/Message/AbstractRequest.php @@ -25,8 +25,12 @@ protected abstract function setServicesConfig(); */ public function setCard($value) { - if ($value && !$value instanceof CreditCard) { - $value = new CreditCard($value); + if ($value) { + if ($value instanceof \Omnipay\Common\CreditCard) { + $value = new CreditCard($value->getParameters()); + } else if (!$value instanceof CreditCard) { + $value = new CreditCard($value); + } } return $this->setParameter('card', $value); From bc8475585dcfdae4ec0f6a7a3cd728a572973c6d Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Wed, 1 Sep 2021 11:27:17 -0400 Subject: [PATCH 2/2] Removes whitespace from billing address postal code --- src/GlobalPayments/Message/AbstractRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GlobalPayments/Message/AbstractRequest.php b/src/GlobalPayments/Message/AbstractRequest.php index 9aecdad..627e8fa 100644 --- a/src/GlobalPayments/Message/AbstractRequest.php +++ b/src/GlobalPayments/Message/AbstractRequest.php @@ -70,7 +70,7 @@ protected function getGpBillingAddyObj() $gpAddyObj->streetAddress1 = $omnipayCardObj->getBillingAddress1(); $gpAddyObj->streetAddress2 = $omnipayCardObj->getBillingAddress2(); $gpAddyObj->city = $omnipayCardObj->getBillingCity(); - $gpAddyObj->postalCode = $omnipayCardObj->getBillingPostcode(); + $gpAddyObj->postalCode = str_replace(' ', '', $omnipayCardObj->getBillingPostcode()); $gpAddyObj->state = $omnipayCardObj->getBillingState(); $gpAddyObj->country = $omnipayCardObj->getBillingCountry(); }