diff --git a/CHANGELOG.md b/CHANGELOG.md index 00995df..8cb2ce7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Removed +## [1.27.0] - 2024-09-10 +[1.27.0]:https://github.com/secucard/secucard-connect-php-sdk/compare/1.26.0...1.27.0 + +### Added +- General.ContractsService: new method `updateBankAccount()` + + ## [1.26.0] - 2023-06-22 ### Deprecated diff --git a/composer.json b/composer.json index 54c1b8b..72fb6e3 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "secucard connect PHP client SDK", "license": "Apache-2.0", "homepage": "https://github.com/secucard/secucard-connect-php-sdk", - "version": "1.26.0", + "version": "1.27.0", "require": { "php": ">=7.4.0", "ext-json": "*", diff --git a/src/SecucardConnect/Product/General/ContractsService.php b/src/SecucardConnect/Product/General/ContractsService.php index 473c465..19b041c 100644 --- a/src/SecucardConnect/Product/General/ContractsService.php +++ b/src/SecucardConnect/Product/General/ContractsService.php @@ -8,6 +8,7 @@ use SecucardConnect\Client\ClientError; use SecucardConnect\Client\MissingParamsError; use SecucardConnect\Client\ProductService; +use SecucardConnect\Product\General\Model\BankAccount; use SecucardConnect\Product\General\Model\PaymentMethodsRequestParams; use SecucardConnect\Product\Smart\Model\PaymentWizardContractOptions; @@ -69,4 +70,44 @@ public function revokeAccrual($contractId) return (bool)$this->execute($contractId, 'revokeAccrual'); } + + /** + * Initiate the update of bank account for the given contract + * + * @param string $contractId General-Contract-ID, mandatory, f.e. "GCR_..." + * @param string $owner bank account owner, mandatory, f.e. "Max Muster" + * @param string $iban IBAN, mandatory, f.e. "DE12..." + * @param string|null $bic BIC, recommended, depending on the contract settings this param is mandatory or optional + * @param string|null $bankname optional + * @return bool TRUE if successful, throws ApiError otherwise. + * @throws GuzzleException + * @throws ApiError + * @throws AuthError + * @throws ClientError + * @throws MissingParamsError + */ + public function updateBankAccount(string $contractId, string $owner, string $iban, ?string $bic = null, ?string $bankname = null) + { + if (empty($contractId)) { + throw new MissingParamsError('contractId', __METHOD__); + } + + if (empty($owner)) { + throw new MissingParamsError('owner', __METHOD__); + } + + if (empty($iban)) { + throw new MissingParamsError('iban', __METHOD__); + } + + $class = $this->resourceMetadata->resourceClass; + $object = new BankAccount( + $owner, + $iban, + $bic, + $bankname + ); + + return (bool)$this->execute($contractId, 'updateBankAccount', null, $object, $class); + } } diff --git a/src/SecucardConnect/Product/General/Model/BankAccount.php b/src/SecucardConnect/Product/General/Model/BankAccount.php new file mode 100644 index 0000000..b572b89 --- /dev/null +++ b/src/SecucardConnect/Product/General/Model/BankAccount.php @@ -0,0 +1,49 @@ +owner = $owner; + $this->iban = $iban; + $this->bic = $bic; + $this->bankname = $bankname; + } +} diff --git a/src/SecucardConnect/SecucardConnect.php b/src/SecucardConnect/SecucardConnect.php index 6da0f60..bd0fc41 100644 --- a/src/SecucardConnect/SecucardConnect.php +++ b/src/SecucardConnect/SecucardConnect.php @@ -33,7 +33,7 @@ final class SecucardConnect /** * SDK version */ - const VERSION = '1.26.0'; + const VERSION = '1.27.0'; /** * @var OAuthProvider @@ -109,6 +109,7 @@ public function __construct( $this->logger = $logger == null ? new Logger(null, false) : $logger; $config->isValid(); + $this->logger->debug('Using config: ' . json_encode($config->toArray(), JSON_PRETTY_PRINT)); $this->config = $config; // Create the default common storage if necessary