Skip to content

Commit e516e65

Browse files
Fix shared Gateway and transparent Redirect to support recurring payments.
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
1 parent ecf58c7 commit e516e65

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/RapidGateway.php

+8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Omnipay\Eway;
77

88
use Omnipay\Common\AbstractGateway;
9+
use Omnipay\Omnipay;
910

1011
/**
1112
* eWAY Rapid Transparent Redirect Gateway
@@ -64,6 +65,13 @@ public function setPassword($value)
6465

6566
public function purchase(array $parameters = array())
6667
{
68+
if (!empty($parameters['cardTransactionType']) && $parameters['cardTransactionType'] === 'continuous') {
69+
$gateway = Omnipay::create('Eway_RapidDirect');
70+
$gateway->setApiKey($this->getApiKey());
71+
$gateway->setPassword($this->getPassword());
72+
$gateway->setTestMode($this->getTestMode());
73+
return $gateway->createRequest('\Omnipay\Eway\Message\RapidDirectPurchaseRequest', $parameters);
74+
}
6775
return $this->createRequest('\Omnipay\Eway\Message\RapidPurchaseRequest', $parameters);
6876
}
6977

src/RapidSharedGateway.php

+8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Omnipay\Eway;
77

88
use Omnipay\Common\AbstractGateway;
9+
use Omnipay\Omnipay;
910

1011
/**
1112
* eWAY Rapid Responsive Shared Page Gateway
@@ -61,6 +62,13 @@ public function setPassword($value)
6162

6263
public function purchase(array $parameters = array())
6364
{
65+
if (!empty($parameters['cardTransactionType']) && $parameters['cardTransactionType'] === 'continuous') {
66+
$gateway = Omnipay::create('Eway_RapidDirect');
67+
$gateway->setApiKey($this->getApiKey());
68+
$gateway->setPassword($this->getPassword());
69+
$gateway->setTestMode($this->getTestMode());
70+
return $gateway->createRequest('\Omnipay\Eway\Message\RapidDirectPurchaseRequest', $parameters);
71+
}
6472
return $this->createRequest('\Omnipay\Eway\Message\RapidSharedPurchaseRequest', $parameters);
6573
}
6674

0 commit comments

Comments
 (0)