From c38a72b4f013a830f15b45c94c5cb598cef810be Mon Sep 17 00:00:00 2001 From: Craig Paul Date: Fri, 21 Oct 2016 12:28:03 -0600 Subject: [PATCH] Adds update credit card functionality --- src/Vault.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Vault.php b/src/Vault.php index c816f5d..3f9f4c7 100644 --- a/src/Vault.php +++ b/src/Vault.php @@ -59,4 +59,25 @@ public static function create(string $id, string $token, string $environment) { return new static($id, $token, $environment); } + + /** + * @param string $key + * @param \CraigPaul\Moneris\CreditCard $card + * + * @return \CraigPaul\Moneris\Response + */ + public function update(string $key, CreditCard $card) + { + $params = [ + 'type' => 'res_update_cc', + 'data_key' => $key, + 'crypt_type' => $card->crypt, + 'pan' => $card->number, + 'expdate' => $card->expiry, + ]; + + $transaction = $this->transaction($params); + + return $this->process($transaction); + } } \ No newline at end of file