Class DiscountCodeImportBuilder

java.lang.Object
com.commercetools.importapi.models.discount_codes.DiscountCodeImportBuilder
All Implemented Interfaces:
Builder<DiscountCodeImport>

public class DiscountCodeImportBuilder extends Object implements Builder<DiscountCodeImport>
DiscountCodeImportBuilder
Example to create an instance using the builder pattern

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

    • DiscountCodeImportBuilder

      public DiscountCodeImportBuilder()
  • Method Details

    • key

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

      Parameters:
      key - value to be set
      Returns:
      Builder
    • name

      Maps to DiscountCode.name.

      Parameters:
      builder - function to build the name value
      Returns:
      Builder
    • withName

      Maps to DiscountCode.name.

      Parameters:
      builder - function to build the name value
      Returns:
      Builder
    • name

      Maps to DiscountCode.name.

      Parameters:
      name - value to be set
      Returns:
      Builder
    • description

      Maps to DiscountCode.description.

      Parameters:
      builder - function to build the description value
      Returns:
      Builder
    • withDescription

      Maps to DiscountCode.description.

      Parameters:
      builder - function to build the description value
      Returns:
      Builder
    • description

      public DiscountCodeImportBuilder description(@Nullable LocalizedString description)

      Maps to DiscountCode.description.

      Parameters:
      description - value to be set
      Returns:
      Builder
    • code

      public DiscountCodeImportBuilder code(String code)

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

      Parameters:
      code - value to be set
      Returns:
      Builder
    • cartDiscounts

      public DiscountCodeImportBuilder cartDiscounts(CartDiscountKeyReference... cartDiscounts)

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

      Parameters:
      cartDiscounts - value to be set
      Returns:
      Builder
    • cartDiscounts

      public DiscountCodeImportBuilder cartDiscounts(List<CartDiscountKeyReference> cartDiscounts)

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

      Parameters:
      cartDiscounts - value to be set
      Returns:
      Builder
    • plusCartDiscounts

      public DiscountCodeImportBuilder plusCartDiscounts(CartDiscountKeyReference... cartDiscounts)

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

      Parameters:
      cartDiscounts - value to be set
      Returns:
      Builder
    • plusCartDiscounts

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

      Parameters:
      builder - function to build the cartDiscounts value
      Returns:
      Builder
    • withCartDiscounts

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

      Parameters:
      builder - function to build the cartDiscounts value
      Returns:
      Builder
    • addCartDiscounts

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

      Parameters:
      builder - function to build the cartDiscounts value
      Returns:
      Builder
    • setCartDiscounts

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

      Parameters:
      builder - function to build the cartDiscounts value
      Returns:
      Builder
    • cartPredicate

      public DiscountCodeImportBuilder cartPredicate(@Nullable String cartPredicate)

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

      Parameters:
      cartPredicate - value to be set
      Returns:
      Builder
    • isActive

      public DiscountCodeImportBuilder isActive(Boolean isActive)

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

      Parameters:
      isActive - value to be set
      Returns:
      Builder
    • maxApplications

      public DiscountCodeImportBuilder maxApplications(@Nullable 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
      Returns:
      Builder
    • maxApplicationsPerCustomer

      public DiscountCodeImportBuilder maxApplicationsPerCustomer(@Nullable 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
      Returns:
      Builder
    • groups

      public DiscountCodeImportBuilder groups(@Nullable String... groups)

      Groups to which the DiscountCode belongs.

      Parameters:
      groups - value to be set
      Returns:
      Builder
    • groups

      Groups to which the DiscountCode belongs.

      Parameters:
      groups - value to be set
      Returns:
      Builder
    • plusGroups

      public DiscountCodeImportBuilder plusGroups(@Nullable String... groups)

      Groups to which the DiscountCode belongs.

      Parameters:
      groups - value to be set
      Returns:
      Builder
    • validFrom

      public DiscountCodeImportBuilder validFrom(@Nullable ZonedDateTime validFrom)

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

      Parameters:
      validFrom - value to be set
      Returns:
      Builder
    • validUntil

      public DiscountCodeImportBuilder validUntil(@Nullable ZonedDateTime validUntil)

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

      Parameters:
      validUntil - value to be set
      Returns:
      Builder
    • custom

      Custom Fields of the DiscountCode.

      Parameters:
      builder - function to build the custom value
      Returns:
      Builder
    • withCustom

      Custom Fields of the DiscountCode.

      Parameters:
      builder - function to build the custom value
      Returns:
      Builder
    • custom

      public DiscountCodeImportBuilder custom(@Nullable Custom custom)

      Custom Fields of the DiscountCode.

      Parameters:
      custom - value to be set
      Returns:
      Builder
    • getKey

      public String getKey()

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

      Returns:
      key
    • getName

      @Nullable public LocalizedString getName()

      Maps to DiscountCode.name.

      Returns:
      name
    • getDescription

      @Nullable public LocalizedString getDescription()

      Maps to DiscountCode.description.

      Returns:
      description
    • getCode

      public String getCode()

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

      Returns:
      code
    • getCartDiscounts

      public List<CartDiscountKeyReference> getCartDiscounts()

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

      Returns:
      cartDiscounts
    • getCartPredicate

      @Nullable public String getCartPredicate()

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

      Returns:
      cartPredicate
    • getIsActive

      public Boolean getIsActive()

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

      Returns:
      isActive
    • getMaxApplications

      @Nullable public 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

      @Nullable public 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

      @Nullable public List<String> getGroups()

      Groups to which the DiscountCode belongs.

      Returns:
      groups
    • getValidFrom

      @Nullable public ZonedDateTime getValidFrom()

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

      Returns:
      validFrom
    • getValidUntil

      @Nullable public ZonedDateTime getValidUntil()

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

      Returns:
      validUntil
    • getCustom

      @Nullable public Custom getCustom()

      Custom Fields of the DiscountCode.

      Returns:
      custom
    • build

      public DiscountCodeImport build()
      builds DiscountCodeImport with checking for non-null required values
      Specified by:
      build in interface Builder<DiscountCodeImport>
      Returns:
      DiscountCodeImport
    • buildUnchecked

      public DiscountCodeImport buildUnchecked()
      builds DiscountCodeImport without checking for non-null required values
      Returns:
      DiscountCodeImport
    • of

      public static DiscountCodeImportBuilder of()
      factory method for an instance of DiscountCodeImportBuilder
      Returns:
      builder
    • of

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