本文整理汇总了Java中com.google.android.gms.wallet.FullWalletRequest类的典型用法代码示例。如果您正苦于以下问题:Java FullWalletRequest类的具体用法?Java FullWalletRequest怎么用?Java FullWalletRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FullWalletRequest类属于com.google.android.gms.wallet包,在下文中一共展示了FullWalletRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createFullWalletRequest
import com.google.android.gms.wallet.FullWalletRequest; //导入依赖的package包/类
/**
* @param googleTransactionId
* @return {@link FullWalletRequest} instance
*/
public FullWalletRequest createFullWalletRequest(String googleTransactionId) {
// [START full_wallet_request]
return FullWalletRequest.newBuilder()
.setGoogleTransactionId(googleTransactionId)
.setCart(Cart.newBuilder()
.setCurrencyCode(currency)
.setTotalPrice(cartTotal)
/*
.addLineItem(
LineItem.newBuilder()
.setCurrencyCode("GBP")
.setQuantity("2")
.setUnitPrice("0.50")
.setTotalPrice("1.00")
.setDescription("Description")
.build())
*/
.build())
.build();
// [END full_wallet_request]
}
开发者ID:Adyen,项目名称:adyen-android,代码行数:27,代码来源:AndroidPayActivity.java
示例2: getFullWalletRequest
import com.google.android.gms.wallet.FullWalletRequest; //导入依赖的package包/类
FullWalletRequest getFullWalletRequest() {
return FullWalletRequest.newBuilder()
.setGoogleTransactionId(mMaskedWallet.getGoogleTransactionId())
.setCart(Cart.newBuilder()
.setCurrencyCode(Constants.DEFAULT_CURRENCY.getCode())
.setTotalPrice("2.00")
.addLineItem(LineItem.newBuilder()
.setCurrencyCode(Constants.DEFAULT_CURRENCY.getCode())
.setDescription(mShopItem.getName())
.setQuantity(Integer.toString(mShopItem.getAmount()))
.setUnitPrice("2.00")
.setTotalPrice("2.00")
.build())
.build())
.build();
}
开发者ID:ChristopherAbram,项目名称:Book-Shelf,代码行数:18,代码来源:AndroidPayActivity.java
示例3: createFullWalletRequest
import com.google.android.gms.wallet.FullWalletRequest; //导入依赖的package包/类
/**
*
* @param products {@link Product} to use for creating
* the {@link com.google.android.gms.wallet.FullWalletRequest}
* @param googleTransactionId
* @return {@link FullWalletRequest} instance
*/
public static FullWalletRequest createFullWalletRequest(List<Product> products,
String orderTotal,
String googleTransactionId,
Context context) {
List<LineItem> lineItems = buildLineItems(products, false, context);
// [START full_wallet_request]
FullWalletRequest request = FullWalletRequest.newBuilder()
.setGoogleTransactionId(googleTransactionId)
.setCart(Cart.newBuilder()
.setCurrencyCode(PreferencesUtil.getDefaultSharedPreferences(context).getString(context.getString(R.string.active_currency), "USD"))
.setTotalPrice(orderTotal)
.setLineItems(lineItems)
.build())
.build();
// [END full_wallet_request]
return request;
}
开发者ID:Adyen,项目名称:adyen-android-pay-sample-code,代码行数:28,代码来源:WalletUtil.java
示例4: getFullWalletRequest
import com.google.android.gms.wallet.FullWalletRequest; //导入依赖的package包/类
FullWalletRequest getFullWalletRequest() {
return FullWalletRequest.newBuilder()
.setGoogleTransactionId(mMaskedWallet.getGoogleTransactionId())
.setCart(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())
.build();
}
开发者ID:simplifycom,项目名称:simplify-android-sample,代码行数:18,代码来源:ConfirmationActivity.java
示例5: createFullWalletRequest
import com.google.android.gms.wallet.FullWalletRequest; //导入依赖的package包/类
/**
*
* @param itemInfo {@link com.google.android.gms.samples.wallet.ItemInfo} to use for creating
* the {@link com.google.android.gms.wallet.FullWalletRequest}
* @param googleTransactionId
* @return {@link FullWalletRequest} instance
*/
public static FullWalletRequest createFullWalletRequest(ItemInfo itemInfo,
String googleTransactionId) {
List<LineItem> lineItems = buildLineItems(itemInfo, false);
String cartTotal = calculateCartTotal(lineItems);
return FullWalletRequest.newBuilder()
.setGoogleTransactionId(googleTransactionId)
.setCart(Cart.newBuilder()
.setCurrencyCode(Constants.CURRENCY_CODE_USD)
.setTotalPrice(cartTotal)
.setLineItems(lineItems)
.build())
.build();
}
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:24,代码来源:WalletUtil.java
示例6: generateFullWalletRequest
import com.google.android.gms.wallet.FullWalletRequest; //导入依赖的package包/类
private FullWalletRequest generateFullWalletRequest(String googleTransactionId) {
FullWalletRequest fullWalletRequest = FullWalletRequest.newBuilder()
.setGoogleTransactionId(googleTransactionId)
.setCart(Cart.newBuilder()
.setCurrencyCode("USD")
.setTotalPrice("10.10")
.addLineItem(LineItem.newBuilder()
.setCurrencyCode("USD")
.setDescription("Google I/O Sticker")
.setQuantity("1")
.setUnitPrice("10.00")
.setTotalPrice("10.00")
.build())
.addLineItem(LineItem.newBuilder()
.setCurrencyCode("USD")
.setDescription("Tax")
.setRole(LineItem.Role.TAX)
.setTotalPrice(".10")
.build())
.build())
.build();
return fullWalletRequest;
}
开发者ID:googlesamples,项目名称:io2014-codelabs,代码行数:24,代码来源:MainActivity.java
示例7: getFullWallet
import com.google.android.gms.wallet.FullWalletRequest; //导入依赖的package包/类
private void getFullWallet() {
FullWalletRequest fullWalletRequest = WalletUtil.createFullWalletRequest(productsList,
String.valueOf(orderTotal),
mMaskedWallet.getGoogleTransactionId(),
getActivity().getApplicationContext());
// [START load_full_wallet]
Wallet.Payments.loadFullWallet(mGoogleApiClient, fullWalletRequest,
REQUEST_CODE_RESOLVE_LOAD_FULL_WALLET);
// [END load_full_wallet]
}
开发者ID:Adyen,项目名称:adyen-android-pay-sample-code,代码行数:12,代码来源:FullWalletConfirmationFragment.java
示例8: createFullWalletRequest
import com.google.android.gms.wallet.FullWalletRequest; //导入依赖的package包/类
public static @NonNull FullWalletRequest createFullWalletRequest(final @NonNull String googleTransactionId,
final @NonNull AndroidPayPayload payload) {
return FullWalletRequest.newBuilder()
.setGoogleTransactionId(googleTransactionId)
.setCart(
Cart.newBuilder()
.setCurrencyCode(payload.cart().currencyCode())
.setTotalPrice(payload.cart().totalPrice())
.setLineItems(lineItemsFromPayload(payload))
.build()
)
.build();
}
开发者ID:kickstarter,项目名称:android-oss,代码行数:15,代码来源:AndroidPayUtils.java
示例9: attemptAndroidPayConfirmation
import com.google.android.gms.wallet.FullWalletRequest; //导入依赖的package包/类
private void attemptAndroidPayConfirmation(final @NonNull MaskedWallet maskedWallet,
final @NonNull AndroidPayPayload payload) {
final FullWalletRequest fullWalletRequest = AndroidPayUtils.createFullWalletRequest(
maskedWallet.getGoogleTransactionId(),
payload
);
Wallet.Payments.loadFullWallet(this.googleApiClient, fullWalletRequest,
ActivityRequestCodes.CHECKOUT_ACTIVITY_WALLET_OBTAINED_FULL);
}
开发者ID:kickstarter,项目名称:android-oss,代码行数:12,代码来源:CheckoutActivity.java
示例10: fullWalletRequest
import com.google.android.gms.wallet.FullWalletRequest; //导入依赖的package包/类
/**
* Construct {@link MaskedWallet} from this {@link PayCart}.
*
* @param maskedWallet masked wallet to be associated with
* @return {@link MaskedWallet}
*/
public FullWalletRequest fullWalletRequest(@NonNull final MaskedWallet maskedWallet) {
checkNotNull(maskedWallet, "maskedWallet can't be empty");
return FullWalletRequest.newBuilder()
.setGoogleTransactionId(maskedWallet.getGoogleTransactionId())
.setCart(cartBuilder().build())
.build();
}
开发者ID:Shopify,项目名称:mobile-buy-sdk-android,代码行数:14,代码来源:PayCart.java
示例11: loadFullWallet
import com.google.android.gms.wallet.FullWalletRequest; //导入依赖的package包/类
private void loadFullWallet(String googleTransactionId) {
FullWalletRequest.Builder fullWalletRequestBuilder = FullWalletRequest.newBuilder()
.setCart(getCart())
.setGoogleTransactionId(googleTransactionId);
Wallet.Payments.loadFullWallet(mGoogleApiClient, fullWalletRequestBuilder.build(), FULL_WALLET_REQUEST);
}
开发者ID:braintree,项目名称:braintree_android,代码行数:8,代码来源:AndroidPayActivity.java
示例12: onActivityResult
import com.google.android.gms.wallet.FullWalletRequest; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
Log.d(TAG, "Request code: " + requestCode + ", result code: " + resultCode);
switch (requestCode) {
case REQUEST_CODE_MASKED_WALLET:
switch (resultCode) {
case Activity.RESULT_OK:
if (data != null) {
maskedWallet = data.getParcelableExtra(WalletConstants.EXTRA_MASKED_WALLET);
if (maskedWallet != null) {
googleApiClient.connect();
FullWalletRequest fullWalletRequest
= createFullWalletRequest(maskedWallet.getGoogleTransactionId());
// [START load_full_wallet]
Wallet.Payments.loadFullWallet(googleApiClient, fullWalletRequest,
REQUEST_CODE_RESOLVE_LOAD_FULL_WALLET);
// [END load_full_wallet]
}
}
break;
case Activity.RESULT_CANCELED:
break;
default:
//paymentRequestListener.onPaymentResult(paymentRequest,
// new PaymentResult(new Throwable(errorCode + ": Android Pay error")));
break;
}
break;
case WalletConstants.RESULT_ERROR:
//paymentRequestListener.onPaymentResult(paymentRequest,
// new PaymentResult(new Throwable(errorCode + ": Android Pay error")));
break;
case REQUEST_CODE_RESOLVE_LOAD_FULL_WALLET:
final Intent intent = new Intent("com.adyen.androidpay.ui.AndroidTokenProvided");
switch (resultCode) {
case RESULT_OK:
if (data != null) {
fullWallet = data.getParcelableExtra(WalletConstants.EXTRA_FULL_WALLET);
intent.putExtra("androidpay.token", fullWallet.getPaymentMethodToken().getToken());
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(intent);
}
break;
case WalletConstants.RESULT_ERROR:
intent.putExtra("androidpay.error", "An error occurred with AndroidPay");
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(intent);
break;
default:
intent.putExtra("androidpay.error", "Unknown result code");
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(intent);
break;
}
break;
default:
super.onActivityResult(requestCode, resultCode, data);
break;
}
}
开发者ID:Adyen,项目名称:adyen-android,代码行数:58,代码来源:AndroidPayActivity.java
示例13: onActivityResultFragment
import com.google.android.gms.wallet.FullWalletRequest; //导入依赖的package包/类
@Override
public void onActivityResultFragment(int requestCode, int resultCode, Intent data) {
if (requestCode == LOAD_MASKED_WALLET_REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK) {
showEditDoneProgress(true, true);
setDonePressed(true);
MaskedWallet maskedWallet = data.getParcelableExtra(WalletConstants.EXTRA_MASKED_WALLET);
Cart.Builder cardBuilder = Cart.newBuilder()
.setCurrencyCode(paymentForm.invoice.currency)
.setTotalPrice(totalPriceDecimal);
ArrayList<TLRPC.TL_labeledPrice> arrayList = new ArrayList<>();
arrayList.addAll(paymentForm.invoice.prices);
if (shippingOption != null) {
arrayList.addAll(shippingOption.prices);
}
for (int a = 0; a < arrayList.size(); a++) {
TLRPC.TL_labeledPrice price = arrayList.get(a);
String amount = LocaleController.getInstance().formatCurrencyDecimalString(price.amount, paymentForm.invoice.currency, false);
cardBuilder.addLineItem(LineItem.newBuilder()
.setCurrencyCode(paymentForm.invoice.currency)
.setQuantity("1")
.setDescription(price.label)
.setTotalPrice(amount)
.setUnitPrice(amount).build());
}
FullWalletRequest fullWalletRequest = FullWalletRequest.newBuilder()
.setCart(cardBuilder.build())
.setGoogleTransactionId(maskedWallet.getGoogleTransactionId())
.build();
Wallet.Payments.loadFullWallet(googleApiClient, fullWalletRequest, LOAD_FULL_WALLET_REQUEST_CODE);
} else {
showEditDoneProgress(true, false);
setDonePressed(false);
}
} else if (requestCode == LOAD_FULL_WALLET_REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK) {
FullWallet fullWallet = data.getParcelableExtra(WalletConstants.EXTRA_FULL_WALLET);
String tokenJSON = fullWallet.getPaymentMethodToken().getToken();
try {
if (androidPayPublicKey != null) {
androidPayCredentials = new TLRPC.TL_inputPaymentCredentialsAndroidPay();
androidPayCredentials.payment_token = new TLRPC.TL_dataJSON();
androidPayCredentials.payment_token.data = tokenJSON;
String[] descriptions = fullWallet.getPaymentDescriptions();
if (descriptions.length > 0) {
cardName = descriptions[0];
} else {
cardName = "Android Pay";
}
} else {
Token token = TokenParser.parseToken(tokenJSON);
paymentJson = String.format(Locale.US, "{\"type\":\"%1$s\", \"id\":\"%2$s\"}", token.getType(), token.getId());
Card card = token.getCard();
cardName = card.getType() + " *" + card.getLast4();
}
goToNextStep();
showEditDoneProgress(true, false);
setDonePressed(false);
} catch (JSONException ignore) {
showEditDoneProgress(true, false);
setDonePressed(false);
}
} else {
showEditDoneProgress(true, false);
setDonePressed(false);
}
}
}
开发者ID:DrKLO,项目名称:Telegram,代码行数:72,代码来源:PaymentFormActivity.java
示例14: requestFullWallet
import com.google.android.gms.wallet.FullWalletRequest; //导入依赖的package包/类
/**
* Requests full wallet for provided {@link PayCart} and {@link MaskedWallet}.
*
* @param googleApiClient {@link GoogleApiClient}
* @param payCart {@link PayCart}
* @param maskedWallet {@link MaskedWallet}
*/
public static void requestFullWallet(final GoogleApiClient googleApiClient, final PayCart payCart, final MaskedWallet maskedWallet) {
FullWalletRequest fullWalletRequest = payCart.fullWalletRequest(maskedWallet);
Wallet.Payments.loadFullWallet(googleApiClient, fullWalletRequest, PayHelper.REQUEST_CODE_FULL_WALLET);
}
开发者ID:Shopify,项目名称:mobile-buy-sdk-android,代码行数:12,代码来源:PayHelper.java
示例15: a
import com.google.android.gms.wallet.FullWalletRequest; //导入依赖的package包/类
public abstract void a(FullWalletRequest paramFullWalletRequest, Bundle paramBundle, it paramit);
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:2,代码来源:is.java
注:本文中的com.google.android.gms.wallet.FullWalletRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论