Skip to content

Commit

Permalink
Merge pull request Credit-Jeeves#23 from smartbrother/master
Browse files Browse the repository at this point in the history
Adding createCardFromSingleUseToken()
  • Loading branch information
francoisneron authored Feb 22, 2018
2 parents 38c3250 + ccf68eb commit 8ab96cd
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions source/Paysafe/CustomerVaultService.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,32 @@ public function createCard( CustomerVault\Card $card )
return new CustomerVault\Card($response);
}

/**
* Create card from a Single-Use Token.
*
* @param \Paysafe\CustomerVault\Card $card
* @return \Paysafe\CustomerVault\Card
* @throws PaysafeException
*/
public function createCardFromSingleUseToken( CustomerVault\Card $card )
{
$card->setRequiredFields(array('profileID'));
$card->checkRequiredFields();
$card->setRequiredFields(array(
'singleUseToken',
));

$request = new Request(array(
'method' => Request::POST,
'uri' => $this->prepareURI("/profiles/" . $card->profileID . "/cards"),
'body' => $card
));
$response = $this->client->processRequest($request);
$response['profileID'] = $card->profileID;

return new CustomerVault\Card($response);
}

/**
* Update card.
*
Expand All @@ -391,6 +417,7 @@ public function updateCard( CustomerVault\Card $card )
'merchantRefNum',
'holderName',
'billingAddressId',
'defaultCardIndicator',
));

$request = new Request(array(
Expand Down

0 comments on commit 8ab96cd

Please sign in to comment.