Interface DiscountCodeImport

All Superinterfaces:
ImportResource

public interface DiscountCodeImport extends ImportResource

Represents the data used to import a DiscountCode. Once imported, this data is persisted as a DiscountCode 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 DiscountCode with this key exists, it is 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()

      Maps to DiscountCode.code. This value cannot be updated. Attempting to update this value will result in an InvalidFieldsUpdate error.

      Returns:
      code
    • getCartDiscounts

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

      Maps to DiscountCode.cartDiscounts. If the referenced CartDiscounts do not exist, the state of the ImportOperation will be set to unresolved until the referenced CartDiscounts are created.

      Returns:
      cartDiscounts
    • getCartPredicate

      String getCartPredicate()

      Maps to DiscountCode.cartPredicate.

      Returns:
      cartPredicate
    • getIsActive

      @NotNull @NotNull Boolean getIsActive()

      Maps to DiscountCode.isActive.

      Returns:
      isActive
    • getMaxApplications

      Long getMaxApplications()

      Maps to DiscountCode.maxApplications.

      Returns:
      maxApplications
    • getMaxApplicationsPerCustomer

      Long getMaxApplicationsPerCustomer()

      Maps to DiscountCode.maxApplicationsPerCustomer.

      Returns:
      maxApplicationsPerCustomer
    • getGroups

      List<String> getGroups()

      Maps to DiscountCode.groups.

      Returns:
      groups
    • getValidFrom

      ZonedDateTime getValidFrom()

      Maps to DiscountCode.validFrom.

      Returns:
      validFrom
    • getValidUntil

      ZonedDateTime getValidUntil()

      Maps to DiscountCode.validUntil.

      Returns:
      validUntil
    • getCustom

      @Valid @Valid Custom getCustom()

      Maps to DiscountCode.custom.

      Returns:
      custom
    • setKey

      void setKey(String key)

      User-defined unique identifier. If a DiscountCode with this key exists, it is 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)

      Maps to DiscountCode.code. This value cannot be updated. Attempting to update this value will result in an InvalidFieldsUpdate error.

      Parameters:
      code - value to be set
    • setCartDiscounts

      void setCartDiscounts(CartDiscountKeyReference... cartDiscounts)

      Maps to DiscountCode.cartDiscounts. If the referenced CartDiscounts do not exist, the state of the ImportOperation will be set to unresolved until the referenced CartDiscounts are created.

      Parameters:
      cartDiscounts - values to be set
    • setCartDiscounts

      void setCartDiscounts(List<CartDiscountKeyReference> cartDiscounts)

      Maps to DiscountCode.cartDiscounts. If the referenced CartDiscounts do not exist, the state of the ImportOperation will be set to unresolved until the referenced CartDiscounts are created.

      Parameters:
      cartDiscounts - values to be set
    • setCartPredicate

      void setCartPredicate(String cartPredicate)

      Maps to DiscountCode.cartPredicate.

      Parameters:
      cartPredicate - value to be set
    • setIsActive

      void setIsActive(Boolean isActive)

      Maps to DiscountCode.isActive.

      Parameters:
      isActive - value to be set
    • setMaxApplications

      void setMaxApplications(Long maxApplications)

      Maps to DiscountCode.maxApplications.

      Parameters:
      maxApplications - value to be set
    • setMaxApplicationsPerCustomer

      void setMaxApplicationsPerCustomer(Long maxApplicationsPerCustomer)

      Maps to DiscountCode.maxApplicationsPerCustomer.

      Parameters:
      maxApplicationsPerCustomer - value to be set
    • setGroups

      void setGroups(String... groups)

      Maps to DiscountCode.groups.

      Parameters:
      groups - values to be set
    • setGroups

      void setGroups(List<String> groups)

      Maps to DiscountCode.groups.

      Parameters:
      groups - values to be set
    • setValidFrom

      void setValidFrom(ZonedDateTime validFrom)

      Maps to DiscountCode.validFrom.

      Parameters:
      validFrom - value to be set
    • setValidUntil

      void setValidUntil(ZonedDateTime validUntil)

      Maps to DiscountCode.validUntil.

      Parameters:
      validUntil - value to be set
    • setCustom

      void setCustom(Custom custom)

      Maps to DiscountCode.custom.

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

      DiscountCodeImport copyDeep()
      Specified by:
      copyDeep in interface ImportResource
    • deepCopy

      @Nullable static DiscountCodeImport deepCopy(@Nullable DiscountCodeImport template)
      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