本文整理汇总了Java中com.google.android.gms.wallet.PaymentMethodTokenizationType类的典型用法代码示例。如果您正苦于以下问题:Java PaymentMethodTokenizationType类的具体用法?Java PaymentMethodTokenizationType怎么用?Java PaymentMethodTokenizationType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PaymentMethodTokenizationType类属于com.google.android.gms.wallet包,在下文中一共展示了PaymentMethodTokenizationType类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createMaskedWalletRequest
import com.google.android.gms.wallet.PaymentMethodTokenizationType; //导入依赖的package包/类
/**
* Creates a MaskedWalletRequest for direct merchant integration (no payment processor).
*
* @param publicKey base64-encoded public encryption key. See instructions for more details.
* @return {@link MaskedWalletRequest} instance
*/
private MaskedWalletRequest createMaskedWalletRequest(@Nullable String publicKey) {
// Validate the public key
if (publicKey == null || publicKey.contains("REPLACE_ME")) {
throw new IllegalArgumentException("Invalid public key, see README for instructions.");
}
// Create direct integration parameters
// [START direct_integration_parameters]
PaymentMethodTokenizationParameters parameters =
PaymentMethodTokenizationParameters.newBuilder()
.setPaymentMethodTokenizationType(PaymentMethodTokenizationType.NETWORK_TOKEN)
.addParameter("publicKey", publicKey)
.build();
// [END direct_integration_parameters]
return createMaskedWalletRequest(parameters);
}
开发者ID:Adyen,项目名称:adyen-android,代码行数:24,代码来源:AndroidPayActivity.java
示例2: createMaskedWalletRequest
import com.google.android.gms.wallet.PaymentMethodTokenizationType; //导入依赖的package包/类
/**
* Creates a MaskedWalletRequest for direct merchant integration (no payment processor)
*
* @param product {@link Product} containing details
* of an item.
* @param publicKey base64-encoded public encryption key. See instructions for more details.
* @return {@link MaskedWalletRequest} instance
*/
public static MaskedWalletRequest createMaskedWalletRequest(List<Product> product,
String orderTotal,
String publicKey,
Context context) {
// Validate the public key
if (publicKey == null || publicKey.contains("REPLACE_ME")) {
throw new IllegalArgumentException("Invalid public key, see README for instructions.");
}
// Create direct integration parameters
// [START direct_integration_parameters]
PaymentMethodTokenizationParameters parameters =
PaymentMethodTokenizationParameters.newBuilder()
.setPaymentMethodTokenizationType(PaymentMethodTokenizationType.NETWORK_TOKEN)
.addParameter("publicKey", publicKey)
.build();
// [END direct_integration_parameters]
return createMaskedWalletRequest(product, orderTotal, parameters, context);
}
开发者ID:Adyen,项目名称:adyen-android-pay-sample-code,代码行数:29,代码来源:WalletUtil.java
示例3: maskedWalletRequest
import com.google.android.gms.wallet.PaymentMethodTokenizationType; //导入依赖的package包/类
/**
* Construct {@link MaskedWalletRequest} from this {@link PayCart}.
*
* @param androidPayPublicKey Android Pay public key
* @return {@link MaskedWalletRequest}
*/
public MaskedWalletRequest maskedWalletRequest(@NonNull final String androidPayPublicKey) {
PaymentMethodTokenizationParameters parameters =
PaymentMethodTokenizationParameters.newBuilder()
.setPaymentMethodTokenizationType(PaymentMethodTokenizationType.NETWORK_TOKEN)
.addParameter("publicKey", checkNotEmpty(androidPayPublicKey, "androidPayPublicKey can't be empty"))
.build();
MaskedWalletRequest.Builder builder = MaskedWalletRequest.newBuilder()
.setMerchantName(merchantName)
.setPhoneNumberRequired(phoneNumberRequired)
.setShippingAddressRequired(shippingAddressRequired)
.setCurrencyCode(currencyCode)
.setCountryCode(countryCode)
.setEstimatedTotalPrice(totalPrice.toString())
.setPaymentMethodTokenizationParameters(parameters)
.setCart(cartBuilder().build());
Collection<CountrySpecification> shippingCountrySpecifications = shippingCountrySpecifications(shipsToCountries);
builder.addAllowedCountrySpecificationsForShipping(shippingCountrySpecifications);
return builder.build();
}
开发者ID:Shopify,项目名称:mobile-buy-sdk-android,代码行数:29,代码来源:PayCart.java
示例4: getMaskedWalletRequest
import com.google.android.gms.wallet.PaymentMethodTokenizationType; //导入依赖的package包/类
private MaskedWalletRequest getMaskedWalletRequest() {
PaymentMethodTokenizationParameters parameters =
PaymentMethodTokenizationParameters.newBuilder()
.setPaymentMethodTokenizationType(PaymentMethodTokenizationType.NETWORK_TOKEN)
.addParameter("publicKey", simplify.getAndroidPayPublicKey())
.build();
Cart cart = Cart.newBuilder()
.setCurrencyCode(Constants.DEFAULT_CURRENCY.getCode())
.setTotalPrice(mShopItem.priceToString())
.addLineItem(LineItem.newBuilder()
.setCurrencyCode(Constants.DEFAULT_CURRENCY.getCode())
.setDescription(mShopItem.getName())
.setQuantity("1")
.setUnitPrice("2.00")
.setTotalPrice("2.00")
.build())
.build();
return MaskedWalletRequest.newBuilder()
.setMerchantName("BookShelf")
.setPhoneNumberRequired(true)
.setShippingAddressRequired(true)
.setCurrencyCode(Constants.DEFAULT_CURRENCY.getCode())
.setCart(cart)
.setEstimatedTotalPrice(Item.priceToString(mShopItem.getTotalPrice()))
.setPaymentMethodTokenizationParameters(parameters)
.build();
}
开发者ID:ChristopherAbram,项目名称:Book-Shelf,代码行数:31,代码来源:CardFormActivity.java
示例5: createMaskedWalletRequest
import com.google.android.gms.wallet.PaymentMethodTokenizationType; //导入依赖的package包/类
public static @NonNull MaskedWalletRequest createMaskedWalletRequest(final @NonNull AndroidPayPayload payload) {
return MaskedWalletRequest.newBuilder()
.setMerchantName(payload.merchantName())
.setPhoneNumberRequired(payload.phoneNumberRequired())
.setShippingAddressRequired(payload.shippingAddressRequired())
.setCurrencyCode(payload.currencyCode())
.setAllowDebitCard(payload.allowDebitCard())
.setAllowPrepaidCard(payload.allowPrepaidCard())
.setEstimatedTotalPrice(payload.estimatedTotalPrice())
.setCart(
Cart.newBuilder()
.setCurrencyCode(payload.cart().currencyCode())
.setTotalPrice(payload.cart().totalPrice())
.setLineItems(lineItemsFromPayload(payload))
.build()
)
.setPaymentMethodTokenizationParameters(
PaymentMethodTokenizationParameters.newBuilder()
.setPaymentMethodTokenizationType(PaymentMethodTokenizationType.PAYMENT_GATEWAY)
.addParameter("gateway", "stripe")
.addParameter("stripe:publishableKey", payload.stripePublishableKey())
.addParameter("stripe:version", payload.stripeVersion())
.build()
)
.build();
}
开发者ID:kickstarter,项目名称:android-oss,代码行数:28,代码来源:AndroidPayUtils.java
示例6: getMaskedWalletRequest
import com.google.android.gms.wallet.PaymentMethodTokenizationType; //导入依赖的package包/类
MaskedWalletRequest getMaskedWalletRequest() {
PaymentMethodTokenizationParameters parameters =
PaymentMethodTokenizationParameters.newBuilder()
.setPaymentMethodTokenizationType(PaymentMethodTokenizationType.NETWORK_TOKEN)
.addParameter("publicKey", simplify.getAndroidPayPublicKey())
.build();
Cart cart = Cart.newBuilder()
.setCurrencyCode(Constants.CURRENCY_CODE)
.setTotalPrice(Constants.AMOUNT)
.addLineItem(LineItem.newBuilder()
.setCurrencyCode(Constants.CURRENCY_CODE)
.setDescription("Iced Coffee")
.setQuantity("1")
.setUnitPrice(Constants.AMOUNT)
.setTotalPrice(Constants.AMOUNT)
.build())
.build();
return MaskedWalletRequest.newBuilder()
.setMerchantName("Overpriced Coffee Shop")
.setPhoneNumberRequired(true)
.setShippingAddressRequired(true)
.setCurrencyCode(Constants.CURRENCY_CODE)
.setCart(cart)
.setEstimatedTotalPrice(Constants.AMOUNT)
.setPaymentMethodTokenizationParameters(parameters)
.build();
}
开发者ID:simplifycom,项目名称:simplify-android-sample,代码行数:31,代码来源:MainActivity.java
示例7: showAndroidPay
import com.google.android.gms.wallet.PaymentMethodTokenizationType; //导入依赖的package包/类
private void showAndroidPay() {
if (getParentActivity() == null || androidPayContainer == null) {
return;
}
WalletFragmentOptions.Builder optionsBuilder = WalletFragmentOptions.newBuilder();
optionsBuilder.setEnvironment(paymentForm.invoice.test ? WalletConstants.ENVIRONMENT_TEST : WalletConstants.ENVIRONMENT_PRODUCTION);
optionsBuilder.setMode(WalletFragmentMode.BUY_BUTTON);
WalletFragmentStyle walletFragmentStyle;
if (androidPayPublicKey != null) {
androidPayContainer.setBackgroundColor(androidPayBackgroundColor);
walletFragmentStyle = new WalletFragmentStyle()
.setBuyButtonText(WalletFragmentStyle.BuyButtonText.BUY_WITH)
.setBuyButtonAppearance(androidPayBlackTheme ? WalletFragmentStyle.BuyButtonAppearance.ANDROID_PAY_LIGHT_WITH_BORDER : WalletFragmentStyle.BuyButtonAppearance.ANDROID_PAY_DARK)
.setBuyButtonWidth(WalletFragmentStyle.Dimension.MATCH_PARENT);
} else {
walletFragmentStyle = new WalletFragmentStyle()
.setBuyButtonText(WalletFragmentStyle.BuyButtonText.LOGO_ONLY)
.setBuyButtonAppearance(WalletFragmentStyle.BuyButtonAppearance.ANDROID_PAY_LIGHT_WITH_BORDER)
.setBuyButtonWidth(WalletFragmentStyle.Dimension.WRAP_CONTENT);
}
optionsBuilder.setFragmentStyle(walletFragmentStyle);
WalletFragment walletFragment = WalletFragment.newInstance(optionsBuilder.build());
FragmentManager fragmentManager = getParentActivity().getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(fragment_container_id, walletFragment);
fragmentTransaction.commit();
ArrayList<TLRPC.TL_labeledPrice> arrayList = new ArrayList<>();
arrayList.addAll(paymentForm.invoice.prices);
if (shippingOption != null) {
arrayList.addAll(shippingOption.prices);
}
totalPriceDecimal = getTotalPriceDecimalString(arrayList);
PaymentMethodTokenizationParameters parameters;
if (androidPayPublicKey != null) {
parameters = PaymentMethodTokenizationParameters.newBuilder()
.setPaymentMethodTokenizationType(PaymentMethodTokenizationType.NETWORK_TOKEN)
.addParameter("publicKey", androidPayPublicKey)
.build();
} else {
parameters = PaymentMethodTokenizationParameters.newBuilder()
.setPaymentMethodTokenizationType(PaymentMethodTokenizationType.PAYMENT_GATEWAY)
.addParameter("gateway", "stripe")
.addParameter("stripe:publishableKey", stripeApiKey)
.addParameter("stripe:version", StripeApiHandler.VERSION)
.build();
}
MaskedWalletRequest maskedWalletRequest = MaskedWalletRequest.newBuilder()
.setPaymentMethodTokenizationParameters(parameters)
.setEstimatedTotalPrice(totalPriceDecimal)
.setCurrencyCode(paymentForm.invoice.currency)
.build();
WalletFragmentInitParams initParams = WalletFragmentInitParams.newBuilder()
.setMaskedWalletRequest(maskedWalletRequest)
.setMaskedWalletRequestCode(LOAD_MASKED_WALLET_REQUEST_CODE)
.build();
walletFragment.initialize(initParams);
androidPayContainer.setVisibility(View.VISIBLE);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(androidPayContainer, "alpha", 0.0f, 1.0f));
animatorSet.setInterpolator(new DecelerateInterpolator());
animatorSet.setDuration(180);
animatorSet.start();
}
开发者ID:DrKLO,项目名称:Telegram,代码行数:72,代码来源:PaymentFormActivity.java
注:本文中的com.google.android.gms.wallet.PaymentMethodTokenizationType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论