Interface StagedOrderAddLineItemAction

All Superinterfaces:
CustomizableDraft<StagedOrderAddLineItemAction>, ResourceUpdateAction<StagedOrderUpdateAction>, StagedOrderUpdateAction

public interface StagedOrderAddLineItemAction extends StagedOrderUpdateAction, CustomizableDraft<StagedOrderAddLineItemAction>

If the Cart contains a LineItem for a Product Variant with the same LineItemMode, Custom Fields, supply and distribution channel, then only the quantity of the existing Line Item is increased. If LineItem shippingDetails is set, it is merged. All addresses will be present afterwards and, for address keys present in both shipping details, the quantity will be summed up. A new Line Item is added when the externalPrice or externalTotalPrice is set in this update action. The LineItem price is set as described in Line Item price selection.

If the Tax Rate is not set, a MissingTaxRateForCountry error is returned.

If the Line Items do not have a Price according to the Product priceMode value for a selected currency and/or country, Customer Group, or Channel, a MatchingPriceNotFound error is returned.


Example to create an instance using the builder pattern

     StagedOrderAddLineItemAction stagedOrderAddLineItemAction = StagedOrderAddLineItemAction.builder()
             .build()
 
  • Field Details

    • ADD_LINE_ITEM

      static final String ADD_LINE_ITEM
      discriminator value for StagedOrderAddLineItemAction
      See Also:
  • Method Details

    • getKey

      String getKey()

      User-defined unique identifier of the LineItem.

      Returns:
      key
    • getProductId

      String getProductId()

      id of the published Product.

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

      Returns:
      productId
    • getVariantId

      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

      String getSku()

      SKU of the ProductVariant.

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

      Returns:
      sku
    • getQuantity

      Long getQuantity()

      Quantity of the Product Variant to add to the Cart.

      Returns:
      quantity
    • getAddedAt

      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

      @Valid @Valid 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

      @Valid @Valid ChannelResourceIdentifier getSupplyChannel()

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

      Returns:
      supplyChannel
    • getExternalPrice

      @Valid @Valid Money getExternalPrice()

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

      Returns:
      externalPrice
    • getExternalTotalPrice

      @Valid @Valid ExternalLineItemTotalPrice getExternalTotalPrice()

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

      Returns:
      externalTotalPrice
    • getExternalTaxRate

      @Valid @Valid ExternalTaxRateDraft getExternalTaxRate()

      External Tax Rate for the Line Item, if the Cart has the External TaxMode.

      Returns:
      externalTaxRate
    • getInventoryMode

      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

      @Valid @Valid ItemShippingDetailsDraft getShippingDetails()

      Container for Line Item-specific addresses.

      Returns:
      shippingDetails
    • getCustom

      @Valid @Valid CustomFieldsDraft getCustom()

      Custom Fields for the Line Item.

      Specified by:
      getCustom in interface CustomizableDraft<StagedOrderAddLineItemAction>
      Returns:
      custom
    • setKey

      void setKey(String key)

      User-defined unique identifier of the LineItem.

      Parameters:
      key - value to be set
    • setProductId

      void setProductId(String productId)

      id of the published Product.

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

      Parameters:
      productId - value to be set
    • setVariantId

      void setVariantId(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
    • setSku

      void setSku(String sku)

      SKU of the ProductVariant.

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

      Parameters:
      sku - value to be set
    • setQuantity

      void setQuantity(Long quantity)

      Quantity of the Product Variant to add to the Cart.

      Parameters:
      quantity - value to be set
    • setAddedAt

      void setAddedAt(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
    • setDistributionChannel

      void setDistributionChannel(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
    • setSupplyChannel

      void setSupplyChannel(ChannelResourceIdentifier supplyChannel)

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

      Parameters:
      supplyChannel - value to be set
    • setExternalPrice

      void setExternalPrice(Money externalPrice)

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

      Parameters:
      externalPrice - value to be set
    • setExternalTotalPrice

      void setExternalTotalPrice(ExternalLineItemTotalPrice externalTotalPrice)

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

      Parameters:
      externalTotalPrice - value to be set
    • setExternalTaxRate

      void setExternalTaxRate(ExternalTaxRateDraft externalTaxRate)

      External Tax Rate for the Line Item, if the Cart has the External TaxMode.

      Parameters:
      externalTaxRate - value to be set
    • setInventoryMode

      void setInventoryMode(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
    • setShippingDetails

      void setShippingDetails(ItemShippingDetailsDraft shippingDetails)

      Container for Line Item-specific addresses.

      Parameters:
      shippingDetails - value to be set
    • setCustom

      void setCustom(CustomFieldsDraft custom)

      Custom Fields for the Line Item.

      Specified by:
      setCustom in interface CustomizableDraft<StagedOrderAddLineItemAction>
      Parameters:
      custom - value to be set
    • of

      factory method
      Returns:
      instance of StagedOrderAddLineItemAction
    • of

      factory method to create a shallow copy StagedOrderAddLineItemAction
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • deepCopy

      factory method to create a deep copy of StagedOrderAddLineItemAction
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      builder factory method for StagedOrderAddLineItemAction
      Returns:
      builder
    • builder

      create builder for StagedOrderAddLineItemAction instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withStagedOrderAddLineItemAction

      default <T> T withStagedOrderAddLineItemAction(Function<StagedOrderAddLineItemAction,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<StagedOrderAddLineItemAction> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference