use of com.braintreepayments.api.models.PaymentMethodNonce in project braintree_android by braintree.
the class ThreeDSecureVerificationTest method performVerification_doesALookupAndReturnsACardWhenThereIsAMPILookupError.
@Test(timeout = 10000)
public void performVerification_doesALookupAndReturnsACardWhenThereIsAMPILookupError() throws InterruptedException {
BraintreeFragment fragment = getFragment();
fragment.addListener(new PaymentMethodNonceCreatedListener() {
@Override
public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
assertIsANonce(paymentMethodNonce.getNonce());
CardNonce cardNonce = (CardNonce) paymentMethodNonce;
assertEquals("85", cardNonce.getLastTwo());
assertFalse(cardNonce.getThreeDSecureInfo().isLiabilityShifted());
assertFalse(cardNonce.getThreeDSecureInfo().isLiabilityShiftPossible());
assertTrue(((CardNonce) paymentMethodNonce).getThreeDSecureInfo().wasVerified());
mCountDownLatch.countDown();
}
});
CardBuilder cardBuilder = new CardBuilder().cardNumber(THREE_D_SECURE_MPI_LOOKUP_ERROR).expirationDate("12/20");
ThreeDSecure.performVerification(fragment, cardBuilder, TEST_AMOUNT);
mCountDownLatch.await();
}
use of com.braintreepayments.api.models.PaymentMethodNonce 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.models.PaymentMethodNonce 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