Interface CartDiscount

All Superinterfaces:
BaseResource, CartDiscountMixin, Customizable<CartDiscount>, DomainResource<CartDiscount>, Identifiable<CartDiscount>, Referencable<CartDiscount>, ResourceIdentifiable<CartDiscount>, Versioned<CartDiscount>, WithKey

CartDiscount
Example to create an instance using the builder pattern

     CartDiscount cartDiscount = CartDiscount.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .name(nameBuilder -> nameBuilder)
             .value(valueBuilder -> valueBuilder)
             .cartPredicate("{cartPredicate}")
             .sortOrder("{sortOrder}")
             .plusStores(storesBuilder -> storesBuilder)
             .isActive(true)
             .requiresDiscountCode(true)
             .plusReferences(referencesBuilder -> referencesBuilder)
             .stackingMode(StackingMode.STACKING)
             .build()
 
  • Method Details

    • getId

      @NotNull @NotNull String getId()

      Unique identifier of the CartDiscount.

      Specified by:
      getId in interface BaseResource
      Specified by:
      getId in interface DomainResource<CartDiscount>
      Specified by:
      getId in interface Identifiable<CartDiscount>
      Specified by:
      getId in interface Versioned<CartDiscount>
      Returns:
      id
    • getVersion

      @NotNull @NotNull Long getVersion()

      Current version of the CartDiscount.

      Specified by:
      getVersion in interface BaseResource
      Specified by:
      getVersion in interface DomainResource<CartDiscount>
      Specified by:
      getVersion in interface Versioned<CartDiscount>
      Returns:
      version
    • getCreatedAt

      @NotNull @NotNull ZonedDateTime getCreatedAt()

      Date and time (UTC) the CartDiscount was initially created.

      Specified by:
      getCreatedAt in interface BaseResource
      Returns:
      createdAt
    • getLastModifiedAt

      @NotNull @NotNull ZonedDateTime getLastModifiedAt()

      Date and time (UTC) the CartDiscount was last updated.

      Specified by:
      getLastModifiedAt in interface BaseResource
      Returns:
      lastModifiedAt
    • getLastModifiedBy

      @Valid @Valid LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the CartDiscount.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Valid @Valid CreatedBy getCreatedBy()

      IDs and references that created the CartDiscount.

      Returns:
      createdBy
    • getName

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

      Name of the CartDiscount.

      Returns:
      name
    • getKey

      String getKey()

      User-defined unique identifier of 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 CartDiscountValue 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 is discounted.

      Empty, if the value is giftLineItem.

      Returns:
      target
    • getSortOrder

      @NotNull @NotNull String getSortOrder()

      Value between 0 and 1. All matching CartDiscounts are applied to a Cart in the order defined by this field. A Discount with a higher sortOrder is prioritized. The sort order is unambiguous among all CartDiscounts.

      Returns:
      sortOrder
    • getStores

      @NotNull @Valid @NotNull @Valid List<StoreKeyReference> getStores()
      • If a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
      • If empty, the Cart Discount applies on all Carts, irrespective of a Store.
      Returns:
      stores
    • getIsActive

      @NotNull @NotNull Boolean getIsActive()

      Indicates if the CartDiscount is active and can be applied to the Cart.

      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

      @NotNull @NotNull Boolean getRequiresDiscountCode()

      Indicates if the Discount is used in connection with a DiscountCode.

      Returns:
      requiresDiscountCode
    • getReferences

      @NotNull @Valid @NotNull @Valid List<Reference> getReferences()

      References of all resources that are addressed in the predicate. The API generates this array from the predicate.

      Returns:
      references
    • getStackingMode

      @NotNull @NotNull StackingMode getStackingMode()

      Indicates whether the application of the CartDiscount causes other discounts to be ignored.

      Returns:
      stackingMode
    • getCustom

      @Valid @Valid CustomFields getCustom()

      Custom Fields of the CartDiscount.

      Specified by:
      getCustom in interface Customizable<CartDiscount>
      Returns:
      custom
    • setId

      void setId(String id)

      Unique identifier of the CartDiscount.

      Specified by:
      setId in interface BaseResource
      Parameters:
      id - value to be set
    • setVersion

      void setVersion(Long version)

      Current version of the CartDiscount.

      Specified by:
      setVersion in interface BaseResource
      Parameters:
      version - value to be set
    • setCreatedAt

      void setCreatedAt(ZonedDateTime createdAt)

      Date and time (UTC) the CartDiscount was initially created.

      Specified by:
      setCreatedAt in interface BaseResource
      Parameters:
      createdAt - value to be set
    • setLastModifiedAt

      void setLastModifiedAt(ZonedDateTime lastModifiedAt)

      Date and time (UTC) the CartDiscount was last updated.

      Specified by:
      setLastModifiedAt in interface BaseResource
      Parameters:
      lastModifiedAt - value to be set
    • setLastModifiedBy

      void setLastModifiedBy(LastModifiedBy lastModifiedBy)

      IDs and references that last modified the CartDiscount.

      Parameters:
      lastModifiedBy - value to be set
    • setCreatedBy

      void setCreatedBy(CreatedBy createdBy)

      IDs and references that created the CartDiscount.

      Parameters:
      createdBy - value to be set
    • setName

      void setName(LocalizedString name)

      Name of the CartDiscount.

      Parameters:
      name - value to be set
    • setKey

      void setKey(String key)

      User-defined unique identifier of 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(CartDiscountValue 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 is discounted.

      Empty, if the value is giftLineItem.

      Parameters:
      target - value to be set
    • setSortOrder

      void setSortOrder(String sortOrder)

      Value between 0 and 1. All matching CartDiscounts are applied to a Cart in the order defined by this field. A Discount with a higher sortOrder is prioritized. The sort order is unambiguous among all CartDiscounts.

      Parameters:
      sortOrder - value to be set
    • setStores

      void setStores(StoreKeyReference... stores)
      • If a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
      • If empty, the Cart Discount applies on all Carts, irrespective of a Store.
      Parameters:
      stores - values to be set
    • setStores

      void setStores(List<StoreKeyReference> stores)
      • If a value exists, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
      • If empty, the Cart Discount applies on all Carts, irrespective of a Store.
      Parameters:
      stores - values to be set
    • setIsActive

      void setIsActive(Boolean isActive)

      Indicates if the CartDiscount is active and can be applied to the Cart.

      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)

      Indicates if the Discount is used in connection with a DiscountCode.

      Parameters:
      requiresDiscountCode - value to be set
    • setReferences

      void setReferences(Reference... references)

      References of all resources that are addressed in the predicate. The API generates this array from the predicate.

      Parameters:
      references - values to be set
    • setReferences

      void setReferences(List<Reference> references)

      References of all resources that are addressed in the predicate. The API generates this array from the predicate.

      Parameters:
      references - values to be set
    • setStackingMode

      void setStackingMode(StackingMode stackingMode)

      Indicates whether the application of the CartDiscount causes other discounts to be ignored.

      Parameters:
      stackingMode - value to be set
    • setCustom

      void setCustom(CustomFields custom)

      Custom Fields of the CartDiscount.

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

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

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

      @Nullable static CartDiscount deepCopy(@Nullable CartDiscount template)
      factory method to create a deep copy of CartDiscount
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      static CartDiscountBuilder builder()
      builder factory method for CartDiscount
      Returns:
      builder
    • builder

      static CartDiscountBuilder builder(CartDiscount template)
      create builder for CartDiscount instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withCartDiscount

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

      static ReferenceTypeId referenceTypeId()
    • typeReference

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