Search in sources :

Example 6 with FullWallet

use of com.google.android.gms.wallet.FullWallet in project braintree_android by braintree.

the class AndroidPayTest method createFullWallet.

private FullWallet createFullWallet() throws Exception {
    Class paymentMethodTokenClass = PaymentMethodToken.class;
    Class[] tokenParams = new Class[] { int.class, String.class };
    Constructor<PaymentMethodToken> tokenConstructor = paymentMethodTokenClass.getDeclaredConstructor(tokenParams);
    tokenConstructor.setAccessible(true);
    PaymentMethodToken token = tokenConstructor.newInstance(0, stringFromFixture("payment_methods/android_pay_card.json"));
    Class fullWalletClass = FullWallet.class;
    Class[] walletParams = new Class[] { String.class, String.class, ProxyCard.class, String.class, com.google.android.gms.wallet.zza.class, com.google.android.gms.wallet.zza.class, String[].class, UserAddress.class, UserAddress.class, InstrumentInfo[].class, PaymentMethodToken.class };
    Constructor<FullWallet> walletConstructor = fullWalletClass.getDeclaredConstructor(walletParams);
    walletConstructor.setAccessible(true);
    return walletConstructor.newInstance(null, null, null, null, null, null, null, null, null, null, token);
}
Also used : FullWallet(com.google.android.gms.wallet.FullWallet) ProxyCard(com.google.android.gms.wallet.ProxyCard) PaymentMethodToken(com.google.android.gms.wallet.PaymentMethodToken) UserAddress(com.google.android.gms.identity.intents.model.UserAddress)

Example 7 with FullWallet

use of com.google.android.gms.wallet.FullWallet in project connect-sdk-client-android by Ingenico-ePayments.

the class FullWalletConfirmationButtonFragment method onActivityResult.

// [START on_activity_result]
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    mProgressDialog.hide();
    // retrieve the error code, if available
    int errorCode = -1;
    if (data != null) {
        errorCode = data.getIntExtra(WalletConstants.EXTRA_ERROR_CODE, -1);
    }
    switch(requestCode) {
        case REQUEST_CODE_RESOLVE_LOAD_FULL_WALLET:
            switch(resultCode) {
                case Activity.RESULT_OK:
                    if (data != null && data.hasExtra(WalletConstants.EXTRA_FULL_WALLET)) {
                        FullWallet fullWallet = data.getParcelableExtra(WalletConstants.EXTRA_FULL_WALLET);
                        // the full wallet can now be used to process the customer's payment
                        // send the wallet info up to server to process, and to get the result
                        // for sending a transaction status
                        fetchTransactionStatus(fullWallet);
                    } else if (data != null && data.hasExtra(WalletConstants.EXTRA_MASKED_WALLET)) {
                        // re-launch the activity with new masked wallet information
                        mMaskedWallet = data.getParcelableExtra(WalletConstants.EXTRA_MASKED_WALLET);
                        mActivityLaunchIntent.putExtra(Constants.INTENT_MASKED_WALLET, mMaskedWallet);
                        startActivity(mActivityLaunchIntent);
                    }
                    break;
                case Activity.RESULT_CANCELED:
                    // nothing to do here
                    break;
                default:
                    handleError(errorCode);
                    break;
            }
            break;
    }
}
Also used : FullWallet(com.google.android.gms.wallet.FullWallet)

Aggregations

FullWallet (com.google.android.gms.wallet.FullWallet)7 UserAddress (com.google.android.gms.identity.intents.model.UserAddress)4 Test (org.junit.Test)4 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)3 Cart (com.google.android.gms.wallet.Cart)2 PaymentMethodToken (com.google.android.gms.wallet.PaymentMethodToken)2 Intent (android.content.Intent)1 Parcel (android.os.Parcel)1 ProxyCard (com.google.android.gms.wallet.ProxyCard)1