Skip to content

Commit

Permalink
Fix shared Gateway and transparent Redirect to support recurring paym…
Browse files Browse the repository at this point in the history
…ents.

When processing a recurring payment the directGateway should be
used as a 'Continuous' (recurring) authorization as the card is
not present at that stage

thephpleague/omnipay-common#160
thephpleague/omnipay#466
  • Loading branch information
eileenmcnaughton committed Oct 2, 2017
1 parent ecf58c7 commit e516e65
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/RapidGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Omnipay\Eway;

use Omnipay\Common\AbstractGateway;
use Omnipay\Omnipay;

/**
* eWAY Rapid Transparent Redirect Gateway
Expand Down Expand Up @@ -64,6 +65,13 @@ public function setPassword($value)

public function purchase(array $parameters = array())
{
if (!empty($parameters['cardTransactionType']) && $parameters['cardTransactionType'] === 'continuous') {
$gateway = Omnipay::create('Eway_RapidDirect');
$gateway->setApiKey($this->getApiKey());
$gateway->setPassword($this->getPassword());
$gateway->setTestMode($this->getTestMode());
return $gateway->createRequest('\Omnipay\Eway\Message\RapidDirectPurchaseRequest', $parameters);
}
return $this->createRequest('\Omnipay\Eway\Message\RapidPurchaseRequest', $parameters);
}

Expand Down
8 changes: 8 additions & 0 deletions src/RapidSharedGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Omnipay\Eway;

use Omnipay\Common\AbstractGateway;
use Omnipay\Omnipay;

/**
* eWAY Rapid Responsive Shared Page Gateway
Expand Down Expand Up @@ -61,6 +62,13 @@ public function setPassword($value)

public function purchase(array $parameters = array())
{
if (!empty($parameters['cardTransactionType']) && $parameters['cardTransactionType'] === 'continuous') {
$gateway = Omnipay::create('Eway_RapidDirect');
$gateway->setApiKey($this->getApiKey());
$gateway->setPassword($this->getPassword());
$gateway->setTestMode($this->getTestMode());
return $gateway->createRequest('\Omnipay\Eway\Message\RapidDirectPurchaseRequest', $parameters);
}
return $this->createRequest('\Omnipay\Eway\Message\RapidSharedPurchaseRequest', $parameters);
}

Expand Down

0 comments on commit e516e65

Please sign in to comment.