Skip to content

Commit

Permalink
Issue thephpleague#65 Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmitrikeski committed May 11, 2021
1 parent 64b8d96 commit 413cbed
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Message/CreatePaymentMethodRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,30 @@ public function getData()

$data['billingAddress'] = [];

if ($this->getStreetAddress() !== '') {
if ($this->getStreetAddress() !== NULL && $this->getStreetAddress() !== '') {
$data['billingAddress']['streetAddress'] = $this->getStreetAddress();
}

if ($this->getLocality() !== '') {
if ($this->getLocality() !== NULL && $this->getLocality() !== '') {
$data['billingAddress']['locality'] = $this->getLocality();
}

if ($this->getPostalCode() !== '') {
if ($this->getPostalCode() !== NULL && $this->getPostalCode() !== '') {
$data['billingAddress']['postalCode'] = $this->getPostalCode();
}

if ($this->getRegion() !== '') {
if ($this->getRegion() !== NULL && $this->getRegion() !== '') {
$data['billingAddress']['region'] = $this->getRegion();
}

if ($this->getCountryCodeAlpha2() !== '') {
if ($this->getCountryCodeAlpha2() !== NULL && $this->getCountryCodeAlpha2() !== '') {
$data['billingAddress']['countryCodeAlpha2'] = $this->getCountryCodeAlpha2();
}

if (count($data['billingAddress']) === 0) {
unset($data['billingAddress']);
}

$data = array_merge($data, $this->getOptionData());

return $data;
Expand Down

0 comments on commit 413cbed

Please sign in to comment.