Skip to content

Commit

Permalink
Relase 1.22.0
Browse files Browse the repository at this point in the history
  • Loading branch information
r-simlinger committed Jun 11, 2021
1 parent 3fbf0e5 commit cfc5227
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 5 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Removed

## [1.22.0] - 2021-06-11

### Added
- General.ContractsService: new method `revokeAccrual()`
- Payment.ContractsService: new method `revokeAccrual()`

### Changed
- Adjusted response handling to support empty HTTP responses like `204 No Content`


## [1.21.0] - 2021-03-10

Expand Down Expand Up @@ -693,3 +702,4 @@ First release
[1.19.0]:https://github.com/secucard/secucard-connect-php-sdk/compare/1.18.0...1.19.0
[1.20.0]:https://github.com/secucard/secucard-connect-php-sdk/compare/1.19.0...1.20.0
[1.21.0]:https://github.com/secucard/secucard-connect-php-sdk/compare/1.20.0...1.21.0
[1.22.0]:https://github.com/secucard/secucard-connect-php-sdk/compare/1.21.0...1.22.0
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.21.0",
"version": "1.22.0",
"require": {
"php": ">=5.5.0",
"guzzlehttp/guzzle": "~6.3|~7.0",
Expand Down
26 changes: 23 additions & 3 deletions src/SecucardConnect/Client/ProductService.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function getNextBatch($id)
* @param null $expireTime
* @param null $scrollId
*
* @return BaseCollection
* @return BaseCollection|bool
* @throws ApiError
* @throws AuthError
* @throws ClientError
Expand All @@ -179,6 +179,11 @@ private function getListInternal(QueryParams $query = null, $expireTime = null,
throw new ClientError('Error retrieving data list.');
}

if ($jsonResponse === true) {
$this->postProcess($jsonResponse);
return true;
}

$list = new BaseCollection();

if (is_object($jsonResponse)) {
Expand Down Expand Up @@ -216,7 +221,7 @@ private function getListInternal(QueryParams $query = null, $expireTime = null,
* Method to get object identified by id
*
* @param string $id
* @return BaseModel
* @return BaseModel|bool
* @throws ApiError
* @throws AuthError
* @throws ClientError
Expand All @@ -236,6 +241,11 @@ public function get($id)
throw new Exception('Error retrieving data');
}

if ($jsonResponse === true) {
$this->postProcess($jsonResponse);
return true;
}

$inst = $this->createResourceInst($jsonResponse, $this->resourceMetadata->resourceClass);

$this->postProcess($inst);
Expand Down Expand Up @@ -297,7 +307,7 @@ public function delete(BaseModel $model)
* new object.
*
* @param BaseModel $model The object to save.
* @return BaseModel The created object, has same type as the given input.
* @return BaseModel|bool The created object, has same type as the given input.
* @throws ApiError
* @throws AuthError
* @throws ClientError
Expand Down Expand Up @@ -326,6 +336,11 @@ public function save(BaseModel $model)
throw new Exception('Error updating model');
}

if ($jsonResponse === true) {
$this->postProcess($jsonResponse);
return true;
}

$inst = $this->createResourceInst($jsonResponse, $this->resourceMetadata->resourceClass);

$this->postProcess($inst);
Expand Down Expand Up @@ -602,6 +617,11 @@ private function request(RequestParams $params)
return MapperUtil::mapResponse($response);
}

// handle f.e. "202 Accepted" or "204 No Content"
if ($response->getStatusCode() > 200 && $response->getStatusCode() < 300) {
return true;
}

return false;
}

Expand Down
23 changes: 23 additions & 0 deletions src/SecucardConnect/Product/General/ContractsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use SecucardConnect\Client\ApiError;
use SecucardConnect\Client\AuthError;
use SecucardConnect\Client\ClientError;
use SecucardConnect\Client\MissingParamsError;
use SecucardConnect\Client\ProductService;
use SecucardConnect\Product\General\Model\PaymentMethodsRequestParams;
use SecucardConnect\Product\Smart\Model\PaymentWizardContractOptions;
Expand Down Expand Up @@ -46,4 +47,26 @@ public function getPaymentWizardOptions($contract_id)
{
return $this->getWithAction($contract_id, 'iframeOptions', null, null, PaymentWizardContractOptions::class);
}

/**
* Remove the accrual flag from all payment transactions of the given contract
* (this will be done in the background,
* so the response TRUE will only indicate the the API has accepted this request)
*
* @param string $contractId The general contract id
* @return bool
* @throws ApiError
* @throws AuthError
* @throws ClientError
* @throws GuzzleException
* @throws MissingParamsError
*/
public function revokeAccrual($contractId)
{
if (empty($contractId)) {
throw new MissingParamsError('contractId', __METHOD__);
}

return (bool)$this->execute($contractId, 'revokeAccrual');
}
}
24 changes: 24 additions & 0 deletions src/SecucardConnect/Product/Payment/ContractsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
use SecucardConnect\Client\ApiError;
use SecucardConnect\Client\AuthError;
use SecucardConnect\Client\ClientError;
use SecucardConnect\Client\MissingParamsError;
use SecucardConnect\Client\ProductService;
use SecucardConnect\Product\Payment\Model\CloneParams;
use SecucardConnect\Product\Payment\Model\CreateSubContractRequest;
use SecucardConnect\Product\Payment\Model\CreateSubContractResponse;
use SecucardConnect\Product\Payment\Model\Transaction;
use SecucardConnect\Product\Services\Model\Contract;


Expand Down Expand Up @@ -84,4 +86,26 @@ public function createSubContract(CreateSubContractRequest $param, $contract_id

return $this->execute($contract_id, 'requestId', null, $param, CreateSubContractResponse::class);
}

/**
* Remove the accrual flag from all payment transactions of the given contract
* (this will be done in the background,
* so the response TRUE will only indicate the the API has accepted this request)
*
* @param string $contractId The payment contract id
* @return bool
* @throws ApiError
* @throws AuthError
* @throws ClientError
* @throws GuzzleException
* @throws MissingParamsError
*/
public function revokeAccrual($contractId)
{
if (empty($contractId)) {
throw new MissingParamsError('contractId', __METHOD__);
}

return (bool)$this->execute($contractId, 'revokeAccrual');
}
}
2 changes: 1 addition & 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.21.0';
const VERSION = '1.22.0';

/**
* @var OAuthProvider
Expand Down

0 comments on commit cfc5227

Please sign in to comment.