当前位置: 首页>>代码示例>>Java>>正文


Java PaymentMethodNonceCreatedListener类代码示例

本文整理汇总了Java中com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener的典型用法代码示例。如果您正苦于以下问题:Java PaymentMethodNonceCreatedListener类的具体用法?Java PaymentMethodNonceCreatedListener怎么用?Java PaymentMethodNonceCreatedListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PaymentMethodNonceCreatedListener类属于com.braintreepayments.api.interfaces包,在下文中一共展示了PaymentMethodNonceCreatedListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setup

import com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener; //导入依赖的package包/类
@ReactMethod
public void setup(final String token, final Callback successCallback, final Callback errorCallback) {
  try {
    this.mBraintreeFragment = BraintreeFragment.newInstance(getCurrentActivity(), token);
    this.mBraintreeFragment.addListener(new PaymentMethodNonceCreatedListener() {
      @Override
      public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
        nonceCallback(paymentMethodNonce.getNonce());
      }
    });
    this.setToken(token);
    successCallback.invoke(this.getToken());
  } catch (InvalidArgumentException e) {
    errorCallback.invoke(e.getMessage());
  }
}
 
开发者ID:surialabs,项目名称:react-native-braintree-android,代码行数:17,代码来源:Braintree.java

示例2: tokenize

import com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener; //导入依赖的package包/类
public static CardNonce tokenize(BraintreeFragment fragment, CardBuilder cardBuilder) {
    final CountDownLatch latch = new CountDownLatch(1);
    final CardNonce[] cardNonce = new CardNonce[1];
    PaymentMethodNonceCreatedListener listener = new PaymentMethodNonceCreatedListener() {
        @Override
        public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
            cardNonce[0] = (CardNonce) paymentMethodNonce;
            latch.countDown();
        }
    };
    fragment.addListener(listener);

    Card.tokenize(fragment, cardBuilder);

    try {
        latch.await();
    } catch (InterruptedException ignored) {}

    fragment.removeListener(listener);
    return cardNonce[0];
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:22,代码来源:BraintreeFragmentTestUtils.java

示例3: performVerification_postsPaymentMethodNonceToListenersWhenLookupReturnsACard

import com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener; //导入依赖的package包/类
@Test(timeout = 10000)
public void performVerification_postsPaymentMethodNonceToListenersWhenLookupReturnsACard()
        throws InterruptedException, InvalidArgumentException {
    String clientToken = new TestClientTokenBuilder().withThreeDSecure().build();
    BraintreeFragment fragment = getFragmentWithAuthorization(mActivity, clientToken);
    String nonce = tokenize(fragment, new CardBuilder()
            .cardNumber("4000000000000051")
            .expirationDate("12/20")).getNonce();
    fragment.addListener(new PaymentMethodNonceCreatedListener() {
        @Override
        public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
            assertIsANonce(paymentMethodNonce.getNonce());
            assertEquals("51", ((CardNonce) paymentMethodNonce).getLastTwo());
            mCountDownLatch.countDown();
        }
    });

    ThreeDSecure.performVerification(fragment, nonce, "5");

    mCountDownLatch.await();
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:22,代码来源:ThreeDSecureTest.java

示例4: performVerification_acceptsACardBuilderAndPostsAPaymentMethodNonceToListener

import com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener; //导入依赖的package包/类
@Test(timeout = 10000)
public void performVerification_acceptsACardBuilderAndPostsAPaymentMethodNonceToListener()
        throws InterruptedException {
    String clientToken = new TestClientTokenBuilder().withThreeDSecure().build();
    BraintreeFragment fragment = getFragmentWithAuthorization(mActivity, clientToken);
    fragment.addListener(new PaymentMethodNonceCreatedListener() {
        @Override
        public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
            assertIsANonce(paymentMethodNonce.getNonce());
            assertEquals("51", ((CardNonce) paymentMethodNonce).getLastTwo());
            mCountDownLatch.countDown();
        }
    });
    CardBuilder cardBuilder = new CardBuilder()
            .cardNumber("4000000000000051")
            .expirationDate("12/20");

    ThreeDSecure.performVerification(fragment, cardBuilder, "5");

    mCountDownLatch.await();
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:22,代码来源:ThreeDSecureTest.java

示例5: onActivityResult_postsPaymentMethodNonceToListener

