Class CartDraftBuilder
Example to create an instance using the builder pattern
CartDraft cartDraft = CartDraft.builder()
.currency("{currency}")
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCustom Line Items to add to the Cart.Custom Shipping Methods for a Cart withMultiple
ShippingMode.Multiple shipping addresses of the Cart.Line Items to add to the Cart.addShipping
(Function<ShippingDraftBuilder, ShippingDraft> builder) Shipping Methods for a Cart withMultiple
ShippingMode.anonymousId
(String anonymousId) Anonymous session associated with the Cart.billingAddress
(BaseAddress billingAddress) Billing address associated with the Cart.Billing address associated with the Cart.build()
builds CartDraft with checking for non-null required valuesbuilds CartDraft without checking for non-null required valuesbusinessUnit
(BusinessUnitResourceIdentifier businessUnit) ResourceIdentifier to the Business Unit the Cart should belong to.businessUnit
(Function<BusinessUnitResourceIdentifierBuilder, BusinessUnitResourceIdentifierBuilder> builder) ResourceIdentifier to the Business Unit the Cart should belong to.Used for Line Item price selection.Currency the Cart uses.custom
(CustomFieldsDraft custom) Custom Fields for the Cart.Custom Fields for the Cart.customerEmail
(String customerEmail) Email address of the Customer that the Cart belongs to.customerGroup
(CustomerGroupResourceIdentifier customerGroup) ResourceIdentifier to the Customer Group of the Customer that the Cart belongs to.customerGroup
(Function<CustomerGroupResourceIdentifierBuilder, CustomerGroupResourceIdentifierBuilder> builder) ResourceIdentifier 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
(CustomLineItemDraft... customLineItems) Custom Line Items to add to the Cart.customLineItems
(List<CustomLineItemDraft> customLineItems) Custom Line Items to add to the Cart.customShipping
(CustomShippingDraft... customShipping) Custom Shipping Methods for a Cart withMultiple
ShippingMode.customShipping
(List<CustomShippingDraft> customShipping) Custom Shipping Methods for a Cart withMultiple
ShippingMode.deleteDaysAfterLastModification
(Long deleteDaysAfterLastModification) Number of days after which an active Cart is deleted since its last modification.discountCodes
(String... discountCodes) code
of the existing DiscountCodes to add to the Cart.discountCodes
(List<String> discountCodes) code
of the existing DiscountCodes to add to the Cart.externalTaxRateForShippingMethod
(ExternalTaxRateDraft externalTaxRateForShippingMethod) External Tax Rate for theshippingMethod
if the Cart hasExternal
TaxMode.externalTaxRateForShippingMethod
(Function<ExternalTaxRateDraftBuilder, ExternalTaxRateDraftBuilder> builder) External Tax Rate for theshippingMethod
if the Cart hasExternal
TaxMode.Anonymous session associated with the Cart.Billing address associated with the Cart.ResourceIdentifier to the Business Unit the Cart should belong to.Used for Line Item price selection.Currency the Cart uses.Custom Fields for the Cart.Email address of the Customer that the Cart belongs to.ResourceIdentifier to the Customer Group of the Customer that the Cart belongs to.id
of the Customer that the Cart belongs to.Custom Line Items to add to the Cart.Custom Shipping Methods for a Cart withMultiple
ShippingMode.Number of days after which an active Cart is deleted since its last modification.code
of the existing DiscountCodes to add to the Cart.External Tax Rate for theshippingMethod
if the Cart hasExternal
TaxMode.Determines how stock quantities are tracked for Line Items in the Cart.Multiple shipping addresses of the Cart.getKey()
User-defined unique identifier for the Cart.Line Items to add to the Cart.Languages of the Cart.Indicates how the Cart was created.Shipping Methods for a Cart withMultiple
ShippingMode.Shipping address for a Cart withSingle
ShippingMode.Shipping Method for a Cart withSingle
ShippingMode.If set toSingle
, only a single Shipping Method can be added to the Cart. If set toMultiple
, multiple Shipping Methods can be added to the Cart.Used as an input to select a ShippingRatePriceTier.getStore()
ResourceIdentifier to the Store the Cart should belong to.Determines how taxes are calculated fortaxedPrice
.Determines how Tax Rates are set.Determines how monetary values are rounded when calculating taxes fortaxedPrice
.inventoryMode
(InventoryMode inventoryMode) Determines how stock quantities are tracked for Line Items in the Cart.itemShippingAddresses
(BaseAddress... itemShippingAddresses) Multiple shipping addresses of the Cart.itemShippingAddresses
(List<BaseAddress> itemShippingAddresses) Multiple shipping addresses of the Cart.User-defined unique identifier for the Cart.lineItems
(LineItemDraft... lineItems) Line Items to add to the Cart.lineItems
(List<LineItemDraft> lineItems) Line Items to add to the Cart.Languages of the Cart.static CartDraftBuilder
of()
factory method for an instance of CartDraftBuilderstatic CartDraftBuilder
create builder for CartDraft instanceorigin
(CartOrigin origin) Indicates how the Cart was created.plusCustomLineItems
(CustomLineItemDraft... customLineItems) Custom Line Items to add to the Cart.Custom Line Items to add to the Cart.plusCustomShipping
(CustomShippingDraft... customShipping) Custom Shipping Methods for a Cart withMultiple
ShippingMode.Custom Shipping Methods for a Cart withMultiple
ShippingMode.plusDiscountCodes
(String... discountCodes) code
of the existing DiscountCodes to add to the Cart.plusItemShippingAddresses
(BaseAddress... itemShippingAddresses) Multiple shipping addresses of the Cart.Multiple shipping addresses of the Cart.plusLineItems
(LineItemDraft... lineItems) Line Items to add to the Cart.Line Items to add to the Cart.plusShipping
(ShippingDraft... shipping) Shipping Methods for a Cart withMultiple
ShippingMode.Shipping Methods for a Cart withMultiple
ShippingMode.Custom Line Items to add to the Cart.Custom Shipping Methods for a Cart withMultiple
ShippingMode.Multiple shipping addresses of the Cart.Line Items to add to the Cart.setShipping
(Function<ShippingDraftBuilder, ShippingDraft> builder) Shipping Methods for a Cart withMultiple
ShippingMode.shipping
(ShippingDraft... shipping) Shipping Methods for a Cart withMultiple
ShippingMode.shipping
(List<ShippingDraft> shipping) Shipping Methods for a Cart withMultiple
ShippingMode.shippingAddress
(BaseAddress shippingAddress) Shipping address for a Cart withSingle
ShippingMode.Shipping address for a Cart withSingle
ShippingMode.shippingMethod
(ShippingMethodResourceIdentifier shippingMethod) Shipping Method for a Cart withSingle
ShippingMode.shippingMethod
(Function<ShippingMethodResourceIdentifierBuilder, ShippingMethodResourceIdentifierBuilder> builder) Shipping Method for a Cart withSingle
ShippingMode.shippingMode
(ShippingMode shippingMode) If set toSingle
, only a single Shipping Method can be added to the Cart. If set toMultiple
, multiple Shipping Methods can be added to the Cart.shippingRateInput
(ShippingRateInputDraft shippingRateInput) Used as an input to select a ShippingRatePriceTier.shippingRateInput
(Function<ShippingRateInputDraftBuilder, Builder<? extends ShippingRateInputDraft>> builder) Used as an input to select a ShippingRatePriceTier.store
(StoreResourceIdentifier store) ResourceIdentifier to the Store the Cart should belong to.ResourceIdentifier to the Store the Cart should belong to.taxCalculationMode
(TaxCalculationMode taxCalculationMode) Determines how taxes are calculated fortaxedPrice
.Determines how Tax Rates are set.taxRoundingMode
(RoundingMode taxRoundingMode) Determines how monetary values are rounded when calculating taxes fortaxedPrice
.Billing address associated with the Cart.withBusinessUnit
(Function<BusinessUnitResourceIdentifierBuilder, BusinessUnitResourceIdentifier> builder) ResourceIdentifier to the Business Unit the Cart should belong to.Custom Fields for the Cart.withCustomerGroup
(Function<CustomerGroupResourceIdentifierBuilder, CustomerGroupResourceIdentifier> builder) ResourceIdentifier to the Customer Group of the Customer that the Cart belongs to.Custom Line Items to add to the Cart.Custom Shipping Methods for a Cart withMultiple
ShippingMode.withExternalTaxRateForShippingMethod
(Function<ExternalTaxRateDraftBuilder, ExternalTaxRateDraft> builder) External Tax Rate for theshippingMethod
if the Cart hasExternal
TaxMode.Multiple shipping addresses of the Cart.Line Items to add to the Cart.Shipping Methods for a Cart withMultiple
ShippingMode.Shipping address for a Cart withSingle
ShippingMode.withShippingMethod
(Function<ShippingMethodResourceIdentifierBuilder, ShippingMethodResourceIdentifier> builder) Shipping Method for a Cart withSingle
ShippingMode.ResourceIdentifier to the Store the Cart should belong to.
-
Constructor Details
-
CartDraftBuilder
public CartDraftBuilder()
-
-
Method Details
-
currency
Currency the Cart uses.
- Parameters:
currency
- value to be set- Returns:
- Builder
-
key
User-defined unique identifier for 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 CartDraftBuilder customerGroup(Function<CustomerGroupResourceIdentifierBuilder, CustomerGroupResourceIdentifierBuilder> builder) ResourceIdentifier to the Customer Group of the Customer that the Cart belongs to. Used for Line Item price selection.
It is automatically set if the Customer referenced in
customerId
belongs to a Customer Group. It can also be set explicitly when nocustomerId
is present.- Parameters:
builder
- function to build the customerGroup value- Returns:
- Builder
-
withCustomerGroup
public CartDraftBuilder withCustomerGroup(Function<CustomerGroupResourceIdentifierBuilder, CustomerGroupResourceIdentifier> builder) ResourceIdentifier to the Customer Group of the Customer that the Cart belongs to. Used for Line Item price selection.
It is automatically set if the Customer referenced in
customerId
belongs to a Customer Group. It can also be set explicitly when nocustomerId
is present.- Parameters:
builder
- function to build the customerGroup value- Returns:
- Builder
-
customerGroup
ResourceIdentifier to the Customer Group of the Customer that the Cart belongs to. Used for Line Item price selection.
It is automatically set if the Customer referenced in
customerId
belongs to a Customer Group. It can also be set explicitly when nocustomerId
is present.- 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 CartDraftBuilder businessUnit(Function<BusinessUnitResourceIdentifierBuilder, BusinessUnitResourceIdentifierBuilder> builder) ResourceIdentifier to the Business Unit the Cart should belong to. When the
customerId
of the Cart is also set, the Customer must be an Associate of the Business Unit.- Parameters:
builder
- function to build the businessUnit value- Returns:
- Builder
-
withBusinessUnit
public CartDraftBuilder withBusinessUnit(Function<BusinessUnitResourceIdentifierBuilder, BusinessUnitResourceIdentifier> builder) ResourceIdentifier to the Business Unit the Cart should belong to. When the
customerId
of the Cart is also set, the Customer must be an Associate of the Business Unit.- Parameters:
builder
- function to build the businessUnit value- Returns:
- Builder
-
businessUnit
ResourceIdentifier to the Business Unit the Cart should belong to. When the
customerId
of the Cart is also set, the Customer must be an Associate of the Business Unit.- Parameters:
businessUnit
- value to be set- Returns:
- Builder
-
store
public CartDraftBuilder store(Function<StoreResourceIdentifierBuilder, StoreResourceIdentifierBuilder> builder) ResourceIdentifier to the Store the Cart should belong to. Once set, it cannot be updated.
- Parameters:
builder
- function to build the store value- Returns:
- Builder
-
withStore
public CartDraftBuilder withStore(Function<StoreResourceIdentifierBuilder, StoreResourceIdentifier> builder) ResourceIdentifier to the Store the Cart should belong to. Once set, it cannot be updated.
- Parameters:
builder
- function to build the store value- Returns:
- Builder
-
store
ResourceIdentifier to the Store the Cart should belong to. Once set, it cannot be updated.
- Parameters:
store
- value to be set- Returns:
- Builder
-
lineItems
Line Items to add to the Cart.
- Parameters:
lineItems
- value to be set- Returns:
- Builder
-
lineItems
Line Items to add to the Cart.
- Parameters:
lineItems
- value to be set- Returns:
- Builder
-
plusLineItems
Line Items to add to the Cart.
- Parameters:
lineItems
- value to be set- Returns:
- Builder
-
plusLineItems
Line Items to add to the Cart.
- Parameters:
builder
- function to build the lineItems value- Returns:
- Builder
-
withLineItems
Line Items to add to the Cart.
- Parameters:
builder
- function to build the lineItems value- Returns:
- Builder
-
addLineItems
Line Items to add to the Cart.
- Parameters:
builder
- function to build the lineItems value- Returns:
- Builder
-
setLineItems
Line Items to add to the Cart.
- Parameters:
builder
- function to build the lineItems value- Returns:
- Builder
-
customLineItems
Custom Line Items to add to the Cart.
- Parameters:
customLineItems
- value to be set- Returns:
- Builder
-
customLineItems
Custom Line Items to add to the Cart.
- Parameters:
customLineItems
- value to be set- Returns:
- Builder
-
plusCustomLineItems
Custom Line Items to add to the Cart.
- Parameters:
customLineItems
- value to be set- Returns:
- Builder
-
plusCustomLineItems
public CartDraftBuilder plusCustomLineItems(Function<CustomLineItemDraftBuilder, CustomLineItemDraftBuilder> builder) Custom Line Items to add to the Cart.
- Parameters:
builder
- function to build the customLineItems value- Returns:
- Builder
-
withCustomLineItems
public CartDraftBuilder withCustomLineItems(Function<CustomLineItemDraftBuilder, CustomLineItemDraftBuilder> builder) Custom Line Items to add to the Cart.
- Parameters:
builder
- function to build the customLineItems value- Returns:
- Builder
-
addCustomLineItems
public CartDraftBuilder addCustomLineItems(Function<CustomLineItemDraftBuilder, CustomLineItemDraft> builder) Custom Line Items to add to the Cart.
- Parameters:
builder
- function to build the customLineItems value- Returns:
- Builder
-
setCustomLineItems
public CartDraftBuilder setCustomLineItems(Function<CustomLineItemDraftBuilder, CustomLineItemDraft> builder) Custom Line Items to add to the Cart.
- Parameters:
builder
- function to build the customLineItems value- Returns:
- Builder
-
taxMode
Determines how Tax Rates are set.
- Parameters:
taxMode
- value to be set- Returns:
- Builder
-
externalTaxRateForShippingMethod
public CartDraftBuilder externalTaxRateForShippingMethod(Function<ExternalTaxRateDraftBuilder, ExternalTaxRateDraftBuilder> builder) External Tax Rate for the
shippingMethod
if the Cart hasExternal
TaxMode.- Parameters:
builder
- function to build the externalTaxRateForShippingMethod value- Returns:
- Builder
-
withExternalTaxRateForShippingMethod
public CartDraftBuilder withExternalTaxRateForShippingMethod(Function<ExternalTaxRateDraftBuilder, ExternalTaxRateDraft> builder) External Tax Rate for the
shippingMethod
if the Cart hasExternal
TaxMode.- Parameters:
builder
- function to build the externalTaxRateForShippingMethod value- Returns:
- Builder
-
externalTaxRateForShippingMethod
public CartDraftBuilder externalTaxRateForShippingMethod(@Nullable ExternalTaxRateDraft externalTaxRateForShippingMethod) External Tax Rate for the
shippingMethod
if the Cart hasExternal
TaxMode.- Parameters:
externalTaxRateForShippingMethod
- value to be set- Returns:
- Builder
-
taxRoundingMode
Determines how monetary values are rounded when calculating taxes for
taxedPrice
.- Parameters:
taxRoundingMode
- value to be set- Returns:
- Builder
-
taxCalculationMode
Determines how taxes are calculated for
taxedPrice
.- Parameters:
taxCalculationMode
- value to be set- Returns:
- Builder
-
inventoryMode
Determines how stock quantities are tracked for Line Items in the Cart.
- Parameters:
inventoryMode
- 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. Must be one of theitemShippingAddresses
when that field is also provided.- 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. Must be one of theitemShippingAddresses
when that field is also provided.- 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. Must be one of theitemShippingAddresses
when that field is also provided.- Parameters:
shippingAddress
- value to be set- Returns:
- Builder
-
shippingMethod
public CartDraftBuilder shippingMethod(Function<ShippingMethodResourceIdentifierBuilder, ShippingMethodResourceIdentifierBuilder> builder) Shipping Method for a Cart with
Single
ShippingMode. If the referenced ShippingMethod has apredicate
that does not match the Cart, an InvalidOperation error is returned when creating a Cart.- Parameters:
builder
- function to build the shippingMethod value- Returns:
- Builder
-
withShippingMethod
public CartDraftBuilder withShippingMethod(Function<ShippingMethodResourceIdentifierBuilder, ShippingMethodResourceIdentifier> builder) Shipping Method for a Cart with
Single
ShippingMode. If the referenced ShippingMethod has apredicate
that does not match the Cart, an InvalidOperation error is returned when creating a Cart.- Parameters:
builder
- function to build the shippingMethod value- Returns:
- Builder
-
shippingMethod
Shipping Method for a Cart with
Single
ShippingMode. If the referenced ShippingMethod has apredicate
that does not match the Cart, an InvalidOperation error is returned when creating a Cart.- Parameters:
shippingMethod
- value to be set- Returns:
- Builder
-
shippingRateInput
Used as an input to select a ShippingRatePriceTier. The data type of this field depends on the
shippingRateInputType.type
configured in the Project:- If
CartClassification
, it must be ClassificationShippingRateInputDraft. - If
CartScore
, it must be ScoreShippingRateInputDraft. - If
CartValue
, it cannot be set.
- Parameters:
shippingRateInput
- value to be set- Returns:
- Builder
- If
-
shippingRateInput
public CartDraftBuilder shippingRateInput(Function<ShippingRateInputDraftBuilder, Builder<? extends ShippingRateInputDraft>> builder) Used as an input to select a ShippingRatePriceTier. The data type of this field depends on the
shippingRateInputType.type
configured in the Project:- If
CartClassification
, it must be ClassificationShippingRateInputDraft. - If
CartScore
, it must be ScoreShippingRateInputDraft. - If
CartValue
, it cannot be set.
- Parameters:
builder
- function to build the shippingRateInput value- Returns:
- Builder
- If
-
shippingMode
- If set to
Single
, only a single Shipping Method can be added to the Cart. - If set to
Multiple
, multiple Shipping Methods can be added to the Cart.
- Parameters:
shippingMode
- value to be set- Returns:
- Builder
- If set to
-
customShipping
Custom Shipping Methods for a Cart with
Multiple
ShippingMode.- Parameters:
customShipping
- value to be set- Returns:
- Builder
-
customShipping
Custom Shipping Methods for a Cart with
Multiple
ShippingMode.- Parameters:
customShipping
- value to be set- Returns:
- Builder
-
plusCustomShipping
Custom Shipping Methods for a Cart with
Multiple
ShippingMode.- Parameters:
customShipping
- value to be set- Returns:
- Builder
-
plusCustomShipping
public CartDraftBuilder plusCustomShipping(Function<CustomShippingDraftBuilder, CustomShippingDraftBuilder> builder) Custom Shipping Methods for a Cart with
Multiple
ShippingMode.- Parameters:
builder
- function to build the customShipping value- Returns:
- Builder
-
withCustomShipping
public CartDraftBuilder withCustomShipping(Function<CustomShippingDraftBuilder, CustomShippingDraftBuilder> builder) Custom Shipping Methods for a Cart with
Multiple
ShippingMode.- Parameters:
builder
- function to build the customShipping value- Returns:
- Builder
-
addCustomShipping
public CartDraftBuilder addCustomShipping(Function<CustomShippingDraftBuilder, CustomShippingDraft> builder) Custom Shipping Methods for a Cart with
Multiple
ShippingMode.- Parameters:
builder
- function to build the customShipping value- Returns:
- Builder
-
setCustomShipping
public CartDraftBuilder setCustomShipping(Function<CustomShippingDraftBuilder, CustomShippingDraft> builder) Custom Shipping Methods for a Cart with
Multiple
ShippingMode.- Parameters:
builder
- function to build the customShipping value- Returns:
- Builder
-
shipping
Shipping Methods for a Cart with
Multiple
ShippingMode.- Parameters:
shipping
- value to be set- Returns:
- Builder
-
shipping
Shipping Methods for a Cart with
Multiple
ShippingMode.- Parameters:
shipping
- value to be set- Returns:
- Builder
-
plusShipping
Shipping Methods for a Cart with
Multiple
ShippingMode.- Parameters:
shipping
- value to be set- Returns:
- Builder
-
plusShipping
Shipping Methods for a Cart with
Multiple
ShippingMode.- Parameters:
builder
- function to build the shipping value- Returns:
- Builder
-
withShipping
Shipping Methods for a Cart with
Multiple
ShippingMode.- Parameters:
builder
- function to build the shipping value- Returns:
- Builder
-
addShipping
Shipping Methods for a Cart with
Multiple
ShippingMode.- Parameters:
builder
- function to build the shipping value- Returns:
- Builder
-
setShipping
Shipping Methods for a Cart with
Multiple
ShippingMode.- Parameters:
builder
- function to build the shipping value- Returns:
- Builder
-
itemShippingAddresses
Multiple shipping addresses of the Cart. Each address must contain a
key
that is unique in this Cart. The keys are used by LineItems to reference these addresses under theirshippingDetails
.For Carts with
Single
ShippingMode: eligible Shipping Methods or applicable Tax Rates are determined by the addressshippingAddress
, and notitemShippingAddresses
.- Parameters:
itemShippingAddresses
- value to be set- Returns:
- Builder
-
itemShippingAddresses
Multiple shipping addresses of the Cart. Each address must contain a
key
that is unique in this Cart. The keys are used by LineItems to reference these addresses under theirshippingDetails
.For Carts with
Single
ShippingMode: eligible Shipping Methods or applicable Tax Rates are determined by the addressshippingAddress
, and notitemShippingAddresses
.- Parameters:
itemShippingAddresses
- value to be set- Returns:
- Builder
-
plusItemShippingAddresses
Multiple shipping addresses of the Cart. Each address must contain a
key
that is unique in this Cart. The keys are used by LineItems to reference these addresses under theirshippingDetails
.For Carts with
Single
ShippingMode: eligible Shipping Methods or applicable Tax Rates are determined by the addressshippingAddress
, and notitemShippingAddresses
.- Parameters:
itemShippingAddresses
- value to be set- Returns:
- Builder
-
plusItemShippingAddresses
public CartDraftBuilder plusItemShippingAddresses(Function<BaseAddressBuilder, BaseAddressBuilder> builder) Multiple shipping addresses of the Cart. Each address must contain a
key
that is unique in this Cart. The keys are used by LineItems to reference these addresses under theirshippingDetails
.For Carts with
Single
ShippingMode: eligible Shipping Methods or applicable Tax Rates are determined by the addressshippingAddress
, and notitemShippingAddresses
.- Parameters:
builder
- function to build the itemShippingAddresses value- Returns:
- Builder
-
withItemShippingAddresses
public CartDraftBuilder withItemShippingAddresses(Function<BaseAddressBuilder, BaseAddressBuilder> builder) Multiple shipping addresses of the Cart. Each address must contain a
key
that is unique in this Cart. The keys are used by LineItems to reference these addresses under theirshippingDetails
.For Carts with
Single
ShippingMode: eligible Shipping Methods or applicable Tax Rates are determined by the addressshippingAddress
, and notitemShippingAddresses
.- Parameters:
builder
- function to build the itemShippingAddresses value- Returns:
- Builder
-
addItemShippingAddresses
Multiple shipping addresses of the Cart. Each address must contain a
key
that is unique in this Cart. The keys are used by LineItems to reference these addresses under theirshippingDetails
.For Carts with
Single
ShippingMode: eligible Shipping Methods or applicable Tax Rates are determined by the addressshippingAddress
, and notitemShippingAddresses
.- Parameters:
builder
- function to build the itemShippingAddresses value- Returns:
- Builder
-
setItemShippingAddresses
Multiple shipping addresses of the Cart. Each address must contain a
key
that is unique in this Cart. The keys are used by LineItems to reference these addresses under theirshippingDetails
.For Carts with
Single
ShippingMode: eligible Shipping Methods or applicable Tax Rates are determined by the addressshippingAddress
, and notitemShippingAddresses
.- Parameters:
builder
- function to build the itemShippingAddresses value- Returns:
- Builder
-
discountCodes
code
of the existing DiscountCodes to add to the Cart.- Parameters:
discountCodes
- value to be set- Returns:
- Builder
-
discountCodes
code
of the existing DiscountCodes to add to the Cart.- Parameters:
discountCodes
- value to be set- Returns:
- Builder
-
plusDiscountCodes
code
of the existing DiscountCodes to add to the Cart.- Parameters:
discountCodes
- value to be set- Returns:
- Builder
-
country
Used for Line Item price selection. If used for Create Cart in Store, the provided country must be one of the Store's
countries
.- 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
-
deleteDaysAfterLastModification
public CartDraftBuilder deleteDaysAfterLastModification(@Nullable Long deleteDaysAfterLastModification) Number of days after which an active Cart is deleted since its last modification. If not provided, the default value for this field configured in Project settings is assigned.
Create a ChangeSubscription for Carts to receive a ResourceDeletedDeliveryPayload upon deletion of the Cart.
- Parameters:
deleteDaysAfterLastModification
- value to be set- Returns:
- Builder
-
custom
Custom Fields for the Cart.
- Parameters:
builder
- function to build the custom value- Returns:
- Builder
-
withCustom
Custom Fields for the Cart.
- Parameters:
builder
- function to build the custom value- Returns:
- Builder
-
custom
Custom Fields for the Cart.
- Parameters:
custom
- value to be set- Returns:
- Builder
-
getCurrency
Currency the Cart uses.
- Returns:
- currency
-
getKey
User-defined unique identifier for 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
ResourceIdentifier to the Customer Group of the Customer that the Cart belongs to. Used for Line Item price selection.
It is automatically set if the Customer referenced in
customerId
belongs to a Customer Group. It can also be set explicitly when nocustomerId
is present.- Returns:
- customerGroup
-
getAnonymousId
Anonymous session associated with the Cart.
- Returns:
- anonymousId
-
getBusinessUnit
ResourceIdentifier to the Business Unit the Cart should belong to. When the
customerId
of the Cart is also set, the Customer must be an Associate of the Business Unit.- Returns:
- businessUnit
-
getStore
ResourceIdentifier to the Store the Cart should belong to. Once set, it cannot be updated.
- Returns:
- store
-
getLineItems
Line Items to add to the Cart.
- Returns:
- lineItems
-
getCustomLineItems
Custom Line Items to add to the Cart.
- Returns:
- customLineItems
-
getTaxMode
Determines how Tax Rates are set.
- Returns:
- taxMode
-
getExternalTaxRateForShippingMethod
External Tax Rate for the
shippingMethod
if the Cart hasExternal
TaxMode.- Returns:
- externalTaxRateForShippingMethod
-
getTaxRoundingMode
Determines how monetary values are rounded when calculating taxes for
taxedPrice
.- Returns:
- taxRoundingMode
-
getTaxCalculationMode
Determines how taxes are calculated for
taxedPrice
.- Returns:
- taxCalculationMode
-
getInventoryMode
Determines how stock quantities are tracked for Line Items in the Cart.
- Returns:
- inventoryMode
-
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. Must be one of theitemShippingAddresses
when that field is also provided.- Returns:
- shippingAddress
-
getShippingMethod
Shipping Method for a Cart with
Single
ShippingMode. If the referenced ShippingMethod has apredicate
that does not match the Cart, an InvalidOperation error is returned when creating a Cart.- Returns:
- shippingMethod
-
getShippingRateInput
Used as an input to select a ShippingRatePriceTier. The data type of this field depends on the
shippingRateInputType.type
configured in the Project:- If
CartClassification
, it must be ClassificationShippingRateInputDraft. - If
CartScore
, it must be ScoreShippingRateInputDraft. - If
CartValue
, it cannot be set.
- Returns:
- shippingRateInput
- If
-
getShippingMode
- If set to
Single
, only a single Shipping Method can be added to the Cart. - If set to
Multiple
, multiple Shipping Methods can be added to the Cart.
- Returns:
- shippingMode
- If set to
-
getCustomShipping
Custom Shipping Methods for a Cart with
Multiple
ShippingMode.- Returns:
- customShipping
-
getShipping
Shipping Methods for a Cart with
Multiple
ShippingMode.- Returns:
- shipping
-
getItemShippingAddresses
Multiple shipping addresses of the Cart. Each address must contain a
key
that is unique in this Cart. The keys are used by LineItems to reference these addresses under theirshippingDetails
.For Carts with
Single
ShippingMode: eligible Shipping Methods or applicable Tax Rates are determined by the addressshippingAddress
, and notitemShippingAddresses
.- Returns:
- itemShippingAddresses
-
getDiscountCodes
code
of the existing DiscountCodes to add to the Cart.- Returns:
- discountCodes
-
getCountry
Used for Line Item price selection. If used for Create Cart in Store, the provided country must be one of the Store's
countries
.- 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
-
getDeleteDaysAfterLastModification
Number of days after which an active Cart is deleted since its last modification. If not provided, the default value for this field configured in Project settings is assigned.
Create a ChangeSubscription for Carts to receive a ResourceDeletedDeliveryPayload upon deletion of the Cart.
- Returns:
- deleteDaysAfterLastModification
-
getCustom
Custom Fields for the Cart.
- Returns:
- custom
-
build
builds CartDraft with checking for non-null required values -
buildUnchecked
builds CartDraft without checking for non-null required values- Returns:
- CartDraft
-
of
factory method for an instance of CartDraftBuilder- Returns:
- builder
-
of
create builder for CartDraft instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-