Skip to content

Commit 221f8df

Browse files
committed
Dev snapshot while working on tests (time for bed)
1 parent 35a3d58 commit 221f8df

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

tests/DPMGatewayTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ public function testAuthorize()
3535
$this->assertSame('https://www.example.com/return', $redirectData['x_relay_url']);
3636
}
3737

38+
/**
39+
* The MD4 Hash consists of the shared secret, the login ID, the transaction *reference* (as
40+
* generated on the remote gateway for the transaction) and the amount.
41+
*/
3842
public function testCompleteAuthorize()
3943
{
4044
$this->getHttpRequest()->request->replace(
@@ -53,6 +57,30 @@ public function testCompleteAuthorize()
5357
$this->assertNull($response->getMessage());
5458
}
5559

60+
/**
61+
* @expectedException Omnipay\Common\Exception\InvalidRequestException
62+
* @expectedExceptionMessage Incorrect amount
63+
*
64+
* The hash is correct, so the sender knows the shared secret, but the amount
65+
* is not what we expected, i.e. what we had requested to be authorized.
66+
*/
67+
public function testCompleteAuthorizeWrongAmount()
68+
{
69+
$this->getHttpRequest()->request->replace(
70+
array(
71+
'x_response_code' => '1',
72+
'x_trans_id' => '12345',
73+
'x_amount' => '20.00',
74+
'x_MD5_Hash' => md5('elpmaxe' . 'example' . '12345' . '20.00'),
75+
)
76+
);
77+
78+
$response = $this->gateway->completeAuthorize($this->options)->send();
79+
//$this->assertTrue($response->isSuccessful());
80+
//$this->assertSame('12345', $response->getTransactionReference());
81+
//$this->assertNull($response->getMessage());
82+
}
83+
5684
public function testPurchase()
5785
{
5886
$response = $this->gateway->purchase($this->options)->send();

tests/Message/SIMAuthorizeRequestTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function testSend()
5757

5858
$this->assertFalse($response->isSuccessful());
5959
$this->assertTrue($response->isRedirect());
60-
$this->assertNotEmpty($response->getRedirectUrl());
60+
$this->assertNotEmpty($response->getRedirectUrl()); // This test is failing; not sure why.
6161
$this->assertSame('POST', $response->getRedirectMethod());
6262

6363
$redirectData = $response->getRedirectData();

0 commit comments

Comments
 (0)