File tree Expand file tree Collapse file tree 5 files changed +67
-3
lines changed
tests/Omnipay/AuthorizeNet Expand file tree Collapse file tree 5 files changed +67
-3
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,16 @@ public function setCustomerId($value)
59
59
return $ this ->setParameter ('customerId ' , $ value );
60
60
}
61
61
62
+ public function getHashSecret ()
63
+ {
64
+ return $ this ->getParameter ('hashSecret ' );
65
+ }
66
+
67
+ public function setHashSecret ($ value )
68
+ {
69
+ return $ this ->setParameter ('hashSecret ' , $ value );
70
+ }
71
+
62
72
protected function getBaseData ()
63
73
{
64
74
$ data = array ();
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public function getData()
29
29
30
30
public function getHash ()
31
31
{
32
- return md5 ($ this ->getApiLoginId ().$ this ->getTransactionId ().$ this ->getAmount ());
32
+ return md5 ($ this ->getHashSecret (). $ this -> getApiLoginId ().$ this ->getTransactionId ().$ this ->getAmount ());
33
33
}
34
34
35
35
public function send ()
Original file line number Diff line number Diff line change @@ -24,6 +24,25 @@ public function getName()
24
24
return 'Authorize.Net SIM ' ;
25
25
}
26
26
27
+ public function getDefaultParameters ()
28
+ {
29
+ $ parameters = parent ::getDefaultParameters ();
30
+ $ parameters ['hashSecret ' ] = '' ;
31
+
32
+ return $ parameters ;
33
+ }
34
+
35
+ public function getHashSecret ()
36
+ {
37
+ return $ this ->getParameter ('hashSecret ' );
38
+ }
39
+
40
+ public function setHashSecret ($ value )
41
+ {
42
+ return $ this ->setParameter ('hashSecret ' , $ value );
43
+ }
44
+
45
+
27
46
public function authorize (array $ parameters = array ())
28
47
{
29
48
return $ this ->createRequest ('\Omnipay\AuthorizeNet\Message\SIMAuthorizeRequest ' , $ parameters );
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Omnipay package.
5
+ *
6
+ * (c) Adrian Macneil <[email protected] >
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Omnipay \AuthorizeNet \Message ;
13
+
14
+ use Omnipay \TestCase ;
15
+
16
+ class SIMCompleteAuthorizeRequestTest extends TestCase
17
+ {
18
+ public function setUp ()
19
+ {
20
+ $ this ->request = new SIMCompleteAuthorizeRequest ($ this ->getHttpClient (), $ this ->getHttpRequest ());
21
+ }
22
+
23
+ public function testGetHash ()
24
+ {
25
+ $ this ->assertSame (md5 ('' ), $ this ->request ->getHash ());
26
+
27
+ $ this ->request ->setHashSecret ('hashsec ' );
28
+ $ this ->request ->setApiLoginId ('apilogin ' );
29
+ $ this ->request ->setTransactionId ('trnid ' );
30
+ $ this ->request ->setAmount ('10.00 ' );
31
+
32
+ $ this ->assertSame (md5 ('hashsecapilogintrnid10.00 ' ), $ this ->request ->getHash ());
33
+ }
34
+ }
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ public function setUp()
21
21
22
22
$ this ->gateway = new SIMGateway ($ this ->getHttpClient (), $ this ->getHttpRequest ());
23
23
$ this ->gateway ->setApiLoginId ('example ' );
24
+ $ this ->gateway ->setHashSecret ('elpmaxe ' );
24
25
25
26
$ this ->options = array (
26
27
'amount ' => '10.00 ' ,
@@ -47,7 +48,7 @@ public function testCompleteAuthorize()
47
48
array (
48
49
'x_response_code ' => '1 ' ,
49
50
'x_trans_id ' => '12345 ' ,
50
- 'x_MD5_Hash ' => md5 ('example9910 .00 ' ),
51
+ 'x_MD5_Hash ' => md5 ('elpmaxeexample9910 .00 ' ),
51
52
)
52
53
);
53
54
@@ -76,7 +77,7 @@ public function testCompletePurchase()
76
77
array (
77
78
'x_response_code ' => '1 ' ,
78
79
'x_trans_id ' => '12345 ' ,
79
- 'x_MD5_Hash ' => md5 ('example9910 .00 ' ),
80
+ 'x_MD5_Hash ' => md5 ('elpmaxeexample9910 .00 ' ),
80
81
)
81
82
);
82
83
You can’t perform that action at this time.
0 commit comments