Skip to content

Commit

Permalink
Pass hasUserLocationConsent from DropInRequest when PayPalRequest is …
Browse files Browse the repository at this point in the history
…null
  • Loading branch information
tdchow committed Apr 17, 2024
1 parent d07b64d commit c90379b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void shouldRequestThreeDSecureVerification(PaymentMethodNonce paymentMethodNonce
void tokenizePayPalRequest(FragmentActivity activity, PayPalFlowStartedCallback callback) {
PayPalRequest paypalRequest = dropInRequest.getPayPalRequest();
if (paypalRequest == null) {
paypalRequest = new PayPalVaultRequest(false);
paypalRequest = new PayPalVaultRequest(dropInRequest.hasUserLocationConsent());
}
payPalClient.tokenizePayPalAccount(activity, paypalRequest, callback);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,26 @@ public void tokenizePayPalAccount_withPayPalVaultRequest_tokenizesPayPalWithVaul
verify(payPalClient).tokenizePayPalAccount(same(activity), same(payPalRequest), same(callback));
}

@Test
public void tokenizePayPalRequest_when_dropInRequest_is_null_hasUserLocationConsent_is_set_from_dropInRequest() {
BraintreeClient braintreeClient = new MockBraintreeClientBuilder().build();
DropInRequest dropInRequest = new DropInRequest(true);
PayPalClient payPalClient = mock(PayPalClient.class);
DropInInternalClientParams params = new DropInInternalClientParams()
.dropInRequest(dropInRequest)
.payPalClient(payPalClient)
.braintreeClient(braintreeClient);

PayPalFlowStartedCallback callback = mock(PayPalFlowStartedCallback.class);
DropInInternalClient sut = new DropInInternalClient(params);

sut.tokenizePayPalRequest(activity, callback);

ArgumentCaptor<PayPalRequest> captor = ArgumentCaptor.forClass(PayPalRequest.class);
verify(payPalClient).tokenizePayPalAccount(same(activity), captor.capture(), same(callback));
assertTrue(captor.getValue().hasUserLocationConsent());
}

@Test
public void tokenizeVenmoAccount_tokenizesVenmo() {
Configuration configuration = mockConfiguration(false, true, false, false, false);
Expand Down

0 comments on commit c90379b

Please sign in to comment.