From f7117911ed655d689f3d0c96cfeebd416d049ca3 Mon Sep 17 00:00:00 2001 From: Bushra Asif Date: Mon, 12 May 2025 07:07:34 +0000 Subject: [PATCH 1/5] Make shipping and billing information optional --- docs/request/customerinfo.md | 7 ++++++- src/AbstractApi.php | 2 +- src/Request/Customer.php | 13 +++++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/docs/request/customerinfo.md b/docs/request/customerinfo.md index 4326f09..b87af08 100644 --- a/docs/request/customerinfo.md +++ b/docs/request/customerinfo.md @@ -1,7 +1,7 @@ [<](../index.md) Altapay - PHP Api - Customer Info ================================================== -A customer object requries a billing address +Previously a billing address was **required**: ```php $billingAddress = new \Altapay\Request\Address(); @@ -12,7 +12,12 @@ $billingAddress->City = 'City'; $billingAddress->PostalCode = 'Postal code'; $billingAddress->Region = 'Region'; $billingAddress->Country = 'Country'; + +// 1) With a billing address: $customer = new Altapay\Request\Customer($billingAddress); + +// 2) Without a billing address: +$customer = new Altapay\Request\Customer(); ``` We can also add a shipping address diff --git a/src/AbstractApi.php b/src/AbstractApi.php index 24fb8a5..82ac64f 100644 --- a/src/AbstractApi.php +++ b/src/AbstractApi.php @@ -55,7 +55,7 @@ abstract class AbstractApi /** * PHP API version */ - const PHP_API_VERSION = '3.4.9'; + const PHP_API_VERSION = '3.5.0'; /** * Event dispatcher diff --git a/src/Request/Customer.php b/src/Request/Customer.php index 48bd7f3..c5e4d8d 100644 --- a/src/Request/Customer.php +++ b/src/Request/Customer.php @@ -265,9 +265,9 @@ class Customer extends AbstractSerializer /** * Customer constructor. * - * @param Address $billingAddress Billing address + * @param Address|null $billingAddress Billing address */ - public function __construct(Address $billingAddress) + public function __construct(Address $billingAddress = null) { $this->billing = $billingAddress; } @@ -860,8 +860,13 @@ public function serialize() $output['shipping_ref'] = $this->shippingRef; } - $this->setAddress($output, 'billing_', $this->billing); - $this->setAddress($output, 'shipping_', $this->shipping); + if ($this->billing) { + $this->setAddress($output, 'billing_', $this->billing); + } + + if ($this->shipping) { + $this->setAddress($output, 'shipping_', $this->shipping); + } return $output; } From e0c5b3ac7ca9d98ef9eead7394bb21954a49671a Mon Sep 17 00:00:00 2001 From: Bushra Asif Date: Mon, 12 May 2025 07:36:40 +0000 Subject: [PATCH 2/5] Update doc-block --- src/Request/Customer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Request/Customer.php b/src/Request/Customer.php index c5e4d8d..277d762 100644 --- a/src/Request/Customer.php +++ b/src/Request/Customer.php @@ -125,7 +125,7 @@ class Customer extends AbstractSerializer /** * Billing address * - * @var Address + * @var Address|null */ private $billing; From 72779b5439535933d28fb67434fbf755551a95dd Mon Sep 17 00:00:00 2001 From: Bushra Asif Date: Mon, 12 May 2025 07:40:11 +0000 Subject: [PATCH 3/5] Update doc-block for shipping address --- src/Request/Customer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Request/Customer.php b/src/Request/Customer.php index 277d762..5088d1b 100644 --- a/src/Request/Customer.php +++ b/src/Request/Customer.php @@ -132,7 +132,7 @@ class Customer extends AbstractSerializer /** * Shipping address * - * @var Address + * @var Address|null */ private $shipping; From 92cabff20da4b2c60b5de7cde4d38e5bfa6428dc Mon Sep 17 00:00:00 2001 From: Bushra Asif Date: Mon, 12 May 2025 07:52:04 +0000 Subject: [PATCH 4/5] Update customer info doc --- docs/request/customerinfo.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/request/customerinfo.md b/docs/request/customerinfo.md index b87af08..6d86858 100644 --- a/docs/request/customerinfo.md +++ b/docs/request/customerinfo.md @@ -1,7 +1,7 @@ [<](../index.md) Altapay - PHP Api - Customer Info ================================================== -Previously a billing address was **required**: +You can optionally supply a billing address when you instantiate a Customer object. ```php $billingAddress = new \Altapay\Request\Address(); From c18fab4dc00ca2963fde0f4d616e5a5d6315a4fb Mon Sep 17 00:00:00 2001 From: Bushra Asif Date: Mon, 12 May 2025 09:09:23 +0000 Subject: [PATCH 5/5] Update release notes --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b8d280..140ca82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.5.0] - 2025-05-12 +### Added +- Make billing and shipping address optional for Customer Info + ## [3.4.9] - 2025-04-22 ### Added - Provide `setCustomerCreatedDate` method to set `extra_merchant_data` for the `createPaymentRequest` callback config.