Skip to content

Commit

Permalink
Merge pull request #4 from digitickets/Adding-more-standard-methods
Browse files Browse the repository at this point in the history
Add purchase, complete purchase and complete authorise methods
  • Loading branch information
delatbabel authored Dec 28, 2016
2 parents db31b81 + 42729a5 commit d896909
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
33 changes: 33 additions & 0 deletions tests/GatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

0 comments on commit d896909

Please sign in to comment.