Class CartDiscountDraftBuilder

java.lang.Object
com.commercetools.api.models.cart_discount.CartDiscountDraftBuilder
All Implemented Interfaces:
io.vrap.rmf.base.client.Builder<CartDiscountDraft>

public class CartDiscountDraftBuilder extends Object implements io.vrap.rmf.base.client.Builder<CartDiscountDraft>
CartDiscountDraftBuilder
Example to create an instance using the builder pattern

     CartDiscountDraft cartDiscountDraft = CartDiscountDraft.builder()
             .name(nameBuilder -> nameBuilder)
             .value(valueBuilder -> valueBuilder)
             .cartPredicate("{cartPredicate}")
             .sortOrder("{sortOrder}")
             .build()
 
  • Constructor Details

  • Method Details

    • name

      Name of the CartDiscount.

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

      Name of the CartDiscount.

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

      Name of the CartDiscount.

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

      User-defined unique identifier for the CartDiscount.

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

      Description of the CartDiscount.

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

      Description of the CartDiscount.

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

      Description of the CartDiscount.

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

      Effect of the CartDiscount. For a target, relative or absolute Discount values or a fixed item Price value can be specified. If no target is specified, a Gift Line Item can be added to the Cart.

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

      public CartDiscountDraftBuilder value(Function<CartDiscountValueDraftBuilder,io.vrap.rmf.base.client.Builder<? extends CartDiscountValueDraft>> builder)

      Effect of the CartDiscount. For a target, relative or absolute Discount values or a fixed item Price value can be specified. If no target is specified, a Gift Line Item can be added to the Cart.

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

      Valid Cart Predicate.

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

      Must not be set when the value has type giftLineItem, otherwise a CartDiscountTarget must be set.

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

      public CartDiscountDraftBuilder target(Function<CartDiscountTargetBuilder,io.vrap.rmf.base.client.Builder<? extends CartDiscountTarget>> builder)

      Must not be set when the value has type giftLineItem, otherwise a CartDiscountTarget must be set.

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

      Value between 0 and 1. A Discount with a higher sortOrder is prioritized. The sort order must be unambiguous among all CartDiscounts.

      Parameters:
      sortOrder - value to be set
      Returns:
      Builder
    • stores

      • If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
      • If not defined, the Cart Discount applies on all Carts, irrespective of a Store.

      If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.

      If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.

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

      • If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
      • If not defined, the Cart Discount applies on all Carts, irrespective of a Store.

      If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.

      If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.

      Parameters:
      stores - value to be set
      Returns:
      Builder
    • plusStores

      • If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
      • If not defined, the Cart Discount applies on all Carts, irrespective of a Store.

      If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.

      If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.

      Parameters:
      stores - value to be set
      Returns:
      Builder
    • plusStores

      • If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
      • If not defined, the Cart Discount applies on all Carts, irrespective of a Store.

      If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.

      If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.

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

      • If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
      • If not defined, the Cart Discount applies on all Carts, irrespective of a Store.

      If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.

      If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.

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

      • If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
      • If not defined, the Cart Discount applies on all Carts, irrespective of a Store.

      If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.

      If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.

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

      • If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
      • If not defined, the Cart Discount applies on all Carts, irrespective of a Store.

      If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.

      If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.

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

      Only active Discounts can be applied to the Cart. If the limit for active Cart Discounts is reached, a MaxCartDiscountsReached error is returned.

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

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

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

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

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

      States whether the Discount can only be used in a connection with a DiscountCode.

      Parameters:
      requiresDiscountCode - value to be set
      Returns:
      Builder
    • stackingMode

      Specifies whether the application of this discount causes the following discounts to be ignored.

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

      Custom Fields of the CartDiscount.

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

      Custom Fields of the CartDiscount.

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

      Custom Fields of the CartDiscount.

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

      Name of the CartDiscount.

      Returns:
      name
    • getKey

      User-defined unique identifier for the CartDiscount.

      Returns:
      key
    • getDescription

      Description of the CartDiscount.

      Returns:
      description
    • getValue

      Effect of the CartDiscount. For a target, relative or absolute Discount values or a fixed item Price value can be specified. If no target is specified, a Gift Line Item can be added to the Cart.

      Returns:
      value
    • getCartPredicate

      Valid Cart Predicate.

      Returns:
      cartPredicate
    • getTarget

      Must not be set when the value has type giftLineItem, otherwise a CartDiscountTarget must be set.

      Returns:
      target
    • getSortOrder

      public String getSortOrder()

      Value between 0 and 1. A Discount with a higher sortOrder is prioritized. The sort order must be unambiguous among all CartDiscounts.

      Returns:
      sortOrder
    • getStores

      • If defined, the Cart Discount applies on Carts having a Store matching any Store defined for this field.
      • If not defined, the Cart Discount applies on all Carts, irrespective of a Store.

      If the referenced Stores exceed the limit, a MaxStoreReferencesReached error is returned.

      If the referenced Stores exceed the limit for Cart Discounts that do not require a Discount Code, a StoreCartDiscountsLimitReached error is returned.

      Returns:
      stores
    • getIsActive

      Only active Discounts can be applied to the Cart. If the limit for active Cart Discounts is reached, a MaxCartDiscountsReached error is returned.

      Returns:
      isActive
    • getValidFrom

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

      Returns:
      validFrom
    • getValidUntil

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

      Returns:
      validUntil
    • getRequiresDiscountCode

      States whether the Discount can only be used in a connection with a DiscountCode.

      Returns:
      requiresDiscountCode
    • getStackingMode

      Specifies whether the application of this discount causes the following discounts to be ignored.

      Returns:
      stackingMode
    • getCustom

      Custom Fields of the CartDiscount.

      Returns:
      custom
    • build

      builds CartDiscountDraft with checking for non-null required values
      Specified by:
      build in interface io.vrap.rmf.base.client.Builder<CartDiscountDraft>
      Returns:
      CartDiscountDraft
    • buildUnchecked

      builds CartDiscountDraft without checking for non-null required values
      Returns:
      CartDiscountDraft
    • of

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

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