Skip to content
This repository has been archived by the owner on Oct 30, 2020. It is now read-only.

Commit

Permalink
Adds add card method. Extends default gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Paul committed Oct 21, 2016
1 parent e419249 commit d1522e2
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions src/Vault.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,10 @@
* @property-read string $id
* @property-read string $token
*/
class Vault
class Vault extends Gateway
{
use Gettable;

/**
* @var string
*/
protected $id;

/**
* @var string
*/
protected $token;

/**
* @var string
*/
protected $environment;

/**
* Create a new Vault instance.
*
Expand All @@ -39,9 +24,26 @@ class Vault
*/
public function __construct(string $id, string $token, string $environment)
{
$this->id = $id;
$this->token = $token;
$this->environment = $environment;
parent::__construct($id, $token, $environment);
}

/**
* @param \CraigPaul\Moneris\CreditCard $card
*
* @return \CraigPaul\Moneris\Response
*/
public function add(CreditCard $card)
{
$params = [
'type' => 'res_add_cc',
'crypt_type' => $card->crypt,
'pan' => $card->number,
'expdate' => $card->expiry,
];

$transaction = $this->transaction($params);

return $this->process($transaction);
}

/**
Expand Down

0 comments on commit d1522e2

Please sign in to comment.