import com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener; //导入依赖的package包/类
@Test(timeout = 2000)
public void onActivityResult_postsPaymentMethodNonceToListener() throws JSONException, InterruptedException {
    BraintreeFragment fragment = getMockFragmentWithConfiguration(mActivity, new TestConfigurationBuilder().build());
    fragment.addListener(new PaymentMethodNonceCreatedListener() {
        @Override
        public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
            assertIsANonce(paymentMethodNonce.getNonce());
            assertEquals("11", ((CardNonce) paymentMethodNonce).getLastTwo());
            mCountDownLatch.countDown();
        }
    });
    JSONObject authResponse = new JSONObject(
            stringFromFixture("three_d_secure/authentication_response.json"));
    Intent data = new Intent()
            .putExtra(ThreeDSecureWebViewActivity.EXTRA_THREE_D_SECURE_RESULT,
                    ThreeDSecureAuthenticationResponse.fromJson(authResponse.toString()));

    ThreeDSecure.onActivityResult(fragment, Activity.RESULT_OK, data);

    mCountDownLatch.await();
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:22,代码来源:ThreeDSecureTest.java

示例6: postCallback_postsPaymentMethodNonceToListener

import com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener; //导入依赖的package包/类
@Test
public void postCallback_postsPaymentMethodNonceToListener() throws InvalidArgumentException {
    BraintreeFragment fragment = BraintreeFragment.newInstance(mActivity, TOKENIZATION_KEY);
    final AtomicBoolean wasCalled = new AtomicBoolean(false);
    fragment.addListener(new PaymentMethodNonceCreatedListener() {
        @Override
        public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
            assertTrue(paymentMethodNonce instanceof CardNonce);
            wasCalled.set(true);
        }
    });

    fragment.postCallback(new CardNonce());

    assertTrue(wasCalled.get());
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:17,代码来源:BraintreeFragmentUnitTest.java

示例7: performVerification_doesALookupAndReturnsACardAndANullACSUrlWhenAuthenticationIsNotRequired

import com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener; //导入依赖的package包/类
@Test(timeout = 10000)
public void performVerification_doesALookupAndReturnsACardAndANullACSUrlWhenAuthenticationIsNotRequired()
        throws InterruptedException {
    BraintreeFragment fragment = getFragment();
    fragment.addListener(new PaymentMethodNonceCreatedListener() {
        @Override
        public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
            assertIsANonce(paymentMethodNonce.getNonce());
            CardNonce cardNonce = (CardNonce) paymentMethodNonce;

            assertEquals("51", cardNonce.getLastTwo());
            assertFalse(cardNonce.getThreeDSecureInfo().isLiabilityShifted());
            assertFalse(cardNonce.getThreeDSecureInfo().isLiabilityShiftPossible());

            mCountDownLatch.countDown();
        }
    });
    CardBuilder cardBuilder = new CardBuilder()
            .cardNumber(THREE_D_SECURE_VERIFICATON_NOT_REQUIRED)
            .expirationDate("12/20");

    ThreeDSecure.performVerification(fragment, cardBuilder, TEST_AMOUNT);

    mCountDownLatch.await();
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:26,代码来源:ThreeDSecureVerificationTest.java

示例8: performVerification_doesALookupAndReturnsACardAfterATimeout

import com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener; //导入依赖的package包/类
@Test(timeout = 30000)
public void performVerification_doesALookupAndReturnsACardAfterATimeout() throws InterruptedException {
    BraintreeFragment fragment = getFragment();
    fragment.addListener(new PaymentMethodNonceCreatedListener() {
        @Override
        public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
            assertIsANonce(paymentMethodNonce.getNonce());
            CardNonce cardNonce = (CardNonce) paymentMethodNonce;

            assertEquals("44", cardNonce.getLastTwo());
            assertFalse(cardNonce.getThreeDSecureInfo().isLiabilityShifted());
            assertFalse(cardNonce.getThreeDSecureInfo().isLiabilityShiftPossible());

            mCountDownLatch.countDown();
        }
    });
    CardBuilder cardBuilder = new CardBuilder()
            .cardNumber(THREE_D_SECURE_LOOKUP_TIMEOUT)
            .expirationDate("12/20");

    ThreeDSecure.performVerification(fragment, cardBuilder, TEST_AMOUNT);

    mCountDownLatch.await();
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:25,代码来源:ThreeDSecureVerificationTest.java

示例9: performVerification_doesALookupAndReturnsACardWhenAuthenticationIsUnavailable

