diff --git a/src/GlobalPayments/Message/AbstractRequest.php b/src/GlobalPayments/Message/AbstractRequest.php index 174b92c..627e8fa 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); @@ -66,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(); }