@@ -21,30 +21,27 @@ public function setUp()
21
21
$ this ->request = new TwoPartyPurchaseRequest ($ this ->getHttpClient (), $ this ->getHttpRequest ());
22
22
}
23
23
24
- public function testSignature ()
24
+ public function testCalculateHash ()
25
25
{
26
- $ this ->request ->initialize (
27
- array (
28
- 'amount ' => 1200 ,
29
- 'transactionId ' => 123 ,
30
- 'card ' => new CreditCard (
31
- array (
32
- 'number ' => '4111111111111111 ' ,
33
- 'expiryMonth ' => '05 ' ,
34
- 'expiryYear ' => '2013 ' ,
35
- 'cvv ' => '123 ' ,
36
- )
37
- ),
38
- 'merchantId ' => '123 ' ,
39
- 'merchantAccessCode ' => '123 ' ,
40
- 'secureHash ' => '123 ' ,
41
- 'returnUrl ' => 'https://www.example.com/return '
42
- )
26
+ $ data = array (
27
+ 'vpc_Merchant ' => '123 ' ,
28
+ 'vpc_AccessCode ' => '123 ' ,
29
+ 'vpc_Version ' => '1 ' ,
30
+ 'vpc_Locale ' => 'en ' ,
31
+ 'vpc_Command ' => 'pay ' ,
32
+ 'vpc_Amount ' => '1200 ' ,
33
+ 'vpc_MerchTxnRef ' => '123 ' ,
34
+ 'vpc_OrderInfo ' => '' ,
35
+ 'vpc_ReturnURL ' => 'https://www.example.com/return ' ,
36
+ 'vpc_CardNum ' => '4111111111111111 ' ,
37
+ 'vpc_CardExp ' => '1305 ' ,
38
+ 'vpc_CardSecurityCode ' => '123 ' ,
43
39
);
44
40
45
- $ data = $ this ->request ->getData ();
41
+ $ this ->request ->setSecureHash ('123 ' );
42
+ $ hash = $ this ->request ->calculateHash ($ data );
46
43
47
- $ this ->assertSame ('2624B4BABED7CCA98665238D75560600 ' , $ data [ ' vpc_SecureHash ' ] );
44
+ $ this ->assertSame ('2624B4BABED7CCA98665238D75560600 ' , $ hash );
48
45
}
49
46
50
47
public function testPurchase ()
@@ -55,14 +52,7 @@ public function testPurchase()
55
52
array (
56
53
'amount ' => 1200 ,
57
54
'transactionId ' => 123 ,
58
- 'card ' => new CreditCard (
59
- array (
60
- 'number ' => '4111111111111111 ' ,
61
- 'expiryMonth ' => '05 ' ,
62
- 'expiryYear ' => '2013 ' ,
63
- 'cvv ' => '123 ' ,
64
- )
65
- ),
55
+ 'card ' => $ this ->getValidCard (),
66
56
'merchantId ' => '123 ' ,
67
57
'merchantAccessCode ' => '123 ' ,
68
58
'secureHash ' => '123 ' ,
0 commit comments