Class CartAddLineItemActionBuilder

java.lang.Object
com.commercetools.api.models.cart.CartAddLineItemActionBuilder
All Implemented Interfaces:
Builder<CartAddLineItemAction>

public class CartAddLineItemActionBuilder extends Object implements Builder<CartAddLineItemAction>
CartAddLineItemActionBuilder
Example to create an instance using the builder pattern

     CartAddLineItemAction cartAddLineItemAction = CartAddLineItemAction.builder()
             .build()
 
  • Constructor Details

    • CartAddLineItemActionBuilder

      public CartAddLineItemActionBuilder()
  • Method Details

    • key

      public CartAddLineItemActionBuilder key(@Nullable String key)

      User-defined unique identifier of the LineItem.

      Parameters:
      key - value to be set
      Returns:
      Builder
    • productId

      public CartAddLineItemActionBuilder productId(@Nullable String productId)

      id of the published Product.

      Either the productId and variantId, or sku must be provided.

      Parameters:
      productId - value to be set
      Returns:
      Builder
    • variantId

      public CartAddLineItemActionBuilder variantId(@Nullable Long variantId)

      id of the ProductVariant in the Product. If not provided, the Master Variant is used.

      Either the productId and variantId, or sku must be provided.

      Parameters:
      variantId - value to be set
      Returns:
      Builder
    • sku

      public CartAddLineItemActionBuilder sku(@Nullable String sku)

      SKU of the ProductVariant.

      Either the productId and variantId, or sku must be provided.

      Parameters:
      sku - value to be set
      Returns:
      Builder
    • quantity

      public CartAddLineItemActionBuilder quantity(@Nullable Long quantity)

      Quantity of the Product Variant to add to the Cart.

      Parameters:
      quantity - value to be set
      Returns:
      Builder
    • addedAt

      public CartAddLineItemActionBuilder addedAt(@Nullable ZonedDateTime addedAt)

      Date and time (UTC) the Product Variant is added to the Cart. If not set, it defaults to the current date and time.

      Optional for backwards compatibility reasons.

      Parameters:
      addedAt - value to be set
      Returns:
      Builder
    • distributionChannel

      Used to select a Product Price. The Channel must have the ProductDistribution ChannelRoleEnum. If the Cart is bound to a Store with distributionChannels set, the Channel must match one of the Store's distribution channels.

      Parameters:
      builder - function to build the distributionChannel value
      Returns:
      Builder
    • withDistributionChannel

      Used to select a Product Price. The Channel must have the ProductDistribution ChannelRoleEnum. If the Cart is bound to a Store with distributionChannels set, the Channel must match one of the Store's distribution channels.

      Parameters:
      builder - function to build the distributionChannel value
      Returns:
      Builder
    • distributionChannel

      public CartAddLineItemActionBuilder distributionChannel(@Nullable ChannelResourceIdentifier distributionChannel)

      Used to select a Product Price. The Channel must have the ProductDistribution ChannelRoleEnum. If the Cart is bound to a Store with distributionChannels set, the Channel must match one of the Store's distribution channels.

      Parameters:
      distributionChannel - value to be set
      Returns:
      Builder
    • supplyChannel

      Used to identify Inventory entries that must be reserved. The Channel must have the InventorySupply ChannelRoleEnum.

      Parameters:
      builder - function to build the supplyChannel value
      Returns:
      Builder
    • withSupplyChannel

      Used to identify Inventory entries that must be reserved. The Channel must have the InventorySupply ChannelRoleEnum.

      Parameters:
      builder - function to build the supplyChannel value
      Returns:
      Builder
    • supplyChannel

      public CartAddLineItemActionBuilder supplyChannel(@Nullable ChannelResourceIdentifier supplyChannel)

      Used to identify Inventory entries that must be reserved. The Channel must have the InventorySupply ChannelRoleEnum.

      Parameters:
      supplyChannel - value to be set
      Returns:
      Builder
    • externalPrice

      Sets the LineItem price value, and the priceMode to ExternalPrice LineItemPriceMode.

      Parameters:
      builder - function to build the externalPrice value
      Returns:
      Builder
    • withExternalPrice

      public CartAddLineItemActionBuilder withExternalPrice(Function<MoneyBuilder,Money> builder)

      Sets the LineItem price value, and the priceMode to ExternalPrice LineItemPriceMode.

      Parameters:
      builder - function to build the externalPrice value
      Returns:
      Builder
    • externalPrice

      public CartAddLineItemActionBuilder externalPrice(@Nullable Money externalPrice)

      Sets the LineItem price value, and the priceMode to ExternalPrice LineItemPriceMode.

      Parameters:
      externalPrice - value to be set
      Returns:
      Builder
    • externalTotalPrice

      Sets the LineItem price and totalPrice values, and the priceMode to ExternalTotal LineItemPriceMode.

      Parameters:
      builder - function to build the externalTotalPrice value
      Returns:
      Builder
    • withExternalTotalPrice

      Sets the LineItem price and totalPrice values, and the priceMode to ExternalTotal LineItemPriceMode.

      Parameters:
      builder - function to build the externalTotalPrice value
      Returns:
      Builder
    • externalTotalPrice

      public CartAddLineItemActionBuilder externalTotalPrice(@Nullable ExternalLineItemTotalPrice externalTotalPrice)

      Sets the LineItem price and totalPrice values, and the priceMode to ExternalTotal LineItemPriceMode.

      Parameters:
      externalTotalPrice - value to be set
      Returns:
      Builder
    • externalTaxRate

      Sets the external Tax Rate for the Line Item, if the Cart has the External TaxMode and Single ShippingMode. If the Cart has Multiple ShippingMode, the Tax Rate is accepted but ignored.

      Parameters:
      builder - function to build the externalTaxRate value
      Returns:
      Builder
    • withExternalTaxRate

      Sets the external Tax Rate for the Line Item, if the Cart has the External TaxMode and Single ShippingMode. If the Cart has Multiple ShippingMode, the Tax Rate is accepted but ignored.

      Parameters:
      builder - function to build the externalTaxRate value
      Returns:
      Builder
    • externalTaxRate

      public CartAddLineItemActionBuilder externalTaxRate(@Nullable ExternalTaxRateDraft externalTaxRate)

      Sets the external Tax Rate for the Line Item, if the Cart has the External TaxMode and Single ShippingMode. If the Cart has Multiple ShippingMode, the Tax Rate is accepted but ignored.

      Parameters:
      externalTaxRate - value to be set
      Returns:
      Builder
    • perMethodExternalTaxRate

      public CartAddLineItemActionBuilder perMethodExternalTaxRate(@Nullable MethodExternalTaxRateDraft... perMethodExternalTaxRate)

      Sets the external Tax Rates for individual Shipping Methods, if the Cart has the External TaxMode and Multiple ShippingMode.

      Parameters:
      perMethodExternalTaxRate - value to be set
      Returns:
      Builder
    • perMethodExternalTaxRate

      public CartAddLineItemActionBuilder perMethodExternalTaxRate(@Nullable List<MethodExternalTaxRateDraft> perMethodExternalTaxRate)

      Sets the external Tax Rates for individual Shipping Methods, if the Cart has the External TaxMode and Multiple ShippingMode.

      Parameters:
      perMethodExternalTaxRate - value to be set
      Returns:
      Builder
    • plusPerMethodExternalTaxRate

      public CartAddLineItemActionBuilder plusPerMethodExternalTaxRate(@Nullable MethodExternalTaxRateDraft... perMethodExternalTaxRate)

      Sets the external Tax Rates for individual Shipping Methods, if the Cart has the External TaxMode and Multiple ShippingMode.

      Parameters:
      perMethodExternalTaxRate - value to be set
      Returns:
      Builder
    • plusPerMethodExternalTaxRate

      Sets the external Tax Rates for individual Shipping Methods, if the Cart has the External TaxMode and Multiple ShippingMode.

      Parameters:
      builder - function to build the perMethodExternalTaxRate value
      Returns:
      Builder
    • withPerMethodExternalTaxRate

      Sets the external Tax Rates for individual Shipping Methods, if the Cart has the External TaxMode and Multiple ShippingMode.

      Parameters:
      builder - function to build the perMethodExternalTaxRate value
      Returns:
      Builder
    • addPerMethodExternalTaxRate

      Sets the external Tax Rates for individual Shipping Methods, if the Cart has the External TaxMode and Multiple ShippingMode.

      Parameters:
      builder - function to build the perMethodExternalTaxRate value
      Returns:
      Builder
    • setPerMethodExternalTaxRate

      Sets the external Tax Rates for individual Shipping Methods, if the Cart has the External TaxMode and Multiple ShippingMode.

      Parameters:
      builder - function to build the perMethodExternalTaxRate value
      Returns:
      Builder
    • inventoryMode

      public CartAddLineItemActionBuilder inventoryMode(@Nullable InventoryMode inventoryMode)

      Inventory mode specific to the Line Item only, and valid for the entire quantity of the Line Item. Set only if the inventory mode should be different from the inventoryMode specified on the Cart.

      Parameters:
      inventoryMode - value to be set
      Returns:
      Builder
    • shippingDetails

      Container for Line Item-specific addresses.

      Parameters:
      builder - function to build the shippingDetails value
      Returns:
      Builder
    • withShippingDetails

      Container for Line Item-specific addresses.

      Parameters:
      builder - function to build the shippingDetails value
      Returns:
      Builder
    • shippingDetails

      public CartAddLineItemActionBuilder shippingDetails(@Nullable ItemShippingDetailsDraft shippingDetails)

      Container for Line Item-specific addresses.

      Parameters:
      shippingDetails - value to be set
      Returns:
      Builder
    • custom

      Custom Fields for the Line Item.

      Parameters:
      builder - function to build the custom value
      Returns:
      Builder
    • withCustom

      Custom Fields for the Line Item.

      Parameters:
      builder - function to build the custom value
      Returns:
      Builder
    • custom

      public CartAddLineItemActionBuilder custom(@Nullable CustomFieldsDraft custom)

      Custom Fields for the Line Item.

      Parameters:
      custom - value to be set
      Returns:
      Builder
    • getKey

      @Nullable public String getKey()

      User-defined unique identifier of the LineItem.

      Returns:
      key
    • getProductId

      @Nullable public String getProductId()

      id of the published Product.

      Either the productId and variantId, or sku must be provided.

      Returns:
      productId
    • getVariantId

      @Nullable public Long getVariantId()

      id of the ProductVariant in the Product. If not provided, the Master Variant is used.

      Either the productId and variantId, or sku must be provided.

      Returns:
      variantId
    • getSku

      @Nullable public String getSku()

      SKU of the ProductVariant.

      Either the productId and variantId, or sku must be provided.

      Returns:
      sku
    • getQuantity

      @Nullable public Long getQuantity()

      Quantity of the Product Variant to add to the Cart.

      Returns:
      quantity
    • getAddedAt

      @Nullable public ZonedDateTime getAddedAt()

      Date and time (UTC) the Product Variant is added to the Cart. If not set, it defaults to the current date and time.

      Optional for backwards compatibility reasons.

      Returns:
      addedAt
    • getDistributionChannel

      @Nullable public ChannelResourceIdentifier getDistributionChannel()

      Used to select a Product Price. The Channel must have the ProductDistribution ChannelRoleEnum. If the Cart is bound to a Store with distributionChannels set, the Channel must match one of the Store's distribution channels.

      Returns:
      distributionChannel
    • getSupplyChannel

      @Nullable public ChannelResourceIdentifier getSupplyChannel()

      Used to identify Inventory entries that must be reserved. The Channel must have the InventorySupply ChannelRoleEnum.

      Returns:
      supplyChannel
    • getExternalPrice

      @Nullable public Money getExternalPrice()

      Sets the LineItem price value, and the priceMode to ExternalPrice LineItemPriceMode.

      Returns:
      externalPrice
    • getExternalTotalPrice

      @Nullable public ExternalLineItemTotalPrice getExternalTotalPrice()

      Sets the LineItem price and totalPrice values, and the priceMode to ExternalTotal LineItemPriceMode.

      Returns:
      externalTotalPrice
    • getExternalTaxRate

      @Nullable public ExternalTaxRateDraft getExternalTaxRate()

      Sets the external Tax Rate for the Line Item, if the Cart has the External TaxMode and Single ShippingMode. If the Cart has Multiple ShippingMode, the Tax Rate is accepted but ignored.

      Returns:
      externalTaxRate
    • getPerMethodExternalTaxRate

      @Nullable public List<MethodExternalTaxRateDraft> getPerMethodExternalTaxRate()

      Sets the external Tax Rates for individual Shipping Methods, if the Cart has the External TaxMode and Multiple ShippingMode.

      Returns:
      perMethodExternalTaxRate
    • getInventoryMode

      @Nullable public InventoryMode getInventoryMode()

      Inventory mode specific to the Line Item only, and valid for the entire quantity of the Line Item. Set only if the inventory mode should be different from the inventoryMode specified on the Cart.

      Returns:
      inventoryMode
    • getShippingDetails

      @Nullable public ItemShippingDetailsDraft getShippingDetails()

      Container for Line Item-specific addresses.

      Returns:
      shippingDetails
    • getCustom

      @Nullable public CustomFieldsDraft getCustom()

      Custom Fields for the Line Item.

      Returns:
      custom
    • build

      public CartAddLineItemAction build()
      builds CartAddLineItemAction with checking for non-null required values
      Specified by:
      build in interface Builder<CartAddLineItemAction>
      Returns:
      CartAddLineItemAction
    • buildUnchecked

      public CartAddLineItemAction buildUnchecked()
      builds CartAddLineItemAction without checking for non-null required values
      Returns:
      CartAddLineItemAction
    • of

      public static CartAddLineItemActionBuilder of()
      factory method for an instance of CartAddLineItemActionBuilder
      Returns:
      builder
    • of

      create builder for CartAddLineItemAction instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder