File tree Expand file tree Collapse file tree
tests/paysafe/CardPayments Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ public function authorize(CardPayments\Authorization $auth)
8888 'accordD ' ,
8989 'description ' ,
9090 'splitpay ' ,
91+ 'storedCredential '
9192 ));
9293
9394 $ request = new Request (array (
Original file line number Diff line number Diff line change 5353 * @property \Paysafe\Error $error
5454 * @property \Paysafe\Link[] $links
5555 * @property \Paysafe\CardPayments\SplitPay[] $splitpay
56+ * @property \Paysafe\CardPayments\StoredCredential $storedCredential
5657 */
5758class Authorization extends \Paysafe \JSONObject implements \Paysafe \Pageable
5859{
@@ -114,7 +115,8 @@ public static function getPageableArrayKey()
114115 'settlements ' => 'array:\Paysafe\CardPayments\Settlement ' ,
115116 'error ' => '\Paysafe\Error ' ,
116117 'links ' => 'array:\Paysafe\Link ' ,
117- 'splitpay ' => 'array:\Paysafe\CardPayments\SplitPay ' ,
118+ 'splitpay ' => 'array:\Paysafe\CardPayments\SplitPay ' ,
119+ 'storedCredential ' => '\Paysafe\CardPayments\StoredCredential '
118120 );
119121
120122}
Original file line number Diff line number Diff line change 1+ <?php
2+ /*
3+ * TODO insert appropriate copyright notice
4+ */
5+
6+ namespace Paysafe \CardPayments ;
7+
8+ /**
9+ * @property string $type
10+ * @property number $occurrence
11+ */
12+ class StoredCredential extends \Paysafe \JSONObject
13+ {
14+ protected static $ fieldTypes = array (
15+ 'type ' => array (
16+ 'ADHOC ' ,
17+ 'TOPUP ' ,
18+ 'RECURRING '
19+ ),
20+ 'occurrence ' => array (
21+ 'INITIAL ' ,
22+ 'SUBSEQUENT '
23+ )
24+ );
25+ }
Original file line number Diff line number Diff line change @@ -370,6 +370,32 @@ public function createCard( CustomerVault\Card $card )
370370 return new CustomerVault \Card ($ response );
371371 }
372372
373+ /**
374+ * Create card from a Single-Use Token.
375+ *
376+ * @param \Paysafe\CustomerVault\Card $card
377+ * @return \Paysafe\CustomerVault\Card
378+ * @throws PaysafeException
379+ */
380+ public function createCardFromSingleUseToken ( CustomerVault \Card $ card )
381+ {
382+ $ card ->setRequiredFields (array ('profileID ' ));
383+ $ card ->checkRequiredFields ();
384+ $ card ->setRequiredFields (array (
385+ 'singleUseToken ' ,
386+ ));
387+
388+ $ request = new Request (array (
389+ 'method ' => Request::POST ,
390+ 'uri ' => $ this ->prepareURI ("/profiles/ " . $ card ->profileID . "/cards " ),
391+ 'body ' => $ card
392+ ));
393+ $ response = $ this ->client ->processRequest ($ request );
394+ $ response ['profileID ' ] = $ card ->profileID ;
395+
396+ return new CustomerVault \Card ($ response );
397+ }
398+
373399 /**
374400 * Update card.
375401 *
@@ -391,6 +417,7 @@ public function updateCard( CustomerVault\Card $card )
391417 'merchantRefNum ' ,
392418 'holderName ' ,
393419 'billingAddressId ' ,
420+ 'defaultCardIndicator ' ,
394421 ));
395422
396423 $ request = new Request (array (
Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ public function directDebitService() {
176176 /**
177177 * Threed Secure service.
178178 *
179- * @return \Paysafe\ThreedSecureService
179+ * @return \Paysafe\ThreeDSecureService
180180 */
181181 public function threeDSecureService () {
182182 return new ThreeDSecureService ($ this );
Original file line number Diff line number Diff line change 2828
2929namespace Paysafe ;
3030
31- class ThreeDsecureService
31+ class ThreeDSecureService
3232{
3333
3434 /**
Original file line number Diff line number Diff line change @@ -382,6 +382,10 @@ public function testAllFieldsValidValues()
382382 'linkedAccount ' => 'link_account_id ' ,
383383 'amount ' => 500 ,
384384 ]],
385+ 'storedCredential ' => [
386+ 'type ' => 'RECURRING ' ,
387+ 'occurrence ' => 'SUBSEQUENT '
388+ ]
385389 ];
386390 $ auth = new Authorization ($ auth_array );
387391
You can’t perform that action at this time.
0 commit comments