use of com.braintreepayments.api.test.TestClientTokenBuilder in project braintree_android by braintree.
the class BraintreeFragmentTest method setUp.
@Before
public void setUp() {
mActivity = mActivityTestRule.getActivity();
mClientToken = new TestClientTokenBuilder().build();
mCountDownLatch = new CountDownLatch(1);
}
use of com.braintreepayments.api.test.TestClientTokenBuilder in project braintree_android by braintree.
the class CardTest method tokenize_tokenizesACardWithACustomer.
@Test(timeout = 10000)
public void tokenize_tokenizesACardWithACustomer() throws Exception {
CardBuilder cardBuilder = new CardBuilder().cardNumber(VISA).expirationDate("08/20");
assertTokenizationSuccessful(new TestClientTokenBuilder().build(), cardBuilder);
}
use of com.braintreepayments.api.test.TestClientTokenBuilder in project braintree_android by braintree.
the class CardTest method tokenize_tokenizesACardWithPostalCode.
@Test(timeout = 10000)
public void tokenize_tokenizesACardWithPostalCode() throws Exception {
CardBuilder cardBuilder = new CardBuilder().cardNumber(VISA).expirationDate("08/20").cvv("123");
assertTokenizationSuccessful(new TestClientTokenBuilder().withPostalCodeVerification().build(), cardBuilder);
}
use of com.braintreepayments.api.test.TestClientTokenBuilder in project braintree_android by braintree.
the class CardTest method tokenize_tokenizesACardWithValidateFalse.
@Test(timeout = 10000)
public void tokenize_tokenizesACardWithValidateFalse() throws Exception {
CardBuilder cardBuilder = new CardBuilder().cardNumber(VISA).expirationDate("08/20").validate(false);
assertTokenizationSuccessful(new TestClientTokenBuilder().build(), cardBuilder);
}
use of com.braintreepayments.api.test.TestClientTokenBuilder in project braintree_android by braintree.
the class CardTest method tokenize_callsErrorCallbackForInvalidCvv.
@Test(timeout = 10000)
public void tokenize_callsErrorCallbackForInvalidCvv() throws Exception {
CardBuilder cardBuilder = new CardBuilder().cardNumber(VISA).expirationDate("08/20").cvv("200");
final CountDownLatch countDownLatch = new CountDownLatch(1);
BraintreeFragment fragment = setupBraintreeFragment(new TestClientTokenBuilder().withCvvVerification().build());
fragment.addListener(new BraintreeErrorListener() {
@Override
public void onError(Exception error) {
assertEquals("CVV verification failed", ((ErrorWithResponse) error).errorFor("creditCard").getFieldErrors().get(0).getMessage());
countDownLatch.countDown();
}
});
Card.tokenize(fragment, cardBuilder);
countDownLatch.await();
}
Aggregations