File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,12 @@ public function getData()
1717
1818 $ data ['x_trans_id ' ] = $ this ->getTransactionReference ();
1919 $ data ['x_card_num ' ] = $ this ->getCard ()->getNumber ();
20- $ data ['x_exp_date ' ] = $ this ->getCard ()->getExpiryDate ('my ' );
20+
21+ $ expiryMonth = $ this ->getCard ()->getExpiryMonth ();
22+ if (!empty ($ expiryMonth )) {
23+ $ data ['x_exp_date ' ] = $ this ->getCard ()->getExpiryDate ('my ' );
24+ }
25+
2126 $ data ['x_amount ' ] = $ this ->getAmount ();
2227
2328 return $ data ;
Original file line number Diff line number Diff line change @@ -29,5 +29,24 @@ public function testGetData()
2929 $ this ->assertSame ('60O2UZ ' , $ data ['x_trans_id ' ]);
3030 $ this ->assertSame ($ card ['number ' ], $ data ['x_card_num ' ]);
3131 $ this ->assertSame ('12.00 ' , $ data ['x_amount ' ]);
32+
33+ $ this ->assertArrayHasKey ('x_exp_date ' , $ data );
34+ }
35+
36+ public function testRefundWithSimplifiedCard ()
37+ {
38+ $ simplifiedCard = array (
39+ 'firstName ' => 'Example ' ,
40+ 'lastName ' => 'User ' ,
41+ 'number ' => '1111 ' ,
42+ );
43+
44+ $ this ->request ->setCard ($ simplifiedCard );
45+
46+ $ data = $ this ->request ->getData ();
47+
48+ $ this ->assertSame ($ simplifiedCard ['number ' ], $ data ['x_card_num ' ]);
49+
50+ $ this ->assertArrayNotHasKey ('x_exp_date ' , $ data );
3251 }
3352}
You can’t perform that action at this time.
0 commit comments