当前位置: 首页>>代码示例>>Java>>正文


Java WalletConstants类代码示例

本文整理汇总了Java中com.google.android.gms.wallet.WalletConstants的典型用法代码示例。如果您正苦于以下问题:Java WalletConstants类的具体用法?Java WalletConstants怎么用?Java WalletConstants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WalletConstants类属于com.google.android.gms.wallet包,在下文中一共展示了WalletConstants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import com.google.android.gms.wallet.WalletConstants; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_card_form);

    // Initialize simplify instance:
    simplify = ((ShopApplication) getApplication()).getSimplify();

    // Build Google API instance:
    // API: Wallet
    mGoogleApiClient = new GoogleApiClient.Builder(this)
        .addConnectionCallbacks(this)
        .addOnConnectionFailedListener(this)
        .addApi(Wallet.API, new Wallet.WalletOptions.Builder()
            .setEnvironment(Constants.WALLET_ENVIRONMENT)
            .setTheme(WalletConstants.THEME_LIGHT)
            .build())
        .build();

    // Initialize view:
    init_view();

    // Wallet payment request:
    readyToPayRequest();

}
 
开发者ID:ChristopherAbram,项目名称:Book-Shelf,代码行数:27,代码来源:CardFormActivity.java

示例2: onCreate

import com.google.android.gms.wallet.WalletConstants; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_android_pay);

    mMaskedWallet = getIntent().getParcelableExtra(WalletConstants.EXTRA_MASKED_WALLET);

    // Initialize simplify instance:
    simplify = ((ShopApplication) getApplication()).getSimplify();

    // Build Google API instance:
    // API: Wallet
    mGoogleApiClient = new GoogleApiClient.Builder(this)
        .addConnectionCallbacks(this)
        .addOnConnectionFailedListener(this)
        .addApi(Wallet.API, new Wallet.WalletOptions.Builder()
            .setEnvironment(Constants.WALLET_ENVIRONMENT)
            .setTheme(WalletConstants.THEME_LIGHT)
            .build())
        .build();

    // Initialize view:
    initView();
}
 
开发者ID:ChristopherAbram,项目名称:Book-Shelf,代码行数:25,代码来源:AndroidPayActivity.java

示例3: onActivityResult

import com.google.android.gms.wallet.WalletConstants; //导入依赖的package包/类
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    EditText textBox = (EditText) findViewById(R.id.s2wResponse);
    switch (requestCode) {
        case SAVE_TO_ANDROID:
            switch (resultCode) {
                case Activity.RESULT_OK:
                    textBox.setText(SUCCESS_RESPONSE_TEXT);
                    break;
                case Activity.RESULT_CANCELED:
                    textBox.setText(CANCELED_RESPONSE_TEXT);
                    break;
                default:
                    int errorCode =
                            data.getIntExtra(
                                    WalletConstants.EXTRA_ERROR_CODE, -1);
                    textBox.setText(ERROR_PREFIX_TEXT + errorCode);
                    break;
            }
    }
}
 
开发者ID:android-pay,项目名称:s2ap-quickstart-android,代码行数:21,代码来源:MainActivity.java

示例4: handleError

import com.google.android.gms.wallet.WalletConstants; //导入依赖的package包/类
protected void handleError(int errorCode) {
    switch (errorCode) {
        case WalletConstants.ERROR_CODE_SPENDING_LIMIT_EXCEEDED:
            Toast.makeText(this, getString(R.string.spending_limit_exceeded, errorCode),
                    Toast.LENGTH_LONG).show();
            break;
        case WalletConstants.ERROR_CODE_INVALID_PARAMETERS:
        case WalletConstants.ERROR_CODE_AUTHENTICATION_FAILURE:
        case WalletConstants.ERROR_CODE_BUYER_ACCOUNT_ERROR:
        case WalletConstants.ERROR_CODE_MERCHANT_ACCOUNT_ERROR:
        case WalletConstants.ERROR_CODE_SERVICE_UNAVAILABLE:
        case WalletConstants.ERROR_CODE_UNSUPPORTED_API_VERSION:
        case WalletConstants.ERROR_CODE_UNKNOWN:
        default:
            // unrecoverable error
            String errorMessage = getString(R.string.google_wallet_unavailable) + "\n" +
                    getString(R.string.error_code, errorCode);
            Toast.makeText(this, errorMessage, Toast.LENGTH_LONG).show();
            break;
    }
}
 
