Skip to content

Commit

Permalink
Merge pull request #58 from sergej-koscejev/master
Browse files Browse the repository at this point in the history
Add interfaces for incoming notifications
  • Loading branch information
greydnls committed Oct 27, 2015
2 parents 597f572 + 0b72bb1 commit 8e396e9
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Omnipay/Common/AbstractGateway.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,16 @@ public function supportsVoid()
return method_exists($this, 'void');
}

/**
* Supports AcceptNotification
*
* @return boolean True if this gateway supports the acceptNotification() method
*/
public function supportsAcceptNotification()
{
return method_exists($this, 'acceptNotification');
}

/**
* Supports CreateCard
*
Expand Down
35 changes: 35 additions & 0 deletions src/Omnipay/Common/Message/NotificationInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace Omnipay\Common\Message;

/**
* Incoming notification
*/
interface NotificationInterface extends MessageInterface
{
const STATUS_COMPLETED = 'completed';
const STATUS_PENDING = 'pending';
const STATUS_FAILED = 'failed';

/**
* Gateway Reference
*
* @return string A reference provided by the gateway to represent this transaction
*/
public function getTransactionReference();

/**
* Was the transaction successful?
*
* @return string Transaction status, one of {@see STATUS_COMPLETED}, {@see #STATUS_PENDING},
* or {@see #STATUS_FAILED}.
*/
public function getTransactionStatus();

/**
* Response Message
*
* @return string A response message from the payment gateway
*/
public function getMessage();
}
5 changes: 5 additions & 0 deletions tests/Omnipay/Common/AbstractGatewayTest.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ public function testSupportsUpdateCard()
$this->assertFalse($this->gateway->supportsUpdateCard());
}

public function testSupportsAcceptNotification()
{
$this->assertFalse($this->gateway->supportsAcceptNotification());
}

public function testCreateRequest()
{
$this->gateway = new AbstractGatewayTest_MockAbstractGateway;
Expand Down

0 comments on commit 8e396e9

Please sign in to comment.