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

Commit

Permalink
Adds transaction validator for res_add_cc
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Paul committed Oct 21, 2016
1 parent a8c9f42 commit e419249
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @property-read array $errors
* @property-read \CraigPaul\Moneris\Gateway $gateway
* @property-read array $params
* @property SimpleXMLElement|null $response
* @property \SimpleXMLElement|null $response
*/
class Transaction
{
Expand Down Expand Up @@ -38,7 +38,7 @@ class Transaction
protected $params;

/**
* @var SimpleXMLElement|null
* @var \SimpleXMLElement|null
*/
protected $response = null;

Expand Down Expand Up @@ -242,6 +242,11 @@ public function valid()
$errors[] = Validator::set($params, 'order_id') ? null : 'Order id not provided.';
$errors[] = Validator::set($params, 'txn_number') ? null : 'Transaction number not provided.';

break;
case 'res_add_cc':
$errors[] = Validator::set($params, 'pan') ? null : 'Credit card number not provided.';
$errors[] = Validator::set($params, 'expdate') ? null : 'Expiry date not provided.';

break;
default:
$errors[] = $params['type'].' is not a supported transaction type.';
Expand Down

0 comments on commit e419249

Please sign in to comment.