Skip to content

Commit

Permalink
finish
Browse files Browse the repository at this point in the history
  • Loading branch information
bladeroot committed Apr 28, 2017
1 parent 7c2cf19 commit 261e5ee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
23 changes: 17 additions & 6 deletions src/Message/CompletePurchaseResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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'];
}
}
2 changes: 0 additions & 2 deletions tests/unit/Message/CompletePurchaseResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

0 comments on commit 261e5ee

Please sign in to comment.