File tree Expand file tree Collapse file tree 4 files changed +22
-8
lines changed
Expand file tree Collapse file tree 4 files changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
55and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
66
7+ ## [ 3.5.0] - 2025-05-12
8+ ### Added
9+ - Make billing and shipping address optional for Customer Info
10+
711## [ 3.4.9] - 2025-04-22
812### Added
913- Provide ` setCustomerCreatedDate ` method to set ` extra_merchant_data ` for the ` createPaymentRequest ` callback config.
Original file line number Diff line number Diff line change 11[ <] ( ../index.md ) Altapay - PHP Api - Customer Info
22==================================================
33
4- A customer object requries a billing address
4+ You can optionally supply a billing address when you instantiate a Customer object.
55
66``` php
77$billingAddress = new \Altapay\Request\Address();
@@ -12,7 +12,12 @@ $billingAddress->City = 'City';
1212$billingAddress->PostalCode = 'Postal code';
1313$billingAddress->Region = 'Region';
1414$billingAddress->Country = 'Country';
15+
16+ // 1) With a billing address:
1517$customer = new Altapay\Request\Customer($billingAddress);
18+
19+ // 2) Without a billing address:
20+ $customer = new Altapay\Request\Customer();
1621```
1722
1823We can also add a shipping address
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ abstract class AbstractApi
5555 /**
5656 * PHP API version
5757 */
58- const PHP_API_VERSION = '3.4.9 ' ;
58+ const PHP_API_VERSION = '3.5.0 ' ;
5959
6060 /**
6161 * Event dispatcher
Original file line number Diff line number Diff line change @@ -125,14 +125,14 @@ class Customer extends AbstractSerializer
125125 /**
126126 * Billing address
127127 *
128- * @var Address
128+ * @var Address|null
129129 */
130130 private $ billing ;
131131
132132 /**
133133 * Shipping address
134134 *
135- * @var Address
135+ * @var Address|null
136136 */
137137 private $ shipping ;
138138
@@ -265,9 +265,9 @@ class Customer extends AbstractSerializer
265265 /**
266266 * Customer constructor.
267267 *
268- * @param Address $billingAddress Billing address
268+ * @param Address|null $billingAddress Billing address
269269 */
270- public function __construct (Address $ billingAddress )
270+ public function __construct (Address $ billingAddress = null )
271271 {
272272 $ this ->billing = $ billingAddress ;
273273 }
@@ -860,8 +860,13 @@ public function serialize()
860860 $ output ['shipping_ref ' ] = $ this ->shippingRef ;
861861 }
862862
863- $ this ->setAddress ($ output , 'billing_ ' , $ this ->billing );
864- $ this ->setAddress ($ output , 'shipping_ ' , $ this ->shipping );
863+ if ($ this ->billing ) {
864+ $ this ->setAddress ($ output , 'billing_ ' , $ this ->billing );
865+ }
866+
867+ if ($ this ->shipping ) {
868+ $ this ->setAddress ($ output , 'shipping_ ' , $ this ->shipping );
869+ }
865870
866871 return $ output ;
867872 }
You can’t perform that action at this time.
0 commit comments