From 77217dd37584edfdfda2f2981dbaeeb91568448d Mon Sep 17 00:00:00 2001 From: LAMP ELK <1291378+Lampelk@users.noreply.github.com> Date: Mon, 18 Jun 2018 10:15:55 +0100 Subject: [PATCH 1/3] Adding storedCredential to authorize method As per API documentation for recurring payments: https://developer.paysafe.com/en/cards/api/#/introduction/complex-json-objects/standalonecredits This field is missing from the optional fields. --- source/Paysafe/CardPaymentService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/source/Paysafe/CardPaymentService.php b/source/Paysafe/CardPaymentService.php index d699d1e..8d5e5ed 100644 --- a/source/Paysafe/CardPaymentService.php +++ b/source/Paysafe/CardPaymentService.php @@ -88,6 +88,7 @@ public function authorize(CardPayments\Authorization $auth) 'accordD', 'description', 'splitpay', + 'storedCredential' )); $request = new Request(array( From b3d4a789134d3d2b7d50ef144b5219abb14c2ac0 Mon Sep 17 00:00:00 2001 From: LAMP ELK <1291378+Lampelk@users.noreply.github.com> Date: Mon, 18 Jun 2018 10:57:45 +0100 Subject: [PATCH 2/3] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2ef0672..0041f6f 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "paysafegroup/paysafe_sdk_php", + "name": "Lampelk/paysafe_sdk_php", "type": "library", "description": "PHP SDK for the Paysafe API", "keywords" : ["payment", "payment processing", "netbanx", "optimal", "sdk"], From 0aa6cee55eb2664418d8b97950b0202811bbb7fb Mon Sep 17 00:00:00 2001 From: James Meers Date: Mon, 18 Jun 2018 11:41:00 +0100 Subject: [PATCH 3/3] Adding support for 'storedCredential' to the Authorization model for the Card Payments API. Updating the card payment authorization test `testAllFieldsValidValues` for the new field. --- composer.json | 2 +- source/Paysafe/CardPayments/Authorization.php | 4 ++- .../Paysafe/CardPayments/StoredCredential.php | 25 +++++++++++++++++++ .../CardPayments/AuthorizationTest.php | 4 +++ 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 source/Paysafe/CardPayments/StoredCredential.php diff --git a/composer.json b/composer.json index 0041f6f..2ef0672 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "Lampelk/paysafe_sdk_php", + "name": "paysafegroup/paysafe_sdk_php", "type": "library", "description": "PHP SDK for the Paysafe API", "keywords" : ["payment", "payment processing", "netbanx", "optimal", "sdk"], diff --git a/source/Paysafe/CardPayments/Authorization.php b/source/Paysafe/CardPayments/Authorization.php index 50b00ec..b7b5fa4 100644 --- a/source/Paysafe/CardPayments/Authorization.php +++ b/source/Paysafe/CardPayments/Authorization.php @@ -53,6 +53,7 @@ * @property \Paysafe\Error $error * @property \Paysafe\Link[] $links * @property \Paysafe\CardPayments\SplitPay[] $splitpay + * @property \Paysafe\CardPayments\StoredCredential $storedCredential */ class Authorization extends \Paysafe\JSONObject implements \Paysafe\Pageable { @@ -114,7 +115,8 @@ public static function getPageableArrayKey() 'settlements' => 'array:\Paysafe\CardPayments\Settlement', 'error' => '\Paysafe\Error', 'links' => 'array:\Paysafe\Link', - 'splitpay' => 'array:\Paysafe\CardPayments\SplitPay', + 'splitpay' => 'array:\Paysafe\CardPayments\SplitPay', + 'storedCredential' => '\Paysafe\CardPayments\StoredCredential' ); } diff --git a/source/Paysafe/CardPayments/StoredCredential.php b/source/Paysafe/CardPayments/StoredCredential.php new file mode 100644 index 0000000..7426feb --- /dev/null +++ b/source/Paysafe/CardPayments/StoredCredential.php @@ -0,0 +1,25 @@ + array( + 'ADHOC', + 'TOPUP', + 'RECURRING' + ), + 'occurrence' => array( + 'INITIAL', + 'SUBSEQUENT' + ) + ); +} diff --git a/tests/paysafe/CardPayments/AuthorizationTest.php b/tests/paysafe/CardPayments/AuthorizationTest.php index 0d9e2ef..af7e665 100644 --- a/tests/paysafe/CardPayments/AuthorizationTest.php +++ b/tests/paysafe/CardPayments/AuthorizationTest.php @@ -382,6 +382,10 @@ public function testAllFieldsValidValues() 'linkedAccount' => 'link_account_id', 'amount' => 500, ]], + 'storedCredential' => [ + 'type' => 'RECURRING', + 'occurrence' => 'SUBSEQUENT' + ] ]; $auth = new Authorization($auth_array);