diff --git a/src/Message/DirectPostAbstractRequest.php b/src/Message/DirectPostAbstractRequest.php index 465a62b..1a7f419 100644 --- a/src/Message/DirectPostAbstractRequest.php +++ b/src/Message/DirectPostAbstractRequest.php @@ -71,24 +71,26 @@ public function getBaseData() $card = $this->getCard(); - if ($billingPostcode = $card->getBillingPostcode()) { - $data['EPS_ZIPCODE'] = $billingPostcode; - } - - if ($billingCity = $card->getBillingCity()) { - $data['EPS_TOWN'] = $billingCity; - } - - if ($billingCountry = $card->getBillingCountry()) { - $data['EPS_BILLINGCOUNTRY'] = $billingCountry; - } - - if ($shippingCountry = $card->getShippingCountry()) { - $data['EPS_DELIVERYCOUNTRY'] = $shippingCountry; - } - - if ($emailAddress = $card->getEmail()) { - $data['EPS_EMAILADDRESS'] = $emailAddress; + if ($card) { //UnionPay doesn't have card option + if ($billingPostcode = $card->getBillingPostcode()) { + $data['EPS_ZIPCODE'] = $billingPostcode; + } + + if ($billingCity = $card->getBillingCity()) { + $data['EPS_TOWN'] = $billingCity; + } + + if ($billingCountry = $card->getBillingCountry()) { + $data['EPS_BILLINGCOUNTRY'] = $billingCountry; + } + + if ($shippingCountry = $card->getShippingCountry()) { + $data['EPS_DELIVERYCOUNTRY'] = $shippingCountry; + } + + if ($emailAddress = $card->getEmail()) { + $data['EPS_EMAILADDRESS'] = $emailAddress; + } } if ($this->getHasEMV3DSEnabled()) {