• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LineItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getFullWalletRequest

import com.google.android.gms.wallet.LineItem; //导入依赖的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


示例2: createFullWalletRequest

import com.google.android.gms.wallet.LineItem; //导入依赖的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


示例3: PayCart

import com.google.android.gms.wallet.LineItem; //导入依赖的package包/类
protected PayCart(Parcel in) {
  currencyCode = in.readString();
  countryCode = in.readString();
  merchantName = in.readString();
  shipsToCountries = Collections.unmodifiableList(in.createStringArrayList());
  shippingAddressRequired = in.readByte() != 0;
  phoneNumberRequired = in.readByte() != 0;
  lineItems = Collections.unmodifiableList(in.createTypedArrayList(LineItem.CREATOR));
  subtotal = BigDecimal.valueOf(in.readDouble()).setScale(2, RoundingMode.HALF_EVEN);
  if (in.readByte() == 1) {
    taxPrice = BigDecimal.valueOf(in.readDouble()).setScale(2, RoundingMode.HALF_EVEN);
  } else {
    taxPrice = null;
  }
  if (in.readByte() == 1) {
    shippingPrice = BigDecimal.valueOf(in.readDouble()).setScale(2, RoundingMode.HALF_EVEN);
  } else {
    shippingPrice = null;
  }
  totalPrice = BigDecimal.valueOf(in.readDouble()).setScale(2, RoundingMode.HALF_EVEN);
}
 
开发者ID:Shopify,项目名称:mobile-buy-sdk-android,代码行数:22,代码来源:PayCart.java


示例4: cartBuilder

import com.google.android.gms.wallet.LineItem; //导入依赖的package包/类
Cart.Builder cartBuilder() {
  Cart.Builder builder = Cart.newBuilder()
    .setCurrencyCode(currencyCode)
    .setTotalPrice(totalPrice.toString())
    .setLineItems(lineItems);

  if (taxPrice != null) {
    builder.addLineItem(LineItem.newBuilder()
      .setCurrencyCode(currencyCode)
      .setDescription("Tax")
      .setRole(LineItem.Role.TAX)
      .setTotalPrice(taxPrice.toString())
      .build());
  }

  if (shippingPrice != null) {
    builder.addLineItem(LineItem.newBuilder()
      .setCurrencyCode(currencyCode)
      .setDescription("Shipping")
      .setRole(LineItem.Role.SHIPPING)
      .setTotalPrice(shippingPrice.toString())
      .build());
  }

  return builder;
}
 
开发者ID:Shopify,项目名称:mobile-buy-sdk-android,代码行数:27,代码来源:PayCart.java


示例5: addLineItem

import com.google.android.gms.wallet.LineItem; //导入依赖的package包/类
public Builder addLineItem(@NonNull final String title, final int quantity, @NonNull final BigDecimal price) {
  checkNotEmpty(title, "title can't be empty");
  if (quantity <= 0) {
    throw new IllegalArgumentException("quantity can't be less than 1");
  }
  checkNotNull(price, "price == null");

  LineItem lineItem = LineItem.newBuilder()
    .setQuantity(Integer.toString(quantity))
    .setUnitPrice(price.toString())
    .setTotalPrice(price.multiply(BigDecimal.valueOf(quantity)).toString())
    .setDescription(title)
    .setCurrencyCode(currencyCode)
    .setRole(Role.REGULAR)
    .build();
  lineItems.add(lineItem);
  lineItemSubtotal = lineItemSubtotal.add(price.multiply(BigDecimal.valueOf(quantity)));
  return this;
}
 
开发者ID:Shopify,项目名称:mobile-buy-sdk-android,代码行数:20,代码来源:PayCart.java


示例6: getFullWalletRequest

import com.google.android.gms.wallet.LineItem; //导入依赖的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


示例7: createMaskedWalletRequest

import com.google.android.gms.wallet.LineItem; //导入依赖的package包/类
/**
 * Creates a MaskedWalletRequest
 *
 * @param itemInfo {@link com.google.android.gms.samples.wallet.ItemInfo} containing details
 *                 of an item.
 * @return {@link MaskedWalletRequest} instance
 */