开发者ID:Adyen,项目名称:adyen-android-pay-sample-code,代码行数:22,代码来源:OrderConfirmationActivity.java

示例5: onCreate

import com.google.android.gms.wallet.WalletConstants; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mActivityLaunchIntent = getActivity().getIntent();
    mMaskedWallet = mActivityLaunchIntent.getParcelableExtra(Constants.EXTRA_MASKED_WALLET);
    productsList = fillProductListFromIntent(mActivityLaunchIntent);
    orderTotal = mActivityLaunchIntent.getFloatExtra("orderTotal", 0);

    // Set up an API client
    FragmentActivity fragmentActivity = getActivity();

    // [START build_google_api_client]
    mGoogleApiClient = new GoogleApiClient.Builder(getActivity())
            .enableAutoManage(fragmentActivity, this /* onConnectionFailedListener */)
            .addApi(Wallet.API, new Wallet.WalletOptions.Builder()
                    .setEnvironment(Constants.WALLET_ENVIRONMENT)
                    .setTheme(WalletConstants.THEME_LIGHT)
                    .build())
            .build();
    // [END build_google_api_client]
}
 
开发者ID:Adyen,项目名称:adyen-android-pay-sample-code,代码行数:23,代码来源:FullWalletConfirmationFragment.java

示例6: handleError

import com.google.android.gms.wallet.WalletConstants; //导入依赖的package包/类
private void handleError(int errorCode) {
    switch (errorCode) {
        case WalletConstants.ERROR_CODE_SPENDING_LIMIT_EXCEEDED:
            // may be recoverable if the user tries to lower their charge
            // take the user back to the checkout page to try to handle
        case WalletConstants.ERROR_CODE_INVALID_PARAMETERS:
        case WalletConstants.ERROR_CODE_AUTHENTICATION_FAILURE:
        case WalletConstants.ERROR_CODE_BUYER_ACCOUNT_ERROR:
        case WalletConstants.ERROR_CODE_MERCHANT_ACCOUNT_ERROR:
        case WalletConstants.ERROR_CODE_SERVICE_UNAVAILABLE:
        case WalletConstants.ERROR_CODE_UNSUPPORTED_API_VERSION:
        case WalletConstants.ERROR_CODE_UNKNOWN:
        default:
            // unrecoverable error
            // take the user back to the checkout page to handle these errors
            handleUnrecoverableGoogleWalletError(errorCode);
    }
}
 
开发者ID:Adyen,项目名称:adyen-android-pay-sample-code,代码行数:19,代码来源:FullWalletConfirmationFragment.java

示例7: onActivityResult

import com.google.android.gms.wallet.WalletConstants; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode) {
        case REQUEST_CODE_CHANGE_MASKED_WALLET:
            if (resultCode == Activity.RESULT_OK &&
                    data.hasExtra(WalletConstants.EXTRA_MASKED_WALLET)) {
                mMaskedWallet = data.getParcelableExtra(WalletConstants.EXTRA_MASKED_WALLET);
                ((FullWalletConfirmationFragment) getResultTargetFragment())
                        .updateMaskedWallet(mMaskedWallet);
            }
            // you may also want to use the new masked wallet data here, say to recalculate
            // shipping or taxes if shipping address changed
            break;
        case WalletConstants.RESULT_ERROR:
            int errorCode = data.getIntExtra(WalletConstants.EXTRA_ERROR_CODE, 0);
            handleError(errorCode);
            break;
        default:
            super.onActivityResult(requestCode, resultCode, data);
            break;
    }
}
 
开发者ID:Adyen,项目名称:adyen-android-pay-sample-code,代码行数:23,代码来源:ConfirmationActivity.java

示例8: convertSupportedCardNetworks

import com.google.android.gms.wallet.WalletConstants; //导入依赖的package包/类
@Test
public void convertSupportedCardNetworks() {
  try {
    PayHelper.convertSupportedCardNetworks(null);
    fail("expected NullPointerException");
  } catch (NullPointerException expected) {
  }

  Set<Integer> cardNetworks = PayHelper.convertSupportedCardNetworks(
    new LinkedHashSet<>(Arrays.asList(CardNetworkType.VISA, CardNetworkType.MASTERCARD, CardNetworkType.DISCOVER,
      CardNetworkType.AMERICAN_EXPRESS, CardNetworkType.JCB)
    )
  );

  assertThat(new ArrayList<>(cardNetworks)).isEqualTo(Arrays.asList(WalletConstants.CardNetwork.VISA,
    WalletConstants.CardNetwork.MASTERCARD, WalletConstants.CardNetwork.DISCOVER, WalletConstants.CardNetwork.AMEX,
    WalletConstants.CardNetwork.JCB));
}
 
