use of com.braintreepayments.api.interfaces.PaymentMethodNonceCallback in project braintree_android by braintree.
the class PayPal method onSuccess.
private static void onSuccess(final BraintreeFragment fragment, Intent data, Request request, Result result) {
PayPalRequest paypalRequest = getPersistedPayPalRequest(fragment.getApplicationContext());
TokenizationClient.tokenize(fragment, parseResponse(paypalRequest, request, result, data), new PaymentMethodNonceCallback() {
@Override
public void success(PaymentMethodNonce paymentMethodNonce) {
if (paymentMethodNonce instanceof PayPalAccountNonce && ((PayPalAccountNonce) paymentMethodNonce).getCreditFinancing() != null) {
fragment.sendAnalyticsEvent("paypal.credit.accepted");
}
fragment.postCallback(paymentMethodNonce);
}
@Override
public void failure(Exception exception) {
fragment.postCallback(exception);
}
});
}
use of com.braintreepayments.api.interfaces.PaymentMethodNonceCallback in project braintree_android by braintree.
the class Venmo method vault.
private static void vault(final BraintreeFragment fragment, String nonce) {
VenmoAccountBuilder vaultBuilder = new VenmoAccountBuilder().nonce(nonce);
TokenizationClient.tokenize(fragment, vaultBuilder, new PaymentMethodNonceCallback() {
@Override
public void success(PaymentMethodNonce paymentMethodNonce) {
fragment.postCallback(paymentMethodNonce);
fragment.sendAnalyticsEvent("pay-with-venmo.vault.success");
}
@Override
public void failure(Exception exception) {
fragment.postCallback(exception);
fragment.sendAnalyticsEvent("pay-with-venmo.vault.failed");
}
});
}
Aggregations