@@ -127,4 +127,50 @@ public function testSetLocale()
127127 $ this ->request ->setLocale ('en-nz ' );
128128 $ this ->assertSame ('en-nz ' , $ this ->request ->getLocale ());
129129 }
130+
131+ public function testInvalidCanadianAddress ()
132+ {
133+ $ this ->request ->setCard (array (
134+ 'firstName ' => 'Test ' ,
135+ 'lastName ' => 'Customer ' ,
136+ 'billingAddress1 ' => '1 Some St ' ,
137+ 'billingAddress2 ' => 'Suburbia ' ,
138+ 'billingCity ' => 'Toronto ' ,
139+ 'billingPostcode ' => '123 456 ' ,
140+ 'billingState ' => 'XYZ ' ,
141+ 'billingCountry ' => 'CA ' ,
142+ 'billingPhone ' => '123456789 ' ,
143+ 144+ ));
145+ $ data = $ this ->request ->getData ();
146+ $ this ->assertSame ('1 Some St ' , $ data ['bill_to_address_line1 ' ]);
147+ $ this ->assertSame ('Suburbia ' , $ data ['bill_to_address_line2 ' ]);
148+ $ this ->assertSame ('Toronto ' , $ data ['bill_to_address_city ' ]);
149+ $ this ->assertSame ('XY ' , $ data ['bill_to_address_state ' ]);
150+ $ this ->assertFalse (array_key_exists ('bill_to_address_postal_code ' , $ data ));
151+ $ this ->assertSame ('CA ' , $ data ['bill_to_address_country ' ]);
152+ }
153+
154+ public function testInvalidAmericanAddress ()
155+ {
156+ $ this ->request ->setCard (array (
157+ 'firstName ' => 'Test ' ,
158+ 'lastName ' => 'Customer ' ,
159+ 'billingAddress1 ' => '1 Some St ' ,
160+ 'billingAddress2 ' => 'Suburbia ' ,
161+ 'billingCity ' => 'New York ' ,
162+ 'billingPostcode ' => '123 456 ' ,
163+ 'billingState ' => 'XYZ ' ,
164+ 'billingCountry ' => 'US ' ,
165+ 'billingPhone ' => '123456789 ' ,
166+ 167+ ));
168+ $ data = $ this ->request ->getData ();
169+ $ this ->assertSame ('1 Some St ' , $ data ['bill_to_address_line1 ' ]);
170+ $ this ->assertSame ('Suburbia ' , $ data ['bill_to_address_line2 ' ]);
171+ $ this ->assertSame ('New York ' , $ data ['bill_to_address_city ' ]);
172+ $ this ->assertSame ('XY ' , $ data ['bill_to_address_state ' ]);
173+ $ this ->assertFalse (array_key_exists ('bill_to_address_postal_code ' , $ data ));
174+ $ this ->assertSame ('US ' , $ data ['bill_to_address_country ' ]);
175+ }
130176}
0 commit comments