Interface DiscountCodeImport

All Superinterfaces:
ImportResource

public interface DiscountCodeImport extends ImportResource

The data representation for a Discount Code to be imported that is persisted as a Discount Code in the Project.


Example to create an instance using the builder pattern

     DiscountCodeImport discountCodeImport = DiscountCodeImport.builder()
             .key("{key}")
             .code("{code}")
             .plusCartDiscounts(cartDiscountsBuilder -> cartDiscountsBuilder)
             .isActive(true)
             .build()
 
  • Method Details

    • getKey

      @NotNull @NotNull String getKey()

      User-defined unique identifier. If a Discount Code with this key exists, it will be updated with the imported data.

      Specified by:
      getKey in interface ImportResource
      Returns:
      key
    • getName

      @Valid @Valid LocalizedString getName()

      Maps to DiscountCode.name.

      Returns:
      name
    • getDescription

      @Valid @Valid LocalizedString getDescription()

      Maps to DiscountCode.description.

      Returns:
      description
    • getCode

      @NotNull @NotNull String getCode()

      User-defined unique identifier of the DiscountCode that is used by the customer to apply the discount.

      The value cannot be updated. Attempting to update the value will result in an InvalidFieldsUpdate error.

      Returns:
      code
    • getCartDiscounts

      @NotNull @Valid @NotNull @Valid List<CartDiscountKeyReference> 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
    • getMaxApplications

      Long getMaxApplications()

      Number of times the DiscountCode can be applied. DiscountCode application is counted at the time of Order creation or update. 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 update. However, Order cancellation or deletion does not decrement the count.

      Returns:
      maxApplicationsPerCustomer
    • getGroups

      List<String> getGroups()

      Groups to which the DiscountCode belongs.

      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
    • getCustom

      @Valid @Valid Custom getCustom()

      Custom Fields of the DiscountCode.

      Returns:
      custom
    • setKey

      void setKey(String key)

      User-defined unique identifier. If a Discount Code with this key exists, it will be updated with the imported data.

      Specified by:
      setKey in interface ImportResource
      Parameters:
      key - value to be set
    • setName

      void setName(LocalizedString name)

      Maps to DiscountCode.name.

      Parameters:
      name - value to be set
    • setDescription

      void setDescription(LocalizedString description)

      Maps to DiscountCode.description.

      Parameters:
      description - value to be set
    • setCode

      void setCode(String code)

      User-defined unique identifier of the DiscountCode that is used by the customer to apply the discount.

      The value cannot be updated. Attempting to update the value will result in an InvalidFieldsUpdate error.

      Parameters:
      code - value to be set
    • setCartDiscounts

      void setCartDiscounts(CartDiscountKeyReference... 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<CartDiscountKeyReference> 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
    • setMaxApplications

      void setMaxApplications(Long maxApplications)

      Number of times the DiscountCode can be applied. DiscountCode application is counted at the time of Order creation or update. 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 update. However, Order cancellation or deletion does not decrement the count.

      Parameters:
      maxApplicationsPerCustomer - value to be set
    • setGroups

      void setGroups(String... groups)

      Groups to which the DiscountCode belongs.

      Parameters:
      groups - values to be set
    • setGroups

      void setGroups(List<String> groups)

      Groups to which the DiscountCode belongs.

      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
    • setCustom

      void setCustom(Custom custom)

      Custom Fields of the DiscountCode.

      Parameters:
      custom - value to be set
    • of

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

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

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

      static DiscountCodeImportBuilder builder()
      builder factory method for DiscountCodeImport
      Returns:
      builder
    • builder

      static DiscountCodeImportBuilder builder(DiscountCodeImport template)
      create builder for DiscountCodeImport instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withDiscountCodeImport

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