Skip to content

Commit

Permalink
Adding support for 'storedCredential' to the Authorization model for the
Browse files Browse the repository at this point in the history
Card Payments API.

Updating the card payment authorization test `testAllFieldsValidValues`
for the new field.
  • Loading branch information
James Meers committed Jun 18, 2018
1 parent b3d4a78 commit 0aa6cee
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -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"],
Expand Down
4 changes: 3 additions & 1 deletion source/Paysafe/CardPayments/Authorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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'
);

}
25 changes: 25 additions & 0 deletions source/Paysafe/CardPayments/StoredCredential.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/*
* TODO insert appropriate copyright notice
*/

namespace Paysafe\CardPayments;

/**
* @property string $type
* @property number $occurrence
*/
class StoredCredential extends \Paysafe\JSONObject
{
protected static $fieldTypes = array(
'type' => array(
'ADHOC',
'TOPUP',
'RECURRING'
),
'occurrence' => array(
'INITIAL',
'SUBSEQUENT'
)
);
}
4 changes: 4 additions & 0 deletions tests/paysafe/CardPayments/AuthorizationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@ public function testAllFieldsValidValues()
'linkedAccount' => 'link_account_id',
'amount' => 500,
]],
'storedCredential' => [
'type' => 'RECURRING',
'occurrence' => 'SUBSEQUENT'
]
];
$auth = new Authorization($auth_array);

Expand Down

0 comments on commit 0aa6cee

Please sign in to comment.