Search in sources :

Example 1 with IsReadyToPayRequest

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

the class AndroidPayUtil method isAndroidPayAllowed.

private static boolean isAndroidPayAllowed(Collection<Integer> networks, Context context, C2sCommunicator communicator) {
    GoogleApiClient client = new GoogleApiClient.Builder(context).addApi(Wallet.API, new Wallet.WalletOptions.Builder().setEnvironment(getWalletEnvironment(communicator)).build()).build();
    client.connect();
    IsReadyToPayRequest request = createIsReadyToPayRequest(networks);
    PendingResult<BooleanResult> result = Wallet.Payments.isReadyToPay(client, request);
    BooleanResult actualResult = result.await(Constants.ACCEPTABLE_WAIT_TIME_IN_MILISECONDS, TimeUnit.MILLISECONDS);
    if (actualResult.getStatus().isSuccess()) {
        return actualResult.getValue();
    } else {
        Log.e(TAG, "Error while making isReadyToPay call: " + actualResult.getStatus());
        return false;
    }
}
Also used : BooleanResult(com.google.android.gms.common.api.BooleanResult) GoogleApiClient(com.google.android.gms.common.api.GoogleApiClient) Wallet(com.google.android.gms.wallet.Wallet) IsReadyToPayRequest(com.google.android.gms.wallet.IsReadyToPayRequest)

Aggregations

BooleanResult (com.google.android.gms.common.api.BooleanResult)1 GoogleApiClient (com.google.android.gms.common.api.GoogleApiClient)1 IsReadyToPayRequest (com.google.android.gms.wallet.IsReadyToPayRequest)1 Wallet (com.google.android.gms.wallet.Wallet)1