File tree 2 files changed +36
-2
lines changed
2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,11 @@ public function getCardReference()
59
59
if (isset ($ this ->data ['Customer ' ]['TokenCustomerID ' ])) {
60
60
return $ this ->data ['Customer ' ]['TokenCustomerID ' ];
61
61
}
62
+ if (isset ($ this ->data ['TokenCustomerID ' ])) {
63
+ // This format appears when creating a card and making a concurrent
64
+ // payment using Shared or Transparent redirect methods.
65
+ return $ this ->data ['TokenCustomerID ' ];
66
+ }
62
67
63
68
return null ;
64
69
}
Original file line number Diff line number Diff line change 14
14
*/
15
15
class RapidSharedCreateCardRequest extends RapidSharedPurchaseRequest
16
16
{
17
+ protected $ action ;
18
+
19
+ /**
20
+ * @return string|NULL
21
+ */
22
+ public function getAction ()
23
+ {
24
+ return $ this ->action ;
25
+ }
26
+
27
+ /**
28
+ * @param string $action
29
+ */
30
+ public function setAction ($ action )
31
+ {
32
+ $ this ->action = $ action ;
33
+ }
34
+
17
35
public function getData ()
18
36
{
19
37
$ this ->validate ('returnUrl ' );
20
38
21
39
$ data = $ this ->getBaseData ();
22
- $ data [ ' Method ' ] = ' CreateTokenCustomer ' ;
40
+
23
41
$ data ['TransactionType ' ] = 'Purchase ' ;
24
42
$ data ['RedirectUrl ' ] = $ this ->getReturnUrl ();
25
43
@@ -32,7 +50,18 @@ public function getData()
32
50
$ data ['CustomView ' ] = $ this ->getCustomView ();
33
51
34
52
$ data ['Payment ' ] = array ();
35
- $ data ['Payment ' ]['TotalAmount ' ] = 0 ;
53
+
54
+ if ($ this ->getAction () === 'Purchase ' ) {
55
+ $ data ['Payment ' ]['TotalAmount ' ] = (int ) $ this ->getAmountInteger ();
56
+ $ data ['Payment ' ]['InvoiceNumber ' ] = $ this ->getTransactionId ();
57
+ $ data ['Payment ' ]['InvoiceDescription ' ] = $ this ->getDescription ();
58
+ $ data ['Payment ' ]['CurrencyCode ' ] = $ this ->getCurrency ();
59
+ $ data ['Payment ' ]['InvoiceReference ' ] = $ this ->getInvoiceReference ();
60
+ $ data ['Method ' ] = 'TokenPayment ' ;
61
+ } else {
62
+ $ data ['Method ' ] = 'CreateTokenCustomer ' ;
63
+ $ data ['Payment ' ]['TotalAmount ' ] = 0 ;
64
+ }
36
65
37
66
return $ data ;
38
67
}
You can’t perform that action at this time.
0 commit comments