Interface DiscountCode

All Superinterfaces:
BaseResource, Customizable<DiscountCode>, DiscountCodeMixin, DomainResource<DiscountCode>, Identifiable<DiscountCode>, Referencable<DiscountCode>, ResourceIdentifiable<DiscountCode>, Versioned<DiscountCode>

DiscountCode
Example to create an instance using the builder pattern

     DiscountCode discountCode = DiscountCode.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .code("{code}")
             .plusCartDiscounts(cartDiscountsBuilder -> cartDiscountsBuilder)
             .isActive(true)
             .plusReferences(referencesBuilder -> referencesBuilder)
             .plusGroups(groupsBuilder -> groupsBuilder)
             .build()
 
  • Method Details

    • getId

      @NotNull @NotNull String getId()

      Unique identifier of the DiscountCode.

      Specified by:
      getId in interface BaseResource
      Specified by:
      getId in interface DomainResource<DiscountCode>
      Specified by:
      getId in interface Identifiable<DiscountCode>
      Specified by:
      getId in interface Versioned<DiscountCode>
      Returns:
      id
    • getKey

      String getKey()

      User-defined unique identifier of the DiscountCode.

      Returns:
      key
    • getVersion

      @NotNull @NotNull Long getVersion()

      Current version of the DiscountCode.

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

      @NotNull @NotNull ZonedDateTime getCreatedAt()

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

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

      @NotNull @NotNull ZonedDateTime getLastModifiedAt()

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

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

      @Valid @Valid LastModifiedBy getLastModifiedBy()

      Present on resources created after 1 February 2019 except for events not tracked.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Valid @Valid CreatedBy getCreatedBy()

      Present on resources created after 1 February 2019 except for events not tracked.

      Returns:
      createdBy
    • getName

      @Valid @Valid LocalizedString getName()

      Name of the DiscountCode.

      Returns:
      name
    • getDescription

      @Valid @Valid LocalizedString getDescription()

      Description of the DiscountCode.

      Returns:
      description
    • getCode

      @NotNull @NotNull String getCode()

      User-defined unique identifier of the DiscountCode added to the Cart to apply the related CartDiscounts.

      Returns:
      code
    • getCartDiscounts

      @NotNull @Valid @NotNull @Valid List<CartDiscountReference> getCartDiscounts()

      Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.

      Returns:
      cartDiscounts
    • getCartPredicate

      String getCartPredicate()

      DiscountCode can only be applied to Carts that match this predicate.

      Returns:
      cartPredicate
    • getIsActive

      @NotNull @NotNull Boolean getIsActive()

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

      Returns:
      isActive
    • getReferences

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

      Array generated from the Cart predicate. It contains the references of all the resources that are addressed in the predicate.

      Returns:
      references
    • getMaxApplications

      Long getMaxApplications()

      Number of times the DiscountCode can be applied. DiscountCode application is counted at the time of Order creation or edit. However, Order cancellation or deletion does not decrement the count.

      Returns:
      maxApplications
    • getMaxApplicationsPerCustomer

      Long getMaxApplicationsPerCustomer()

      Number of times the DiscountCode can be applied per Customer (anonymous Carts are not supported). DiscountCode application is counted at the time of Order creation or edit. However, Order cancellation or deletion does not decrement the count.

      Returns:
      maxApplicationsPerCustomer
    • getCustom

      @Valid @Valid CustomFields getCustom()

      Custom Fields of the DiscountCode.

      Specified by:
      getCustom in interface Customizable<DiscountCode>
      Returns:
      custom
    • getGroups

      @NotNull @NotNull List<String> getGroups()

      Groups to which the DiscountCode belongs to.

      Returns:
      groups
    • getValidFrom

      ZonedDateTime getValidFrom()

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

      Returns:
      validFrom
    • getValidUntil

      ZonedDateTime getValidUntil()

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

      Returns:
      validUntil
    • getApplicationVersion

      Long getApplicationVersion()

      Used and managed by the API and must not be used in customer logic. The value can change at any time due to internal and external factors.

      Returns:
      applicationVersion
    • setId

      void setId(String id)

      Unique identifier of the DiscountCode.

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

      void setKey(String key)

      User-defined unique identifier of the DiscountCode.

      Parameters:
      key - value to be set
    • setVersion

      void setVersion(Long version)

      Current version of the DiscountCode.

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

      void setCreatedAt(ZonedDateTime createdAt)

      Date and time (UTC) the DiscountCode 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 DiscountCode was last updated.

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

      void setLastModifiedBy(LastModifiedBy lastModifiedBy)

      Present on resources created after 1 February 2019 except for events not tracked.

      Parameters:
      lastModifiedBy - value to be set
    • setCreatedBy

      void setCreatedBy(CreatedBy createdBy)

      Present on resources created after 1 February 2019 except for events not tracked.

      Parameters:
      createdBy - value to be set
    • setName

      void setName(LocalizedString name)

      Name of the DiscountCode.

      Parameters:
      name - value to be set
    • setDescription

      void setDescription(LocalizedString description)

      Description of the DiscountCode.

      Parameters:
      description - value to be set
    • setCode

      void setCode(String code)

      User-defined unique identifier of the DiscountCode added to the Cart to apply the related CartDiscounts.

      Parameters:
      code - value to be set
    • setCartDiscounts

      void setCartDiscounts(CartDiscountReference... cartDiscounts)

      Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.

      Parameters:
      cartDiscounts - values to be set
    • setCartDiscounts

      void setCartDiscounts(List<CartDiscountReference> cartDiscounts)

      Reference to CartDiscounts that can be applied to the Cart once the DiscountCode is applied.

      Parameters:
      cartDiscounts - values to be set
    • setCartPredicate

      void setCartPredicate(String cartPredicate)

      DiscountCode can only be applied to Carts that match this predicate.

      Parameters:
      cartPredicate - value to be set
    • setIsActive

      void setIsActive(Boolean isActive)

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

      Parameters:
      isActive - value to be set
    • setReferences

      void setReferences(Reference... references)

      Array generated from the Cart predicate. It contains the references of all the resources that are addressed in the predicate.

      Parameters:
      references - values to be set
    • setReferences

      void setReferences(List<Reference> references)

      Array generated from the Cart predicate. It contains the references of all the resources that are addressed in the predicate.

      Parameters:
      references - values to be set
    • setMaxApplications

      void setMaxApplications(Long maxApplications)

      Number of times the DiscountCode can be applied. DiscountCode application is counted at the time of Order creation or edit. However, Order cancellation or deletion does not decrement the count.

      Parameters:
      maxApplications - value to be set
    • setMaxApplicationsPerCustomer

      void setMaxApplicationsPerCustomer(Long maxApplicationsPerCustomer)

      Number of times the DiscountCode can be applied per Customer (anonymous Carts are not supported). DiscountCode application is counted at the time of Order creation or edit. However, Order cancellation or deletion does not decrement the count.

      Parameters:
      maxApplicationsPerCustomer - value to be set
    • setCustom

      void setCustom(CustomFields custom)

      Custom Fields of the DiscountCode.

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

      void setGroups(String... groups)

      Groups to which the DiscountCode belongs to.

      Parameters:
      groups - values to be set
    • setGroups

      void setGroups(List<String> groups)

      Groups to which the DiscountCode belongs to.

      Parameters:
      groups - values to be set
    • setValidFrom

      void setValidFrom(ZonedDateTime validFrom)

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

      Parameters:
      validFrom - value to be set
    • setValidUntil

      void setValidUntil(ZonedDateTime validUntil)

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

      Parameters:
      validUntil - value to be set
    • setApplicationVersion

      void setApplicationVersion(Long applicationVersion)

      Used and managed by the API and must not be used in customer logic. The value can change at any time due to internal and external factors.

      Parameters:
      applicationVersion - value to be set
    • of

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

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

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

      static DiscountCodeBuilder builder()
      builder factory method for DiscountCode
      Returns:
      builder
    • builder

      static DiscountCodeBuilder builder(DiscountCode template)
      create builder for DiscountCode instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withDiscountCode

      default <T> T withDiscountCode(Function<DiscountCode,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<DiscountCode> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference