Search in sources :

Example 1 with MaskedWallet

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

the class AndroidPay method handleOnActivityResult.

public void handleOnActivityResult(int resultCode, Intent data, int errorCode) {
    switch(resultCode) {
        case Activity.RESULT_OK:
            if (data != null) {
                MaskedWallet maskedWallet = data.getParcelableExtra(WalletConstants.EXTRA_MASKED_WALLET);
                // create the paymentRequest that can eventually be used to pay with, set
                // Android Pay as the payment product
                PaymentRequest paymentRequest = new PaymentRequest();
                paymentRequest.setPaymentProduct(paymentProduct);
                initializeAndStartConfirmationActivity(maskedWallet, paymentRequest);
            }
            break;
        case Activity.RESULT_CANCELED:
            Log.i(TAG, "Android Pay was cancelled");
            break;
        case WalletConstants.RESULT_ERROR:
        default:
            Log.e(TAG, "Something went wrong whilst retrieving the Masked Wallet; errorCode: " + errorCode);
            handleError(errorCode);
            break;
    }
}
Also used : PaymentRequest(com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentRequest) MaskedWallet(com.google.android.gms.wallet.MaskedWallet)

Aggregations

PaymentRequest (com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentRequest)1 MaskedWallet (com.google.android.gms.wallet.MaskedWallet)1