Class CartDiscountValueFixedDraftBuilder
- All Implemented Interfaces:
Builder<CartDiscountValueFixedDraft>
Example to create an instance using the builder pattern
CartDiscountValueFixedDraft cartDiscountValueFixedDraft = CartDiscountValueFixedDraft.builder()
.plusMoney(moneyBuilder -> moneyBuilder)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddMoney
(Function<MoneyBuilder, Money> builder) Money values provided either in cent precision or high precision for different currencies.applicationMode
(DiscountApplicationMode applicationMode) Determines how the discount applies on CartDiscountLineItemTarget or CartDiscountCustomLineItemTarget.build()
builds CartDiscountValueFixedDraft with checking for non-null required valuesbuilds CartDiscountValueFixedDraft without checking for non-null required valuesDetermines how the discount applies on CartDiscountLineItemTarget or CartDiscountCustomLineItemTarget.getMoney()
Money values provided either in cent precision or high precision for different currencies.Money values provided either in cent precision or high precision for different currencies.Money values provided either in cent precision or high precision for different currencies.of()
factory method for an instance of CartDiscountValueFixedDraftBuilderof
(CartDiscountValueFixedDraft template) create builder for CartDiscountValueFixedDraft instanceMoney values provided either in cent precision or high precision for different currencies.plusMoney
(Function<MoneyBuilder, MoneyBuilder> builder) Money values provided either in cent precision or high precision for different currencies.setMoney
(Function<MoneyBuilder, Money> builder) Money values provided either in cent precision or high precision for different currencies.withMoney
(Function<MoneyBuilder, MoneyBuilder> builder) Money values provided either in cent precision or high precision for different currencies.
-
Constructor Details
-
CartDiscountValueFixedDraftBuilder
public CartDiscountValueFixedDraftBuilder()
-
-
Method Details
-
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
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
-
applicationMode
public CartDiscountValueFixedDraftBuilder applicationMode(@Nullable DiscountApplicationMode applicationMode) Determines how the discount applies on CartDiscountLineItemTarget or CartDiscountCustomLineItemTarget.
For CartDiscountPatternTarget, you can also set the mode to
ProportionateDistribution
orEvenDistribution
.- Parameters:
applicationMode
- value to be set- Returns:
- Builder
-
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
-
getApplicationMode
Determines how the discount applies on CartDiscountLineItemTarget or CartDiscountCustomLineItemTarget.
For CartDiscountPatternTarget, you can also set the mode to
ProportionateDistribution
orEvenDistribution
.- Returns:
- applicationMode
-
build
builds CartDiscountValueFixedDraft with checking for non-null required values- Specified by:
build
in interfaceBuilder<CartDiscountValueFixedDraft>
- Returns:
- 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
-