Interface CartDiscountDraft

All Superinterfaces:
CustomizableDraft<CartDiscountDraft>, Draft<CartDiscountDraft>, WithKey

public interface CartDiscountDraft extends CustomizableDraft<CartDiscountDraft>, WithKey, Draft<CartDiscountDraft>
CartDiscountDraft
Example to create an instance using the builder pattern

     CartDiscountDraft cartDiscountDraft = CartDiscountDraft.builder()
             .name(nameBuilder -> nameBuilder)
             .value(valueBuilder -> valueBuilder)
             .cartPredicate("{cartPredicate}")
             .sortOrder("{sortOrder}")
             .build()
 
  • Method Details

    • getName

      @NotNull @Valid @NotNull @Valid LocalizedString getName()

      Name of the CartDiscount.

      Returns:
      name
    • getKey

      String getKey()

      User-defined unique identifier for the CartDiscount.

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

      @Valid @Valid LocalizedString getDescription()

      Description of the CartDiscount.

      Returns:
      description
    • getValue

      @NotNull @Valid @NotNull @Valid CartDiscountValueDraft getValue()

      Effect of the CartDiscount on the target.

      Returns:
      value
    • getCartPredicate

      @NotNull @NotNull String getCartPredicate()

      Valid Cart Predicate.

      Returns:
      cartPredicate
    • getTarget

      @Valid @Valid CartDiscountTarget getTarget()

      Segment of the Cart that will be discounted.

      Must not be set if the value is giftLineItem.

      Returns:
      target
    • getSortOrder

      @NotNull @NotNull String getSortOrder()

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

      Returns:
      sortOrder
    • getStores

      @Valid @Valid 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.

      Returns:
      stores
    • getIsActive

      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.

      Returns:
      isActive
    • getValidFrom

      ZonedDateTime getValidFrom()

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

      Returns:
      validFrom
    • getValidUntil

      ZonedDateTime getValidUntil()

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

      Returns:
      validUntil
    • getRequiresDiscountCode

      Boolean getRequiresDiscountCode()

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

      Returns:
      requiresDiscountCode
    • getStackingMode

      StackingMode getStackingMode()

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

      Returns:
      stackingMode
    • getCustom

      @Valid @Valid CustomFieldsDraft getCustom()

      Custom Fields of the CartDiscount.

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

      void setName(LocalizedString name)

      Name of the CartDiscount.

      Parameters:
      name - value to be set
    • setKey

      void setKey(String key)

      User-defined unique identifier for the CartDiscount.

      Parameters:
      key - value to be set
    • setDescription

      void setDescription(LocalizedString description)

      Description of the CartDiscount.

      Parameters:
      description - value to be set
    • setValue

      void setValue(CartDiscountValueDraft value)

      Effect of the CartDiscount on the target.

      Parameters:
      value - value to be set
    • setCartPredicate

      void setCartPredicate(String cartPredicate)

      Valid Cart Predicate.

      Parameters:
      cartPredicate - value to be set
    • setTarget

      void setTarget(CartDiscountTarget target)

      Segment of the Cart that will be discounted.

      Must not be set if the value is giftLineItem.

      Parameters:
      target - value to be set
    • setSortOrder

      void setSortOrder(String sortOrder)

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

      Parameters:
      sortOrder - value to be set
    • setStores

      void setStores(StoreResourceIdentifier... stores)
      • 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.

      Parameters:
      stores - values to be set
    • setStores

      void setStores(List<StoreResourceIdentifier> stores)
      • 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.

      Parameters:
      stores - values to be set
    • setIsActive

      void setIsActive(Boolean isActive)

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

      Parameters:
      isActive - value to be set
    • setValidFrom

      void setValidFrom(ZonedDateTime validFrom)

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

      Parameters:
      validFrom - value to be set
    • setValidUntil

      void setValidUntil(ZonedDateTime validUntil)

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

      Parameters:
      validUntil - value to be set
    • setRequiresDiscountCode

      void setRequiresDiscountCode(Boolean requiresDiscountCode)

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

      Parameters:
      requiresDiscountCode - value to be set
    • setStackingMode

      void setStackingMode(StackingMode stackingMode)

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

      Parameters:
      stackingMode - value to be set
    • setCustom

      void setCustom(CustomFieldsDraft custom)

      Custom Fields of the CartDiscount.

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

      static CartDiscountDraft of()
      factory method
      Returns:
      instance of CartDiscountDraft
    • of

      static CartDiscountDraft of(CartDiscountDraft template)
      factory method to create a shallow copy CartDiscountDraft
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • deepCopy

      factory method to create a deep copy of CartDiscountDraft
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      static CartDiscountDraftBuilder builder()
      builder factory method for CartDiscountDraft
      Returns:
      builder
    • builder

      static CartDiscountDraftBuilder builder(CartDiscountDraft template)
      create builder for CartDiscountDraft instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withCartDiscountDraft

      default <T> T withCartDiscountDraft(Function<CartDiscountDraft,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<CartDiscountDraft> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference