Class OrderBuilder

java.lang.Object
com.commercetools.api.models.order.OrderBuilder
All Implemented Interfaces:
Builder<Order>

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

     Order order = Order.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .plusLineItems(lineItemsBuilder -> lineItemsBuilder)
             .plusCustomLineItems(customLineItemsBuilder -> customLineItemsBuilder)
             .totalPrice(totalPriceBuilder -> totalPriceBuilder)
             .shippingMode(ShippingMode.SINGLE)
             .plusShipping(shippingBuilder -> shippingBuilder)
             .plusRefusedGifts(refusedGiftsBuilder -> refusedGiftsBuilder)
             .origin(CartOrigin.CUSTOMER)
             .orderState(OrderState.OPEN)
             .plusSyncInfo(syncInfoBuilder -> syncInfoBuilder)
             .build()
 
  • Constructor Details

    • OrderBuilder

      public OrderBuilder()
  • Method Details

    • id

      public OrderBuilder id(String id)

      Unique identifier of the Order.

      Parameters:
      id - value to be set
      Returns:
      Builder
    • version

      public OrderBuilder version(Long version)

      Current version of the Order.

      Parameters:
      version - value to be set
      Returns:
      Builder
    • createdAt

      public OrderBuilder createdAt(ZonedDateTime createdAt)

      Date and time (UTC) the Order was initially created.

      Parameters:
      createdAt - value to be set
      Returns:
      Builder
    • lastModifiedAt

      public OrderBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

      Date and time (UTC) the Order was last updated.

      Parameters:
      lastModifiedAt - value to be set
      Returns:
      Builder
    • orderNumber

      public OrderBuilder orderNumber(@Nullable String orderNumber)

      User-defined identifier of the Order that is unique across a Project.

      Parameters:
      orderNumber - value to be set
      Returns:
      Builder
    • purchaseOrderNumber

      public OrderBuilder purchaseOrderNumber(@Nullable String purchaseOrderNumber)

      User-defined identifier of a purchase Order.

      It is typically set by the Buyer and can be used with Quotes to track the purchase Order during the quote and order flow.

      Parameters:
      purchaseOrderNumber - value to be set
      Returns:
      Builder
    • customerId

      public OrderBuilder customerId(@Nullable String customerId)

      id of the Customer that the Order belongs to.

      Parameters:
      customerId - value to be set
      Returns:
      Builder
    • customerEmail

      public OrderBuilder customerEmail(@Nullable String customerEmail)

      Email address of the Customer that the Order belongs to.

      Parameters:
      customerEmail - value to be set
      Returns:
      Builder
    • customerGroup

      Reference to the Customer Group of the Customer that the Order belongs to. Used for Line Item price selection.

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

      Reference to the Customer Group of the Customer that the Order belongs to. Used for Line Item price selection.

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

      public OrderBuilder customerGroup(@Nullable CustomerGroupReference customerGroup)

      Reference to the Customer Group of the Customer that the Order belongs to. Used for Line Item price selection.

      Parameters:
      customerGroup - value to be set
      Returns:
      Builder
    • anonymousId

      public OrderBuilder anonymousId(@Nullable String anonymousId)

      Anonymous session associated with the Order.

      Parameters:
      anonymousId - value to be set
      Returns:
      Builder
    • businessUnit

      Reference to a Business Unit the Order belongs to.

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

      Reference to a Business Unit the Order belongs to.

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

      public OrderBuilder businessUnit(@Nullable BusinessUnitKeyReference businessUnit)

      Reference to a Business Unit the Order belongs to.

      Parameters:
      businessUnit - value to be set
      Returns:
      Builder
    • store

      Reference to a Store the Order belongs to.

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

      Reference to a Store the Order belongs to.

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

      Reference to a Store the Order belongs to.

      Parameters:
      store - value to be set
      Returns:
      Builder
    • lineItems

      public OrderBuilder lineItems(LineItem... lineItems)

      Line Items that are part of the Order.

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

      public OrderBuilder lineItems(List<LineItem> lineItems)

      Line Items that are part of the Order.

      Parameters:
      lineItems - value to be set
      Returns:
      Builder
    • plusLineItems

      public OrderBuilder plusLineItems(LineItem... lineItems)

      Line Items that are part of the Order.

      Parameters:
      lineItems - value to be set
      Returns:
      Builder
    • plusLineItems

      public OrderBuilder plusLineItems(Function<LineItemBuilder,LineItemBuilder> builder)

      Line Items that are part of the Order.

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

      public OrderBuilder withLineItems(Function<LineItemBuilder,LineItemBuilder> builder)

      Line Items that are part of the Order.

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

      public OrderBuilder addLineItems(Function<LineItemBuilder,LineItem> builder)

      Line Items that are part of the Order.

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

      public OrderBuilder setLineItems(Function<LineItemBuilder,LineItem> builder)

      Line Items that are part of the Order.

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

      public OrderBuilder customLineItems(CustomLineItem... customLineItems)

      Custom Line Items that are part of the Order.

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

      public OrderBuilder customLineItems(List<CustomLineItem> customLineItems)

      Custom Line Items that are part of the Order.

      Parameters:
      customLineItems - value to be set
      Returns:
      Builder
    • plusCustomLineItems

      public OrderBuilder plusCustomLineItems(CustomLineItem... customLineItems)

      Custom Line Items that are part of the Order.

      Parameters:
      customLineItems - value to be set
      Returns:
      Builder
    • plusCustomLineItems

      public OrderBuilder plusCustomLineItems(Function<CustomLineItemBuilder,CustomLineItemBuilder> builder)

      Custom Line Items that are part of the Order.

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

      public OrderBuilder withCustomLineItems(Function<CustomLineItemBuilder,CustomLineItemBuilder> builder)

      Custom Line Items that are part of the Order.

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

      public OrderBuilder addCustomLineItems(Function<CustomLineItemBuilder,CustomLineItem> builder)

      Custom Line Items that are part of the Order.

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

      public OrderBuilder setCustomLineItems(Function<CustomLineItemBuilder,CustomLineItem> builder)

      Custom Line Items that are part of the Order.

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

      public OrderBuilder totalPrice(TypedMoney totalPrice)

      Sum of the totalPrice field of all LineItems and CustomLineItems, and if available, the price field of ShippingInfo. If a discount applies on totalPrice, this field holds the discounted value.

      Taxes are included if TaxRate includedInPrice is true for each price.

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

      public OrderBuilder totalPrice(Function<TypedMoneyBuilder,Builder<? extends TypedMoney>> builder)

      Sum of the totalPrice field of all LineItems and CustomLineItems, and if available, the price field of ShippingInfo. If a discount applies on totalPrice, this field holds the discounted value.

      Taxes are included if TaxRate includedInPrice is true for each price.

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

      • For Platform TaxMode, it is automatically set when a shipping address is set.
      • For External TaxMode, it is automatically set when shippingAddress and external Tax Rates for all Line Items, Custom Line Items, and Shipping Methods in the Cart are set.

      If a discount applies on totalPrice, this field holds the discounted values.

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

      public OrderBuilder withTaxedPrice(Function<TaxedPriceBuilder,TaxedPrice> builder)
      • For Platform TaxMode, it is automatically set when a shipping address is set.
      • For External TaxMode, it is automatically set when shippingAddress and external Tax Rates for all Line Items, Custom Line Items, and Shipping Methods in the Cart are set.

      If a discount applies on totalPrice, this field holds the discounted values.

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

      public OrderBuilder taxedPrice(@Nullable TaxedPrice taxedPrice)
      • For Platform TaxMode, it is automatically set when a shipping address is set.
      • For External TaxMode, it is automatically set when shippingAddress and external Tax Rates for all Line Items, Custom Line Items, and Shipping Methods in the Cart are set.

      If a discount applies on totalPrice, this field holds the discounted values.

      Parameters:
      taxedPrice - value to be set
      Returns:
      Builder
    • taxedShippingPrice

      public OrderBuilder taxedShippingPrice(Function<TaxedPriceBuilder,TaxedPriceBuilder> builder)

      Sum of the taxedPrice field of ShippingInfo across all Shipping Methods.

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

      public OrderBuilder withTaxedShippingPrice(Function<TaxedPriceBuilder,TaxedPrice> builder)

      Sum of the taxedPrice field of ShippingInfo across all Shipping Methods.

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

      public OrderBuilder taxedShippingPrice(@Nullable TaxedPrice taxedShippingPrice)

      Sum of the taxedPrice field of ShippingInfo across all Shipping Methods.

      Parameters:
      taxedShippingPrice - value to be set
      Returns:
      Builder
    • discountOnTotalPrice

      Discounts that apply on the total price of the Order.

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

      public OrderBuilder withDiscountOnTotalPrice(Function<DiscountOnTotalPriceBuilder,DiscountOnTotalPrice> builder)

      Discounts that apply on the total price of the Order.

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

      public OrderBuilder discountOnTotalPrice(@Nullable DiscountOnTotalPrice discountOnTotalPrice)

      Discounts that apply on the total price of the Order.

      Parameters:
      discountOnTotalPrice - value to be set
      Returns:
      Builder
    • taxMode

      public OrderBuilder taxMode(@Nullable TaxMode taxMode)

      Indicates how Tax Rates are set.

      Parameters:
      taxMode - value to be set
      Returns:
      Builder
    • taxRoundingMode

      public OrderBuilder taxRoundingMode(@Nullable RoundingMode taxRoundingMode)

      Indicates how monetary values are rounded when calculating taxes for taxedPrice.

      Parameters:
      taxRoundingMode - value to be set
      Returns:
      Builder
    • taxCalculationMode

      public OrderBuilder taxCalculationMode(@Nullable TaxCalculationMode taxCalculationMode)

      Indicates how taxes are calculated when calculating taxes for taxedPrice.

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

      public OrderBuilder inventoryMode(@Nullable InventoryMode inventoryMode)

      Indicates how stock quantities are tracked for Line Items in the Order.

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

      public OrderBuilder billingAddress(Function<AddressBuilder,AddressBuilder> builder)

      Billing address associated with the Order.

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

      public OrderBuilder withBillingAddress(Function<AddressBuilder,Address> builder)

      Billing address associated with the Order.

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

      public OrderBuilder billingAddress(@Nullable Address billingAddress)

      Billing address associated with the Order.

      Parameters:
      billingAddress - value to be set
      Returns:
      Builder
    • shippingAddress

      public OrderBuilder shippingAddress(Function<AddressBuilder,AddressBuilder> builder)

      Shipping address associated with the Order. Determines eligible ShippingMethod rates and Tax Rates of Line Items.

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

      public OrderBuilder withShippingAddress(Function<AddressBuilder,Address> builder)

      Shipping address associated with the Order. Determines eligible ShippingMethod rates and Tax Rates of Line Items.

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

      public OrderBuilder shippingAddress(@Nullable Address shippingAddress)

      Shipping address associated with the Order. Determines eligible ShippingMethod rates and Tax Rates of Line Items.

      Parameters:
      shippingAddress - value to be set
      Returns:
      Builder
    • shippingMode

      public OrderBuilder shippingMode(ShippingMode shippingMode)

      Indicates whether there can be one or multiple Shipping Methods.

      Parameters:
      shippingMode - value to be set
      Returns:
      Builder
    • shippingKey

      public OrderBuilder shippingKey(@Nullable String shippingKey)

      key of the ShippingMethod for Single ShippingMode.

      Parameters:
      shippingKey - value to be set
      Returns:
      Builder
    • shippingInfo

      Shipping-related information for Single ShippingMode. Automatically set when a Shipping Method is set.

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

      public OrderBuilder withShippingInfo(Function<ShippingInfoBuilder,ShippingInfo> builder)

      Shipping-related information for Single ShippingMode. Automatically set when a Shipping Method is set.

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

      public OrderBuilder shippingInfo(@Nullable ShippingInfo shippingInfo)

      Shipping-related information for Single ShippingMode. Automatically set when a Shipping Method is set.

      Parameters:
      shippingInfo - value to be set
      Returns:
      Builder
    • shippingRateInput

      public OrderBuilder shippingRateInput(@Nullable ShippingRateInput shippingRateInput)

      Input used to select a ShippingRatePriceTier. The data type of this field depends on the shippingRateInputType.type configured in the Project:

      • If CartClassification, it is ClassificationShippingRateInput.
      • If CartScore, it is ScoreShippingRateInput.
      • If CartValue, it cannot be used.
      Parameters:
      shippingRateInput - value to be set
      Returns:
      Builder
    • shippingRateInput

      public OrderBuilder shippingRateInput(Function<ShippingRateInputBuilder,Builder<? extends ShippingRateInput>> builder)

      Input used to select a ShippingRatePriceTier. The data type of this field depends on the shippingRateInputType.type configured in the Project:

      • If CartClassification, it is ClassificationShippingRateInput.
      • If CartScore, it is ScoreShippingRateInput.
      • If CartValue, it cannot be used.
      Parameters:
      builder - function to build the shippingRateInput value
      Returns:
      Builder
    • shippingCustomFields

      public OrderBuilder shippingCustomFields(Function<CustomFieldsBuilder,CustomFieldsBuilder> builder)

      Custom Fields of the Shipping Method for Single ShippingMode.

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

      public OrderBuilder withShippingCustomFields(Function<CustomFieldsBuilder,CustomFields> builder)

      Custom Fields of the Shipping Method for Single ShippingMode.

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

      public OrderBuilder shippingCustomFields(@Nullable CustomFields shippingCustomFields)

      Custom Fields of the Shipping Method for Single ShippingMode.

      Parameters:
      shippingCustomFields - value to be set
      Returns:
      Builder
    • shipping

      public OrderBuilder shipping(Shipping... shipping)

      Shipping-related information for Multiple ShippingMode. Updated automatically each time a new Shipping Method is added.

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

      public OrderBuilder shipping(List<Shipping> shipping)

      Shipping-related information for Multiple ShippingMode. Updated automatically each time a new Shipping Method is added.

      Parameters:
      shipping - value to be set
      Returns:
      Builder
    • plusShipping

      public OrderBuilder plusShipping(Shipping... shipping)

      Shipping-related information for Multiple ShippingMode. Updated automatically each time a new Shipping Method is added.

      Parameters:
      shipping - value to be set
      Returns:
      Builder
    • plusShipping

      public OrderBuilder plusShipping(Function<ShippingBuilder,ShippingBuilder> builder)

      Shipping-related information for Multiple ShippingMode. Updated automatically each time a new Shipping Method is added.

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

      public OrderBuilder withShipping(Function<ShippingBuilder,ShippingBuilder> builder)

      Shipping-related information for Multiple ShippingMode. Updated automatically each time a new Shipping Method is added.

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

      public OrderBuilder addShipping(Function<ShippingBuilder,Shipping> builder)

      Shipping-related information for Multiple ShippingMode. Updated automatically each time a new Shipping Method is added.

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

      public OrderBuilder setShipping(Function<ShippingBuilder,Shipping> builder)

      Shipping-related information for Multiple ShippingMode. Updated automatically each time a new Shipping Method is added.

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

      public OrderBuilder itemShippingAddresses(@Nullable Address... itemShippingAddresses)

      Additional shipping addresses of the Order as specified by LineItems using the shippingDetails field. Eligible Shipping Methods or applicable Tax Rates are determined by the address in shippingAddress, and not itemShippingAddresses.

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

      public OrderBuilder itemShippingAddresses(@Nullable List<Address> itemShippingAddresses)

      Additional shipping addresses of the Order as specified by LineItems using the shippingDetails field. Eligible Shipping Methods or applicable Tax Rates are determined by the address in shippingAddress, and not itemShippingAddresses.

      Parameters:
      itemShippingAddresses - value to be set
      Returns:
      Builder
    • plusItemShippingAddresses

      public OrderBuilder plusItemShippingAddresses(@Nullable Address... itemShippingAddresses)

      Additional shipping addresses of the Order as specified by LineItems using the shippingDetails field. Eligible Shipping Methods or applicable Tax Rates are determined by the address in shippingAddress, and not itemShippingAddresses.

      Parameters:
      itemShippingAddresses - value to be set
      Returns:
      Builder
    • plusItemShippingAddresses

      public OrderBuilder plusItemShippingAddresses(Function<AddressBuilder,AddressBuilder> builder)

      Additional shipping addresses of the Order as specified by LineItems using the shippingDetails field. Eligible Shipping Methods or applicable Tax Rates are determined by the address in shippingAddress, and not itemShippingAddresses.

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

      public OrderBuilder withItemShippingAddresses(Function<AddressBuilder,AddressBuilder> builder)

      Additional shipping addresses of the Order as specified by LineItems using the shippingDetails field. Eligible Shipping Methods or applicable Tax Rates are determined by the address in shippingAddress, and not itemShippingAddresses.

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

      public OrderBuilder addItemShippingAddresses(Function<AddressBuilder,Address> builder)

      Additional shipping addresses of the Order as specified by LineItems using the shippingDetails field. Eligible Shipping Methods or applicable Tax Rates are determined by the address in shippingAddress, and not itemShippingAddresses.

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

      public OrderBuilder setItemShippingAddresses(Function<AddressBuilder,Address> builder)

      Additional shipping addresses of the Order as specified by LineItems using the shippingDetails field. Eligible Shipping Methods or applicable Tax Rates are determined by the address in shippingAddress, and not itemShippingAddresses.

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

      public OrderBuilder discountCodes(@Nullable DiscountCodeInfo... discountCodes)

      Discount Codes added to the Order. An Order that has directDiscounts cannot have discountCodes.

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

      public OrderBuilder discountCodes(@Nullable List<DiscountCodeInfo> discountCodes)

      Discount Codes added to the Order. An Order that has directDiscounts cannot have discountCodes.

      Parameters:
      discountCodes - value to be set
      Returns:
      Builder
    • plusDiscountCodes

      public OrderBuilder plusDiscountCodes(@Nullable DiscountCodeInfo... discountCodes)

      Discount Codes added to the Order. An Order that has directDiscounts cannot have discountCodes.

      Parameters:
      discountCodes - value to be set
      Returns:
      Builder
    • plusDiscountCodes

      Discount Codes added to the Order. An Order that has directDiscounts cannot have discountCodes.

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

      Discount Codes added to the Order. An Order that has directDiscounts cannot have discountCodes.

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

      public OrderBuilder addDiscountCodes(Function<DiscountCodeInfoBuilder,DiscountCodeInfo> builder)

      Discount Codes added to the Order. An Order that has directDiscounts cannot have discountCodes.

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

      public OrderBuilder setDiscountCodes(Function<DiscountCodeInfoBuilder,DiscountCodeInfo> builder)

      Discount Codes added to the Order. An Order that has directDiscounts cannot have discountCodes.

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

      public OrderBuilder directDiscounts(@Nullable DirectDiscount... directDiscounts)

      Direct Discounts added to the Order. An Order that has discountCodes cannot have directDiscounts.

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

      public OrderBuilder directDiscounts(@Nullable List<DirectDiscount> directDiscounts)

      Direct Discounts added to the Order. An Order that has discountCodes cannot have directDiscounts.

      Parameters:
      directDiscounts - value to be set
      Returns:
      Builder
    • plusDirectDiscounts

      public OrderBuilder plusDirectDiscounts(@Nullable DirectDiscount... directDiscounts)

      Direct Discounts added to the Order. An Order that has discountCodes cannot have directDiscounts.

      Parameters:
      directDiscounts - value to be set
      Returns:
      Builder
    • plusDirectDiscounts

      public OrderBuilder plusDirectDiscounts(Function<DirectDiscountBuilder,DirectDiscountBuilder> builder)

      Direct Discounts added to the Order. An Order that has discountCodes cannot have directDiscounts.

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

      public OrderBuilder withDirectDiscounts(Function<DirectDiscountBuilder,DirectDiscountBuilder> builder)

      Direct Discounts added to the Order. An Order that has discountCodes cannot have directDiscounts.

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

      public OrderBuilder addDirectDiscounts(Function<DirectDiscountBuilder,DirectDiscount> builder)

      Direct Discounts added to the Order. An Order that has discountCodes cannot have directDiscounts.

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

      public OrderBuilder setDirectDiscounts(Function<DirectDiscountBuilder,DirectDiscount> builder)

      Direct Discounts added to the Order. An Order that has discountCodes cannot have directDiscounts.

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

      public OrderBuilder refusedGifts(CartDiscountReference... refusedGifts)

      Automatically set when a Line Item with GiftLineItem LineItemMode is removed from the Order.

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

      public OrderBuilder refusedGifts(List<CartDiscountReference> refusedGifts)

      Automatically set when a Line Item with GiftLineItem LineItemMode is removed from the Order.

      Parameters:
      refusedGifts - value to be set
      Returns:
      Builder
    • plusRefusedGifts

      public OrderBuilder plusRefusedGifts(CartDiscountReference... refusedGifts)

      Automatically set when a Line Item with GiftLineItem LineItemMode is removed from the Order.

      Parameters:
      refusedGifts - value to be set
      Returns:
      Builder
    • plusRefusedGifts

      Automatically set when a Line Item with GiftLineItem LineItemMode is removed from the Order.

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

      Automatically set when a Line Item with GiftLineItem LineItemMode is removed from the Order.

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

      Automatically set when a Line Item with GiftLineItem LineItemMode is removed from the Order.

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

      Automatically set when a Line Item with GiftLineItem LineItemMode is removed from the Order.

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

      Payment information related to the Order.

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

      public OrderBuilder withPaymentInfo(Function<PaymentInfoBuilder,PaymentInfo> builder)

      Payment information related to the Order.

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

      public OrderBuilder paymentInfo(@Nullable PaymentInfo paymentInfo)

      Payment information related to the Order.

      Parameters:
      paymentInfo - value to be set
      Returns:
      Builder
    • country

      public OrderBuilder country(@Nullable String country)

      Used for Line Item price selection.

      Parameters:
      country - value to be set
      Returns:
      Builder
    • locale

      public OrderBuilder locale(@Nullable String locale)

      Languages of the Order. Can only contain languages supported by the Project.

      Parameters:
      locale - value to be set
      Returns:
      Builder
    • origin

      public OrderBuilder origin(CartOrigin origin)

      Indicates the origin of the Cart from which the Order was created.

      Parameters:
      origin - value to be set
      Returns:
      Builder
    • cart

      Reference to the Cart for an Order created from Cart. The referenced Cart will have the Ordered CartState.

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

      Reference to the Cart for an Order created from Cart. The referenced Cart will have the Ordered CartState.

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

      public OrderBuilder cart(@Nullable CartReference cart)

      Reference to the Cart for an Order created from Cart. The referenced Cart will have the Ordered CartState.

      Parameters:
      cart - value to be set
      Returns:
      Builder
    • quote

      Reference to the Quote for an Order created from Quote.

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

      Reference to the Quote for an Order created from Quote.

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

      public OrderBuilder quote(@Nullable QuoteReference quote)

      Reference to the Quote for an Order created from Quote.

      Parameters:
      quote - value to be set
      Returns:
      Builder
    • orderState

      public OrderBuilder orderState(OrderState orderState)

      Current status of the Order.

      Parameters:
      orderState - value to be set
      Returns:
      Builder
    • shipmentState

      public OrderBuilder shipmentState(@Nullable ShipmentState shipmentState)

      Shipment status of the Order.

      Parameters:
      shipmentState - value to be set
      Returns:
      Builder
    • paymentState

      public OrderBuilder paymentState(@Nullable PaymentState paymentState)

      Payment status of the Order.

      Parameters:
      paymentState - value to be set
      Returns:
      Builder
    • state

      State of the Order. This reference can point to a State in a custom workflow.

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

      State of the Order. This reference can point to a State in a custom workflow.

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

      public OrderBuilder state(@Nullable StateReference state)

      State of the Order. This reference can point to a State in a custom workflow.

      Parameters:
      state - value to be set
      Returns:
      Builder
    • syncInfo

      public OrderBuilder syncInfo(SyncInfo... syncInfo)

      Contains synchronization activity information of the Order (like export or import). Can only be set with Update SyncInfo update action.

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

      public OrderBuilder syncInfo(List<SyncInfo> syncInfo)

      Contains synchronization activity information of the Order (like export or import). Can only be set with Update SyncInfo update action.

      Parameters:
      syncInfo - value to be set
      Returns:
      Builder
    • plusSyncInfo

      public OrderBuilder plusSyncInfo(SyncInfo... syncInfo)

      Contains synchronization activity information of the Order (like export or import). Can only be set with Update SyncInfo update action.

      Parameters:
      syncInfo - value to be set
      Returns:
      Builder
    • plusSyncInfo

      public OrderBuilder plusSyncInfo(Function<SyncInfoBuilder,SyncInfoBuilder> builder)

      Contains synchronization activity information of the Order (like export or import). Can only be set with Update SyncInfo update action.

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

      public OrderBuilder withSyncInfo(Function<SyncInfoBuilder,SyncInfoBuilder> builder)

      Contains synchronization activity information of the Order (like export or import). Can only be set with Update SyncInfo update action.

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

      public OrderBuilder addSyncInfo(Function<SyncInfoBuilder,SyncInfo> builder)

      Contains synchronization activity information of the Order (like export or import). Can only be set with Update SyncInfo update action.

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

      public OrderBuilder setSyncInfo(Function<SyncInfoBuilder,SyncInfo> builder)

      Contains synchronization activity information of the Order (like export or import). Can only be set with Update SyncInfo update action.

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

      public OrderBuilder returnInfo(@Nullable ReturnInfo... returnInfo)

      Contains information regarding the returns associated with the Order.

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

      public OrderBuilder returnInfo(@Nullable List<ReturnInfo> returnInfo)

      Contains information regarding the returns associated with the Order.

      Parameters:
      returnInfo - value to be set
      Returns:
      Builder
    • plusReturnInfo

      public OrderBuilder plusReturnInfo(@Nullable ReturnInfo... returnInfo)

      Contains information regarding the returns associated with the Order.

      Parameters:
      returnInfo - value to be set
      Returns:
      Builder
    • plusReturnInfo

      public OrderBuilder plusReturnInfo(Function<ReturnInfoBuilder,ReturnInfoBuilder> builder)

      Contains information regarding the returns associated with the Order.

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

      public OrderBuilder withReturnInfo(Function<ReturnInfoBuilder,ReturnInfoBuilder> builder)

      Contains information regarding the returns associated with the Order.

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

      public OrderBuilder addReturnInfo(Function<ReturnInfoBuilder,ReturnInfo> builder)

      Contains information regarding the returns associated with the Order.

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

      public OrderBuilder setReturnInfo(Function<ReturnInfoBuilder,ReturnInfo> builder)

      Contains information regarding the returns associated with the Order.

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

      @Deprecated public OrderBuilder lastMessageSequenceNumber(@Nullable Long lastMessageSequenceNumber)
      Deprecated.

      Internal-only field.

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

      Custom Fields of the Order.

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

      public OrderBuilder withCustom(Function<CustomFieldsBuilder,CustomFields> builder)

      Custom Fields of the Order.

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

      public OrderBuilder custom(@Nullable CustomFields custom)

      Custom Fields of the Order.

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

      public OrderBuilder completedAt(@Nullable ZonedDateTime completedAt)

      User-defined date and time (UTC) of the Order. Present only on an Order created using Order Import.

      Parameters:
      completedAt - value to be set
      Returns:
      Builder
    • lastModifiedBy

      IDs and references that last modified the Order.

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

      public OrderBuilder withLastModifiedBy(Function<LastModifiedByBuilder,LastModifiedBy> builder)

      IDs and references that last modified the Order.

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

      public OrderBuilder lastModifiedBy(@Nullable LastModifiedBy lastModifiedBy)

      IDs and references that last modified the Order.

      Parameters:
      lastModifiedBy - value to be set
      Returns:
      Builder
    • createdBy

      IDs and references that created the Order.

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

      public OrderBuilder withCreatedBy(Function<CreatedByBuilder,CreatedBy> builder)

      IDs and references that created the Order.

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

      public OrderBuilder createdBy(@Nullable CreatedBy createdBy)

      IDs and references that created the Order.

      Parameters:
      createdBy - value to be set
      Returns:
      Builder
    • getId

      public String getId()

      Unique identifier of the Order.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Current version of the Order.

      Returns:
      version
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

      Date and time (UTC) the Order was initially created.

      Returns:
      createdAt
    • getLastModifiedAt

      public ZonedDateTime getLastModifiedAt()

      Date and time (UTC) the Order was last updated.

      Returns:
      lastModifiedAt
    • getOrderNumber

      @Nullable public String getOrderNumber()

      User-defined identifier of the Order that is unique across a Project.

      Returns:
      orderNumber
    • getPurchaseOrderNumber

      @Nullable public String getPurchaseOrderNumber()

      User-defined identifier of a purchase Order.

      It is typically set by the Buyer and can be used with Quotes to track the purchase Order during the quote and order flow.

      Returns:
      purchaseOrderNumber
    • getCustomerId

      @Nullable public String getCustomerId()

      id of the Customer that the Order belongs to.

      Returns:
      customerId
    • getCustomerEmail

      @Nullable public String getCustomerEmail()

      Email address of the Customer that the Order belongs to.

      Returns:
      customerEmail
    • getCustomerGroup

      @Nullable public CustomerGroupReference getCustomerGroup()

      Reference to the Customer Group of the Customer that the Order belongs to. Used for Line Item price selection.

      Returns:
      customerGroup
    • getAnonymousId

      @Nullable public String getAnonymousId()

      Anonymous session associated with the Order.

      Returns:
      anonymousId
    • getBusinessUnit

      @Nullable public BusinessUnitKeyReference getBusinessUnit()

      Reference to a Business Unit the Order belongs to.

      Returns:
      businessUnit
    • getStore

      @Nullable public StoreKeyReference getStore()

      Reference to a Store the Order belongs to.

      Returns:
      store
    • getLineItems

      public List<LineItem> getLineItems()

      Line Items that are part of the Order.

      Returns:
      lineItems
    • getCustomLineItems

      public List<CustomLineItem> getCustomLineItems()

      Custom Line Items that are part of the Order.

      Returns:
      customLineItems
    • getTotalPrice

      public TypedMoney getTotalPrice()

      Sum of the totalPrice field of all LineItems and CustomLineItems, and if available, the price field of ShippingInfo. If a discount applies on totalPrice, this field holds the discounted value.

      Taxes are included if TaxRate includedInPrice is true for each price.

      Returns:
      totalPrice
    • getTaxedPrice

      @Nullable public TaxedPrice getTaxedPrice()
      • For Platform TaxMode, it is automatically set when a shipping address is set.
      • For External TaxMode, it is automatically set when shippingAddress and external Tax Rates for all Line Items, Custom Line Items, and Shipping Methods in the Cart are set.

      If a discount applies on totalPrice, this field holds the discounted values.

      Returns:
      taxedPrice
    • getTaxedShippingPrice

      @Nullable public TaxedPrice getTaxedShippingPrice()

      Sum of the taxedPrice field of ShippingInfo across all Shipping Methods.

      Returns:
      taxedShippingPrice
    • getDiscountOnTotalPrice

      @Nullable public DiscountOnTotalPrice getDiscountOnTotalPrice()

      Discounts that apply on the total price of the Order.

      Returns:
      discountOnTotalPrice
    • getTaxMode

      @Nullable public TaxMode getTaxMode()

      Indicates how Tax Rates are set.

      Returns:
      taxMode
    • getTaxRoundingMode

      @Nullable public RoundingMode getTaxRoundingMode()

      Indicates how monetary values are rounded when calculating taxes for taxedPrice.

      Returns:
      taxRoundingMode
    • getTaxCalculationMode

      @Nullable public TaxCalculationMode getTaxCalculationMode()

      Indicates how taxes are calculated when calculating taxes for taxedPrice.

      Returns:
      taxCalculationMode
    • getInventoryMode

      @Nullable public InventoryMode getInventoryMode()

      Indicates how stock quantities are tracked for Line Items in the Order.

      Returns:
      inventoryMode
    • getBillingAddress

      @Nullable public Address getBillingAddress()

      Billing address associated with the Order.

      Returns:
      billingAddress
    • getShippingAddress

      @Nullable public Address getShippingAddress()

      Shipping address associated with the Order. Determines eligible ShippingMethod rates and Tax Rates of Line Items.

      Returns:
      shippingAddress
    • getShippingMode

      public ShippingMode getShippingMode()

      Indicates whether there can be one or multiple Shipping Methods.

      Returns:
      shippingMode
    • getShippingKey

      @Nullable public String getShippingKey()

      key of the ShippingMethod for Single ShippingMode.

      Returns:
      shippingKey
    • getShippingInfo

      @Nullable public ShippingInfo getShippingInfo()

      Shipping-related information for Single ShippingMode. Automatically set when a Shipping Method is set.

      Returns:
      shippingInfo
    • getShippingRateInput

      @Nullable public ShippingRateInput getShippingRateInput()

      Input used to select a ShippingRatePriceTier. The data type of this field depends on the shippingRateInputType.type configured in the Project:

      • If CartClassification, it is ClassificationShippingRateInput.
      • If CartScore, it is ScoreShippingRateInput.
      • If CartValue, it cannot be used.
      Returns:
      shippingRateInput
    • getShippingCustomFields

      @Nullable public CustomFields getShippingCustomFields()

      Custom Fields of the Shipping Method for Single ShippingMode.

      Returns:
      shippingCustomFields
    • getShipping

      public List<Shipping> getShipping()

      Shipping-related information for Multiple ShippingMode. Updated automatically each time a new Shipping Method is added.

      Returns:
      shipping
    • getItemShippingAddresses

      @Nullable public List<Address> getItemShippingAddresses()

      Additional shipping addresses of the Order as specified by LineItems using the shippingDetails field. Eligible Shipping Methods or applicable Tax Rates are determined by the address in shippingAddress, and not itemShippingAddresses.

      Returns:
      itemShippingAddresses
    • getDiscountCodes

      @Nullable public List<DiscountCodeInfo> getDiscountCodes()

      Discount Codes added to the Order. An Order that has directDiscounts cannot have discountCodes.

      Returns:
      discountCodes
    • getDirectDiscounts

      @Nullable public List<DirectDiscount> getDirectDiscounts()

      Direct Discounts added to the Order. An Order that has discountCodes cannot have directDiscounts.

      Returns:
      directDiscounts
    • getRefusedGifts

      public List<CartDiscountReference> getRefusedGifts()

      Automatically set when a Line Item with GiftLineItem LineItemMode is removed from the Order.

      Returns:
      refusedGifts
    • getPaymentInfo

      @Nullable public PaymentInfo getPaymentInfo()

      Payment information related to the Order.

      Returns:
      paymentInfo
    • getCountry

      @Nullable public String getCountry()

      Used for Line Item price selection.

      Returns:
      country
    • getLocale

      @Nullable public String getLocale()

      Languages of the Order. Can only contain languages supported by the Project.

      Returns:
      locale
    • getOrigin

      public CartOrigin getOrigin()

      Indicates the origin of the Cart from which the Order was created.

      Returns:
      origin
    • getCart

      @Nullable public CartReference getCart()

      Reference to the Cart for an Order created from Cart. The referenced Cart will have the Ordered CartState.

      Returns:
      cart
    • getQuote

      @Nullable public QuoteReference getQuote()

      Reference to the Quote for an Order created from Quote.

      Returns:
      quote
    • getOrderState

      public OrderState getOrderState()

      Current status of the Order.

      Returns:
      orderState
    • getShipmentState

      @Nullable public ShipmentState getShipmentState()

      Shipment status of the Order.

      Returns:
      shipmentState
    • getPaymentState

      @Nullable public PaymentState getPaymentState()

      Payment status of the Order.

      Returns:
      paymentState
    • getState

      @Nullable public StateReference getState()

      State of the Order. This reference can point to a State in a custom workflow.

      Returns:
      state
    • getSyncInfo

      public List<SyncInfo> getSyncInfo()

      Contains synchronization activity information of the Order (like export or import). Can only be set with Update SyncInfo update action.

      Returns:
      syncInfo
    • getReturnInfo

      @Nullable public List<ReturnInfo> getReturnInfo()

      Contains information regarding the returns associated with the Order.

      Returns:
      returnInfo
    • getLastMessageSequenceNumber

      @Deprecated @Nullable public Long getLastMessageSequenceNumber()
      Deprecated.

      Internal-only field.

      Returns:
      lastMessageSequenceNumber
    • getCustom

      @Nullable public CustomFields getCustom()

      Custom Fields of the Order.

      Returns:
      custom
    • getCompletedAt

      @Nullable public ZonedDateTime getCompletedAt()

      User-defined date and time (UTC) of the Order. Present only on an Order created using Order Import.

      Returns:
      completedAt
    • getLastModifiedBy

      @Nullable public LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the Order.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Nullable public CreatedBy getCreatedBy()

      IDs and references that created the Order.

      Returns:
      createdBy
    • build

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

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

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

      public static OrderBuilder of(Order template)
      create builder for Order instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder