From 56dcb19c8806d2d2f0329528cf20356638aabe27 Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Wed, 18 Dec 2024 10:24:20 +0100 Subject: [PATCH] Add adapter to the bankaccount (#209) Co-authored-by: Shu Chen --- .../Subscriptions/Models/Subscription.php | 7 ++-- .../ParameterKeys/BankAccountAdapter.php | 35 +++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 src/PaymentMethods/Subscriptions/Service/ParameterKeys/BankAccountAdapter.php diff --git a/src/PaymentMethods/Subscriptions/Models/Subscription.php b/src/PaymentMethods/Subscriptions/Models/Subscription.php index 82d302d..0efbd8b 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\BankAccountAdapter; use Buckaroo\PaymentMethods\Subscriptions\Service\ParameterKeys\AddressAdapter; use Buckaroo\PaymentMethods\Subscriptions\Service\ParameterKeys\CompanyAdapter; @@ -85,9 +86,9 @@ class Subscription extends ServiceParameter */ protected Debtor $debtor; /** - * @var BankAccount + * @var BankAccountAdapter */ - protected BankAccount $bankAccount; + protected BankAccountAdapter $bankAccount; /** * @var Email */ @@ -212,7 +213,7 @@ public function bankAccount($bankAccount = null) { if (is_array($bankAccount)) { - $this->bankAccount = new BankAccount($bankAccount); + $this->bankAccount = new BankAccountAdapter(new BankAccount($bankAccount)); } return $this->bankAccount; diff --git a/src/PaymentMethods/Subscriptions/Service/ParameterKeys/BankAccountAdapter.php b/src/PaymentMethods/Subscriptions/Service/ParameterKeys/BankAccountAdapter.php new file mode 100644 index 0000000..acec273 --- /dev/null +++ b/src/PaymentMethods/Subscriptions/Service/ParameterKeys/BankAccountAdapter.php @@ -0,0 +1,35 @@ + 'CustomerIBAN', + 'accountName' => 'CustomerAccountName', + 'bic' => 'CustomerBIC' + ]; +}