File tree 2 files changed +25
-1
lines changed
2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,12 @@ public function getData()
17
17
18
18
$ data ['x_trans_id ' ] = $ this ->getTransactionReference ();
19
19
$ 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
+
21
26
$ data ['x_amount ' ] = $ this ->getAmount ();
22
27
23
28
return $ data ;
Original file line number Diff line number Diff line change @@ -29,5 +29,24 @@ public function testGetData()
29
29
$ this ->assertSame ('60O2UZ ' , $ data ['x_trans_id ' ]);
30
30
$ this ->assertSame ($ card ['number ' ], $ data ['x_card_num ' ]);
31
31
$ 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 );
32
51
}
33
52
}
You can’t perform that action at this time.
0 commit comments