Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update app switch failure analytics
Browse files Browse the repository at this point in the history
sarahkoop committed Dec 11, 2023
1 parent ef8b821 commit 8de3d07
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -93,7 +93,8 @@ public void createPaymentAuthRequest(@NonNull final FragmentActivity activity,
return;
}
if (!deviceInspector.isVenmoAppSwitchAvailable(activity)) {
callbackPaymentAuthAppSwitchFailure(callback,
braintreeClient.sendAnalyticsEvent(VenmoAnalytics.APP_SWITCH_FAILED);
callbackPaymentAuthFailure(callback,
new VenmoPaymentAuthRequest.Failure(new AppSwitchNotAvailableException("Venmo is not installed")));
return;
}
@@ -254,11 +255,6 @@ public void isReadyToPay(final Context context, final VenmoIsReadyToPayCallback
});
}

private void callbackPaymentAuthAppSwitchFailure(VenmoPaymentAuthRequestCallback callback, VenmoPaymentAuthRequest request) {
braintreeClient.sendAnalyticsEvent(VenmoAnalytics.APP_SWITCH_FAILED);
callback.onVenmoPaymentAuthRequest(request);
}

private void callbackPaymentAuthFailure(VenmoPaymentAuthRequestCallback callback, VenmoPaymentAuthRequest request) {
braintreeClient.sendAnalyticsEvent(VenmoAnalytics.TOKENIZE_FAILED);
callback.onVenmoPaymentAuthRequest(request);
Original file line number Diff line number Diff line change
@@ -216,13 +216,14 @@ public void createPaymentAuthRequest_whenVenmoNotInstalled_forwardsExceptionToLi

verify(deviceInspector).isVenmoAppSwitchAvailable(same(activity));

verify(braintreeClient).sendAnalyticsEvent(VenmoAnalytics.APP_SWITCH_FAILED);
ArgumentCaptor<VenmoPaymentAuthRequest> captor =
ArgumentCaptor.forClass(VenmoPaymentAuthRequest.class);
verify(venmoPaymentAuthRequestCallback).onVenmoPaymentAuthRequest(captor.capture());
VenmoPaymentAuthRequest paymentAuthRequest = captor.getValue();
assertTrue(paymentAuthRequest instanceof VenmoPaymentAuthRequest.Failure);
assertEquals("Venmo is not installed", ((VenmoPaymentAuthRequest.Failure) paymentAuthRequest).getError().getMessage());
verify(braintreeClient).sendAnalyticsEvent(VenmoAnalytics.APP_SWITCH_FAILED);
verify(braintreeClient).sendAnalyticsEvent(VenmoAnalytics.TOKENIZE_FAILED);
}

@Test

0 comments on commit 8de3d07

Please sign in to comment.