Skip to content

Commit

Permalink
reply ok
Browse files Browse the repository at this point in the history
  • Loading branch information
recca0120 committed Apr 23, 2024
1 parent 0fa37d4 commit 75cfa25
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/Message/AcceptNotificationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ public function getMessage()
return $this->getNotificationResponse()->getMessage();
}

/**
* @return string
*/
public function getReply()
{
return $this->getNotificationResponse()->getReply();
}

/**
* @return AcceptNotificationResponse
*/
Expand Down
8 changes: 8 additions & 0 deletions src/Message/AcceptNotificationResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,12 @@ public function getTransactionStatus()
{
return $this->isSuccessful() ? self::STATUS_COMPLETED : self::STATUS_FAILED;
}

/**
* @return string
*/
public function getReply()
{
return 'OK';
}
}
8 changes: 6 additions & 2 deletions tests/Message/AcceptNotificationRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Omnipay\MyCash\Tests\Message;

use Omnipay\Common\Exception\InvalidRequestException;
use Omnipay\Common\Exception\InvalidResponseException;
use Omnipay\Common\Message\NotificationInterface;
use Omnipay\MyCash\Message\AcceptNotificationRequest;
use Omnipay\MyCash\Message\CompletePurchaseRequest;
Expand All @@ -18,7 +18,7 @@ class AcceptNotificationRequestTest extends TestCase

public function testValidateFails(): void
{
$this->expectException(InvalidRequestException::class);
$this->expectException(InvalidResponseException::class);

$options = [
'RtnCode' => '1',
Expand Down Expand Up @@ -60,6 +60,7 @@ public function testCreditCardAcceptNotificationRequest(): void
$request->initialize($this->initialize);

self::assertEquals('成功', $request->getMessage());
self::assertEquals('OK', $request->getReply());
self::assertEquals('20151202001', $request->getTransactionId());
self::assertEquals(NotificationInterface::STATUS_COMPLETED, $request->getTransactionStatus());
self::assertEquals([
Expand Down Expand Up @@ -95,6 +96,7 @@ public function testATMAcceptNotificationRequest(): void
$request->initialize($this->initialize);

self::assertEquals('成功', $request->getMessage());
self::assertEquals('OK', $request->getReply());
self::assertEquals('20151202001', $request->getTransactionId());
self::assertEquals(NotificationInterface::STATUS_COMPLETED, $request->getTransactionStatus());
self::assertEquals([
Expand Down Expand Up @@ -130,6 +132,7 @@ public function testCVSAcceptNotificationRequest(): void
$request->initialize($this->initialize);

self::assertEquals('成功', $request->getMessage());
self::assertEquals('OK', $request->getReply());
self::assertEquals('20151202001', $request->getTransactionId());
self::assertEquals(NotificationInterface::STATUS_COMPLETED, $request->getTransactionStatus());
self::assertEquals([
Expand Down Expand Up @@ -164,6 +167,7 @@ public function testFunPointAcceptNotificationRequest(): void
$request->initialize($this->initialize);

self::assertEquals('成功', $request->getMessage());
self::assertEquals('OK', $request->getReply());
self::assertEquals('20151202001', $request->getTransactionId());
self::assertEquals(NotificationInterface::STATUS_COMPLETED, $request->getTransactionStatus());
self::assertEquals([
Expand Down

0 comments on commit 75cfa25

Please sign in to comment.