@Override public void success(PaymentMethodNonce paymentMethodNonce) { DataCollector.collectRiskData(fragment, paymentMethodNonce); fragment.postCallback(paymentMethodNonce); fragment.sendAnalyticsEvent("card.nonce-received"); }
@Override public void failure(Exception exception) { fragment.sendAnalyticsEvent(paymentTypeForAnalytics() + ".local-payment.tokenize.failed"); fragment.postCallback(exception); } });
protected void postAmericanExpressCallback(final AmericanExpressRewardsBalance rewardsBalance) { postOrQueueCallback(new QueuedCallback() { @Override public boolean shouldRun() { return mAmericanExpressListener != null; } @Override public void run() { mAmericanExpressListener.onRewardsBalanceFetched(rewardsBalance); } }); }
@Test public void performAppSwitch_sendsAnalyticsEvent() { Configuration configuration = getConfigurationFromFixture(); BraintreeFragment fragment = new MockFragmentBuilder() .configuration(configuration) .build(); Venmo.authorizeAccount(fragment); verify(fragment).sendAnalyticsEvent("pay-with-venmo.selected"); }
/** * Starts the Billing Agreement flow for PayPal. This will launch the PayPal app if installed or * fall back to a browser switch. * * @param fragment A {@link BraintreeFragment} used to process the request. * @param request A {@link PayPalRequest} used to customize the request. */ public static void requestBillingAgreement(BraintreeFragment fragment, PayPalRequest request) { requestBillingAgreement(fragment, request, null); }
@Override public void onResponse(LocalPaymentRequest localPaymentRequest) { LocalPayment.approvePayment(mBraintreeFragment, localPaymentRequest); } });
@Override public void failure(Exception exception) { fragment.postCallback(exception); } });
@Override public void onCancel() { fragment.postCancelCallback(BraintreeRequestCodes.PAYPAL); } };
/** * Retrieves the current list of {@link PaymentMethodNonce}s for the current customer. * <p/> * When finished, the {@link java.util.List} of {@link PaymentMethodNonce}s will be sent to {@link * PaymentMethodNoncesUpdatedListener#onPaymentMethodNoncesUpdated(List)}. * * @param fragment {@link BraintreeFragment} */ public static void getPaymentMethodNonces(BraintreeFragment fragment) { getPaymentMethodNonces(fragment, false); }
@Override public void failure(Exception exception) { listener.onFailure(exception); } });
@Override public void failure(Exception exception) { fragment.postCallback(exception); fragment.sendAnalyticsEvent("pay-with-venmo.vault.failed"); } });
protected void postConfigurationCallback() { postOrQueueCallback(new QueuedCallback() { @Override public boolean shouldRun() { return mConfigurationListener != null; } @Override public void run() { mConfigurationListener.onConfigurationFetched(getConfiguration()); } }); }
@Override public void onResponse(LocalPaymentRequest localPaymentRequest) { LocalPayment.approvePayment(mBraintreeFragment, localPaymentRequest); } });
@Override public void onFailure(Exception error) { fragment.postCallback(error); } });
protected void postCancelCallback(final int requestCode) { postOrQueueCallback(new QueuedCallback() { @Override public boolean shouldRun() { return mCancelListener != null; } @Override public void run() { mCancelListener.onCancel(requestCode); } }); }
@Override public void onResponse(LocalPaymentRequest localPaymentRequest) { LocalPayment.approvePayment(mBraintreeFragment, localPaymentRequest); } });
protected void postCallback(final UnionPayCapabilities capabilities) { postOrQueueCallback(new QueuedCallback() { @Override public boolean shouldRun() { return mUnionPayListener != null; } @Override public void run() { mUnionPayListener.onCapabilitiesFetched(capabilities); } }); }
@Override public void onResponse(LocalPaymentRequest localPaymentRequest) { LocalPayment.approvePayment(mBraintreeFragment, localPaymentRequest); } });
protected void postUnionPayCallback(final String enrollmentId, final boolean smsCodeRequired) { postOrQueueCallback(new QueuedCallback() { @Override public boolean shouldRun() { return mUnionPayListener != null; } @Override public void run() { mUnionPayListener.onSmsCodeSent(enrollmentId, smsCodeRequired); } }); }
protected void postCallback(final BraintreePaymentResult result) { postOrQueueCallback(new QueuedCallback() { @Override public boolean shouldRun() { return mBraintreePaymentResultListener != null; } @Override public void run() { mBraintreePaymentResultListener.onBraintreePaymentResult(result); } }); }