@@ -69,7 +69,38 @@ public function testGetData()
69
69
$ this ->assertSame ('4111111111111111 ' , $ data ['Customer ' ]['CardDetails ' ]['Number ' ]);
70
70
$ this ->assertSame ('12 ' , $ data ['Customer ' ]['CardDetails ' ]['ExpiryMonth ' ]);
71
71
}
72
-
72
+
73
+ /**
74
+ * Test that expiry is optional and not mis-set if token is present.
75
+ */
76
+ public function testGetDataNoExpiryTokenPresent ()
77
+ {
78
+ $ this ->request ->initialize (array (
79
+ 'apiKey ' => 'my api key ' ,
80
+ 'password ' => 'secret ' ,
81
+ 'transactionId ' => '999 ' ,
82
+ 'description ' => 'new car ' ,
83
+ 'currency ' => 'AUD ' ,
84
+ 'invoiceReference ' => 'INV-123 ' ,
85
+ 'card ' => array (
86
+ 'title ' => 'Mr. ' ,
87
+ 'firstName ' => 'John ' ,
88
+ 'lastName ' => 'Smith ' ,
89
+ 'shippingFirstName ' => 'Bob ' ,
90
+ 'shippingLastName ' => 'Mann ' ,
91
+ 'shippingAddress1 ' => 'Level 1 ' ,
92
+ 'shippingAddress2 ' => '123 Test Lane ' ,
93
+ 'shippingState ' => 'NSW ' ,
94
+ 'shippingCountry ' => 'AU ' ,
95
+ 'cardReference ' => 'myRef ' ,
96
+ ),
97
+ ));
98
+
99
+ $ data = $ this ->request ->getData ();
100
+ $ this ->assertTrue (!isset ($ data ['Customer ' ]['CardDetails ' ]['ExpiryMonth ' ]));
101
+ $ this ->assertTrue (!isset ($ data ['Customer ' ]['CardDetails ' ]['ExpiryYear ' ]));
102
+ }
103
+
73
104
public function testSendSuccess ()
74
105
{
75
106
$ this ->setMockHttpResponse ('RapidDirectCreateCardRequestSuccess.txt ' );
0 commit comments