Class CartDiscountValueFixedDraftBuilder

java.lang.Object
com.commercetools.api.models.cart_discount.CartDiscountValueFixedDraftBuilder
All Implemented Interfaces:
Builder<CartDiscountValueFixedDraft>

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

     CartDiscountValueFixedDraft cartDiscountValueFixedDraft = CartDiscountValueFixedDraft.builder()
             .plusMoney(moneyBuilder -> moneyBuilder)
             .build()
 
  • Constructor Details

    • CartDiscountValueFixedDraftBuilder

      public CartDiscountValueFixedDraftBuilder()
  • Method Details

    • money

      public CartDiscountValueFixedDraftBuilder money(Money... money)

      Money values provided either in cent precision or high precision for different currencies. A fixed Cart Discount will match a price only if the array contains a value with the same currency. For example, if it contains 10€ and 15$, the matching € price will be discounted by 10€ and the matching $ price will be discounted to 15$. If the array has multiple values of the same currency, the API returns an InvalidOperation error.

      If the array is empty, the discount does not apply.

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

      Money values provided either in cent precision or high precision for different currencies. A fixed Cart Discount will match a price only if the array contains a value with the same currency. For example, if it contains 10€ and 15$, the matching € price will be discounted by 10€ and the matching $ price will be discounted to 15$. If the array has multiple values of the same currency, the API returns an InvalidOperation error.

      If the array is empty, the discount does not apply.

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

      public CartDiscountValueFixedDraftBuilder plusMoney(Money... money)

      Money values provided either in cent precision or high precision for different currencies. A fixed Cart Discount will match a price only if the array contains a value with the same currency. For example, if it contains 10€ and 15$, the matching € price will be discounted by 10€ and the matching $ price will be discounted to 15$. If the array has multiple values of the same currency, the API returns an InvalidOperation error.

      If the array is empty, the discount does not apply.

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

      Money values provided either in cent precision or high precision for different currencies. A fixed Cart Discount will match a price only if the array contains a value with the same currency. For example, if it contains 10€ and 15$, the matching € price will be discounted by 10€ and the matching $ price will be discounted to 15$. If the array has multiple values of the same currency, the API returns an InvalidOperation error.

      If the array is empty, the discount does not apply.

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

      Money values provided either in cent precision or high precision for different currencies. A fixed Cart Discount will match a price only if the array contains a value with the same currency. For example, if it contains 10€ and 15$, the matching € price will be discounted by 10€ and the matching $ price will be discounted to 15$. If the array has multiple values of the same currency, the API returns an InvalidOperation error.

      If the array is empty, the discount does not apply.

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

      Money values provided either in cent precision or high precision for different currencies. A fixed Cart Discount will match a price only if the array contains a value with the same currency. For example, if it contains 10€ and 15$, the matching € price will be discounted by 10€ and the matching $ price will be discounted to 15$. If the array has multiple values of the same currency, the API returns an InvalidOperation error.

      If the array is empty, the discount does not apply.

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

      Money values provided either in cent precision or high precision for different currencies. A fixed Cart Discount will match a price only if the array contains a value with the same currency. For example, if it contains 10€ and 15$, the matching € price will be discounted by 10€ and the matching $ price will be discounted to 15$. If the array has multiple values of the same currency, the API returns an InvalidOperation error.

      If the array is empty, the discount does not apply.

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

      public List<Money> getMoney()

      Money values provided either in cent precision or high precision for different currencies. A fixed Cart Discount will match a price only if the array contains a value with the same currency. For example, if it contains 10€ and 15$, the matching € price will be discounted by 10€ and the matching $ price will be discounted to 15$. If the array has multiple values of the same currency, the API returns an InvalidOperation error.

      If the array is empty, the discount does not apply.

      Returns:
      money
    • build

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

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

      factory method for an instance of CartDiscountValueFixedDraftBuilder
      Returns:
      builder
    • of

      create builder for CartDiscountValueFixedDraft instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder