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

Commit

Permalink
Adds support for preauth
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Paul committed Oct 20, 2016
1 parent ceff55f commit fa0a1c8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,25 @@ public function __construct(string $id, string $token, string $environment)
$this->environment = $environment;
}

/**
* Pre-authorize a purchase.
*
* @param array $params
*
* @return \CraigPaul\Moneris\Response
*/
public function preauth(array $params = [])
{
$params = array_merge($params, [
'type' => 'preauth',
'crypt_type' => Crypt::SSL_ENABLED_MERCHANT,
]);

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

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

/**
* Make a purchase.
*
Expand Down
1 change: 1 addition & 0 deletions src/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public function valid()

if (isset($params['type'])) {
switch ($params['type']) {
case 'preauth':
case 'purchase':
$errors[] = Validator::set($params, 'order_id') ? null : 'Order Id not provided.';
$errors[] = Validator::set($params, 'pan') ? null : 'Credit card number not provided.';
Expand Down

0 comments on commit fa0a1c8

Please sign in to comment.