diff --git a/src/RapidGateway.php b/src/RapidGateway.php index 872b156..fe6d29e 100644 --- a/src/RapidGateway.php +++ b/src/RapidGateway.php @@ -6,6 +6,7 @@ namespace Omnipay\Eway; use Omnipay\Common\AbstractGateway; +use Omnipay\Omnipay; /** * eWAY Rapid Transparent Redirect Gateway @@ -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); } diff --git a/src/RapidSharedGateway.php b/src/RapidSharedGateway.php index 5f5696a..882549f 100644 --- a/src/RapidSharedGateway.php +++ b/src/RapidSharedGateway.php @@ -6,6 +6,7 @@ namespace Omnipay\Eway; use Omnipay\Common\AbstractGateway; +use Omnipay\Omnipay; /** * eWAY Rapid Responsive Shared Page Gateway @@ -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); }