use of com.braintreepayments.api.models.UnionPayCardBuilder in project braintree_android by braintree.
the class UnionPayTest method tokenize_unionPayCredit_withExpirationDate.
@Test(timeout = 10000)
public void tokenize_unionPayCredit_withExpirationDate() throws InvalidArgumentException, InterruptedException {
final UnionPayCardBuilder cardBuilder = new UnionPayCardBuilder().cardNumber(CardNumber.UNIONPAY_CREDIT).expirationDate("08/20").cvv("123").mobileCountryCode("62").mobilePhoneNumber("1111111111");
mBraintreeFragment.addListener(new UnionPayListener() {
@Override
public void onCapabilitiesFetched(UnionPayCapabilities capabilities) {
}
@Override
public void onSmsCodeSent(String enrollmentId, boolean smsCodeRequired) {
assertTrue(smsCodeRequired);
cardBuilder.enrollmentId(enrollmentId);
cardBuilder.smsCode("12345");
UnionPay.tokenize(mBraintreeFragment, cardBuilder);
}
});
mBraintreeFragment.addListener(new PaymentMethodNonceCreatedListener() {
@Override
public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
assertIsANonce(paymentMethodNonce.getNonce());
assertEquals("32", ((CardNonce) paymentMethodNonce).getLastTwo());
mCountDownLatch.countDown();
}
});
UnionPay.enroll(mBraintreeFragment, cardBuilder);
mCountDownLatch.await();
}
use of com.braintreepayments.api.models.UnionPayCardBuilder in project braintree_android by braintree.
the class CardActivity method onPurchase.
public void onPurchase(View v) {
setProgressBarIndeterminateVisibility(true);
if (mIsUnionPay) {
UnionPayCardBuilder unionPayCardBuilder = new UnionPayCardBuilder().cardNumber(mCardForm.getCardNumber()).expirationMonth(mCardForm.getExpirationMonth()).expirationYear(mCardForm.getExpirationYear()).cvv(mCardForm.getCvv()).postalCode(mCardForm.getPostalCode()).mobileCountryCode(mCardForm.getCountryCode()).mobilePhoneNumber(mCardForm.getMobileNumber()).smsCode(mSmsCode.getText().toString()).enrollmentId(mEnrollmentId);
UnionPay.tokenize(mBraintreeFragment, unionPayCardBuilder);
} else {
CardBuilder cardBuilder = new CardBuilder().cardNumber(mCardForm.getCardNumber()).expirationMonth(mCardForm.getExpirationMonth()).expirationYear(mCardForm.getExpirationYear()).cvv(mCardForm.getCvv()).postalCode(mCardForm.getPostalCode());
Card.tokenize(mBraintreeFragment, cardBuilder);
}
}
use of com.braintreepayments.api.models.UnionPayCardBuilder in project braintree_android by braintree.
the class CardActivity method sendSms.
public void sendSms(View v) {
UnionPayCardBuilder unionPayCardBuilder = new UnionPayCardBuilder().cardNumber(mCardForm.getCardNumber()).expirationMonth(mCardForm.getExpirationMonth()).expirationYear(mCardForm.getExpirationYear()).cvv(mCardForm.getCvv()).postalCode(mCardForm.getPostalCode()).mobileCountryCode(mCardForm.getCountryCode()).mobilePhoneNumber(mCardForm.getMobileNumber());
UnionPay.enroll(mBraintreeFragment, unionPayCardBuilder);
}
Aggregations