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);
}
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;
}
}
Aggregations