diff --git a/src/Model/CreatePaymentCustomer.php b/src/Model/CreatePaymentCustomer.php index 0407351..aeb93c4 100644 --- a/src/Model/CreatePaymentCustomer.php +++ b/src/Model/CreatePaymentCustomer.php @@ -17,6 +17,8 @@ final class CreatePaymentCustomer private $phone; /** @var Address|null */ private $billingAddress; + /** @var Address|null */ + private $shippingAddress; /** * @param string|null $name @@ -24,13 +26,14 @@ final class CreatePaymentCustomer * @param string|null $email * @param string|null $phone - customer phone in international format max 15 numeric chars https://en.wikipedia.org/wiki/MSISDN */ - public function __construct($name, $surname, $email, $phone, Address $billingAddress = null) + public function __construct($name, $surname, $email, $phone, Address $billingAddress = null, Address $shippingAddress = null) { $this->name = $name === null ? null : new StringValue($name); $this->surname = $surname === null ? null : new StringValue($surname); $this->email = $email === null ? null : new StringValue($email); $this->phone = $phone === null ? null : new PhoneNumber($phone); $this->billingAddress = $billingAddress; + $this->shippingAddress = $shippingAddress; } /** @@ -72,4 +75,12 @@ public function getBillingAddress() { return $this->billingAddress; } + + /** + * @return Address|null + */ + public function getShippingAddress() + { + return $this->shippingAddress; + } } diff --git a/src/Model/CreatePaymentParams.php b/src/Model/CreatePaymentParams.php index d23ee15..49c57fa 100644 --- a/src/Model/CreatePaymentParams.php +++ b/src/Model/CreatePaymentParams.php @@ -425,6 +425,16 @@ public function toArray() 'street' => $billingAddress->getStreet(), ); } + + $shippingAddress = $this->customer->getShippingAddress(); + if ($shippingAddress) { + $result['customer']['shipping_address'] = array( + 'country_code' => $shippingAddress->getCountryCode(), + 'city' => $shippingAddress->getCity(), + 'zip' => $shippingAddress->getZip(), + 'street' => $shippingAddress->getStreet(), + ); + } } else { $result['customer'] = null; }