Skip to content

Commit a90163f

Browse files
Add interfaces for incoming notifications
1 parent 0cd3186 commit a90163f

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

src/Omnipay/Common/AbstractGateway.php

100644100755
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,16 @@ public function supportsVoid()
247247
return method_exists($this, 'void');
248248
}
249249

250+
/**
251+
* Supports AcceptNotification
252+
*
253+
* @return boolean True if this gateway supports the acceptNotification() method
254+
*/
255+
public function supportsAcceptNotification()
256+
{
257+
return method_exists($this, 'acceptNotification');
258+
}
259+
250260
/**
251261
* Supports CreateCard
252262
*
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Omnipay\Common\Message;
4+
5+
/**
6+
* Incoming notification
7+
*/
8+
interface NotificationInterface extends MessageInterface
9+
{
10+
const STATUS_COMPLETED = 'completed';
11+
const STATUS_PENDING = 'pending';
12+
const STATUS_FAILED = 'failed';
13+
14+
/**
15+
* Gateway Reference
16+
*
17+
* @return string A reference provided by the gateway to represent this transaction
18+
*/
19+
public function getTransactionReference();
20+
21+
/**
22+
* Was the transaction successful?
23+
*
24+
* @return string Transaction status, one of {@see STATUS_COMPLETED}, {@see #STATUS_PENDING}, or {@see #STATUS_FAILED}.
25+
*/
26+
public function getTransactionStatus();
27+
28+
/**
29+
* Response Message
30+
*
31+
* @return string A response message from the payment gateway
32+
*/
33+
public function getMessage();
34+
}

tests/Omnipay/Common/AbstractGatewayTest.php

100644100755
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ public function testSupportsUpdateCard()
133133
$this->assertFalse($this->gateway->supportsUpdateCard());
134134
}
135135

136+
public function testSupportsAcceptNotification()
137+
{
138+
$this->assertFalse($this->gateway->supportsAcceptNotification());
139+
}
140+
136141
public function testCreateRequest()
137142
{
138143
$this->gateway = new AbstractGatewayTest_MockAbstractGateway;

0 commit comments

Comments
 (0)