Class CartBuilder
Example to create an instance using the builder pattern
Cart cart = Cart.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)
.taxMode(TaxMode.PLATFORM)
.priceRoundingMode(RoundingMode.HALF_EVEN)
.taxRoundingMode(RoundingMode.HALF_EVEN)
.taxCalculationMode(TaxCalculationMode.LINE_ITEM_LEVEL)
.inventoryMode(InventoryMode.NONE)
.cartState(CartState.ACTIVE)
.shippingMode(ShippingMode.SINGLE)
.plusShipping(shippingBuilder -> shippingBuilder)
.plusItemShippingAddresses(itemShippingAddressesBuilder -> itemShippingAddressesBuilder)
.plusDiscountCodes(discountCodesBuilder -> discountCodesBuilder)
.plusDirectDiscounts(directDiscountsBuilder -> directDiscountsBuilder)
.plusRefusedGifts(refusedGiftsBuilder -> refusedGiftsBuilder)
.origin(CartOrigin.CUSTOMER)
.build()
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCustom Line Items added to the Cart.Direct Discounts added to the Cart.Discount Codes applied to the Cart.Additional shipping addresses of the Cart as specified by LineItems using theshippingDetailsfield.addLineItems(Function<LineItemBuilder, LineItem> builder) Line Items added to the Cart.addShipping(Function<ShippingBuilder, Shipping> builder) Shipping-related information of a Cart withMultipleShippingMode.anonymousId(String anonymousId) Anonymous session associated with the Cart.billingAddress(Address billingAddress) Billing address associated with the Cart.billingAddress(Function<AddressBuilder, AddressBuilder> builder) Billing address associated with the Cart.build()builds Cart with checking for non-null required valuesbuilds Cart without checking for non-null required valuesbusinessUnit(BusinessUnitKeyReference businessUnit) Reference to a Business Unit the Cart belongs to.Reference to a Business Unit the Cart belongs to.Current status of the Cart.Used for Line Item price selection.createdAt(ZonedDateTime createdAt) Date and time (UTC) the Cart was initially created.IDs and references that created the Cart.createdBy(Function<CreatedByBuilder, CreatedByBuilder> builder) IDs and references that created the Cart.custom(CustomFields custom) Custom Fields of the Cart.custom(Function<CustomFieldsBuilder, CustomFieldsBuilder> builder) Custom Fields of the Cart.customerEmail(String customerEmail) Email address of the Customer that the Cart belongs to.customerGroup(CustomerGroupReference customerGroup) Reference to the Customer Group of the Customer that the Cart belongs to.Reference to the Customer Group of the Customer that the Cart belongs to.customerId(String customerId) idof the Customer that the Cart belongs to.customLineItems(CustomLineItem... customLineItems) Custom Line Items added to the Cart.customLineItems(List<CustomLineItem> customLineItems) Custom Line Items added to the Cart.deleteDaysAfterLastModification(Integer deleteDaysAfterLastModification) Number of days after the last modification before a Cart is deleted.directDiscounts(DirectDiscount... directDiscounts) Direct Discounts added to the Cart.directDiscounts(List<DirectDiscount> directDiscounts) Direct Discounts added to the Cart.discountCodes(DiscountCodeInfo... discountCodes) Discount Codes applied to the Cart.discountCodes(List<DiscountCodeInfo> discountCodes) Discount Codes applied to the Cart.discountOnTotalPrice(DiscountOnTotalPrice discountOnTotalPrice) Discounts that apply on the CarttotalPrice.Discounts that apply on the CarttotalPrice.discountTypeCombination(DiscountTypeCombination discountTypeCombination) Indicates if a combination of discount types can apply on a Cart.discountTypeCombination(Function<DiscountTypeCombinationBuilder, Builder<? extends DiscountTypeCombination>> builder) Indicates if a combination of discount types can apply on a Cart.Anonymous session associated with the Cart.Billing address associated with the Cart.Reference to a Business Unit the Cart belongs to.Current status of the Cart.Used for Line Item price selection.Date and time (UTC) the Cart was initially created.IDs and references that created the Cart.Custom Fields of the Cart.Email address of the Customer that the Cart belongs to.Reference to the Customer Group of the Customer that the Cart belongs to.idof the Customer that the Cart belongs to.Custom Line Items added to the Cart.Number of days after the last modification before a Cart is deleted.Direct Discounts added to the Cart.Discount Codes applied to the Cart.Discounts that apply on the CarttotalPrice.Indicates if a combination of discount types can apply on a Cart.getId()Unique identifier of the Cart.Indicates how stock quantities are tracked for Line Items in the Cart.Additional shipping addresses of the Cart as specified by LineItems using theshippingDetailsfield.getKey()User-defined unique identifier of the Cart.Date and time (UTC) the Cart was last updated.IDs and references that last modified the Cart.Line Items added to the Cart.Language of the Cart.Indicates how the Cart was created.Payment information related to the Cart.Indicates how the total prices on LineItems and CustomLineItems are rounded when calculated.Shipping-related information of a Cart withMultipleShippingMode.Shipping address for a Cart withSingleShippingMode.Custom Fields of the Shipping Method in a Cart withSingleShippingMode.Shipping-related information of a Cart withSingleShippingMode.User-defined unique identifier of the Shipping Method in a Cart withSingleShippingMode.Indicates whether the Cart has one or multiple Shipping Methods.Input used to select a ShippingRatePriceTier.getStore()Reference to a Store the Cart belongs to.Indicates how taxes are calculated when calculating taxes fortaxedPrice.Sum of thetaxedPricefield of ShippingInfo across all Shipping Methods.Indicates how Tax Rates are set.Indicates how monetary values are rounded when calculating taxes fortaxedPrice.Sum of all LineItem quantities, excluding CustomLineItems.Sum of thetotalPricefield of all LineItems and CustomLineItems, and if available, thepricefield of ShippingInfo.Current version of the Cart.Unique identifier of the Cart.inventoryMode(InventoryMode inventoryMode) Indicates how stock quantities are tracked for Line Items in the Cart.itemShippingAddresses(Address... itemShippingAddresses) Additional shipping addresses of the Cart as specified by LineItems using theshippingDetailsfield.itemShippingAddresses(List<Address> itemShippingAddresses) Additional shipping addresses of the Cart as specified by LineItems using theshippingDetailsfield.User-defined unique identifier of the Cart.lastModifiedAt(ZonedDateTime lastModifiedAt) Date and time (UTC) the Cart was last updated.lastModifiedBy(LastModifiedBy lastModifiedBy) IDs and references that last modified the Cart.IDs and references that last modified the Cart.Line Items added to the Cart.Line Items added to the Cart.Language of the Cart.static CartBuilderof()factory method for an instance of CartBuilderstatic CartBuildercreate builder for Cart instanceorigin(CartOrigin origin) Indicates how the Cart was created.paymentInfo(PaymentInfo paymentInfo) Payment information related to the Cart.Payment information related to the Cart.plusCustomLineItems(CustomLineItem... customLineItems) Custom Line Items added to the Cart.Custom Line Items added to the Cart.plusDirectDiscounts(DirectDiscount... directDiscounts) Direct Discounts added to the Cart.Direct Discounts added to the Cart.plusDiscountCodes(DiscountCodeInfo... discountCodes) Discount Codes applied to the Cart.Discount Codes applied to the Cart.plusItemShippingAddresses(Address... itemShippingAddresses) Additional shipping addresses of the Cart as specified by LineItems using theshippingDetailsfield.Additional shipping addresses of the Cart as specified by LineItems using theshippingDetailsfield.plusLineItems(LineItem... lineItems) Line Items added to the Cart.plusLineItems(Function<LineItemBuilder, LineItemBuilder> builder) Line Items added to the Cart.plusRefusedGifts(CartDiscountReference... refusedGifts) plusShipping(Shipping... shipping) Shipping-related information of a Cart withMultipleShippingMode.plusShipping(Function<ShippingBuilder, ShippingBuilder> builder) Shipping-related information of a Cart withMultipleShippingMode.priceRoundingMode(RoundingMode priceRoundingMode) Indicates how the total prices on LineItems and CustomLineItems are rounded when calculated.refusedGifts(CartDiscountReference... refusedGifts) refusedGifts(List<CartDiscountReference> refusedGifts) Custom Line Items added to the Cart.Direct Discounts added to the Cart.Discount Codes applied to the Cart.Additional shipping addresses of the Cart as specified by LineItems using theshippingDetailsfield.setLineItems(Function<LineItemBuilder, LineItem> builder) Line Items added to the Cart.setShipping(Function<ShippingBuilder, Shipping> builder) Shipping-related information of a Cart withMultipleShippingMode.Shipping-related information of a Cart withMultipleShippingMode.Shipping-related information of a Cart withMultipleShippingMode.shippingAddress(Address shippingAddress) Shipping address for a Cart withSingleShippingMode.shippingAddress(Function<AddressBuilder, AddressBuilder> builder) Shipping address for a Cart withSingleShippingMode.shippingCustomFields(CustomFields shippingCustomFields) Custom Fields of the Shipping Method in a Cart withSingleShippingMode.Custom Fields of the Shipping Method in a Cart withSingleShippingMode.shippingInfo(ShippingInfo shippingInfo) Shipping-related information of a Cart withSingleShippingMode.Shipping-related information of a Cart withSingleShippingMode.shippingKey(String shippingKey) User-defined unique identifier of the Shipping Method in a Cart withSingleShippingMode.shippingMode(ShippingMode shippingMode) Indicates whether the Cart has one or multiple Shipping Methods.shippingRateInput(ShippingRateInput shippingRateInput) Input used to select a ShippingRatePriceTier.shippingRateInput(Function<ShippingRateInputBuilder, Builder<? extends ShippingRateInput>> builder) Input used to select a ShippingRatePriceTier.store(StoreKeyReference store) Reference to a Store the Cart belongs to.Reference to a Store the Cart belongs to.taxCalculationMode(TaxCalculationMode taxCalculationMode) Indicates how taxes are calculated when calculating taxes fortaxedPrice.taxedPrice(TaxedPrice taxedPrice) taxedPrice(Function<TaxedPriceBuilder, TaxedPriceBuilder> builder) taxedShippingPrice(TaxedPrice taxedShippingPrice) Sum of thetaxedPricefield of ShippingInfo across all Shipping Methods.Sum of thetaxedPricefield of ShippingInfo across all Shipping Methods.Indicates how Tax Rates are set.taxRoundingMode(RoundingMode taxRoundingMode) Indicates how monetary values are rounded when calculating taxes fortaxedPrice.totalLineItemQuantity(Long totalLineItemQuantity) Sum of all LineItem quantities, excluding CustomLineItems.totalPrice(CentPrecisionMoney totalPrice) Sum of thetotalPricefield of all LineItems and CustomLineItems, and if available, thepricefield of ShippingInfo.Sum of thetotalPricefield of all LineItems and CustomLineItems, and if available, thepricefield of ShippingInfo.Current version of the Cart.withBillingAddress(Function<AddressBuilder, Address> builder) Billing address associated with the Cart.Reference to a Business Unit the Cart belongs to.withCreatedBy(Function<CreatedByBuilder, CreatedBy> builder) IDs and references that created the Cart.withCustom(Function<CustomFieldsBuilder, CustomFields> builder) Custom Fields of the Cart.Reference to the Customer Group of the Customer that the Cart belongs to.Custom Line Items added to the Cart.Direct Discounts added to the Cart.Discount Codes applied to the Cart.Discounts that apply on the CarttotalPrice.Additional shipping addresses of the Cart as specified by LineItems using theshippingDetailsfield.IDs and references that last modified the Cart.withLineItems(Function<LineItemBuilder, LineItemBuilder> builder) Line Items added to the Cart.withPaymentInfo(Function<PaymentInfoBuilder, PaymentInfo> builder) Payment information related to the Cart.withShipping(Function<ShippingBuilder, ShippingBuilder> builder) Shipping-related information of a Cart withMultipleShippingMode.withShippingAddress(Function<AddressBuilder, Address> builder) Shipping address for a Cart withSingleShippingMode.Custom Fields of the Shipping Method in a Cart withSingleShippingMode.Shipping-related information of a Cart withSingleShippingMode.Reference to a Store the Cart belongs to.withTaxedPrice(Function<TaxedPriceBuilder, TaxedPrice> builder) Sum of thetaxedPricefield of ShippingInfo across all Shipping Methods.Sum of thetotalPricefield of all LineItems and CustomLineItems, and if available, thepricefield of ShippingInfo.
-
Constructor Details
-
CartBuilder
public CartBuilder()
-
-
Method Details
-
id
Unique identifier of the Cart.
- Parameters:
id- value to be set- Returns:
- Builder
-
version
Current version of the Cart.
- Parameters:
version- value to be set- Returns:
- Builder
-
createdAt
Date and time (UTC) the Cart was initially created.
- Parameters:
createdAt- value to be set- Returns:
- Builder
-
lastModifiedAt
Date and time (UTC) the Cart was last updated.
- Parameters:
lastModifiedAt- value to be set- Returns:
- Builder
-
key
User-defined unique identifier of the Cart.
- Parameters:
key- value to be set- Returns:
- Builder
-
customerId
idof the Customer that the Cart belongs to.- Parameters:
customerId- value to be set- Returns:
- Builder
-
customerEmail
Email address of the Customer that the Cart belongs to.
- Parameters:
customerEmail- value to be set- Returns:
- Builder
-
customerGroup
public CartBuilder customerGroup(Function<CustomerGroupReferenceBuilder, CustomerGroupReferenceBuilder> builder) Reference to the Customer Group of the Customer that the Cart belongs to. Used for Line Item price selection.
- Parameters:
builder- function to build the customerGroup value- Returns:
- Builder
-
withCustomerGroup
public CartBuilder withCustomerGroup(Function<CustomerGroupReferenceBuilder, CustomerGroupReference> builder) Reference to the Customer Group of the Customer that the Cart belongs to. Used for Line Item price selection.
- Parameters:
builder- function to build the customerGroup value- Returns:
- Builder
-
customerGroup
Reference to the Customer Group of the Customer that the Cart belongs to. Used for Line Item price selection.
- Parameters:
customerGroup- value to be set- Returns:
- Builder
-
anonymousId
Anonymous session associated with the Cart.
- Parameters:
anonymousId- value to be set- Returns:
- Builder
-
businessUnit
public CartBuilder businessUnit(Function<BusinessUnitKeyReferenceBuilder, BusinessUnitKeyReferenceBuilder> builder) Reference to a Business Unit the Cart belongs to. Only available for B2B-enabled Projects.
- Parameters:
builder- function to build the businessUnit value- Returns:
- Builder
-
withBusinessUnit
public CartBuilder withBusinessUnit(Function<BusinessUnitKeyReferenceBuilder, BusinessUnitKeyReference> builder) Reference to a Business Unit the Cart belongs to. Only available for B2B-enabled Projects.
- Parameters:
builder- function to build the businessUnit value- Returns:
- Builder
-
businessUnit
Reference to a Business Unit the Cart belongs to. Only available for B2B-enabled Projects.
- Parameters:
businessUnit- value to be set- Returns:
- Builder
-
store
Reference to a Store the Cart belongs to.
- Parameters:
builder- function to build the store value- Returns:
- Builder
-
withStore
Reference to a Store the Cart belongs to.
- Parameters:
builder- function to build the store value- Returns:
- Builder
-
store
Reference to a Store the Cart belongs to.
- Parameters:
store- value to be set- Returns:
- Builder
-
lineItems
Line Items added to the Cart.
- Parameters:
lineItems- value to be set- Returns:
- Builder
-
lineItems
Line Items added to the Cart.
- Parameters:
lineItems- value to be set- Returns:
- Builder
-
plusLineItems
Line Items added to the Cart.
- Parameters:
lineItems- value to be set- Returns:
- Builder
-
plusLineItems
Line Items added to the Cart.
- Parameters:
builder- function to build the lineItems value- Returns:
- Builder
-
withLineItems
Line Items added to the Cart.
- Parameters:
builder- function to build the lineItems value- Returns:
- Builder
-
addLineItems
Line Items added to the Cart.
- Parameters:
builder- function to build the lineItems value- Returns:
- Builder
-
setLineItems
Line Items added to the Cart.
- Parameters:
builder- function to build the lineItems value- Returns:
- Builder
-
customLineItems
Custom Line Items added to the Cart.
- Parameters:
customLineItems- value to be set- Returns:
- Builder
-
customLineItems
Custom Line Items added to the Cart.
- Parameters:
customLineItems- value to be set- Returns:
- Builder
-
plusCustomLineItems
Custom Line Items added to the Cart.
- Parameters:
customLineItems- value to be set- Returns:
- Builder
-
plusCustomLineItems
public CartBuilder plusCustomLineItems(Function<CustomLineItemBuilder, CustomLineItemBuilder> builder) Custom Line Items added to the Cart.
- Parameters:
builder- function to build the customLineItems value- Returns:
- Builder
-
withCustomLineItems
public CartBuilder withCustomLineItems(Function<CustomLineItemBuilder, CustomLineItemBuilder> builder) Custom Line Items added to the Cart.
- Parameters:
builder- function to build the customLineItems value- Returns:
- Builder
-
addCustomLineItems
Custom Line Items added to the Cart.
- Parameters:
builder- function to build the customLineItems value- Returns:
- Builder
-
setCustomLineItems
Custom Line Items added to the Cart.
- Parameters:
builder- function to build the customLineItems value- Returns:
- Builder
-
totalLineItemQuantity
Sum of all LineItem quantities, excluding CustomLineItems. Only present when the Cart has at least one LineItem.
- Parameters:
totalLineItemQuantity- value to be set- Returns:
- Builder
-
totalPrice
public CartBuilder totalPrice(Function<CentPrecisionMoneyBuilder, CentPrecisionMoneyBuilder> builder) Sum of the
totalPricefield of all LineItems and CustomLineItems, and if available, thepricefield of ShippingInfo. If a discount applies ontotalPrice, this field holds the discounted value.Taxes are included if TaxRate
includedInPriceistruefor each price.- Parameters:
builder- function to build the totalPrice value- Returns:
- Builder
-
withTotalPrice
Sum of the
totalPricefield of all LineItems and CustomLineItems, and if available, thepricefield of ShippingInfo. If a discount applies ontotalPrice, this field holds the discounted value.Taxes are included if TaxRate
includedInPriceistruefor each price.- Parameters:
builder- function to build the totalPrice value- Returns:
- Builder
-
totalPrice
Sum of the
totalPricefield of all LineItems and CustomLineItems, and if available, thepricefield of ShippingInfo. If a discount applies ontotalPrice, this field holds the discounted value.Taxes are included if TaxRate
includedInPriceistruefor each price.- Parameters:
totalPrice- value to be set- Returns:
- Builder
-
taxedPrice
- For a Cart with
PlatformTaxMode, it is automatically set when a shipping address is set. For Carts withMultipleShippingMode, all Line Items and Custom Line Items must be fully distributed between the Shipping Methods (viashippingDetails), otherwisetaxedPriceis not automatically set. - For a Cart with
ExternalTaxMode, it is automatically set whenshippingAddressand external Tax Rates for all Line Items, Custom Line Items, and Shipping Methods in the Cart are set. For Carts withMultipleShippingMode, all allocations must have their respective tax rates present inperMethodTaxRate, otherwisetaxedPriceis not automatically set.
If a discount applies on
totalPrice, this field holds the proportionally discounted value.- Parameters:
builder- function to build the taxedPrice value- Returns:
- Builder
- For a Cart with
-
withTaxedPrice
- For a Cart with
PlatformTaxMode, it is automatically set when a shipping address is set. For Carts withMultipleShippingMode, all Line Items and Custom Line Items must be fully distributed between the Shipping Methods (viashippingDetails), otherwisetaxedPriceis not automatically set. - For a Cart with
ExternalTaxMode, it is automatically set whenshippingAddressand external Tax Rates for all Line Items, Custom Line Items, and Shipping Methods in the Cart are set. For Carts withMultipleShippingMode, all allocations must have their respective tax rates present inperMethodTaxRate, otherwisetaxedPriceis not automatically set.
If a discount applies on
totalPrice, this field holds the proportionally discounted value.- Parameters:
builder- function to build the taxedPrice value- Returns:
- Builder
- For a Cart with
-
taxedPrice
- For a Cart with
PlatformTaxMode, it is automatically set when a shipping address is set. For Carts withMultipleShippingMode, all Line Items and Custom Line Items must be fully distributed between the Shipping Methods (viashippingDetails), otherwisetaxedPriceis not automatically set. - For a Cart with
ExternalTaxMode, it is automatically set whenshippingAddressand external Tax Rates for all Line Items, Custom Line Items, and Shipping Methods in the Cart are set. For Carts withMultipleShippingMode, all allocations must have their respective tax rates present inperMethodTaxRate, otherwisetaxedPriceis not automatically set.
If a discount applies on
totalPrice, this field holds the proportionally discounted value.- Parameters:
taxedPrice- value to be set- Returns:
- Builder
- For a Cart with
-
taxedShippingPrice
Sum of the
taxedPricefield of ShippingInfo across all Shipping Methods.If a discount applies on
totalPrice, this field holds the proportionally discounted value.- Parameters:
builder- function to build the taxedShippingPrice value- Returns:
- Builder
-
withTaxedShippingPrice
Sum of the
taxedPricefield of ShippingInfo across all Shipping Methods.If a discount applies on
totalPrice, this field holds the proportionally discounted value.- Parameters:
builder- function to build the taxedShippingPrice value- Returns:
- Builder
-
taxedShippingPrice
Sum of the
taxedPricefield of ShippingInfo across all Shipping Methods.If a discount applies on
totalPrice, this field holds the proportionally discounted value.- Parameters:
taxedShippingPrice- value to be set- Returns:
- Builder
-
discountOnTotalPrice
public CartBuilder discountOnTotalPrice(Function<DiscountOnTotalPriceBuilder, DiscountOnTotalPriceBuilder> builder) Discounts that apply on the Cart
totalPrice.- Parameters:
builder- function to build the discountOnTotalPrice value- Returns:
- Builder
-
withDiscountOnTotalPrice
public CartBuilder withDiscountOnTotalPrice(Function<DiscountOnTotalPriceBuilder, DiscountOnTotalPrice> builder) Discounts that apply on the Cart
totalPrice.- Parameters:
builder- function to build the discountOnTotalPrice value- Returns:
- Builder
-
discountOnTotalPrice
Discounts that apply on the Cart
totalPrice.- Parameters:
discountOnTotalPrice- value to be set- Returns:
- Builder
-
taxMode
Indicates how Tax Rates are set.
- Parameters:
taxMode- value to be set- Returns:
- Builder
-
priceRoundingMode
Indicates how the total prices on LineItems and CustomLineItems are rounded when calculated. Configured in Project settings.
- Parameters:
priceRoundingMode- value to be set- Returns:
- Builder
-
taxRoundingMode
Indicates how monetary values are rounded when calculating taxes for
taxedPrice. Configured in Project settings.- Parameters:
taxRoundingMode- value to be set- Returns:
- Builder
-
taxCalculationMode
Indicates how taxes are calculated when calculating taxes for
taxedPrice.- Parameters:
taxCalculationMode- value to be set- Returns:
- Builder
-
inventoryMode
Indicates how stock quantities are tracked for Line Items in the Cart.
- Parameters:
inventoryMode- value to be set- Returns:
- Builder
-
cartState
Current status of the Cart.
- Parameters:
cartState- value to be set- Returns:
- Builder
-
billingAddress
Billing address associated with the Cart.
- Parameters:
builder- function to build the billingAddress value- Returns:
- Builder
-
withBillingAddress
Billing address associated with the Cart.
- Parameters:
builder- function to build the billingAddress value- Returns:
- Builder
-
billingAddress
Billing address associated with the Cart.
- Parameters:
billingAddress- value to be set- Returns:
- Builder
-
shippingAddress
Shipping address for a Cart with
SingleShippingMode. Determines eligible ShippingMethod rates and Tax Rates of Line Items.- Parameters:
builder- function to build the shippingAddress value- Returns:
- Builder
-
withShippingAddress
Shipping address for a Cart with
SingleShippingMode. Determines eligible ShippingMethod rates and Tax Rates of Line Items.- Parameters:
builder- function to build the shippingAddress value- Returns:
- Builder
-
shippingAddress
Shipping address for a Cart with
SingleShippingMode. Determines eligible ShippingMethod rates and Tax Rates of Line Items.- Parameters:
shippingAddress- value to be set- Returns:
- Builder
-
shippingMode
Indicates whether the Cart has one or multiple Shipping Methods.
- Parameters:
shippingMode- value to be set- Returns:
- Builder
-
shippingKey
User-defined unique identifier of the Shipping Method in a Cart with
SingleShippingMode.- Parameters:
shippingKey- value to be set- Returns:
- Builder
-
shippingInfo
Shipping-related information of a Cart with
SingleShippingMode. Automatically set when a Shipping Method is set.- Parameters:
builder- function to build the shippingInfo value- Returns:
- Builder
-
withShippingInfo
Shipping-related information of a Cart with
SingleShippingMode. Automatically set when a Shipping Method is set.- Parameters:
builder- function to build the shippingInfo value- Returns:
- Builder
-
shippingInfo
Shipping-related information of a Cart with
SingleShippingMode. Automatically set when a Shipping Method is set.- Parameters:
shippingInfo- value to be set- Returns:
- Builder
-
shippingRateInput
Input used to select a ShippingRatePriceTier. The data type of this field depends on the
shippingRateInputType.typeconfigured 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
- If
-
shippingRateInput
public CartBuilder shippingRateInput(Function<ShippingRateInputBuilder, Builder<? extends ShippingRateInput>> builder) Input used to select a ShippingRatePriceTier. The data type of this field depends on the
shippingRateInputType.typeconfigured 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
- If
-
shippingCustomFields
Custom Fields of the Shipping Method in a Cart with
SingleShippingMode.- Parameters:
builder- function to build the shippingCustomFields value- Returns:
- Builder
-
withShippingCustomFields
Custom Fields of the Shipping Method in a Cart with
SingleShippingMode.- Parameters:
builder- function to build the shippingCustomFields value- Returns:
- Builder
-
shippingCustomFields
Custom Fields of the Shipping Method in a Cart with
SingleShippingMode.- Parameters:
shippingCustomFields- value to be set- Returns:
- Builder
-
shipping
Shipping-related information of a Cart with
MultipleShippingMode. Updated automatically each time a new Shipping Method is added.- Parameters:
shipping- value to be set- Returns:
- Builder
-
shipping
Shipping-related information of a Cart with
MultipleShippingMode. Updated automatically each time a new Shipping Method is added.- Parameters:
shipping- value to be set- Returns:
- Builder
-
plusShipping
Shipping-related information of a Cart with
MultipleShippingMode. Updated automatically each time a new Shipping Method is added.- Parameters:
shipping- value to be set- Returns:
- Builder
-
plusShipping
Shipping-related information of a Cart with
MultipleShippingMode. Updated automatically each time a new Shipping Method is added.- Parameters:
builder- function to build the shipping value- Returns:
- Builder
-
withShipping
Shipping-related information of a Cart with
MultipleShippingMode. Updated automatically each time a new Shipping Method is added.- Parameters:
builder- function to build the shipping value- Returns:
- Builder
-
addShipping
Shipping-related information of a Cart with
MultipleShippingMode. Updated automatically each time a new Shipping Method is added.- Parameters:
builder- function to build the shipping value- Returns:
- Builder
-
setShipping
Shipping-related information of a Cart with
MultipleShippingMode. Updated automatically each time a new Shipping Method is added.- Parameters:
builder- function to build the shipping value- Returns:
- Builder
-
itemShippingAddresses
Additional shipping addresses of the Cart as specified by LineItems using the
shippingDetailsfield.For Carts with
SingleShippingMode: eligible Shipping Methods or applicable Tax Rates are determined by the address inshippingAddress, and notitemShippingAddresses.- Parameters:
itemShippingAddresses- value to be set- Returns:
- Builder
-
itemShippingAddresses
Additional shipping addresses of the Cart as specified by LineItems using the
shippingDetailsfield.For Carts with
SingleShippingMode: eligible Shipping Methods or applicable Tax Rates are determined by the address inshippingAddress, and notitemShippingAddresses.- Parameters:
itemShippingAddresses- value to be set- Returns:
- Builder
-
plusItemShippingAddresses
Additional shipping addresses of the Cart as specified by LineItems using the
shippingDetailsfield.For Carts with
SingleShippingMode: eligible Shipping Methods or applicable Tax Rates are determined by the address inshippingAddress, and notitemShippingAddresses.- Parameters:
itemShippingAddresses- value to be set- Returns:
- Builder
-
plusItemShippingAddresses
Additional shipping addresses of the Cart as specified by LineItems using the
shippingDetailsfield.For Carts with
SingleShippingMode: eligible Shipping Methods or applicable Tax Rates are determined by the address inshippingAddress, and notitemShippingAddresses.- Parameters:
builder- function to build the itemShippingAddresses value- Returns:
- Builder
-
withItemShippingAddresses
Additional shipping addresses of the Cart as specified by LineItems using the
shippingDetailsfield.For Carts with
SingleShippingMode: eligible Shipping Methods or applicable Tax Rates are determined by the address inshippingAddress, and notitemShippingAddresses.- Parameters:
builder- function to build the itemShippingAddresses value- Returns:
- Builder
-
addItemShippingAddresses
Additional shipping addresses of the Cart as specified by LineItems using the
shippingDetailsfield.For Carts with
SingleShippingMode: eligible Shipping Methods or applicable Tax Rates are determined by the address inshippingAddress, and notitemShippingAddresses.- Parameters:
builder- function to build the itemShippingAddresses value- Returns:
- Builder
-
setItemShippingAddresses
Additional shipping addresses of the Cart as specified by LineItems using the
shippingDetailsfield.For Carts with
SingleShippingMode: eligible Shipping Methods or applicable Tax Rates are determined by the address inshippingAddress, and notitemShippingAddresses.- Parameters:
builder- function to build the itemShippingAddresses value- Returns:
- Builder
-
discountCodes
Discount Codes applied to the Cart. A Cart that has
directDiscountscannot havediscountCodes.- Parameters:
discountCodes- value to be set- Returns:
- Builder
-
discountCodes
Discount Codes applied to the Cart. A Cart that has
directDiscountscannot havediscountCodes.- Parameters:
discountCodes- value to be set- Returns:
- Builder
-
plusDiscountCodes
Discount Codes applied to the Cart. A Cart that has
directDiscountscannot havediscountCodes.- Parameters:
discountCodes- value to be set- Returns:
- Builder
-
plusDiscountCodes
public CartBuilder plusDiscountCodes(Function<DiscountCodeInfoBuilder, DiscountCodeInfoBuilder> builder) Discount Codes applied to the Cart. A Cart that has
directDiscountscannot havediscountCodes.- Parameters:
builder- function to build the discountCodes value- Returns:
- Builder
-
withDiscountCodes
public CartBuilder withDiscountCodes(Function<DiscountCodeInfoBuilder, DiscountCodeInfoBuilder> builder) Discount Codes applied to the Cart. A Cart that has
directDiscountscannot havediscountCodes.- Parameters:
builder- function to build the discountCodes value- Returns:
- Builder
-
addDiscountCodes
Discount Codes applied to the Cart. A Cart that has
directDiscountscannot havediscountCodes.- Parameters:
builder- function to build the discountCodes value- Returns:
- Builder
-
setDiscountCodes
Discount Codes applied to the Cart. A Cart that has
directDiscountscannot havediscountCodes.- Parameters:
builder- function to build the discountCodes value- Returns:
- Builder
-
directDiscounts
Direct Discounts added to the Cart. A Cart that has
discountCodescannot havedirectDiscounts.- Parameters:
directDiscounts- value to be set- Returns:
- Builder
-
directDiscounts
Direct Discounts added to the Cart. A Cart that has
discountCodescannot havedirectDiscounts.- Parameters:
directDiscounts- value to be set- Returns:
- Builder
-
plusDirectDiscounts
Direct Discounts added to the Cart. A Cart that has
discountCodescannot havedirectDiscounts.- Parameters:
directDiscounts- value to be set- Returns:
- Builder
-
plusDirectDiscounts
public CartBuilder plusDirectDiscounts(Function<DirectDiscountBuilder, DirectDiscountBuilder> builder) Direct Discounts added to the Cart. A Cart that has
discountCodescannot havedirectDiscounts.- Parameters:
builder- function to build the directDiscounts value- Returns:
- Builder
-
withDirectDiscounts
public CartBuilder withDirectDiscounts(Function<DirectDiscountBuilder, DirectDiscountBuilder> builder) Direct Discounts added to the Cart. A Cart that has
discountCodescannot havedirectDiscounts.- Parameters:
builder- function to build the directDiscounts value- Returns:
- Builder
-
addDirectDiscounts
Direct Discounts added to the Cart. A Cart that has
discountCodescannot havedirectDiscounts.- Parameters:
builder- function to build the directDiscounts value- Returns:
- Builder
-
setDirectDiscounts
Direct Discounts added to the Cart. A Cart that has
discountCodescannot havedirectDiscounts.- Parameters:
builder- function to build the directDiscounts value- Returns:
- Builder
-
refusedGifts
Automatically set when a Line Item with
GiftLineItemLineItemMode is removed from the Cart.- Parameters:
refusedGifts- value to be set- Returns:
- Builder
-
refusedGifts
Automatically set when a Line Item with
GiftLineItemLineItemMode is removed from the Cart.- Parameters:
refusedGifts- value to be set- Returns:
- Builder
-
plusRefusedGifts
Automatically set when a Line Item with
GiftLineItemLineItemMode is removed from the Cart.- Parameters:
refusedGifts- value to be set- Returns:
- Builder
-
plusRefusedGifts
public CartBuilder plusRefusedGifts(Function<CartDiscountReferenceBuilder, CartDiscountReferenceBuilder> builder) Automatically set when a Line Item with
GiftLineItemLineItemMode is removed from the Cart.- Parameters:
builder- function to build the refusedGifts value- Returns:
- Builder
-
withRefusedGifts
public CartBuilder withRefusedGifts(Function<CartDiscountReferenceBuilder, CartDiscountReferenceBuilder> builder) Automatically set when a Line Item with
GiftLineItemLineItemMode is removed from the Cart.- Parameters:
builder- function to build the refusedGifts value- Returns:
- Builder
-
addRefusedGifts
public CartBuilder addRefusedGifts(Function<CartDiscountReferenceBuilder, CartDiscountReference> builder) Automatically set when a Line Item with
GiftLineItemLineItemMode is removed from the Cart.- Parameters:
builder- function to build the refusedGifts value- Returns:
- Builder
-
setRefusedGifts
public CartBuilder setRefusedGifts(Function<CartDiscountReferenceBuilder, CartDiscountReference> builder) Automatically set when a Line Item with
GiftLineItemLineItemMode is removed from the Cart.- Parameters:
builder- function to build the refusedGifts value- Returns:
- Builder
-
paymentInfo
Payment information related to the Cart.
- Parameters:
builder- function to build the paymentInfo value- Returns:
- Builder
-
withPaymentInfo
Payment information related to the Cart.
- Parameters:
builder- function to build the paymentInfo value- Returns:
- Builder
-
paymentInfo
Payment information related to the Cart.
- Parameters:
paymentInfo- value to be set- Returns:
- Builder
-
country
Used for Line Item price selection.
- Parameters:
country- value to be set- Returns:
- Builder
-
locale
Language of the Cart. Must be one of the languages supported by the Project.
- Parameters:
locale- value to be set- Returns:
- Builder
-
origin
Indicates how the Cart was created.
- Parameters:
origin- value to be set- Returns:
- Builder
-
custom
Custom Fields of the Cart.
- Parameters:
builder- function to build the custom value- Returns:
- Builder
-
withCustom
Custom Fields of the Cart.
- Parameters:
builder- function to build the custom value- Returns:
- Builder
-
custom
Custom Fields of the Cart.
- Parameters:
custom- value to be set- Returns:
- Builder
-
discountTypeCombination
public CartBuilder discountTypeCombination(@Nullable DiscountTypeCombination discountTypeCombination) Indicates if a combination of discount types can apply on a Cart.
- Parameters:
discountTypeCombination- value to be set- Returns:
- Builder
-
discountTypeCombination
public CartBuilder discountTypeCombination(Function<DiscountTypeCombinationBuilder, Builder<? extends DiscountTypeCombination>> builder) Indicates if a combination of discount types can apply on a Cart.
- Parameters:
builder- function to build the discountTypeCombination value- Returns:
- Builder
-
deleteDaysAfterLastModification
public CartBuilder deleteDaysAfterLastModification(@Nullable Integer deleteDaysAfterLastModification) Number of days after the last modification before a Cart is deleted. Configured in Project settings.
- Parameters:
deleteDaysAfterLastModification- value to be set- Returns:
- Builder
-
lastModifiedBy
IDs and references that last modified the Cart.
- Parameters:
builder- function to build the lastModifiedBy value- Returns:
- Builder
-
withLastModifiedBy
IDs and references that last modified the Cart.
- Parameters:
builder- function to build the lastModifiedBy value- Returns:
- Builder
-
lastModifiedBy
IDs and references that last modified the Cart.
- Parameters:
lastModifiedBy- value to be set- Returns:
- Builder
-
createdBy
IDs and references that created the Cart.
- Parameters:
builder- function to build the createdBy value- Returns:
- Builder
-
withCreatedBy
IDs and references that created the Cart.
- Parameters:
builder- function to build the createdBy value- Returns:
- Builder
-
createdBy
IDs and references that created the Cart.
- Parameters:
createdBy- value to be set- Returns:
- Builder
-
getId
Unique identifier of the Cart.
- Returns:
- id
-
getVersion
Current version of the Cart.
- Returns:
- version
-
getCreatedAt
Date and time (UTC) the Cart was initially created.
- Returns:
- createdAt
-
getLastModifiedAt
Date and time (UTC) the Cart was last updated.
- Returns:
- lastModifiedAt
-
getKey
User-defined unique identifier of the Cart.
- Returns:
- key
-
getCustomerId
idof the Customer that the Cart belongs to.- Returns:
- customerId
-
getCustomerEmail
Email address of the Customer that the Cart belongs to.
- Returns:
- customerEmail
-
getCustomerGroup
Reference to the Customer Group of the Customer that the Cart belongs to. Used for Line Item price selection.
- Returns:
- customerGroup
-
getAnonymousId
Anonymous session associated with the Cart.
- Returns:
- anonymousId
-
getBusinessUnit
Reference to a Business Unit the Cart belongs to. Only available for B2B-enabled Projects.
- Returns:
- businessUnit
-
getStore
Reference to a Store the Cart belongs to.
- Returns:
- store
-
getLineItems
Line Items added to the Cart.
- Returns:
- lineItems
-
getCustomLineItems
Custom Line Items added to the Cart.
- Returns:
- customLineItems
-
getTotalLineItemQuantity
Sum of all LineItem quantities, excluding CustomLineItems. Only present when the Cart has at least one LineItem.
- Returns:
- totalLineItemQuantity
-
getTotalPrice
Sum of the
totalPricefield of all LineItems and CustomLineItems, and if available, thepricefield of ShippingInfo. If a discount applies ontotalPrice, this field holds the discounted value.Taxes are included if TaxRate
includedInPriceistruefor each price.- Returns:
- totalPrice
-
getTaxedPrice
- For a Cart with
PlatformTaxMode, it is automatically set when a shipping address is set. For Carts withMultipleShippingMode, all Line Items and Custom Line Items must be fully distributed between the Shipping Methods (viashippingDetails), otherwisetaxedPriceis not automatically set. - For a Cart with
ExternalTaxMode, it is automatically set whenshippingAddressand external Tax Rates for all Line Items, Custom Line Items, and Shipping Methods in the Cart are set. For Carts withMultipleShippingMode, all allocations must have their respective tax rates present inperMethodTaxRate, otherwisetaxedPriceis not automatically set.
If a discount applies on
totalPrice, this field holds the proportionally discounted value.- Returns:
- taxedPrice
- For a Cart with
-
getTaxedShippingPrice
Sum of the
taxedPricefield of ShippingInfo across all Shipping Methods.If a discount applies on
totalPrice, this field holds the proportionally discounted value.- Returns:
- taxedShippingPrice
-
getDiscountOnTotalPrice
Discounts that apply on the Cart
totalPrice.- Returns:
- discountOnTotalPrice
-
getTaxMode
Indicates how Tax Rates are set.
- Returns:
- taxMode
-
getPriceRoundingMode
Indicates how the total prices on LineItems and CustomLineItems are rounded when calculated. Configured in Project settings.
- Returns:
- priceRoundingMode
-
getTaxRoundingMode
Indicates how monetary values are rounded when calculating taxes for
taxedPrice. Configured in Project settings.- Returns:
- taxRoundingMode
-
getTaxCalculationMode
Indicates how taxes are calculated when calculating taxes for
taxedPrice.- Returns:
- taxCalculationMode
-
getInventoryMode
Indicates how stock quantities are tracked for Line Items in the Cart.
- Returns:
- inventoryMode
-
getCartState
Current status of the Cart.
- Returns:
- cartState
-
getBillingAddress
Billing address associated with the Cart.
- Returns:
- billingAddress
-
getShippingAddress
Shipping address for a Cart with
SingleShippingMode. Determines eligible ShippingMethod rates and Tax Rates of Line Items.- Returns:
- shippingAddress
-
getShippingMode
Indicates whether the Cart has one or multiple Shipping Methods.
- Returns:
- shippingMode
-
getShippingKey
User-defined unique identifier of the Shipping Method in a Cart with
SingleShippingMode.- Returns:
- shippingKey
-
getShippingInfo
Shipping-related information of a Cart with
SingleShippingMode. Automatically set when a Shipping Method is set.- Returns:
- shippingInfo
-
getShippingRateInput
Input used to select a ShippingRatePriceTier. The data type of this field depends on the
shippingRateInputType.typeconfigured in the Project:- If
CartClassification, it is ClassificationShippingRateInput. - If
CartScore, it is ScoreShippingRateInput. - If
CartValue, it cannot be used.
- Returns:
- shippingRateInput
- If
-
getShippingCustomFields
Custom Fields of the Shipping Method in a Cart with
SingleShippingMode.- Returns:
- shippingCustomFields
-
getShipping
Shipping-related information of a Cart with
MultipleShippingMode. Updated automatically each time a new Shipping Method is added.- Returns:
- shipping
-
getItemShippingAddresses
Additional shipping addresses of the Cart as specified by LineItems using the
shippingDetailsfield.For Carts with
SingleShippingMode: eligible Shipping Methods or applicable Tax Rates are determined by the address inshippingAddress, and notitemShippingAddresses.- Returns:
- itemShippingAddresses
-
getDiscountCodes
Discount Codes applied to the Cart. A Cart that has
directDiscountscannot havediscountCodes.- Returns:
- discountCodes
-
getDirectDiscounts
Direct Discounts added to the Cart. A Cart that has
discountCodescannot havedirectDiscounts.- Returns:
- directDiscounts
-
getRefusedGifts
Automatically set when a Line Item with
GiftLineItemLineItemMode is removed from the Cart.- Returns:
- refusedGifts
-
getPaymentInfo
Payment information related to the Cart.
- Returns:
- paymentInfo
-
getCountry
Used for Line Item price selection.
- Returns:
- country
-
getLocale
Language of the Cart. Must be one of the languages supported by the Project.
- Returns:
- locale
-
getOrigin
Indicates how the Cart was created.
- Returns:
- origin
-
getCustom
Custom Fields of the Cart.
- Returns:
- custom
-
getDiscountTypeCombination
Indicates if a combination of discount types can apply on a Cart.
- Returns:
- discountTypeCombination
-
getDeleteDaysAfterLastModification
Number of days after the last modification before a Cart is deleted. Configured in Project settings.
- Returns:
- deleteDaysAfterLastModification
-
getLastModifiedBy
IDs and references that last modified the Cart.
- Returns:
- lastModifiedBy
-
getCreatedBy
IDs and references that created the Cart.
- Returns:
- createdBy
-
build
builds Cart with checking for non-null required values -
buildUnchecked
builds Cart without checking for non-null required values- Returns:
- Cart
-
of
factory method for an instance of CartBuilder- Returns:
- builder
-
of
create builder for Cart instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-