From bbc37e2748523549217f796f32c031ceb5c2174e Mon Sep 17 00:00:00 2001 From: Aleksandr Yegorov Date: Mon, 2 Sep 2024 14:42:06 +0200 Subject: [PATCH] 186 Fixed that HouseNumberAdditional was not mapped correctly to HouseNumberSuffix in CreateSubscription request payload. --- .../Subscriptions/Models/Subscription.php | 9 +++--- .../Service/ParameterKeys/AddressAdapter.php | 31 +++++++++++++++++++ tests/Buckaroo/Payments/SubscriptionsTest.php | 1 + 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 src/PaymentMethods/Subscriptions/Service/ParameterKeys/AddressAdapter.php diff --git a/src/PaymentMethods/Subscriptions/Models/Subscription.php b/src/PaymentMethods/Subscriptions/Models/Subscription.php index 3c88e21c..82d302d2 100644 --- a/src/PaymentMethods/Subscriptions/Models/Subscription.php +++ b/src/PaymentMethods/Subscriptions/Models/Subscription.php @@ -29,6 +29,7 @@ use Buckaroo\Models\Person; use Buckaroo\Models\Phone; use Buckaroo\Models\ServiceParameter; +use Buckaroo\PaymentMethods\Subscriptions\Service\ParameterKeys\AddressAdapter; use Buckaroo\PaymentMethods\Subscriptions\Service\ParameterKeys\CompanyAdapter; class Subscription extends ServiceParameter @@ -96,9 +97,9 @@ class Subscription extends ServiceParameter */ protected Phone $phone; /** - * @var Address + * @var AddressAdapter */ - protected Address $address; + protected AddressAdapter $address; /** * @var Person */ @@ -247,13 +248,13 @@ public function phone($phone = null) /** * @param $address - * @return Address + * @return AddressAdapter */ public function address($address = null) { if (is_array($address)) { - $this->address = new Address($address); + $this->address = new AddressAdapter(new Address($address)); } return $this->address; diff --git a/src/PaymentMethods/Subscriptions/Service/ParameterKeys/AddressAdapter.php b/src/PaymentMethods/Subscriptions/Service/ParameterKeys/AddressAdapter.php new file mode 100644 index 00000000..388b4c8b --- /dev/null +++ b/src/PaymentMethods/Subscriptions/Service/ParameterKeys/AddressAdapter.php @@ -0,0 +1,31 @@ + 'HouseNumberSuffix', + ]; +} diff --git a/tests/Buckaroo/Payments/SubscriptionsTest.php b/tests/Buckaroo/Payments/SubscriptionsTest.php index 44c8ab5b..cc93cf8d 100644 --- a/tests/Buckaroo/Payments/SubscriptionsTest.php +++ b/tests/Buckaroo/Payments/SubscriptionsTest.php @@ -96,6 +96,7 @@ public function it_creates_a_combined_subscription() 'address' => [ 'street' => 'Hoofdstraat', 'houseNumber' => '90', + 'houseNumberAdditional' => 'a', 'zipcode' => '8441ER', 'city' => 'Heerenveen', 'country' => 'NL',