File tree 2 files changed +26
-2
lines changed
2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,12 @@ public function getData()
37
37
// special validation
38
38
if ($ this ->getPaymentMethodToken ()) {
39
39
$ data ['paymentMethodToken ' ] = $ this ->getPaymentMethodToken ();
40
- } elseif ($ this ->getToken ()) {
40
+ } elseif ($ this ->getToken ()) {
41
41
$ data ['paymentMethodNonce ' ] = $ this ->getToken ();
42
+ } elseif ($ this ->getCustomerId ()) {
43
+ $ data ['customerId ' ] = $ this ->getCustomerId ();
42
44
} else {
43
- throw new InvalidRequestException ("The token (payment nonce) or paymentMethodToken field should be set. " );
45
+ throw new InvalidRequestException ("The token (payment nonce), paymentMethodToken or customerId field should be set. " );
44
46
}
45
47
46
48
// Remove null values
Original file line number Diff line number Diff line change @@ -93,6 +93,28 @@ public function testPaymentMethodNonce()
93
93
$ this ->assertArrayNotHasKey ('paymentMethodToken ' , $ data );
94
94
}
95
95
96
+ public function testCustomerId ()
97
+ {
98
+ $ this ->request ->initialize (
99
+ array (
100
+ 'amount ' => '10.00 ' ,
101
+ 'transactionId ' => '684 ' ,
102
+ 'testMode ' => false ,
103
+ 'taxExempt ' => false ,
104
+ 'card ' => array (
105
+ 'firstName ' => 'Kayla ' ,
106
+ 'shippingCompany ' => 'League ' ,
107
+ ),
108
+ 'customerId ' => 'abc123 '
109
+ )
110
+ );
111
+
112
+ $ data = $ this ->request ->getData ();
113
+ $ this ->assertSame ('abc123 ' , $ data ['customerId ' ]);
114
+ $ this ->assertArrayNotHasKey ('paymentMethodToken ' , $ data );
115
+ $ this ->assertArrayNotHasKey ('paymentMethodNonce ' , $ data );
116
+ }
117
+
96
118
public function testSubMerchantSale ()
97
119
{
98
120
$ this ->request ->initialize (
You can’t perform that action at this time.
0 commit comments