Interface MyCartDraft
- All Superinterfaces:
CustomizableDraft<MyCartDraft>,Draft<MyCartDraft>
The customerId is determined by a password flow token and automatically set on the resulting Cart. The anonymousId is determined by a token for an anonymous session and automatically set on the resulting Cart.
Example to create an instance using the builder pattern
MyCartDraft myCartDraft = MyCartDraft.builder()
.currency("{currency}")
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic MyCartDraftBuilderbuilder()builder factory method for MyCartDraftstatic MyCartDraftBuilderbuilder(MyCartDraft template) create builder for MyCartDraft instancecopyDeep()static MyCartDraftdeepCopy(MyCartDraft template) factory method to create a deep copy of MyCartDraft@Valid BaseAddressBilling address associated with the Cart.ResourceIdentifier to the Business Unit the Cart should belong to.Used for Line Item price selection.@NotNull StringCurrency the Cart uses.@Valid CustomFieldsDraftCustom Fields for the Cart.Email address of the Customer the Cart belongs to.Number of days after the last modification before a Cart is deleted.codeof the existing DiscountCodes to add to the Cart.Determines how stock quantities are tracked for Line Items in the Cart.@Valid List<BaseAddress>Multiple shipping addresses of the Cart.@Valid List<MyLineItemDraft>Line Items to add to the Cart.Language of the Cart.@Valid BaseAddressShipping address associated with the Cart.Shipping Method for the Cart.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 StoreResourceIdentifiergetStore()ResourceIdentifier to the Store the Cart should belong to.Determines how Tax Rates are set.static MyCartDraftof()factory methodstatic MyCartDraftof(MyCartDraft template) factory method to create a shallow copy MyCartDraftvoidsetBillingAddress(BaseAddress billingAddress) Billing address associated with the Cart.voidsetBusinessUnit(BusinessUnitResourceIdentifier businessUnit) ResourceIdentifier to the Business Unit the Cart should belong to.voidsetCountry(String country) Used for Line Item price selection.voidsetCurrency(String currency) Currency the Cart uses.voidsetCustom(CustomFieldsDraft custom) Custom Fields for the Cart.voidsetCustomerEmail(String customerEmail) Email address of the Customer the Cart belongs to.voidsetDeleteDaysAfterLastModification(Long deleteDaysAfterLastModification) Number of days after the last modification before a Cart is deleted.voidsetDiscountCodes(String... discountCodes) codeof the existing DiscountCodes to add to the Cart.voidsetDiscountCodes(List<String> discountCodes) codeof the existing DiscountCodes to add to the Cart.voidsetInventoryMode(InventoryMode inventoryMode) Determines how stock quantities are tracked for Line Items in the Cart.voidsetItemShippingAddresses(BaseAddress... itemShippingAddresses) Multiple shipping addresses of the Cart.voidsetItemShippingAddresses(List<BaseAddress> itemShippingAddresses) Multiple shipping addresses of the Cart.voidsetLineItems(MyLineItemDraft... lineItems) Line Items to add to the Cart.voidsetLineItems(List<MyLineItemDraft> lineItems) Line Items to add to the Cart.voidLanguage of the Cart.voidsetShippingAddress(BaseAddress shippingAddress) Shipping address associated with the Cart.voidsetShippingMethod(ShippingMethodResourceIdentifier shippingMethod) Shipping Method for the Cart.voidsetShippingMode(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.voidsetStore(StoreResourceIdentifier store) ResourceIdentifier to the Store the Cart should belong to.voidsetTaxMode(TaxMode taxMode) Determines how Tax Rates are set.static com.fasterxml.jackson.core.type.TypeReference<MyCartDraft>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithMyCartDraft(Function<MyCartDraft, T> helper) accessor map functionMethods inherited from interface com.commercetools.api.models.CustomizableDraft
unwrapCustomizableDraft
-
Method Details
-
getCurrency
Currency the Cart uses.
- Returns:
- currency
-
getCustomerEmail
String getCustomerEmail()Email address of the Customer the Cart belongs to.
- Returns:
- customerEmail
-
getBusinessUnit
ResourceIdentifier to the Business Unit the Cart should belong to. The Customer must be an Associate of the Business Unit. Only available for B2B-enabled Projects.
- 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
-
getTaxMode
TaxMode getTaxMode()Determines how Tax Rates are set. The
DisabledTaxMode cannot be set.- Returns:
- taxMode
-
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 associated with the Cart. Determines eligible ShippingMethod rates and Tax Rates of Line Items.
- Returns:
- shippingAddress
-
getShippingMethod
Shipping Method for the Cart. If the referenced ShippingMethod has a
predicatethat does not match the Cart, an InvalidOperation error is returned when creating a Cart.- Returns:
- shippingMethod
-
getItemShippingAddresses
Multiple shipping addresses of the Cart. Each address must contain a
keythat is unique in this Cart. The keys are used by LineItems to reference these addresses under theirshippingDetails.Eligible Shipping Methods or applicable Tax Rates are determined by the Cart
shippingAddress, and notitemShippingAddresses.- Returns:
- itemShippingAddresses
-
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
-
getDiscountCodes
codeof 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()Language of the Cart. Must be one of the languages supported by the Project.
- Returns:
- locale
-
getDeleteDaysAfterLastModification
Long getDeleteDaysAfterLastModification()Number of days after the last modification before a Cart is deleted. 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:
getCustomin interfaceCustomizableDraft<MyCartDraft>- Returns:
- custom
-
setCurrency
Currency the Cart uses.
- Parameters:
currency- value to be set
-
setCustomerEmail
Email address of the Customer the Cart belongs to.
- Parameters:
customerEmail- value to be set
-
setBusinessUnit
ResourceIdentifier to the Business Unit the Cart should belong to. The Customer must be an Associate of the Business Unit. Only available for B2B-enabled Projects.
- 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
-
setTaxMode
Determines how Tax Rates are set. The
DisabledTaxMode cannot be set.- Parameters:
taxMode- 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 associated with the Cart. Determines eligible ShippingMethod rates and Tax Rates of Line Items.
- Parameters:
shippingAddress- value to be set
-
setShippingMethod
Shipping Method for the Cart. If the referenced ShippingMethod has a
predicatethat does not match the Cart, an InvalidOperation error is returned when creating a Cart.- Parameters:
shippingMethod- value to be set
-
setItemShippingAddresses
Multiple shipping addresses of the Cart. Each address must contain a
keythat is unique in this Cart. The keys are used by LineItems to reference these addresses under theirshippingDetails.Eligible Shipping Methods or applicable Tax Rates are determined by the Cart
shippingAddress, and notitemShippingAddresses.- Parameters:
itemShippingAddresses- values to be set
-
setItemShippingAddresses
Multiple shipping addresses of the Cart. Each address must contain a
keythat is unique in this Cart. The keys are used by LineItems to reference these addresses under theirshippingDetails.Eligible Shipping Methods or applicable Tax Rates are determined by the Cart
shippingAddress, and notitemShippingAddresses.- Parameters:
itemShippingAddresses- values to be set
-
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
-
setDiscountCodes
codeof the existing DiscountCodes to add to the Cart.- Parameters:
discountCodes- values to be set
-
setDiscountCodes
codeof 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
Language of the Cart. Must be one of the languages supported by the Project.
- Parameters:
locale- value to be set
-
setDeleteDaysAfterLastModification
Number of days after the last modification before a Cart is deleted. 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:
setCustomin interfaceCustomizableDraft<MyCartDraft>- Parameters:
custom- value to be set
-
of
factory method- Returns:
- instance of MyCartDraft
-
of
factory method to create a shallow copy MyCartDraft- Parameters:
template- instance to be copied- Returns:
- copy instance
-
copyDeep
MyCartDraft copyDeep() -
deepCopy
factory method to create a deep copy of MyCartDraft- Parameters:
template- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for MyCartDraft- Returns:
- builder
-
builder
create builder for MyCartDraft instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-
withMyCartDraft
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
-