Search in sources :

Example 1 with VenmoAccountBuilder

use of com.braintreepayments.api.models.VenmoAccountBuilder in project braintree_android by braintree.

the class TokenizationClientUnitTest method tokenize_tokenizesNonCardPaymentMethodsWithRestWhenGraphQLIsEnabled.

@Test
public void tokenize_tokenizesNonCardPaymentMethodsWithRestWhenGraphQLIsEnabled() {
    BraintreeFragment fragment = new MockFragmentBuilder().configuration(new TestConfigurationBuilder().graphQL().build()).build();
    TokenizationClient.tokenize(fragment, new PayPalAccountBuilder(), null);
    TokenizationClient.tokenize(fragment, new UnionPayCardBuilder(), null);
    TokenizationClient.tokenize(fragment, new VenmoAccountBuilder(), null);
    verifyZeroInteractions(fragment.getGraphQLHttpClient());
}
Also used : VenmoAccountBuilder(com.braintreepayments.api.models.VenmoAccountBuilder) PayPalAccountBuilder(com.braintreepayments.api.models.PayPalAccountBuilder) UnionPayCardBuilder(com.braintreepayments.api.models.UnionPayCardBuilder) TestConfigurationBuilder(com.braintreepayments.testutils.TestConfigurationBuilder) Test(org.junit.Test)

Example 2 with VenmoAccountBuilder

use of com.braintreepayments.api.models.VenmoAccountBuilder 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");
        }
    });
}
Also used : VenmoAccountBuilder(com.braintreepayments.api.models.VenmoAccountBuilder) PaymentMethodNonceCallback(com.braintreepayments.api.interfaces.PaymentMethodNonceCallback) PaymentMethodNonce(com.braintreepayments.api.models.PaymentMethodNonce) AppSwitchNotAvailableException(com.braintreepayments.api.exceptions.AppSwitchNotAvailableException) JSONException(org.json.JSONException)

Aggregations

VenmoAccountBuilder (com.braintreepayments.api.models.VenmoAccountBuilder)2 AppSwitchNotAvailableException (com.braintreepayments.api.exceptions.AppSwitchNotAvailableException)1 PaymentMethodNonceCallback (com.braintreepayments.api.interfaces.PaymentMethodNonceCallback)1 PayPalAccountBuilder (com.braintreepayments.api.models.PayPalAccountBuilder)1 PaymentMethodNonce (com.braintreepayments.api.models.PaymentMethodNonce)1 UnionPayCardBuilder (com.braintreepayments.api.models.UnionPayCardBuilder)1 TestConfigurationBuilder (com.braintreepayments.testutils.TestConfigurationBuilder)1 JSONException (org.json.JSONException)1 Test (org.junit.Test)1