@@ -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 ();
0 commit comments