Skip to content

Commit 36dfb1f

Browse files
committed
Add supportsCompleteAuthorize() and supportsCompletePurchase() gateway methods
1 parent 8153ed7 commit 36dfb1f

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

src/Omnipay/Common/AbstractGateway.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,16 @@ public function supportsAuthorize()
119119
return method_exists($this, 'authorize');
120120
}
121121

122+
/**
123+
* Supports Complete Authorize
124+
*
125+
* @return boolean True if this gateway supports the completeAuthorize() method
126+
*/
127+
public function supportsCompleteAuthorize()
128+
{
129+
return method_exists($this, 'completeAuthorize');
130+
}
131+
122132
/**
123133
* Supports Capture
124134
*
@@ -129,6 +139,16 @@ public function supportsCapture()
129139
return method_exists($this, 'capture');
130140
}
131141

142+
/**
143+
* Supports Complete Purchase
144+
*
145+
* @return boolean True if this gateway supports the completePurchase() method
146+
*/
147+
public function supportsCompletePurchase()
148+
{
149+
return method_exists($this, 'completePurchase');
150+
}
151+
132152
/**
133153
* Supports Refund
134154
*

tests/Omnipay/GatewayTestCase.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,18 @@ public function testSupportsAuthorize()
8989
}
9090
}
9191

92+
public function testSupportsCompleteAuthorize()
93+
{
94+
$supportsCompleteAuthorize = $this->gateway->supportsCompleteAuthorize();
95+
$this->assertInternalType('boolean', $supportsCompleteAuthorize);
96+
97+
if ($supportsCompleteAuthorize) {
98+
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->completeAuthorize());
99+
} else {
100+
$this->assertFalse(method_exists($this->gateway, 'completeAuthorize'));
101+
}
102+
}
103+
92104
public function testSupportsCapture()
93105
{
94106
$supportsCapture = $this->gateway->supportsCapture();
@@ -101,6 +113,18 @@ public function testSupportsCapture()
101113
}
102114
}
103115

116+
public function testSupportsCompletePurchase()
117+
{
118+
$supportsCompletePurchase = $this->gateway->supportsCompletePurchase();
119+
$this->assertInternalType('boolean', $supportsCompletePurchase);
120+
121+
if ($supportsCompletePurchase) {
122+
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->completePurchase());
123+
} else {
124+
$this->assertFalse(method_exists($this->gateway, 'completePurchase'));
125+
}
126+
}
127+
104128
public function testSupportsRefund()
105129
{
106130
$supportsRefund = $this->gateway->supportsRefund();

0 commit comments

Comments
 (0)