public static MaskedWalletRequest createMaskedWalletRequest(ItemInfo itemInfo) {

    // Build a List of all line items
    List<LineItem> lineItems = buildLineItems(itemInfo, true);

    // Calculate the cart total by iterating over the line items.
    String cartTotal = calculateCartTotal(lineItems);

    return MaskedWalletRequest.newBuilder()
            .setMerchantName(Constants.MERCHANT_NAME)
            .setPhoneNumberRequired(true)
            .setShippingAddressRequired(true)
            .setCurrencyCode(Constants.CURRENCY_CODE_USD)
            .setEstimatedTotalPrice(cartTotal)
            // Create a Cart with the current line items. Provide all the information
            // available up to this point with estimates for shipping and tax included.
            .setCart(Cart.newBuilder()
                    .setCurrencyCode(Constants.CURRENCY_CODE_USD)
                    .setTotalPrice(cartTotal)
                    .setLineItems(lineItems)
                    .build())
            // Indicate whether we need the Wallet Objects associated with the user.
            .setShouldRetrieveWalletObjects(true)
            .build();
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:33,代码来源:WalletUtil.java


示例8: calculateCartTotal

import com.google.android.gms.wallet.LineItem; //导入依赖的package包/类
/**
 *
 * @param lineItems List of {@link com.google.android.gms.wallet.LineItem} used for calculating
 *                  the cart total.
 * @return cart total.
 */
private static String calculateCartTotal(List<LineItem> lineItems) {
    BigDecimal cartTotal = BigDecimal.ZERO;

    // Calculate the total price by adding up each of the line items
    for (LineItem lineItem: lineItems) {
        BigDecimal lineItemTotal = lineItem.getTotalPrice() == null ?
                new BigDecimal(lineItem.getUnitPrice())
                        .multiply(new BigDecimal(lineItem.getQuantity())) :
                new BigDecimal(lineItem.getTotalPrice());

        cartTotal = cartTotal.add(lineItemTotal);
    }

    return cartTotal.setScale(2, RoundingMode.HALF_EVEN).toString();
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:22,代码来源:WalletUtil.java


示例9: createFullWalletRequest

import com.google.android.gms.wallet.LineItem; //导入依赖的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


示例10: generateMaskedWalletRequest

import com.google.android.gms.wallet.LineItem; //导入依赖的package包/类
private MaskedWalletRequest generateMaskedWalletRequest() {
  MaskedWalletRequest maskedWalletRequest =
      MaskedWalletRequest.newBuilder()
          .setMerchantName("Google I/O Codelab")
          .setPhoneNumberRequired(true)
          .setShippingAddressRequired(true)
          .setCurrencyCode("USD")
          .setShouldRetrieveWalletObjects(true)
          .setEstimatedTotalPrice("10.00")
          .setCart(Cart.newBuilder()
              .setCurrencyCode("USD")
              .setTotalPrice("10.00")
              .addLineItem(LineItem.newBuilder()
                  .setCurrencyCode("USD")
                  .setDescription("Google I/O Sticker")
                  .setQuantity("1")
                  .setUnitPrice("10.00")
                  .setTotalPrice("10.00")
                  .build())
              .build())
          .build();

  return maskedWalletRequest;
}
 
开发者ID:googlesamples,项目名称:io2014-codelabs,代码行数:25,代码来源:MainActivity.java


示例11: generateFullWalletRequest

import com.google.android.gms.wallet.LineItem; //导入依赖的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


示例12: getMaskedWalletRequest

import com.google.android.gms.wallet.LineItem; //导入依赖的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


示例13: createMaskedWalletRequest

import com.google.android.gms.wallet.LineItem; //导入依赖的package包/类
private static MaskedWalletRequest createMaskedWalletRequest(List<Product> product,
                                                             String orderTotal,
                                                             PaymentMethodTokenizationParameters parameters,
                                                             Context context) {
    // Build a List of all line items
    List<LineItem> lineItems = buildLineItems(product, true, context);

    // [START masked_wallet_request]
    MaskedWalletRequest request = MaskedWalletRequest.newBuilder()
            .setMerchantName(Constants.MERCHANT_NAME)
            .setPhoneNumberRequired(true)
            .setShippingAddressRequired(true)
            .setCurrencyCode(PreferencesUtil.getDefaultSharedPreferences(context).getString(context.getString(R.string.active_currency), "USD"))
            .setEstimatedTotalPrice(orderTotal)
            // Create a Cart with the current line items. Provide all the information
            // available up to this point with estimates for shipping and tax included.
            .setCart(Cart.newBuilder()
                    .setCurrencyCode(PreferencesUtil.getDefaultSharedPreferences(context).getString(context.getString(R.string.active_currency), "USD"))
                    .setTotalPrice(orderTotal)
                    .setLineItems(lineItems)
                    .build())
            .setPaymentMethodTokenizationParameters(parameters)
            .build();

    return request;
    // [END masked_wallet_request]
}
 
开发者ID:Adyen,项目名称:adyen-android-pay-sample-code,代码行数:28,代码来源:WalletUtil.java


示例14: buildLineItems

import com.google.android.gms.wallet.LineItem; //导入依赖的package包/类
/**
 * Build a list of line items based on the {@link Product} and a boolean that indicates
 * whether to use estimated values of tax and shipping for setting up the
 * {@link MaskedWalletRequest} or actual values in the case of a {@link FullWalletRequest}
 *
 * @param products {@link Product} used for building the
 *                 {@link com.google.android.gms.wallet.LineItem} list.
 * @param isEstimate {@code boolean} that indicates whether to use estimated values for
 *                   shipping and tax values.
 * @return list of line items
 */
private static List<LineItem> buildLineItems(List<Product> products, boolean isEstimate, Context context) {
    List<LineItem> list = new ArrayList<LineItem>();

    for (Product product : products) {
        String itemPrice = toDollars((long) product.getPrice());

        list.add(LineItem.newBuilder()
                .setCurrencyCode(PreferencesUtil.getDefaultSharedPreferences(context).getString(context.getString(R.string.active_currency), "USD"))
                .setDescription(product.getName())
                .setQuantity("1")
                .setUnitPrice(itemPrice)
                .setTotalPrice(itemPrice)
                .build());
    }

    String shippingPrice = toDollars((long) 0.11);

    list.add(LineItem.newBuilder()
            .setCurrencyCode(PreferencesUtil.getDefaultSharedPreferences(context).getString(context.getString(R.string.active_currency), "USD"))
            .setDescription(Constants.DESCRIPTION_LINE_ITEM_SHIPPING)
            .setRole(LineItem.Role.SHIPPING)
            .setTotalPrice(shippingPrice)
            .build());

    String tax = toDollars((long) 0.11);

    list.add(LineItem.newBuilder()
            .setCurrencyCode(PreferencesUtil.getDefaultSharedPreferences(context).getString(context.getString(R.string.active_currency), "USD"))
            .setDescription(Constants.DESCRIPTION_LINE_ITEM_TAX)
            .setRole(LineItem.Role.TAX)
            .setTotalPrice(tax)
            .build());

    return list;
}
 
开发者ID:Adyen,项目名称:adyen-android-pay-sample-code,代码行数:47,代码来源:WalletUtil.java


示例15: getAndroidPayCart

import com.google.android.gms.wallet.LineItem; //导入依赖的package包/类
private Cart getAndroidPayCart() {
    return Cart.newBuilder()
            .setCurrencyCode(Settings.getAndroidPayCurrency(this))
            .setTotalPrice("1.00")
            .addLineItem(LineItem.newBuilder()
                    .setCurrencyCode("USD")
                    .setDescription("Description")
                    .setQuantity("1")
                    .setUnitPrice("1.00")
                    .setTotalPrice("1.00")
                    .build())
            .build();
}
 
开发者ID:braintree,项目名称:braintree-android-drop-in,代码行数:14,代码来源:MainActivity.java


示例16: lineItemFromPayloadLineItem

import com.google.android.gms.wallet.LineItem; //导入依赖的package包/类
private static @NonNull LineItem lineItemFromPayloadLineItem(final @NonNull AndroidPayPayload.Cart.LineItem payloadLineItem) {
  return LineItem.newBuilder()
    .setCurrencyCode(payloadLineItem.currencyCode())
    .setDescription(payloadLineItem.description())
    .setQuantity(payloadLineItem.quantity())
    .setTotalPrice(payloadLineItem.totalPrice())
    .setUnitPrice(payloadLineItem.unitPrice())
    .setRole(LineItem.Role.REGULAR)
    .build();
}
 
开发者ID:kickstarter,项目名称:android-oss,代码行数:11,代码来源:AndroidPayUtils.java


示例17: getMaskedWalletRequest

import com.google.android.gms.wallet.LineItem; //导入依赖的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


示例18: buildLineItems

import com.google.android.gms.wallet.LineItem; //导入依赖的package包/类
/**
 * Build a list of line items based on the {@link ItemInfo} and a boolean that indicates
 * whether to use estimated values of tax and shipping for setting up the
 * {@link MaskedWalletRequest} or actual values in the case of a {@link FullWalletRequest}
 *
 * @param itemInfo {@link com.google.android.gms.samples.wallet.ItemInfo} used for building the
 *                 {@link com.google.android.gms.wallet.LineItem} list.
 * @param isEstimate {@code boolean} that indicates whether to use estimated values for
 *                   shipping and tax values.
 * @return list of line items
 */
private static List<LineItem> buildLineItems(ItemInfo itemInfo, boolean isEstimate) {
    List<LineItem> list = new ArrayList<LineItem>();
    String itemPrice = toDollars(itemInfo.priceMicros);

    list.add(LineItem.newBuilder()
            .setCurrencyCode(Constants.CURRENCY_CODE_USD)
            .setDescription(itemInfo.name)
            .setQuantity("1")
            .setUnitPrice(itemPrice)
            .setTotalPrice(itemPrice)
            .build());

    String shippingPrice = toDollars(
            isEstimate ? itemInfo.estimatedShippingPriceMicros : itemInfo.shippingPriceMicros);

    list.add(LineItem.newBuilder()
            .setCurrencyCode(Constants.CURRENCY_CODE_USD)
            .setDescription(Constants.DESCRIPTION_LINE_ITEM_SHIPPING)
            .setRole(LineItem.Role.SHIPPING)
            .setTotalPrice(shippingPrice)
            .build());

    String tax = toDollars(
            isEstimate ? itemInfo.estimatedTaxMicros : itemInfo.taxMicros);

    list.add(LineItem.newBuilder()
            .setCurrencyCode(Constants.CURRENCY_CODE_USD)
            .setDescription(Constants.DESCRIPTION_LINE_ITEM_TAX)
            .setRole(LineItem.Role.TAX)
            .setTotalPrice(tax)
            .build());

    return list;
}
 
开发者ID:TerribleDev,项目名称:XamarinAdmobTutorial,代码行数:46,代码来源:WalletUtil.java


示例19: lineItemsFromPayload

import com.google.android.gms.wallet.LineItem; //导入依赖的package包/类
private static @NonNull List<LineItem> lineItemsFromPayload(final @NonNull AndroidPayPayload payload) {
  return Observable.from(payload.cart().lineItems())
    .map(AndroidPayUtils::lineItemFromPayloadLineItem)
    .toList().toBlocking().first();
}
 
开发者ID:kickstarter,项目名称:android-oss,代码行数:6,代码来源:AndroidPayUtils.java


示例20: successBuild

import com.google.android.gms.wallet.LineItem; //导入依赖的package包/类
@Test public void successBuild() throws Exception {
  PayCart payCart = PayCart.builder()
    .merchantName("merchantName")
    .currencyCode("UAH")
    .countryCode("UA")
    .shippingAddressRequired(true)
    .addLineItem("lineItem1", 10, BigDecimal.valueOf(1.09))
    .addLineItem("lineItem2", 20, BigDecimal.valueOf(2.99))
    .phoneNumberRequired(true)
    .shipsToCountries(Arrays.asList("US, CA, UA"))
    .shippingPrice(BigDecimal.valueOf(3.01))
    .taxPrice(BigDecimal.valueOf(2.01))
    .subtotal(BigDecimal.valueOf(29.01))
    .totalPrice(BigDecimal.valueOf(100.99))
    .build();

  assertThat(payCart.merchantName).isEqualTo("merchantName");
  assertThat(payCart.currencyCode).isEqualTo("UAH");
  assertThat(payCart.countryCode).isEqualTo("UA");

  assertThat(payCart.shippingAddressRequired).isTrue();
  assertThat(payCart.lineItems).hasSize(2);

  assertThat(payCart.lineItems.get(0).getDescription()).isEqualTo("lineItem1");
  assertThat(payCart.lineItems.get(0).getQuantity()).isEqualTo("10");
  assertThat(payCart.lineItems.get(0).getUnitPrice()).isEqualTo("1.09");
  assertThat(payCart.lineItems.get(0).getTotalPrice()).isEqualTo("10.90");
  assertThat(payCart.lineItems.get(0).getCurrencyCode()).isEqualTo("UAH");
  assertThat(payCart.lineItems.get(0).getRole()).isEqualTo(LineItem.Role.REGULAR);

  assertThat(payCart.lineItems.get(1).getDescription()).isEqualTo("lineItem2");
  assertThat(payCart.lineItems.get(1).getQuantity()).isEqualTo("20");
  assertThat(payCart.lineItems.get(1).getUnitPrice()).isEqualTo("2.99");
  assertThat(payCart.lineItems.get(1).getTotalPrice()).isEqualTo("59.80");
  assertThat(payCart.lineItems.get(1).getCurrencyCode()).isEqualTo("UAH");
  assertThat(payCart.lineItems.get(1).getRole()).isEqualTo(LineItem.Role.REGULAR);

  assertThat(payCart.phoneNumberRequired).isTrue();
  assertThat(payCart.shipsToCountries).isEqualTo(Arrays.asList("US, CA, UA"));
  assertThat(payCart.shippingPrice).isEqualTo(BigDecimal.valueOf(3.01));
  assertThat(payCart.taxPrice).isEqualTo(BigDecimal.valueOf(2.01));
  assertThat(payCart.subtotal).isEqualTo(BigDecimal.valueOf(29.01));
  assertThat(payCart.totalPrice).isEqualTo(BigDecimal.valueOf(100.99));
}
 
开发者ID:Shopify,项目名称:mobile-buy-sdk-android,代码行数:45,代码来源:PayCartTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RpcDetailedMetrics类代码示例发布时间:2022-05-22
下一篇:
Java OuterLanguageElement类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap