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)
.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
-
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 theshippingDetails
field.addLineItems
(Function<LineItemBuilder, LineItem> builder) Line Items added to the Cart.Automatically set when a Line Item withGiftLineItem
LineItemMode is removed from the Cart.addShipping
(Function<ShippingBuilder, Shipping> builder) Shipping-related information of a Cart withMultiple
ShippingMode.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) id
of 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 which an active Cart is deleted since its last modification.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
.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.id
of the Customer that the Cart belongs to.Custom Line Items added to the Cart.Number of days after which an active Cart is deleted since its last modification.Direct Discounts added to the Cart.Discount Codes applied to the Cart.Discounts that apply on the CarttotalPrice
.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 theshippingDetails
field.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.Languages of the Cart.Indicates how the Cart was created.Payment information related to the Cart.Automatically set when a Line Item withGiftLineItem
LineItemMode is removed from the Cart.Shipping-related information of a Cart withMultiple
ShippingMode.Shipping address for a Cart withSingle
ShippingMode.Custom Fields of the Shipping Method in a Cart withSingle
ShippingMode.Shipping-related information of a Cart withSingle
ShippingMode.User-defined unique identifier of the Shipping Method in a Cart withSingle
ShippingMode.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
.For a Cart withPlatform
TaxMode, it is automatically set when a shipping address is set.Sum of thetaxedPrice
field 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 thetotalPrice
field of all LineItems and CustomLineItems, and if available, theprice
field 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 theshippingDetails
field.itemShippingAddresses
(List<Address> itemShippingAddresses) Additional shipping addresses of the Cart as specified by LineItems using theshippingDetails
field.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.Languages of the Cart.static CartBuilder
of()
factory method for an instance of CartBuilderstatic CartBuilder
create 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 theshippingDetails
field.Additional shipping addresses of the Cart as specified by LineItems using theshippingDetails
field.plusLineItems
(LineItem... lineItems) Line Items added to the Cart.plusLineItems
(Function<LineItemBuilder, LineItemBuilder> builder) Line Items added to the Cart.plusRefusedGifts
(CartDiscountReference... refusedGifts) Automatically set when a Line Item withGiftLineItem
LineItemMode is removed from the Cart.Automatically set when a Line Item withGiftLineItem
LineItemMode is removed from the Cart.plusShipping
(Shipping... shipping) Shipping-related information of a Cart withMultiple
ShippingMode.plusShipping
(Function<ShippingBuilder, ShippingBuilder> builder) Shipping-related information of a Cart withMultiple
ShippingMode.refusedGifts
(CartDiscountReference... refusedGifts) Automatically set when a Line Item withGiftLineItem
LineItemMode is removed from the Cart.refusedGifts
(List<CartDiscountReference> refusedGifts) Automatically set when a Line Item withGiftLineItem
LineItemMode is removed from the Cart.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 theshippingDetails
field.setLineItems
(Function<LineItemBuilder, LineItem> builder) Line Items added to the Cart.Automatically set when a Line Item withGiftLineItem
LineItemMode is removed from the Cart.setShipping
(Function<ShippingBuilder, Shipping> builder) Shipping-related information of a Cart withMultiple
ShippingMode.Shipping-related information of a Cart withMultiple
ShippingMode.Shipping-related information of a Cart withMultiple
ShippingMode.shippingAddress
(Address shippingAddress) Shipping address for a Cart withSingle
ShippingMode.shippingAddress
(Function<AddressBuilder, AddressBuilder> builder) Shipping address for a Cart withSingle
ShippingMode.shippingCustomFields
(CustomFields shippingCustomFields) Custom Fields of the Shipping Method in a Cart withSingle
ShippingMode.Custom Fields of the Shipping Method in a Cart withSingle
ShippingMode.shippingInfo
(ShippingInfo shippingInfo) Shipping-related information of a Cart withSingle
ShippingMode.Shipping-related information of a Cart withSingle
ShippingMode.shippingKey
(String shippingKey) User-defined unique identifier of the Shipping Method in a Cart withSingle
ShippingMode.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) For a Cart withPlatform
TaxMode, it is automatically set when a shipping address is set.taxedPrice
(Function<TaxedPriceBuilder, TaxedPriceBuilder> builder) For a Cart withPlatform
TaxMode, it is automatically set when a shipping address is set.taxedShippingPrice
(TaxedPrice taxedShippingPrice) Sum of thetaxedPrice
field of ShippingInfo across all Shipping Methods.Sum of thetaxedPrice
field 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 thetotalPrice
field of all LineItems and CustomLineItems, and if available, theprice
field of ShippingInfo.Sum of thetotalPrice
field of all LineItems and CustomLineItems, and if available, theprice
field 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 theshippingDetails
field.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.Automatically set when a Line Item withGiftLineItem
LineItemMode is removed from the Cart.withShipping
(Function<ShippingBuilder, ShippingBuilder> builder) Shipping-related information of a Cart withMultiple
ShippingMode.withShippingAddress
(Function<AddressBuilder, Address> builder) Shipping address for a Cart withSingle
ShippingMode.Custom Fields of the Shipping Method in a Cart withSingle
ShippingMode.Shipping-related information of a Cart withSingle
ShippingMode.Reference to a Store the Cart belongs to.withTaxedPrice
(Function<TaxedPriceBuilder, TaxedPrice> builder) For a Cart withPlatform
TaxMode, it is automatically set when a shipping address is set.Sum of thetaxedPrice
field of ShippingInfo across all Shipping Methods.Sum of thetotalPrice
field of all LineItems and CustomLineItems, and if available, theprice
field 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
id
of 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.
- 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.
- Parameters:
builder
- function to build the businessUnit value- Returns:
- Builder
-
businessUnit
Reference to a Business Unit the Cart belongs to.
- 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
totalPrice
field of all LineItems and CustomLineItems, and if available, theprice
field of ShippingInfo. If a discount applies ontotalPrice
, this field holds the discounted value.Taxes are included if TaxRate
includedInPrice
istrue
for each price.- Parameters:
builder
- function to build the totalPrice value- Returns:
- Builder
-
withTotalPrice
Sum of the
totalPrice
field of all LineItems and CustomLineItems, and if available, theprice
field of ShippingInfo. If a discount applies ontotalPrice
, this field holds the discounted value.Taxes are included if TaxRate
includedInPrice
istrue
for each price.- Parameters:
builder
- function to build the totalPrice value- Returns:
- Builder
-
totalPrice
Sum of the
totalPrice
field of all LineItems and CustomLineItems, and if available, theprice
field of ShippingInfo. If a discount applies ontotalPrice
, this field holds the discounted value.Taxes are included if TaxRate
includedInPrice
istrue
for each price.- Parameters:
totalPrice
- value to be set- Returns:
- Builder
-
taxedPrice
- For a Cart with
Platform
TaxMode, it is automatically set when a shipping address is set. For Carts withMultiple
ShippingMode, all Line Items and Custom Line Items must be fully distributed between the Shipping Methods (viashippingDetails
), otherwisetaxedPrice
is not automatically set. - For a Cart with
External
TaxMode, it is automatically set whenshippingAddress
and external Tax Rates for all Line Items, Custom Line Items, and Shipping Methods in the Cart are set. For Carts withMultiple
ShippingMode, all allocations must have their respective tax rates present inperMethodTaxRate
, otherwisetaxedPrice
is not automatically set.
If a discount applies on
totalPrice
, this field holds the discounted values.- Parameters:
builder
- function to build the taxedPrice value- Returns:
- Builder
- For a Cart with
-
withTaxedPrice
- For a Cart with
Platform
TaxMode, it is automatically set when a shipping address is set. For Carts withMultiple
ShippingMode, all Line Items and Custom Line Items must be fully distributed between the Shipping Methods (viashippingDetails
), otherwisetaxedPrice
is not automatically set. - For a Cart with
External
TaxMode, it is automatically set whenshippingAddress
and external Tax Rates for all Line Items, Custom Line Items, and Shipping Methods in the Cart are set. For Carts withMultiple
ShippingMode, all allocations must have their respective tax rates present inperMethodTaxRate
, otherwisetaxedPrice
is not automatically set.
If a discount applies on
totalPrice
, this field holds the discounted values.- Parameters:
builder
- function to build the taxedPrice value- Returns:
- Builder
- For a Cart with
-
taxedPrice
- For a Cart with
Platform
TaxMode, it is automatically set when a shipping address is set. For Carts withMultiple
ShippingMode, all Line Items and Custom Line Items must be fully distributed between the Shipping Methods (viashippingDetails
), otherwisetaxedPrice
is not automatically set. - For a Cart with
External
TaxMode, it is automatically set whenshippingAddress
and external Tax Rates for all Line Items, Custom Line Items, and Shipping Methods in the Cart are set. For Carts withMultiple
ShippingMode, all allocations must have their respective tax rates present inperMethodTaxRate
, otherwisetaxedPrice
is not automatically set.
If a discount applies on
totalPrice
, this field holds the discounted values.- Parameters:
taxedPrice
- value to be set- Returns:
- Builder
- For a Cart with
-
taxedShippingPrice
Sum of the
taxedPrice
field of ShippingInfo across all Shipping Methods.- Parameters:
builder
- function to build the taxedShippingPrice value- Returns:
- Builder
-
withTaxedShippingPrice
Sum of the
taxedPrice
field of ShippingInfo across all Shipping Methods.- Parameters:
builder
- function to build the taxedShippingPrice value- Returns:
- Builder
-
taxedShippingPrice
Sum of the
taxedPrice
field of ShippingInfo across all Shipping Methods.- 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
-
taxRoundingMode
Indicates how monetary values are rounded when calculating taxes for
taxedPrice
.- 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
Single
ShippingMode. 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
Single
ShippingMode. 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
Single
ShippingMode. 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
Single
ShippingMode.- Parameters:
shippingKey
- value to be set- Returns:
- Builder
-
shippingInfo
Shipping-related information of a Cart with
Single
ShippingMode. 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
Single
ShippingMode. 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
Single
ShippingMode. 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.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
- 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.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
- If
-
shippingCustomFields
Custom Fields of the Shipping Method in a Cart with
Single
ShippingMode.- Parameters:
builder
- function to build the shippingCustomFields value- Returns:
- Builder
-
withShippingCustomFields
Custom Fields of the Shipping Method in a Cart with
Single
ShippingMode.- Parameters:
builder
- function to build the shippingCustomFields value- Returns:
- Builder
-
shippingCustomFields
Custom Fields of the Shipping Method in a Cart with
Single
ShippingMode.- Parameters:
shippingCustomFields
- value to be set- Returns:
- Builder
-
shipping
Shipping-related information of a Cart with
Multiple
ShippingMode. 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
Multiple
ShippingMode. 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
Multiple
ShippingMode. 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
Multiple
ShippingMode. 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
Multiple
ShippingMode. 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
Multiple
ShippingMode. 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
Multiple
ShippingMode. 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
shippingDetails
field.For Carts with
Single
ShippingMode: 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
shippingDetails
field.For Carts with
Single
ShippingMode: 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
shippingDetails
field.For Carts with
Single
ShippingMode: 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
shippingDetails
field.For Carts with
Single
ShippingMode: 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
shippingDetails
field.For Carts with
Single
ShippingMode: 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
shippingDetails
field.For Carts with
Single
ShippingMode: 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
shippingDetails
field.For Carts with
Single
ShippingMode: 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
directDiscounts
cannot havediscountCodes
.- Parameters:
discountCodes
- value to be set- Returns:
- Builder
-
discountCodes
Discount Codes applied to the Cart. A Cart that has
directDiscounts
cannot havediscountCodes
.- Parameters:
discountCodes
- value to be set- Returns:
- Builder
-
plusDiscountCodes
Discount Codes applied to the Cart. A Cart that has
directDiscounts
cannot 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
directDiscounts
cannot 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
directDiscounts
cannot havediscountCodes
.- Parameters:
builder
- function to build the discountCodes value- Returns:
- Builder
-
addDiscountCodes
Discount Codes applied to the Cart. A Cart that has
directDiscounts
cannot havediscountCodes
.- Parameters:
builder
- function to build the discountCodes value- Returns:
- Builder
-
setDiscountCodes
Discount Codes applied to the Cart. A Cart that has
directDiscounts
cannot havediscountCodes
.- Parameters:
builder
- function to build the discountCodes value- Returns:
- Builder
-
directDiscounts
Direct Discounts added to the Cart. A Cart that has
discountCodes
cannot havedirectDiscounts
.- Parameters:
directDiscounts
- value to be set- Returns:
- Builder
-
directDiscounts
Direct Discounts added to the Cart. A Cart that has
discountCodes
cannot havedirectDiscounts
.- Parameters:
directDiscounts
- value to be set- Returns:
- Builder
-
plusDirectDiscounts
Direct Discounts added to the Cart. A Cart that has
discountCodes
cannot 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
discountCodes
cannot 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
discountCodes
cannot havedirectDiscounts
.- Parameters:
builder
- function to build the directDiscounts value- Returns:
- Builder
-
addDirectDiscounts
Direct Discounts added to the Cart. A Cart that has
discountCodes
cannot havedirectDiscounts
.- Parameters:
builder
- function to build the directDiscounts value- Returns:
- Builder
-
setDirectDiscounts
Direct Discounts added to the Cart. A Cart that has
discountCodes
cannot havedirectDiscounts
.- Parameters:
builder
- function to build the directDiscounts value- Returns:
- Builder
-
refusedGifts
Automatically set when a Line Item with
GiftLineItem
LineItemMode is removed from the Cart.- Parameters:
refusedGifts
- value to be set- Returns:
- Builder
-
refusedGifts
Automatically set when a Line Item with
GiftLineItem
LineItemMode is removed from the Cart.- Parameters:
refusedGifts
- value to be set- Returns:
- Builder
-
plusRefusedGifts
Automatically set when a Line Item with
GiftLineItem
LineItemMode 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
GiftLineItem
LineItemMode 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
GiftLineItem
LineItemMode 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
GiftLineItem
LineItemMode 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
GiftLineItem
LineItemMode 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
Languages of the Cart. Can only contain 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
-
deleteDaysAfterLastModification
public CartBuilder deleteDaysAfterLastModification(@Nullable Integer deleteDaysAfterLastModification) Number of days after which an active Cart is deleted since its last modification. 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
id
of 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.
- 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
totalPrice
field of all LineItems and CustomLineItems, and if available, theprice
field of ShippingInfo. If a discount applies ontotalPrice
, this field holds the discounted value.Taxes are included if TaxRate
includedInPrice
istrue
for each price.- Returns:
- totalPrice
-
getTaxedPrice
- For a Cart with
Platform
TaxMode, it is automatically set when a shipping address is set. For Carts withMultiple
ShippingMode, all Line Items and Custom Line Items must be fully distributed between the Shipping Methods (viashippingDetails
), otherwisetaxedPrice
is not automatically set. - For a Cart with
External
TaxMode, it is automatically set whenshippingAddress
and external Tax Rates for all Line Items, Custom Line Items, and Shipping Methods in the Cart are set. For Carts withMultiple
ShippingMode, all allocations must have their respective tax rates present inperMethodTaxRate
, otherwisetaxedPrice
is not automatically set.
If a discount applies on
totalPrice
, this field holds the discounted values.- Returns:
- taxedPrice
- For a Cart with
-
getTaxedShippingPrice
Sum of the
taxedPrice
field of ShippingInfo across all Shipping Methods.- Returns:
- taxedShippingPrice
-
getDiscountOnTotalPrice
Discounts that apply on the Cart
totalPrice
.- Returns:
- discountOnTotalPrice
-
getTaxMode
Indicates how Tax Rates are set.
- Returns:
- taxMode
-
getTaxRoundingMode
Indicates how monetary values are rounded when calculating taxes for
taxedPrice
.- 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
Single
ShippingMode. 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
Single
ShippingMode.- Returns:
- shippingKey
-
getShippingInfo
Shipping-related information of a Cart with
Single
ShippingMode. 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.type
configured 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
Single
ShippingMode.- Returns:
- shippingCustomFields
-
getShipping
Shipping-related information of a Cart with
Multiple
ShippingMode. 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
shippingDetails
field.For Carts with
Single
ShippingMode: 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
directDiscounts
cannot havediscountCodes
.- Returns:
- discountCodes
-
getDirectDiscounts
Direct Discounts added to the Cart. A Cart that has
discountCodes
cannot havedirectDiscounts
.- Returns:
- directDiscounts
-
getRefusedGifts
Automatically set when a Line Item with
GiftLineItem
LineItemMode 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
Languages of the Cart. Can only contain languages supported by the Project.
- Returns:
- locale
-
getOrigin
Indicates how the Cart was created.
- Returns:
- origin
-
getCustom
Custom Fields of the Cart.
- Returns:
- custom
-
getDeleteDaysAfterLastModification
Number of days after which an active Cart is deleted since its last modification. 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
-