Search in sources :

Example 41 with CardBuilder

use of com.braintreepayments.api.models.CardBuilder 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);
    }
}
Also used : UnionPayCardBuilder(com.braintreepayments.api.models.UnionPayCardBuilder) CardBuilder(com.braintreepayments.api.models.CardBuilder) UnionPayCardBuilder(com.braintreepayments.api.models.UnionPayCardBuilder)

Aggregations

CardBuilder (com.braintreepayments.api.models.CardBuilder)41 Test (org.junit.Test)39 PaymentMethodNonce (com.braintreepayments.api.models.PaymentMethodNonce)15 TestClientTokenBuilder (com.braintreepayments.api.test.TestClientTokenBuilder)14 CardNonce (com.braintreepayments.api.models.CardNonce)12 PaymentMethodNonceCreatedListener (com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener)11 AuthorizationException (com.braintreepayments.api.exceptions.AuthorizationException)10 BraintreeErrorListener (com.braintreepayments.api.interfaces.BraintreeErrorListener)10 InvalidArgumentException (com.braintreepayments.api.exceptions.InvalidArgumentException)7 UnionPayCardBuilder (com.braintreepayments.api.models.UnionPayCardBuilder)7 CountDownLatch (java.util.concurrent.CountDownLatch)6 JSONException (org.json.JSONException)5 TestConfigurationBuilder (com.braintreepayments.testutils.TestConfigurationBuilder)4 HttpResponseCallback (com.braintreepayments.api.interfaces.HttpResponseCallback)3 Matchers.anyString (org.mockito.Matchers.anyString)3 BraintreeException (com.braintreepayments.api.exceptions.BraintreeException)2 BraintreeCancelListener (com.braintreepayments.api.interfaces.BraintreeCancelListener)2 PaymentMethodNonceCallback (com.braintreepayments.api.interfaces.PaymentMethodNonceCallback)2 PaymentMethodNoncesUpdatedListener (com.braintreepayments.api.interfaces.PaymentMethodNoncesUpdatedListener)2 ErrorWithResponse (com.braintreepayments.api.exceptions.ErrorWithResponse)1