开发者ID:Shopify,项目名称:mobile-buy-sdk-android,代码行数:19,代码来源:PayHelperTest.java

示例9: onCreate

import com.google.android.gms.wallet.WalletConstants; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = getActivity().getIntent();
    if (intent != null) {
        mItemId = intent.getIntExtra(Constants.EXTRA_ITEM_ID, 0);
    }

    setRetainInstance(true);

    String accountName = ((XyzApplication) getActivity().getApplication()).getAccountName();

    // Set up an API client;
    mGoogleApiClient = new GoogleApiClient.Builder(getActivity())
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .setAccountName(accountName)
            .addApi(Wallet.API, new Wallet.WalletOptions.Builder()
                .setEnvironment(Constants.WALLET_ENVIRONMENT)
                .setTheme(WalletConstants.THEME_HOLO_LIGHT)
                .build())
            .build();

    mRetryHandler = new RetryHandler(this);
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:27,代码来源:XyzWalletFragment.java

示例10: handleError

import com.google.android.gms.wallet.WalletConstants; //导入依赖的package包/类
@Override
protected void handleError(int errorCode) {
    switch (errorCode) {
        case WalletConstants.ERROR_CODE_SPENDING_LIMIT_EXCEEDED:
            Toast.makeText(getActivity(),
                    getString(R.string.spending_limit_exceeded, errorCode),
                    Toast.LENGTH_LONG).show();
            break;
        case WalletConstants.ERROR_CODE_INVALID_PARAMETERS:
        case WalletConstants.ERROR_CODE_AUTHENTICATION_FAILURE:
        case WalletConstants.ERROR_CODE_BUYER_ACCOUNT_ERROR:
        case WalletConstants.ERROR_CODE_MERCHANT_ACCOUNT_ERROR:
        case WalletConstants.ERROR_CODE_SERVICE_UNAVAILABLE:
        case WalletConstants.ERROR_CODE_UNSUPPORTED_API_VERSION:
        case WalletConstants.ERROR_CODE_UNKNOWN:
        default:
            // unrecoverable error
            mGoogleWalletDisabled = true;
            displayGoogleWalletErrorToast(errorCode);
            break;
    }
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:23,代码来源:CheckoutFragment.java

示例11: handleError

import com.google.android.gms.wallet.WalletConstants; //导入依赖的package包/类
@Override
protected void handleError(int errorCode) {
    if (checkAndRetryFullWallet(errorCode)) {
        // handled by retrying
        return;
    }
    switch (errorCode) {
        case WalletConstants.ERROR_CODE_SPENDING_LIMIT_EXCEEDED:
            // may be recoverable if the user tries to lower their charge
            // take the user back to the checkout page to try to handle
        case WalletConstants.ERROR_CODE_INVALID_PARAMETERS:
        case WalletConstants.ERROR_CODE_AUTHENTICATION_FAILURE:
        case WalletConstants.ERROR_CODE_BUYER_ACCOUNT_ERROR:
        case WalletConstants.ERROR_CODE_MERCHANT_ACCOUNT_ERROR:
        case WalletConstants.ERROR_CODE_SERVICE_UNAVAILABLE:
        case WalletConstants.ERROR_CODE_UNSUPPORTED_API_VERSION:
        case WalletConstants.ERROR_CODE_UNKNOWN:
        default:
            // unrecoverable error
            // take the user back to the checkout page to handle these errors
            handleUnrecoverableGoogleWalletError(errorCode);
    }
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:24,代码来源:ConfirmationFragment.java

示例12: handleError

import com.google.android.gms.wallet.WalletConstants; //导入依赖的package包/类
@Override
protected void handleError(int errorCode) {
    switch (errorCode) {
        case WalletConstants.ERROR_CODE_SPENDING_LIMIT_EXCEEDED:
            Toast.makeText(getActivity(),
                    getString(R.string.spending_limit_exceeded, errorCode),
                    Toast.LENGTH_LONG).show();
            break;
        case WalletConstants.ERROR_CODE_INVALID_PARAMETERS:
        case WalletConstants.ERROR_CODE_AUTHENTICATION_FAILURE:
        case WalletConstants.ERROR_CODE_BUYER_ACCOUNT_ERROR:
        case WalletConstants.ERROR_CODE_MERCHANT_ACCOUNT_ERROR:
        case WalletConstants.ERROR_CODE_SERVICE_UNAVAILABLE:
        case WalletConstants.ERROR_CODE_UNSUPPORTED_API_VERSION:
        case WalletConstants.ERROR_CODE_UNKNOWN:
        default:
            // unrecoverable error
            handleUnrecoverableGoogleWalletError(errorCode);
            break;
    }
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:22,代码来源:PaymentFragment.java

示例13: onActivityResult

import com.google.android.gms.wallet.WalletConstants; //导入依赖的package包/类
static void onActivityResult(BraintreeFragment fragment, int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_OK) {
        if (data.hasExtra(WalletConstants.EXTRA_FULL_WALLET)) {
            fragment.sendAnalyticsEvent("android-pay.authorized");
            tokenize(fragment, (FullWallet) data.getParcelableExtra(WalletConstants.EXTRA_FULL_WALLET),
                    (Cart) data.getParcelableExtra(EXTRA_CART));
        }
    } else if (resultCode == Activity.RESULT_CANCELED) {
        fragment.sendAnalyticsEvent("android-pay.canceled");
    } else {
        if (data != null) {
            if (data.hasExtra(EXTRA_ERROR)) {
                fragment.postCallback(new AndroidPayException(data.getStringExtra(EXTRA_ERROR)));
            } else {
                fragment.postCallback(new AndroidPayException("Android Pay error code: " +
                        data.getIntExtra(WalletConstants.EXTRA_ERROR_CODE, -1) +
                        " see https://developers.google.com/android/reference/com/google/android/gms/wallet/WalletConstants " +
                        "for more details"));
            }
        }

        fragment.sendAnalyticsEvent("android-pay.failed");
    }
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:25,代码来源:AndroidPay.java

示例14: onActivityResult

import com.google.android.gms.wallet.WalletConstants; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == Activity.RESULT_OK && (requestCode == AUTHORIZE || requestCode == CHANGE_PAYMENT_METHOD)) {
        String googleTransactionId = ((MaskedWallet) data.getParcelableExtra(WalletConstants.EXTRA_MASKED_WALLET))
                .getGoogleTransactionId();
        loadFullWallet(googleTransactionId);
    } else if (resultCode == Activity.RESULT_OK && requestCode == FULL_WALLET_REQUEST) {
        data.putExtra(EXTRA_CART, getCart());
        setResult(resultCode, data);
        finish();
    } else {
        setResult(resultCode, data);
        finish();
    }
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:18,代码来源:AndroidPayActivity.java

示例15: getTokenizationParameters

import com.google.android.gms.wallet.WalletConstants; //导入依赖的package包/类
static PaymentMethodTokenizationParameters getTokenizationParameters(BraintreeFragment fragment) {
    PaymentMethodTokenizationParameters.Builder parameters = PaymentMethodTokenizationParameters.newBuilder()
            .setPaymentMethodTokenizationType(WalletConstants.PAYMENT_METHOD_TOKENIZATION_TYPE_PAYMENT_GATEWAY)
            .addParameter("gateway", "braintree")
            .addParameter("braintree:merchantId", fragment.getConfiguration().getMerchantId())
            .addParameter("braintree:authorizationFingerprint",
                    fragment.getConfiguration().getAndroidPay().getGoogleAuthorizationFingerprint())
            .addParameter("braintree:apiVersion", "v1")
            .addParameter("braintree:sdkVersion", BuildConfig.VERSION_NAME)
            .addParameter("braintree:metadata", new MetadataBuilder()
                    .integration(fragment.getIntegrationType())
                    .sessionId(fragment.getSessionId())
                    .version()
                    .toString());

    if (fragment.getAuthorization() instanceof TokenizationKey) {
        parameters.addParameter("braintree:clientKey", fragment.getAuthorization().getBearer());
    }

    return parameters.build();
}
 
开发者ID:braintree,项目名称:braintree_android,代码行数:22,代码来源:GooglePayment.java


注:本文中的com.google.android.gms.wallet.WalletConstants类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。