Class CartDiscountDraftImpl

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

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

    • CartDiscountDraftImpl

      public CartDiscountDraftImpl()
      create empty instance
  • Method Details

    • getName

      public LocalizedString getName()

      Name of the CartDiscount.

      Specified by:
      getName in interface CartDiscountDraft
      Returns:
      name
    • getKey

      public String getKey()

      User-defined unique identifier for the CartDiscount.

      Specified by:
      getKey in interface CartDiscountDraft
      Specified by:
      getKey in interface WithKey
      Returns:
      key
    • getDescription

      public LocalizedString getDescription()

      Description of the CartDiscount.

      Specified by:
      getDescription in interface CartDiscountDraft
      Returns:
      description
    • getValue

      public CartDiscountValueDraft getValue()

      Effect of the CartDiscount on the target.

      Specified by:
      getValue in interface CartDiscountDraft
      Returns:
      value
    • getCartPredicate

      public String getCartPredicate()

      Valid Cart Predicate.

      Specified by:
      getCartPredicate in interface CartDiscountDraft
      Returns:
      cartPredicate
    • getTarget

      public CartDiscountTarget getTarget()

      Segment of the Cart that will be discounted.

      Must not be set if the value is giftLineItem.

      Specified by:
      getTarget in interface CartDiscountDraft
      Returns:
      target
    • getSortOrder

      public String getSortOrder()

      Value between 0 and 1. A Discount with a higher sortOrder is prioritized. The sort order must be unambiguous among all CartDiscounts.

      Specified by:
      getSortOrder in interface CartDiscountDraft
      Returns:
      sortOrder
    • getStores

      public List<StoreResourceIdentifier> getStores()
      • If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
      • If not defined, the Cart Discount applies on all Carts, irrespective of a Store.

      If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.

      If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.

      Specified by:
      getStores in interface CartDiscountDraft
      Returns:
      stores
    • getIsActive

      public Boolean getIsActive()

      Only active Discounts can be applied to the Cart. If the limit for active Cart Discounts is reached, a MaxCartDiscountsReached error is returned.

      Specified by:
      getIsActive in interface CartDiscountDraft
      Returns:
      isActive
    • getValidFrom

      public ZonedDateTime getValidFrom()

      Date and time (UTC) from which the Discount is effective.

      Specified by:
      getValidFrom in interface CartDiscountDraft
      Returns:
      validFrom
    • getValidUntil

      public ZonedDateTime getValidUntil()

      Date and time (UTC) until which the Discount is effective.

      Specified by:
      getValidUntil in interface CartDiscountDraft
      Returns:
      validUntil
    • getRequiresDiscountCode

      public Boolean getRequiresDiscountCode()

      States whether the Discount can only be used in a connection with a DiscountCode.

      Specified by:
      getRequiresDiscountCode in interface CartDiscountDraft
      Returns:
      requiresDiscountCode
    • getStackingMode

      public StackingMode getStackingMode()

      Specifies whether the application of this discount causes the following discounts to be ignored.

      Specified by:
      getStackingMode in interface CartDiscountDraft
      Returns:
      stackingMode
    • getCustom

      public CustomFieldsDraft getCustom()

      Custom Fields of the CartDiscount.

      Specified by:
      getCustom in interface CartDiscountDraft
      Specified by:
      getCustom in interface CustomizableDraft<CartDiscountDraft>
      Returns:
      custom
    • setName

      public void setName(LocalizedString name)
      Description copied from interface: CartDiscountDraft

      Name of the CartDiscount.

      Specified by:
      setName in interface CartDiscountDraft
      Parameters:
      name - value to be set
    • setKey

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

      User-defined unique identifier for the CartDiscount.

      Specified by:
      setKey in interface CartDiscountDraft
      Parameters:
      key - value to be set
    • setDescription

      public void setDescription(LocalizedString description)
      Description copied from interface: CartDiscountDraft

      Description of the CartDiscount.

      Specified by:
      setDescription in interface CartDiscountDraft
      Parameters:
      description - value to be set
    • setValue

      public void setValue(CartDiscountValueDraft value)
      Description copied from interface: CartDiscountDraft

      Effect of the CartDiscount on the target.

      Specified by:
      setValue in interface CartDiscountDraft
      Parameters:
      value - value to be set
    • setCartPredicate

      public void setCartPredicate(String cartPredicate)
      Description copied from interface: CartDiscountDraft

      Valid Cart Predicate.

      Specified by:
      setCartPredicate in interface CartDiscountDraft
      Parameters:
      cartPredicate - value to be set
    • setTarget

      public void setTarget(CartDiscountTarget target)
      Description copied from interface: CartDiscountDraft

      Segment of the Cart that will be discounted.

      Must not be set if the value is giftLineItem.

      Specified by:
      setTarget in interface CartDiscountDraft
      Parameters:
      target - value to be set
    • setSortOrder

      public void setSortOrder(String sortOrder)
      Description copied from interface: CartDiscountDraft

      Value between 0 and 1. A Discount with a higher sortOrder is prioritized. The sort order must be unambiguous among all CartDiscounts.

      Specified by:
      setSortOrder in interface CartDiscountDraft
      Parameters:
      sortOrder - value to be set
    • setStores

      public void setStores(StoreResourceIdentifier... stores)
      Description copied from interface: CartDiscountDraft
      • If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
      • If not defined, the Cart Discount applies on all Carts, irrespective of a Store.

      If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.

      If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.

      Specified by:
      setStores in interface CartDiscountDraft
      Parameters:
      stores - values to be set
    • setStores

      public void setStores(List<StoreResourceIdentifier> stores)
      Description copied from interface: CartDiscountDraft
      • If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
      • If not defined, the Cart Discount applies on all Carts, irrespective of a Store.

      If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.

      If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.

      Specified by:
      setStores in interface CartDiscountDraft
      Parameters:
      stores - values to be set
    • setIsActive

      public void setIsActive(Boolean isActive)
      Description copied from interface: CartDiscountDraft

      Only active Discounts can be applied to the Cart. If the limit for active Cart Discounts is reached, a MaxCartDiscountsReached error is returned.

      Specified by:
      setIsActive in interface CartDiscountDraft
      Parameters:
      isActive - value to be set
    • setValidFrom

      public void setValidFrom(ZonedDateTime validFrom)
      Description copied from interface: CartDiscountDraft

      Date and time (UTC) from which the Discount is effective.

      Specified by:
      setValidFrom in interface CartDiscountDraft
      Parameters:
      validFrom - value to be set
    • setValidUntil

      public void setValidUntil(ZonedDateTime validUntil)
      Description copied from interface: CartDiscountDraft

      Date and time (UTC) until which the Discount is effective.

      Specified by:
      setValidUntil in interface CartDiscountDraft
      Parameters:
      validUntil - value to be set
    • setRequiresDiscountCode

      public void setRequiresDiscountCode(Boolean requiresDiscountCode)
      Description copied from interface: CartDiscountDraft

      States whether the Discount can only be used in a connection with a DiscountCode.

      Specified by:
      setRequiresDiscountCode in interface CartDiscountDraft
      Parameters:
      requiresDiscountCode - value to be set
    • setStackingMode

      public void setStackingMode(StackingMode stackingMode)
      Description copied from interface: CartDiscountDraft

      Specifies whether the application of this discount causes the following discounts to be ignored.

      Specified by:
      setStackingMode in interface CartDiscountDraft
      Parameters:
      stackingMode - value to be set
    • setCustom

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

      Custom Fields of the CartDiscount.

      Specified by:
      setCustom in interface CartDiscountDraft
      Specified by:
      setCustom in interface CustomizableDraft<CartDiscountDraft>
      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
    • toString

      public String toString()
      Overrides:
      toString in class Object