From 42729a5087034224f7d62e02cc815764c34b969f Mon Sep 17 00:00:00 2001 From: Joe Hickson Date: Thu, 15 Dec 2016 09:48:29 +0000 Subject: [PATCH] Add purchase, complete purchase and complete authorise --- src/Gateway.php | 15 +++++++++++++++ tests/GatewayTest.php | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/src/Gateway.php b/src/Gateway.php index 73a705f..1a5b445 100644 --- a/src/Gateway.php +++ b/src/Gateway.php @@ -73,6 +73,21 @@ public function authorize(array $parameters = array()) return $this->createRequest('\Omnipay\Manual\Message\Request', $parameters); } + public function purchase(array $parameters = array()) + { + return $this->createRequest('\Omnipay\Manual\Message\Request', $parameters); + } + + public function completePurchase(array $parameters = array()) + { + return $this->createRequest('\Omnipay\Manual\Message\Request', $parameters); + } + + public function completeAuthorise(array $parameters = array()) + { + return $this->createRequest('\Omnipay\Manual\Message\Request', $parameters); + } + public function capture(array $parameters = array()) { return $this->createRequest('\Omnipay\Manual\Message\Request', $parameters); diff --git a/tests/GatewayTest.php b/tests/GatewayTest.php index 7897379..3872f61 100644 --- a/tests/GatewayTest.php +++ b/tests/GatewayTest.php @@ -60,4 +60,37 @@ public function testRefund() $this->assertNull($response->getTransactionReference()); $this->assertNull($response->getMessage()); } + + public function testPurchase() + { + $response = $this->gateway->purchase($this->options)->send(); + + $this->assertInstanceOf('\Omnipay\Manual\Message\Response', $response); + $this->assertTrue($response->isSuccessful()); + $this->assertFalse($response->isRedirect()); + $this->assertNull($response->getTransactionReference()); + $this->assertNull($response->getMessage()); + } + + public function testCompletePurchase() + { + $response = $this->gateway->completePurchase($this->options)->send(); + + $this->assertInstanceOf('\Omnipay\Manual\Message\Response', $response); + $this->assertTrue($response->isSuccessful()); + $this->assertFalse($response->isRedirect()); + $this->assertNull($response->getTransactionReference()); + $this->assertNull($response->getMessage()); + } + + public function testCompleteAuthorise() + { + $response = $this->gateway->completeAuthorise($this->options)->send(); + + $this->assertInstanceOf('\Omnipay\Manual\Message\Response', $response); + $this->assertTrue($response->isSuccessful()); + $this->assertFalse($response->isRedirect()); + $this->assertNull($response->getTransactionReference()); + $this->assertNull($response->getMessage()); + } }