Interface CartDraft
- All Superinterfaces:
CustomizableDraft<CartDraft>
,Draft<CartDraft>
,WithKey
Example to create an instance using the builder pattern
CartDraft cartDraft = CartDraft.builder()
.currency("{currency}")
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic CartDraftBuilder
builder()
builder factory method for CartDraftstatic CartDraftBuilder
create builder for CartDraft instancestatic CartDraft
factory method to create a deep copy of CartDraftAnonymous session associated with the Cart.@Valid BaseAddress
Billing address associated with the Cart.ResourceIdentifier to the Business Unit the Cart should belong to.Used for Line Item price selection.@NotNull String
Currency the Cart uses.@Valid CustomFieldsDraft
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.@Valid List<CustomLineItemDraft>
Custom Line Items to add to the Cart.@Valid List<CustomShippingDraft>
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.@Valid ExternalTaxRateDraft
External Tax Rate for theshippingMethod
if the Cart hasExternal
TaxMode.Determines how stock quantities are tracked for Line Items in the Cart.@Valid List<BaseAddress>
Multiple shipping addresses of the Cart.getKey()
User-defined unique identifier for the Cart.@Valid List<LineItemDraft>
Line Items to add to the Cart.Languages of the Cart.Indicates how the Cart was created.@Valid List<ShippingDraft>
Shipping Methods for a Cart withMultiple
ShippingMode.@Valid BaseAddress
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.@Valid ShippingRateInputDraft
Used as an input to select a ShippingRatePriceTier.@Valid StoreResourceIdentifier
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
.static CartDraft
of()
factory methodstatic CartDraft
factory method to create a shallow copy CartDraftvoid
setAnonymousId
(String anonymousId) Anonymous session associated with the Cart.void
setBillingAddress
(BaseAddress billingAddress) Billing address associated with the Cart.void
setBusinessUnit
(BusinessUnitResourceIdentifier businessUnit) ResourceIdentifier to the Business Unit the Cart should belong to.void
setCountry
(String country) Used for Line Item price selection.void
setCurrency
(String currency) Currency the Cart uses.void
setCustom
(CustomFieldsDraft custom) Custom Fields for the Cart.void
setCustomerEmail
(String customerEmail) Email address of the Customer that the Cart belongs to.void
setCustomerGroup
(CustomerGroupResourceIdentifier customerGroup) ResourceIdentifier to the Customer Group of the Customer that the Cart belongs to.void
setCustomerId
(String customerId) id
of the Customer that the Cart belongs to.void
setCustomLineItems
(CustomLineItemDraft... customLineItems) Custom Line Items to add to the Cart.void
setCustomLineItems
(List<CustomLineItemDraft> customLineItems) Custom Line Items to add to the Cart.void
setCustomShipping
(CustomShippingDraft... customShipping) Custom Shipping Methods for a Cart withMultiple
ShippingMode.void
setCustomShipping
(List<CustomShippingDraft> customShipping) Custom Shipping Methods for a Cart withMultiple
ShippingMode.void
setDeleteDaysAfterLastModification
(Long deleteDaysAfterLastModification) Number of days after which an active Cart is deleted since its last modification.void
setDiscountCodes
(String... discountCodes) code
of the existing DiscountCodes to add to the Cart.void
setDiscountCodes
(List<String> discountCodes) code
of the existing DiscountCodes to add to the Cart.void
setExternalTaxRateForShippingMethod
(ExternalTaxRateDraft externalTaxRateForShippingMethod) External Tax Rate for theshippingMethod
if the Cart hasExternal
TaxMode.void
setInventoryMode
(InventoryMode inventoryMode) Determines how stock quantities are tracked for Line Items in the Cart.void
setItemShippingAddresses
(BaseAddress... itemShippingAddresses) Multiple shipping addresses of the Cart.void
setItemShippingAddresses
(List<BaseAddress> itemShippingAddresses) Multiple shipping addresses of the Cart.void
User-defined unique identifier for the Cart.void
setLineItems
(LineItemDraft... lineItems) Line Items to add to the Cart.void
setLineItems
(List<LineItemDraft> lineItems) Line Items to add to the Cart.void
Languages of the Cart.void
setOrigin
(CartOrigin origin) Indicates how the Cart was created.void
setShipping
(ShippingDraft... shipping) Shipping Methods for a Cart withMultiple
ShippingMode.void
setShipping
(List<ShippingDraft> shipping) Shipping Methods for a Cart withMultiple
ShippingMode.void
setShippingAddress
(BaseAddress shippingAddress) Shipping address for a Cart withSingle
ShippingMode.void
setShippingMethod
(ShippingMethodResourceIdentifier shippingMethod) Shipping Method for a Cart withSingle
ShippingMode.void
setShippingMode
(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.void
setShippingRateInput
(ShippingRateInputDraft shippingRateInput) Used as an input to select a ShippingRatePriceTier.void
setStore
(StoreResourceIdentifier store) ResourceIdentifier to the Store the Cart should belong to.void
setTaxCalculationMode
(TaxCalculationMode taxCalculationMode) Determines how taxes are calculated fortaxedPrice
.void
setTaxMode
(TaxMode taxMode) Determines how Tax Rates are set.void
setTaxRoundingMode
(RoundingMode taxRoundingMode) Determines how monetary values are rounded when calculating taxes fortaxedPrice
.static com.fasterxml.jackson.core.type.TypeReference<CartDraft>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withCartDraft
(Function<CartDraft, T> helper) accessor map functionMethods inherited from interface com.commercetools.api.models.CustomizableDraft
unwrapCustomizableDraft
-
Method Details
-
getCurrency
Currency the Cart uses.
- Returns:
- currency
-
getKey
String getKey()User-defined unique identifier for the Cart.
-
getCustomerId
String getCustomerId()id
of the Customer that the Cart belongs to.- Returns:
- customerId
-
getCustomerEmail
String 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
String 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
TaxMode getTaxMode()Determines how Tax Rates are set.
- Returns:
- taxMode
-
getExternalTaxRateForShippingMethod
External Tax Rate for the
shippingMethod
if the Cart hasExternal
TaxMode.- Returns:
- externalTaxRateForShippingMethod
-
getTaxRoundingMode
RoundingMode getTaxRoundingMode()Determines how monetary values are rounded when calculating taxes for
taxedPrice
.- Returns:
- taxRoundingMode
-
getTaxCalculationMode
TaxCalculationMode getTaxCalculationMode()Determines how taxes are calculated for
taxedPrice
.- Returns:
- taxCalculationMode
-
getInventoryMode
InventoryMode 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
ShippingMode 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
String 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
String getLocale()Languages of the Cart. Can only contain languages supported by the Project.
- Returns:
- locale
-
getOrigin
CartOrigin getOrigin()Indicates how the Cart was created.
- Returns:
- origin
-
getDeleteDaysAfterLastModification
Long 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.
- Specified by:
getCustom
in interfaceCustomizableDraft<CartDraft>
- Returns:
- custom
-
setCurrency
Currency the Cart uses.
- Parameters:
currency
- value to be set
-
setKey
User-defined unique identifier for the Cart.
- Parameters:
key
- value to be set
-
setCustomerId
id
of the Customer that the Cart belongs to.- Parameters:
customerId
- value to be set
-
setCustomerEmail
Email address of the Customer that the Cart belongs to.
- Parameters:
customerEmail
- value to be set
-
setCustomerGroup
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
-
setAnonymousId
Anonymous session associated with the Cart.
- Parameters:
anonymousId
- value to be set
-
setBusinessUnit
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
-
setStore
ResourceIdentifier to the Store the Cart should belong to. Once set, it cannot be updated.
- Parameters:
store
- value to be set
-
setLineItems
Line Items to add to the Cart.
- Parameters:
lineItems
- values to be set
-
setLineItems
Line Items to add to the Cart.
- Parameters:
lineItems
- values to be set
-
setCustomLineItems
Custom Line Items to add to the Cart.
- Parameters:
customLineItems
- values to be set
-
setCustomLineItems
Custom Line Items to add to the Cart.
- Parameters:
customLineItems
- values to be set
-
setTaxMode
Determines how Tax Rates are set.
- Parameters:
taxMode
- value to be set
-
setExternalTaxRateForShippingMethod
External Tax Rate for the
shippingMethod
if the Cart hasExternal
TaxMode.- Parameters:
externalTaxRateForShippingMethod
- value to be set
-
setTaxRoundingMode
Determines how monetary values are rounded when calculating taxes for
taxedPrice
.- Parameters:
taxRoundingMode
- value to be set
-
setTaxCalculationMode
Determines how taxes are calculated for
taxedPrice
.- Parameters:
taxCalculationMode
- value to be set
-
setInventoryMode
Determines how stock quantities are tracked for Line Items in the Cart.
- Parameters:
inventoryMode
- value to be set
-
setBillingAddress
Billing address associated with the Cart.
- Parameters:
billingAddress
- value to be set
-
setShippingAddress
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
-
setShippingMethod
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
-
setShippingRateInput
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
- If
-
setShippingMode
- 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
- If set to
-
setCustomShipping
Custom Shipping Methods for a Cart with
Multiple
ShippingMode.- Parameters:
customShipping
- values to be set
-
setCustomShipping
Custom Shipping Methods for a Cart with
Multiple
ShippingMode.- Parameters:
customShipping
- values to be set
-
setShipping
Shipping Methods for a Cart with
Multiple
ShippingMode.- Parameters:
shipping
- values to be set
-
setShipping
Shipping Methods for a Cart with
Multiple
ShippingMode.- Parameters:
shipping
- values to be set
-
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:
itemShippingAddresses
- values to be set
-
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:
itemShippingAddresses
- values to be set
-
setDiscountCodes
code
of the existing DiscountCodes to add to the Cart.- Parameters:
discountCodes
- values to be set
-
setDiscountCodes
code
of the existing DiscountCodes to add to the Cart.- Parameters:
discountCodes
- values to be set
-
setCountry
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
-
setLocale
Languages of the Cart. Can only contain languages supported by the Project.
- Parameters:
locale
- value to be set
-
setOrigin
Indicates how the Cart was created.
- Parameters:
origin
- value to be set
-
setDeleteDaysAfterLastModification
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
-
setCustom
Custom Fields for the Cart.
- Specified by:
setCustom
in interfaceCustomizableDraft<CartDraft>
- Parameters:
custom
- value to be set
-
of
factory method- Returns:
- instance of CartDraft
-
of
factory method to create a shallow copy CartDraft- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of CartDraft- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for CartDraft- Returns:
- builder
-
builder
create builder for CartDraft instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withCartDraft
accessor map function- Type Parameters:
T
- mapped type- Parameters:
helper
- function to map the object- Returns:
- mapped value
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-