import com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener; //导入依赖的package包/类
@Test(timeout = 10000)
public void performVerification_doesALookupAndReturnsACardWhenAuthenticationIsUnavailable()
        throws InterruptedException {
    BraintreeFragment fragment = getFragment();
    fragment.addListener(new PaymentMethodNonceCreatedListener() {
        @Override
        public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
            assertIsANonce(paymentMethodNonce.getNonce());
            CardNonce cardNonce = (CardNonce) paymentMethodNonce;

            assertEquals("69", cardNonce.getLastTwo());
            assertFalse(cardNonce.getThreeDSecureInfo().isLiabilityShifted());
            assertFalse(cardNonce.getThreeDSecureInfo().isLiabilityShiftPossible());

            mCountDownLatch.countDown();
        }
    });
    CardBuilder cardBuilder = new CardBuilder()
            .cardNumber(THREE_D_SECURE_AUTHENTICATION_UNAVAILABLE)
            .expirationDate("12/20");

    ThreeDSecure.performVerification(fragment, cardBuilder, TEST_AMOUNT);

    mCountDownLatch.await();
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:26,代码来源:ThreeDSecureVerificationTest.java

示例10: performVerification_doesALookupAndReturnsACardWhenThereIsALookupError

import com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener; //导入依赖的package包/类
@Test(timeout = 10000)
public void performVerification_doesALookupAndReturnsACardWhenThereIsALookupError() throws InterruptedException {
    BraintreeFragment fragment = getFragment();
    fragment.addListener(new PaymentMethodNonceCreatedListener() {
        @Override
        public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
            assertIsANonce(paymentMethodNonce.getNonce());
            CardNonce cardNonce = (CardNonce) paymentMethodNonce;

            assertEquals("77", cardNonce.getLastTwo());
            assertFalse(cardNonce.getThreeDSecureInfo().isLiabilityShifted());
            assertFalse(cardNonce.getThreeDSecureInfo().isLiabilityShiftPossible());

            mCountDownLatch.countDown();
        }
    });
    CardBuilder cardBuilder = new CardBuilder()
            .cardNumber(THREE_D_SECURE_LOOKUP_ERROR)
            .expirationDate("12/20");

    ThreeDSecure.performVerification(fragment, cardBuilder, TEST_AMOUNT);

    mCountDownLatch.await();
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:25,代码来源:ThreeDSecureVerificationTest.java

示例11: performVerification_doesALookupAndReturnsACardWhenThereIsAMPILookupError

import com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener; //导入依赖的package包/类
@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());

            mCountDownLatch.countDown();
        }
    });
    CardBuilder cardBuilder = new CardBuilder()
            .cardNumber(THREE_D_SECURE_MPI_LOOKUP_ERROR)
            .expirationDate("12/20");

    ThreeDSecure.performVerification(fragment, cardBuilder, TEST_AMOUNT);

    mCountDownLatch.await();
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:25,代码来源:ThreeDSecureVerificationTest.java

示例12: performVerification_returnsASuccessfulAuthenticationWhenIssuerDoesNotParticipate

import com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener; //导入依赖的package包/类
@Test(timeout = 30000)
public void performVerification_returnsASuccessfulAuthenticationWhenIssuerDoesNotParticipate()
        throws InterruptedException {
    BraintreeFragment fragment = getFragment();
    fragment.addListener(new PaymentMethodNonceCreatedListener() {
        @Override
        public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
            assertIsANonce(paymentMethodNonce.getNonce());
            CardNonce cardNonce = (CardNonce) paymentMethodNonce;

            assertEquals("01", cardNonce.getLastTwo());
            assertTrue(cardNonce.getThreeDSecureInfo().isLiabilityShifted());
            assertTrue(cardNonce.getThreeDSecureInfo().isLiabilityShiftPossible());

            mCountDownLatch.countDown();
        }
    });
    CardBuilder cardBuilder = new CardBuilder()
            .cardNumber(THREE_D_SECURE_ISSUER_DOES_NOT_PARTICIPATE)
            .expirationDate("12/30");

    ThreeDSecure.performVerification(fragment, cardBuilder, TEST_AMOUNT);

    mCountDownLatch.await();
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:26,代码来源:ThreeDSecureVerificationTest.java

示例13: addListener

import com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener; //导入依赖的package包/类
/**
 * Adds a listener.
 *
 * @param listener the listener to add.
 */
