Skip to content

Commit

Permalink
Release 1.27.0 (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
r-simlinger authored Sep 10, 2024
1 parent ec1582c commit 921d872
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
Expand Down
41 changes: 41 additions & 0 deletions src/SecucardConnect/Product/General/ContractsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}
}
49 changes: 49 additions & 0 deletions src/SecucardConnect/Product/General/Model/BankAccount.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace SecucardConnect\Product\General\Model;

/**
* Class BankAccount
* @package SecucardConnect\Product\General\Model
*/
class BankAccount
{
/**
* @var string
*/
public string $owner;

/**
* @var string
*/
public string $iban;

/**
* @var string
*/
public string $bic;

/**
* @var string|null
*/
public ?string $bankname;

/**
* CloneParams constructor.
* @param string $owner
* @param string $iban
* @param string $bic
* @param string|null $bankname
*/
public function __construct(
string $owner,
string $iban,
string $bic,
string $bankname = null
) {
$this->owner = $owner;
$this->iban = $iban;
$this->bic = $bic;
$this->bankname = $bankname;
}
}
3 changes: 2 additions & 1 deletion src/SecucardConnect/SecucardConnect.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class SecucardConnect
/**
* SDK version
*/
const VERSION = '1.26.0';
const VERSION = '1.27.0';

/**
* @var OAuthProvider
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 921d872

Please sign in to comment.