Skip to content

Commit

Permalink
Add javadoc for hasUserLocationConsent param and pass param to DataCo…
Browse files Browse the repository at this point in the history
…llector
  • Loading branch information
tdchow committed Apr 17, 2024
1 parent c082161 commit d07b64d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ void collectDeviceData(
boolean hasUserLocationConsent,
DataCollectorCallback callback
) {
// TODO: pass in hasUserLocationConsent
dataCollector.collectDeviceData(activity, callback);
DataCollectorRequest request = new DataCollectorRequest(hasUserLocationConsent);
dataCollector.collectDeviceData(activity, request, callback);
}

void performThreeDSecureVerification(final FragmentActivity activity, PaymentMethodNonce paymentMethodNonce, final DropInResultCallback callback) {
Expand Down Expand Up @@ -148,10 +148,8 @@ void shouldRequestThreeDSecureVerification(PaymentMethodNonce paymentMethodNonce
void tokenizePayPalRequest(FragmentActivity activity, PayPalFlowStartedCallback callback) {
PayPalRequest paypalRequest = dropInRequest.getPayPalRequest();
if (paypalRequest == null) {
paypalRequest = new PayPalVaultRequest();
paypalRequest = new PayPalVaultRequest(false);
}
// TODO: set hasUserLocationConsent on paypalRequest
dropInRequest.hasUserLocationConsent();
payPalClient.tokenizePayPalAccount(activity, paypalRequest, callback);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ public DropInRequest() {
hasUserLocationConsent = false;
}

/**
* @param hasUserLocationConsent informs the SDK if your application has obtained consent from
* the user to collect location data in compliance with
* <a href="https://support.google.com/googleplay/android-developer/answer/10144311#personal-sensitive">Google Play Developer Program policies</a>
* This flag enables PayPal to collect necessary information required for Fraud Detection and Risk Management.
*
* @see <a href="https://support.google.com/googleplay/android-developer/answer/10144311#personal-sensitive">User Data policies for the Google Play Developer Program </a>
* @see <a href="https://support.google.com/googleplay/android-developer/answer/9799150?hl=en#Prominent%20in-app%20disclosure">Examples of prominent in-app disclosures</a>
*/
public DropInRequest(boolean hasUserLocationConsent) {
this.hasUserLocationConsent = hasUserLocationConsent;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ public DataCollector build() {
DataCollector dataCollector = mock(DataCollector.class);

doAnswer((Answer<Void>) invocation -> {
DataCollectorCallback callback = (DataCollectorCallback) invocation.getArguments()[1];
DataCollectorCallback callback = (DataCollectorCallback) invocation.getArguments()[2];
if (collectDeviceDataSuccess != null) {
callback.onResult(collectDeviceDataSuccess, null);
} else if (collectDeviceDataError != null) {
callback.onResult(null, collectDeviceDataError);
}
return null;
// TODO: add hasUserLocationConsent argument
}).when(dataCollector).collectDeviceData(any(Context.class), any(DataCollectorCallback.class));
}).when(dataCollector).collectDeviceData(
any(Context.class),
any(DataCollectorRequest.class),
any(DataCollectorCallback.class)
);

return dataCollector;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ public void collectDeviceData_forwardsInvocationToDataCollector() {
DropInInternalClient sut = new DropInInternalClient(params);
sut.collectDeviceData(activity, true, callback);

// TODO: add hasUserLocationConsent to verify
verify(dataCollector).collectDeviceData(activity, callback);
DataCollectorRequest request = new DataCollectorRequest(true);
verify(dataCollector).collectDeviceData(activity, request, callback);
}

@Test
Expand Down

0 comments on commit d07b64d

Please sign in to comment.