public <T extends BraintreeListener> void addListener(T listener) {
    if (listener instanceof ConfigurationListener) {
        mConfigurationListener = (ConfigurationListener) listener;
    }

    if (listener instanceof BraintreeCancelListener) {
        mCancelListener = (BraintreeCancelListener) listener;
    }

    if (listener instanceof PaymentMethodNoncesUpdatedListener) {
        mPaymentMethodNoncesUpdatedListener = (PaymentMethodNoncesUpdatedListener) listener;
    }

    if (listener instanceof PaymentMethodNonceCreatedListener) {
        mPaymentMethodNonceCreatedListener = (PaymentMethodNonceCreatedListener) listener;
    }

    if (listener instanceof BraintreePaymentResultListener) {
        mBraintreePaymentResultListener = (BraintreePaymentResultListener) listener;
    }

    if (listener instanceof BraintreeErrorListener) {
        mErrorListener = (BraintreeErrorListener) listener;
    }

    if (listener instanceof UnionPayListener) {
        mUnionPayListener = (UnionPayListener) listener;
    }

    if (listener instanceof AmericanExpressListener) {
        mAmericanExpressListener = (AmericanExpressListener) listener;
    }

    flushCallbacks();
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:41,代码来源:BraintreeFragment.java

示例14: removeListener

import com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener; //导入依赖的package包/类
/**
 * Removes a previously added listener.
 *
 * @param listener the listener to remove.
 */
public <T extends BraintreeListener> void removeListener(T listener) {
    if (listener instanceof ConfigurationListener) {
        mConfigurationListener = null;
    }

    if (listener instanceof BraintreeCancelListener) {
        mCancelListener = null;
    }

    if (listener instanceof PaymentMethodNoncesUpdatedListener) {
        mPaymentMethodNoncesUpdatedListener = null;
    }

    if (listener instanceof PaymentMethodNonceCreatedListener) {
        mPaymentMethodNonceCreatedListener = null;
    }

    if (listener instanceof BraintreePaymentResultListener) {
        mBraintreePaymentResultListener = null;
    }

    if (listener instanceof BraintreeErrorListener) {
        mErrorListener = null;
    }

    if (listener instanceof UnionPayListener) {
        mUnionPayListener = null;
    }

    if (listener instanceof AmericanExpressListener) {
        mAmericanExpressListener = null;
    }
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:39,代码来源:BraintreeFragment.java

示例15: tokenize_whenSuccess_postsVisaCheckoutNonce

import com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener; //导入依赖的package包/类
@Test(timeout = 10000)
public void tokenize_whenSuccess_postsVisaCheckoutNonce()
        throws InterruptedException {
    mBraintreeFragment.addListener(new PaymentMethodNonceCreatedListener() {
        @Override
        public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
            VisaCheckoutNonce visaCheckoutPayment = (VisaCheckoutNonce) paymentMethodNonce;
            assertIsANonce(visaCheckoutPayment.getNonce());
            assertEquals("44", visaCheckoutPayment.getLastTwo());
            assertEquals("MasterCard", visaCheckoutPayment.getCardType());
            assertEquals("US", visaCheckoutPayment.getShippingAddress().getCountryCode());
            assertEquals("BT", visaCheckoutPayment.getUserData().getUserFirstName());
            assertEquals("2303628416778663701", visaCheckoutPayment.getCallId());
            assertEquals(UNKNOWN, visaCheckoutPayment.getBinData().getPrepaid());
            assertEquals(UNKNOWN, visaCheckoutPayment.getBinData().getHealthcare());
            assertEquals(UNKNOWN, visaCheckoutPayment.getBinData().getDebit());
            assertEquals(UNKNOWN, visaCheckoutPayment.getBinData().getDurbinRegulated());
            assertEquals(UNKNOWN, visaCheckoutPayment.getBinData().getCommercial());
            assertEquals(UNKNOWN, visaCheckoutPayment.getBinData().getPayroll());
            assertEquals(UNKNOWN, visaCheckoutPayment.getBinData().getIssuingBank());
            assertEquals(UNKNOWN, visaCheckoutPayment.getBinData().getCountryOfIssuance());
            assertEquals(UNKNOWN, visaCheckoutPayment.getBinData().getProductId());
            mCountDownLatch.countDown();
        }
    });

    VisaCheckout.tokenize(mBraintreeFragment, sampleVisaPaymentSummary());
    mCountDownLatch.await();
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:30,代码来源:VisaCheckoutTest.java


注:本文中的com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。