File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,12 @@ public function getData()
3737 // special validation
3838 if ($ this ->getPaymentMethodToken ()) {
3939 $ data ['paymentMethodToken ' ] = $ this ->getPaymentMethodToken ();
40- } elseif ($ this ->getToken ()) {
40+ } elseif ($ this ->getToken ()) {
4141 $ data ['paymentMethodNonce ' ] = $ this ->getToken ();
42+ } elseif ($ this ->getCustomerId ()) {
43+ $ data ['customerId ' ] = $ this ->getCustomerId ();
4244 } 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. " );
4446 }
4547
4648 // Remove null values
Original file line number Diff line number Diff line change @@ -93,6 +93,28 @@ public function testPaymentMethodNonce()
9393 $ this ->assertArrayNotHasKey ('paymentMethodToken ' , $ data );
9494 }
9595
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+
96118 public function testSubMerchantSale ()
97119 {
98120 $ this ->request ->initialize (
You can’t perform that action at this time.
0 commit comments