@@ -25,10 +25,10 @@ public function setUp(): void
2525 'returnUrl ' => 'https://www.example.com/return ' ,
2626 'transactionId ' => '123abc ' ,
2727 'testMode ' => true ,
28- 'card ' => [
29- 30- 'name ' => "ABCDE FGHIJK " ,
31- 'phone ' => "123 456 7890 " ,
28+ 'card ' => [
29+ 30+ 'name ' => "ABCDE FGHIJK " ,
31+ 'phone ' => "123 456 7890 " ,
3232 'shippingAddress1 ' => "Ship 1 Test " ,
3333 'shippingAddress2 ' => "Ship 2 Test " ,
3434 'shippingCity ' => "Ship 4 City " ,
@@ -44,4 +44,45 @@ public function setUp(): void
4444 ],
4545 ];
4646 }
47+
48+ public function testPurchaseSuccess ()
49+ {
50+ $ this ->setMockHttpResponse ('PurchaseSuccess.txt ' );
51+
52+ $ options = $ this ->options + ['type ' => 'purchase ' ];
53+ $ request = $ this ->gateway ->purchase ($ options );
54+
55+ $ data = $ request ->getData ();
56+ $ this ->
assertSame (
'[email protected] ' ,
$ data[
'customer ' ][
'email ' ]);
57+ $ this ->assertSame ('ABCDE FGHIJK ' , $ data ['customer ' ]['billing ' ]['name ' ]);
58+ $ this ->assertSame ('Bill 1 Test ' , $ data ['customer ' ]['billing ' ]['address1 ' ]);
59+ $ this ->assertSame ('Bill 2 Test ' , $ data ['customer ' ]['billing ' ]['address2 ' ]);
60+ $ this ->assertSame ('Bill 4 City ' , $ data ['customer ' ]['billing ' ]['city ' ]);
61+ $ this ->assertSame ('Bill 7 Country ' , $ data ['customer ' ]['billing ' ]['countryCode ' ]);
62+ $ this ->assertSame ('Bill 5 Postcode ' , $ data ['customer ' ]['billing ' ]['postalCode ' ]);
63+ $ this ->assertSame ('123 456 7890 ' , $ data ['customer ' ]['billing ' ]['phoneNumber ' ]);
64+ $ this ->assertSame ('Bill 6 State ' , $ data ['customer ' ]['billing ' ]['state ' ]);
65+ $ this ->assertSame ('ABCDE FGHIJK ' , $ data ['customer ' ]['shipping ' ]['name ' ]);
66+ $ this ->assertSame ('Ship 1 Test ' , $ data ['customer ' ]['shipping ' ]['address1 ' ]);
67+ $ this ->assertSame ('Ship 2 Test ' , $ data ['customer ' ]['shipping ' ]['address2 ' ]);
68+ $ this ->assertSame ('Ship 4 City ' , $ data ['customer ' ]['shipping ' ]['city ' ]);
69+ $ this ->assertSame ('Ship 7 Country ' , $ data ['customer ' ]['shipping ' ]['countryCode ' ]);
70+ $ this ->assertSame ('Ship 5 Postcode ' , $ data ['customer ' ]['shipping ' ]['postalCode ' ]);
71+ $ this ->assertSame ('123 456 7890 ' , $ data ['customer ' ]['shipping ' ]['phoneNumber ' ]);
72+ $ this ->assertSame ('Ship 6 State ' , $ data ['customer ' ]['shipping ' ]['state ' ]);
73+
74+ $ response = $ request ->send ();
75+
76+ $ this ->assertFalse ($ response ->isSuccessful ());
77+ $ this ->assertTrue ($ response ->isRedirect ());
78+ $ this ->assertNull ($ response ->getTransactionReference ());
79+ $ this ->assertNull ($ response ->getMessage ());
80+ $ this ->assertSame ('GET ' , $ response ->getRedirectMethod ());
81+ $ this ->assertSame (
82+ 'https://uat.windcave.com/pxmi3/EF4054F622D6C4C1B5D0F260ED2B2C143C1EDCADD7A86374ED601212E11C409319CD439CC8082194B ' ,
83+ $ response ->getRedirectUrl ()
84+ );
85+ $ this ->assertSame ([], $ response ->getRedirectData ());
86+ }
87+
4788}
0 commit comments