Class CartDraftImpl

java.lang.Object
com.commercetools.api.models.cart.CartDraftImpl
All Implemented Interfaces:
CartDraft, CustomizableDraft<CartDraft>, WithKey, io.vrap.rmf.base.client.Draft<CartDraft>, io.vrap.rmf.base.client.ModelBase

public class CartDraftImpl extends Object implements CartDraft, io.vrap.rmf.base.client.ModelBase
CartDraft
  • Constructor Details

    • CartDraftImpl

      public CartDraftImpl()
      create empty instance
  • Method Details

    • getCurrency

      public String getCurrency()

      Currency the Cart uses.

      Specified by:
      getCurrency in interface CartDraft
      Returns:
      currency
    • getKey

      public String getKey()

      User-defined unique identifier for the Cart.

      Specified by:
      getKey in interface CartDraft
      Specified by:
      getKey in interface WithKey
      Returns:
      key
    • getCustomerId

      public String getCustomerId()

      id of the Customer that the Cart belongs to.

      Specified by:
      getCustomerId in interface CartDraft
      Returns:
      customerId
    • getCustomerEmail

      public String getCustomerEmail()

      Email address of the Customer that the Cart belongs to.

      Specified by:
      getCustomerEmail in interface CartDraft
      Returns:
      customerEmail
    • getCustomerGroup

      public CustomerGroupResourceIdentifier getCustomerGroup()

      ResourceIdentifier to the Customer Group of the Customer that the Cart belongs to. Used for LineItem Price selection.

      It is automatically set if the Customer referenced in customerId belongs to a Customer Group. It can also be set explicitly when no customerId is present.

      Specified by:
      getCustomerGroup in interface CartDraft
      Returns:
      customerGroup
    • getAnonymousId

      public String getAnonymousId()

      Anonymous session associated with the Cart.

      Specified by:
      getAnonymousId in interface CartDraft
      Returns:
      anonymousId
    • getBusinessUnit

      public BusinessUnitResourceIdentifier 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.

      Specified by:
      getBusinessUnit in interface CartDraft
      Returns:
      businessUnit
    • getStore

      public StoreResourceIdentifier getStore()

      ResourceIdentifier to the Store the Cart should belong to. Once set, it cannot be updated.

      Specified by:
      getStore in interface CartDraft
      Returns:
      store
    • getLineItems

      public List<LineItemDraft> getLineItems()

      Line Items to add to the Cart.

      Specified by:
      getLineItems in interface CartDraft
      Returns:
      lineItems
    • getCustomLineItems

      public List<CustomLineItemDraft> getCustomLineItems()

      Custom Line Items to add to the Cart.

      Specified by:
      getCustomLineItems in interface CartDraft
      Returns:
      customLineItems
    • getTaxMode

      public TaxMode getTaxMode()

      Determines how Tax Rates are set.

      Specified by:
      getTaxMode in interface CartDraft
      Returns:
      taxMode
    • getExternalTaxRateForShippingMethod

      public ExternalTaxRateDraft getExternalTaxRateForShippingMethod()

      External Tax Rate for the shippingMethod if the Cart has External TaxMode.

      Specified by:
      getExternalTaxRateForShippingMethod in interface CartDraft
      Returns:
      externalTaxRateForShippingMethod
    • getTaxRoundingMode

      public RoundingMode getTaxRoundingMode()

      Determines how monetary values are rounded when calculating taxes for taxedPrice.

      Specified by:
      getTaxRoundingMode in interface CartDraft
      Returns:
      taxRoundingMode
    • getTaxCalculationMode

      public TaxCalculationMode getTaxCalculationMode()

      Determines how taxes are calculated for taxedPrice.

      Specified by:
      getTaxCalculationMode in interface CartDraft
      Returns:
      taxCalculationMode
    • getInventoryMode

      public InventoryMode getInventoryMode()

      Determines how stock quantities are tracked for Line Items in the Cart.

      Specified by:
      getInventoryMode in interface CartDraft
      Returns:
      inventoryMode
    • getBillingAddress

      public BaseAddress getBillingAddress()

      Billing address associated with the Cart.

      Specified by:
      getBillingAddress in interface CartDraft
      Returns:
      billingAddress
    • getShippingAddress

      public BaseAddress getShippingAddress()

      Shipping address associated with the Cart. Determines eligible ShippingMethod rates and Tax Rates of Line Items.

      Specified by:
      getShippingAddress in interface CartDraft
      Returns:
      shippingAddress
    • getShippingMethod

      public ShippingMethodResourceIdentifier getShippingMethod()

      Shipping Method for a Cart with Single ShippingMode. If the referenced ShippingMethod has a predicate that does not match the Cart, an InvalidOperation error is returned when creating a Cart.

      Specified by:
      getShippingMethod in interface CartDraft
      Returns:
      shippingMethod
    • getShippingRateInput

      public ShippingRateInputDraft 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.
      Specified by:
      getShippingRateInput in interface CartDraft
      Returns:
      shippingRateInput
    • getShippingMode

      public 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.
      Specified by:
      getShippingMode in interface CartDraft
      Returns:
      shippingMode
    • getCustomShipping

      public List<CustomShippingDraft> getCustomShipping()

      Custom Shipping Methods for a Cart with Multiple ShippingMode.

      Specified by:
      getCustomShipping in interface CartDraft
      Returns:
      customShipping
    • getShipping

      public List<ShippingDraft> getShipping()

      Shipping Methods for a Cart with Multiple ShippingMode.

      Specified by:
      getShipping in interface CartDraft
      Returns:
      shipping
    • getItemShippingAddresses

      public List<BaseAddress> 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 their shippingDetails.

      Eligible Shipping Methods or applicable Tax Rates are determined by the address shippingAddress, and not itemShippingAddresses.

      Specified by:
      getItemShippingAddresses in interface CartDraft
      Returns:
      itemShippingAddresses
    • getDiscountCodes

      public List<String> getDiscountCodes()

      code of the existing DiscountCodes to add to the Cart.

      Specified by:
      getDiscountCodes in interface CartDraft
      Returns:
      discountCodes
    • getCountry

      public String getCountry()

      Used for LineItem Price selection. If used for Create Cart in Store, the provided country must be one of the Store's countries.

      Specified by:
      getCountry in interface CartDraft
      Returns:
      country
    • getLocale

      public String getLocale()

      Languages of the Cart. Can only contain languages supported by the Project.

      Specified by:
      getLocale in interface CartDraft
      Returns:
      locale
    • getOrigin

      public CartOrigin getOrigin()

      Indicates how the Cart was created.

      Specified by:
      getOrigin in interface CartDraft
      Returns:
      origin
    • getDeleteDaysAfterLastModification

      public 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.

      Specified by:
      getDeleteDaysAfterLastModification in interface CartDraft
      Returns:
      deleteDaysAfterLastModification
    • getCustom

      public CustomFieldsDraft getCustom()

      Custom Fields for the Cart.

      Specified by:
      getCustom in interface CartDraft
      Specified by:
      getCustom in interface CustomizableDraft<CartDraft>
      Returns:
      custom
    • setCurrency

      public void setCurrency(String currency)
      Description copied from interface: CartDraft

      Currency the Cart uses.

      Specified by:
      setCurrency in interface CartDraft
      Parameters:
      currency - value to be set
    • setKey

      public void setKey(String key)
      Description copied from interface: CartDraft

      User-defined unique identifier for the Cart.

      Specified by:
      setKey in interface CartDraft
      Parameters:
      key - value to be set
    • setCustomerId

      public void setCustomerId(String customerId)
      Description copied from interface: CartDraft

      id of the Customer that the Cart belongs to.

      Specified by:
      setCustomerId in interface CartDraft
      Parameters:
      customerId - value to be set
    • setCustomerEmail

      public void setCustomerEmail(String customerEmail)
      Description copied from interface: CartDraft

      Email address of the Customer that the Cart belongs to.

      Specified by:
      setCustomerEmail in interface CartDraft
      Parameters:
      customerEmail - value to be set
    • setCustomerGroup

      public void setCustomerGroup(CustomerGroupResourceIdentifier customerGroup)
      Description copied from interface: CartDraft

      ResourceIdentifier to the Customer Group of the Customer that the Cart belongs to. Used for LineItem Price selection.

      It is automatically set if the Customer referenced in customerId belongs to a Customer Group. It can also be set explicitly when no customerId is present.

      Specified by:
      setCustomerGroup in interface CartDraft
      Parameters:
      customerGroup - value to be set
    • setAnonymousId

      public void setAnonymousId(String anonymousId)
      Description copied from interface: CartDraft

      Anonymous session associated with the Cart.

      Specified by:
      setAnonymousId in interface CartDraft
      Parameters:
      anonymousId - value to be set
    • setBusinessUnit

      public void setBusinessUnit(BusinessUnitResourceIdentifier businessUnit)
      Description copied from interface: CartDraft

      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.

      Specified by:
      setBusinessUnit in interface CartDraft
      Parameters:
      businessUnit - value to be set
    • setStore

      public void setStore(StoreResourceIdentifier store)
      Description copied from interface: CartDraft

      ResourceIdentifier to the Store the Cart should belong to. Once set, it cannot be updated.

      Specified by:
      setStore in interface CartDraft
      Parameters:
      store - value to be set
    • setLineItems

      public void setLineItems(LineItemDraft... lineItems)
      Description copied from interface: CartDraft

      Line Items to add to the Cart.

      Specified by:
      setLineItems in interface CartDraft
      Parameters:
      lineItems - values to be set
    • setLineItems

      public void setLineItems(List<LineItemDraft> lineItems)
      Description copied from interface: CartDraft

      Line Items to add to the Cart.

      Specified by:
      setLineItems in interface CartDraft
      Parameters:
      lineItems - values to be set
    • setCustomLineItems

      public void setCustomLineItems(CustomLineItemDraft... customLineItems)
      Description copied from interface: CartDraft

      Custom Line Items to add to the Cart.

      Specified by:
      setCustomLineItems in interface CartDraft
      Parameters:
      customLineItems - values to be set
    • setCustomLineItems

      public void setCustomLineItems(List<CustomLineItemDraft> customLineItems)
      Description copied from interface: CartDraft

      Custom Line Items to add to the Cart.

      Specified by:
      setCustomLineItems in interface CartDraft
      Parameters:
      customLineItems - values to be set
    • setTaxMode

      public void setTaxMode(TaxMode taxMode)
      Description copied from interface: CartDraft

      Determines how Tax Rates are set.

      Specified by:
      setTaxMode in interface CartDraft
      Parameters:
      taxMode - value to be set
    • setExternalTaxRateForShippingMethod

      public void setExternalTaxRateForShippingMethod(ExternalTaxRateDraft externalTaxRateForShippingMethod)
      Description copied from interface: CartDraft

      External Tax Rate for the shippingMethod if the Cart has External TaxMode.

      Specified by:
      setExternalTaxRateForShippingMethod in interface CartDraft
      Parameters:
      externalTaxRateForShippingMethod - value to be set
    • setTaxRoundingMode

      public void setTaxRoundingMode(RoundingMode taxRoundingMode)
      Description copied from interface: CartDraft

      Determines how monetary values are rounded when calculating taxes for taxedPrice.

      Specified by:
      setTaxRoundingMode in interface CartDraft
      Parameters:
      taxRoundingMode - value to be set
    • setTaxCalculationMode

      public void setTaxCalculationMode(TaxCalculationMode taxCalculationMode)
      Description copied from interface: CartDraft

      Determines how taxes are calculated for taxedPrice.

      Specified by:
      setTaxCalculationMode in interface CartDraft
      Parameters:
      taxCalculationMode - value to be set
    • setInventoryMode

      public void setInventoryMode(InventoryMode inventoryMode)
      Description copied from interface: CartDraft

      Determines how stock quantities are tracked for Line Items in the Cart.

      Specified by:
      setInventoryMode in interface CartDraft
      Parameters:
      inventoryMode - value to be set
    • setBillingAddress

      public void setBillingAddress(BaseAddress billingAddress)
      Description copied from interface: CartDraft

      Billing address associated with the Cart.

      Specified by:
      setBillingAddress in interface CartDraft
      Parameters:
      billingAddress - value to be set
    • setShippingAddress

      public void setShippingAddress(BaseAddress shippingAddress)
      Description copied from interface: CartDraft

      Shipping address associated with the Cart. Determines eligible ShippingMethod rates and Tax Rates of Line Items.

      Specified by:
      setShippingAddress in interface CartDraft
      Parameters:
      shippingAddress - value to be set
    • setShippingMethod

      public void setShippingMethod(ShippingMethodResourceIdentifier shippingMethod)
      Description copied from interface: CartDraft

      Shipping Method for a Cart with Single ShippingMode. If the referenced ShippingMethod has a predicate that does not match the Cart, an InvalidOperation error is returned when creating a Cart.

      Specified by:
      setShippingMethod in interface CartDraft
      Parameters:
      shippingMethod - value to be set
    • setShippingRateInput

      public void setShippingRateInput(ShippingRateInputDraft shippingRateInput)
      Description copied from interface: CartDraft

      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.
      Specified by:
      setShippingRateInput in interface CartDraft
      Parameters:
      shippingRateInput - value to be set
    • setShippingMode

      public void setShippingMode(ShippingMode shippingMode)
      Description copied from interface: CartDraft
      • 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.
      Specified by:
      setShippingMode in interface CartDraft
      Parameters:
      shippingMode - value to be set
    • setCustomShipping

      public void setCustomShipping(CustomShippingDraft... customShipping)
      Description copied from interface: CartDraft

      Custom Shipping Methods for a Cart with Multiple ShippingMode.

      Specified by:
      setCustomShipping in interface CartDraft
      Parameters:
      customShipping - values to be set
    • setCustomShipping

      public void setCustomShipping(List<CustomShippingDraft> customShipping)
      Description copied from interface: CartDraft

      Custom Shipping Methods for a Cart with Multiple ShippingMode.

      Specified by:
      setCustomShipping in interface CartDraft
      Parameters:
      customShipping - values to be set
    • setShipping

      public void setShipping(ShippingDraft... shipping)
      Description copied from interface: CartDraft

      Shipping Methods for a Cart with Multiple ShippingMode.

      Specified by:
      setShipping in interface CartDraft
      Parameters:
      shipping - values to be set
    • setShipping

      public void setShipping(List<ShippingDraft> shipping)
      Description copied from interface: CartDraft

      Shipping Methods for a Cart with Multiple ShippingMode.

      Specified by:
      setShipping in interface CartDraft
      Parameters:
      shipping - values to be set
    • setItemShippingAddresses

      public void setItemShippingAddresses(BaseAddress... itemShippingAddresses)
      Description copied from interface: CartDraft

      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 their shippingDetails.

      Eligible Shipping Methods or applicable Tax Rates are determined by the address shippingAddress, and not itemShippingAddresses.

      Specified by:
      setItemShippingAddresses in interface CartDraft
      Parameters:
      itemShippingAddresses - values to be set
    • setItemShippingAddresses

      public void setItemShippingAddresses(List<BaseAddress> itemShippingAddresses)
      Description copied from interface: CartDraft

      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 their shippingDetails.

      Eligible Shipping Methods or applicable Tax Rates are determined by the address shippingAddress, and not itemShippingAddresses.

      Specified by:
      setItemShippingAddresses in interface CartDraft
      Parameters:
      itemShippingAddresses - values to be set
    • setDiscountCodes

      public void setDiscountCodes(String... discountCodes)
      Description copied from interface: CartDraft

      code of the existing DiscountCodes to add to the Cart.

      Specified by:
      setDiscountCodes in interface CartDraft
      Parameters:
      discountCodes - values to be set
    • setDiscountCodes

      public void setDiscountCodes(List<String> discountCodes)
      Description copied from interface: CartDraft

      code of the existing DiscountCodes to add to the Cart.

      Specified by:
      setDiscountCodes in interface CartDraft
      Parameters:
      discountCodes - values to be set
    • setCountry

      public void setCountry(String country)
      Description copied from interface: CartDraft

      Used for LineItem Price selection. If used for Create Cart in Store, the provided country must be one of the Store's countries.

      Specified by:
      setCountry in interface CartDraft
      Parameters:
      country - value to be set
    • setLocale

      public void setLocale(String locale)
      Description copied from interface: CartDraft

      Languages of the Cart. Can only contain languages supported by the Project.

      Specified by:
      setLocale in interface CartDraft
      Parameters:
      locale - value to be set
    • setOrigin

      public void setOrigin(CartOrigin origin)
      Description copied from interface: CartDraft

      Indicates how the Cart was created.

      Specified by:
      setOrigin in interface CartDraft
      Parameters:
      origin - value to be set
    • setDeleteDaysAfterLastModification

      public void setDeleteDaysAfterLastModification(Long deleteDaysAfterLastModification)
      Description copied from interface: CartDraft

      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.

      Specified by:
      setDeleteDaysAfterLastModification in interface CartDraft
      Parameters:
      deleteDaysAfterLastModification - value to be set
    • setCustom

      public void setCustom(CustomFieldsDraft custom)
      Description copied from interface: CartDraft

      Custom Fields for the Cart.

      Specified by:
      setCustom in interface CartDraft
      Specified by:
      setCustom in interface CustomizableDraft<CartDraft>
      Parameters:
      custom - value to be set
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object