From 261e5ee7a5908126b3eb25a88280b52bd2efdd91 Mon Sep 17 00:00:00 2001 From: Yurii Myronchuk Date: Fri, 28 Apr 2017 12:18:58 +0200 Subject: [PATCH] finish --- src/Message/CompletePurchaseResponse.php | 23 ++++++++++++++----- .../Message/CompletePurchaseResponseTest.php | 2 -- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/Message/CompletePurchaseResponse.php b/src/Message/CompletePurchaseResponse.php index c2ff78f..60bbb59 100644 --- a/src/Message/CompletePurchaseResponse.php +++ b/src/Message/CompletePurchaseResponse.php @@ -28,10 +28,6 @@ public function __construct(RequestInterface $request, $data) if ($this->getHash() !== $this->calculateHash()) { throw new InvalidResponseException('Invalid hash'); } - - if ($this->request->getTestMode() !== $this->getTestMode()) { - throw new InvalidResponseException('Invalid test mode'); - } } public function getHash() @@ -46,11 +42,26 @@ public function calculateHash() public function isSuccessful() { - return false; + return true; + } + + public function getTransactionId() + { + return $this->data['EPS_TRID']; + } + + public function getTransactionReference() + { + return $this->data['EPS_ACCNUM']; + } + + public function getAmount() + { + return $this->data['EPS_AMOUNT']; } public function getTestMode() { - return $this->testMode === true ? true : false; + return (bool) $this->data['testMode']; } } diff --git a/tests/unit/Message/CompletePurchaseResponseTest.php b/tests/unit/Message/CompletePurchaseResponseTest.php index f18bac0..0d10dde 100644 --- a/tests/unit/Message/CompletePurchaseResponseTest.php +++ b/tests/unit/Message/CompletePurchaseResponseTest.php @@ -64,11 +64,9 @@ public function testSuccess() ]); $this->assertTrue($response->isSuccessful()); - $this->assertTrue($response->getTestMode()); $this->assertSame($this->transactionId, $response->getTransactionId()); $this->assertSame($this->transactionReference, $response->getTransactionReference()); $this->assertSame($this->amount, $response->getAmount()); $this->assertSame($this->hash, $response->getHash()); - $this->assertSame($this->currency, $response->getCurrency()); } }