Skip to content

Commit

Permalink
Release/1.10.1 (#29)
Browse files Browse the repository at this point in the history
* Added support for PayPal type of payment
* Added: Product Payment: Contract-ID parameter for the "capture" and "updateBasket" methods.
  • Loading branch information
AntonLunyovBV authored and r-simlinger committed Jan 7, 2019
1 parent 33579c3 commit 1dccc89
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Removed

## [1.10.1] - 2019-01-07

### Added
- Smart Transaction Service: new variable to allow PayPal payments
- Product Payment: Contract-ID parameter for the "capture" and "updateBasket" methods.

## [1.10.0] - 2018-12-21

Expand Down Expand Up @@ -439,3 +444,4 @@ First release
[1.9.4]:https://github.com/secucard/secucard-connect-php-sdk/compare/v1.9.3...v1.9.4
[1.9.5]:https://github.com/secucard/secucard-connect-php-sdk/compare/v1.9.4...v1.9.5
[1.10.0]:https://github.com/secucard/secucard-connect-php-sdk/compare/v1.9.5...v1.10.0
[1.10.1]:https://github.com/secucard/secucard-connect-php-sdk/compare/v1.10.0...v1.10.1
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": "v1.10.0",
"version": "v1.10.1",
"require": {
"php": ">=5.5.0",
"guzzlehttp/guzzle": "~6.3",
Expand Down
16 changes: 11 additions & 5 deletions src/SecucardConnect/Product/Payment/Service/PaymentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ abstract class PaymentService extends ProductService implements PaymentServiceIn
* Currently, partial refunds are are not allowed for all payment products.
*
* @param string $paymentId The payment transaction id.
* @param string $contractId The id of the contract that was used to create this transaction. May be null if the
* contract is an parent contract (not cloned).
* @param string $contractId The id of the contract that was used to create this transaction.
* @param int $amount The amount that you want to refund to the payer. Use '0' for a full refund.
* @param bool $reduceStakeholderPayment TRUE if you want to change the amount of the stakeholder positions too (on partial refund)
*
Expand Down Expand Up @@ -54,17 +53,22 @@ public function cancel($paymentId, $contractId = null, $amount = null, $reduceSt
* Capture a pre-authorized payment transaction.
*
* @param string $paymentId The payment transaction id
* @param string $contractId The id of the contract that was used to create this transaction.
* @return bool TRUE if successful, FALSE otherwise.
* @throws GuzzleException
* @throws ApiError
* @throws AuthError
* @throws ClientError
*/
public function capture($paymentId)
public function capture($paymentId, $contractId = null)
{
$class = $this->resourceMetadata->resourceClass;

$res = $this->execute($paymentId, 'capture', null, null, $class);
$object = [
'contract' => $contractId,
];

$res = $this->execute($paymentId, 'capture', null, $object, $class);

if ($res) {
return true;
Expand All @@ -78,13 +82,14 @@ public function capture($paymentId)
*
* @param string $paymentId The payment transaction id
* @param Basket[] $basket
* @param string $contractId The id of the contract that was used to create this transaction.
* @return bool TRUE if successful, FALSE otherwise.
* @throws GuzzleException
* @throws ApiError
* @throws AuthError
* @throws ClientError
*/
public function updateBasket($paymentId, array $basket)
public function updateBasket($paymentId, array $basket, $contractId = null)
{
$class = $this->resourceMetadata->resourceClass;
/**
Expand All @@ -93,6 +98,7 @@ public function updateBasket($paymentId, array $basket)
$object = new $class();
$object->id = $paymentId;
$object->basket = $basket;
$object->contract = $contractId;
$res = $this->updateWithAction($paymentId, 'basket', null, $object, $class);

if ($res) {
Expand Down
12 changes: 11 additions & 1 deletion src/SecucardConnect/Product/Smart/TransactionsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class TransactionsService extends ProductService
const TYPE_CREDIT_CARD = 'creditcard';
const TYPE_INVOICE = 'invoice';
const TYPE_PREPAID = 'prepaid';
const TYPE_PAYPAL = 'paypal';

/**
* Starting/Executing a transaction.
Expand Down Expand Up @@ -58,7 +59,16 @@ public function start($transactionId, $type, $object = null)
*/
public function prepare($transactionId, $type, $object = null)
{
if (!in_array($type, [self::TYPE_AUTO, self::TYPE_DIRECT_DEBIT, self::TYPE_CREDIT_CARD, self::TYPE_INVOICE])) {
if (!in_array(
$type,
[
self::TYPE_AUTO,
self::TYPE_DIRECT_DEBIT,
self::TYPE_CREDIT_CARD,
self::TYPE_INVOICE,
self::TYPE_PAYPAL,
]
)) {
throw new \InvalidArgumentException('Wrong transaction type');
}

Expand Down
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.10.0';
const VERSION = '1.10.1';

/**
* @var OAuthProvider
Expand Down

0 comments on commit 1dccc89

Please sign in to comment.