File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,11 @@ public function getCardReference()
5959 if (isset ($ this ->data ['Customer ' ]['TokenCustomerID ' ])) {
6060 return $ this ->data ['Customer ' ]['TokenCustomerID ' ];
6161 }
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+ }
6267
6368 return null ;
6469 }
Original file line number Diff line number Diff line change 1414 */
1515class RapidSharedCreateCardRequest extends RapidSharedPurchaseRequest
1616{
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+
1735 public function getData ()
1836 {
1937 $ this ->validate ('returnUrl ' );
2038
2139 $ data = $ this ->getBaseData ();
22- $ data [ ' Method ' ] = ' CreateTokenCustomer ' ;
40+
2341 $ data ['TransactionType ' ] = 'Purchase ' ;
2442 $ data ['RedirectUrl ' ] = $ this ->getReturnUrl ();
2543
@@ -32,7 +50,18 @@ public function getData()
3250 $ data ['CustomView ' ] = $ this ->getCustomView ();
3351
3452 $ 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+ }
3665
3766 return $ data ;
3867 }
You can’t perform that action at this time.
0 commit comments