Class CartDiscountValueAbsoluteDraftBuilder
- All Implemented Interfaces:
Builder<CartDiscountValueAbsoluteDraft>
Example to create an instance using the builder pattern
CartDiscountValueAbsoluteDraft cartDiscountValueAbsoluteDraft = CartDiscountValueAbsoluteDraft.builder()
.plusMoney(moneyBuilder -> moneyBuilder)
.build()
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddMoney(Function<MoneyBuilder, Money> builder) Money values in different currencies.applicationMode(DiscountApplicationMode applicationMode) Determines how the discount applies on CartDiscountLineItemTarget and CartDiscountCustomLineItemTarget.build()builds CartDiscountValueAbsoluteDraft with checking for non-null required valuesbuilds CartDiscountValueAbsoluteDraft without checking for non-null required valuesDetermines how the discount applies on CartDiscountLineItemTarget and CartDiscountCustomLineItemTarget.getMoney()Money values in different currencies.Money values in different currencies.Money values in different currencies.of()factory method for an instance of CartDiscountValueAbsoluteDraftBuilderof(CartDiscountValueAbsoluteDraft template) create builder for CartDiscountValueAbsoluteDraft instanceMoney values in different currencies.plusMoney(Function<MoneyBuilder, MoneyBuilder> builder) Money values in different currencies.setMoney(Function<MoneyBuilder, Money> builder) Money values in different currencies.withMoney(Function<MoneyBuilder, MoneyBuilder> builder) Money values in different currencies.
-
Constructor Details
-
CartDiscountValueAbsoluteDraftBuilder
public CartDiscountValueAbsoluteDraftBuilder()
-
-
Method Details
-
money
Money values in different currencies. An absolute 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 decreased by 10€ and the matching $ price will be decreased by 15$.
If the array is empty or has multiple values of the same currency, the API returns an InvalidOperation error.
- Parameters:
money- value to be set- Returns:
- Builder
-
money
Money values in different currencies. An absolute 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 decreased by 10€ and the matching $ price will be decreased by 15$.
If the array is empty or has multiple values of the same currency, the API returns an InvalidOperation error.
- Parameters:
money- value to be set- Returns:
- Builder
-
plusMoney
Money values in different currencies. An absolute 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 decreased by 10€ and the matching $ price will be decreased by 15$.
If the array is empty or has multiple values of the same currency, the API returns an InvalidOperation error.
- Parameters:
money- value to be set- Returns:
- Builder
-
plusMoney
Money values in different currencies. An absolute 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 decreased by 10€ and the matching $ price will be decreased by 15$.
If the array is empty or has multiple values of the same currency, the API returns an InvalidOperation error.
- Parameters:
builder- function to build the money value- Returns:
- Builder
-
withMoney
Money values in different currencies. An absolute 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 decreased by 10€ and the matching $ price will be decreased by 15$.
If the array is empty or has multiple values of the same currency, the API returns an InvalidOperation error.
- Parameters:
builder- function to build the money value- Returns:
- Builder
-
addMoney
Money values in different currencies. An absolute 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 decreased by 10€ and the matching $ price will be decreased by 15$.
If the array is empty or has multiple values of the same currency, the API returns an InvalidOperation error.
- Parameters:
builder- function to build the money value- Returns:
- Builder
-
setMoney
Money values in different currencies. An absolute 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 decreased by 10€ and the matching $ price will be decreased by 15$.
If the array is empty or has multiple values of the same currency, the API returns an InvalidOperation error.
- Parameters:
builder- function to build the money value- Returns:
- Builder
-
applicationMode
public CartDiscountValueAbsoluteDraftBuilder applicationMode(@Nullable DiscountApplicationMode applicationMode) Determines how the discount applies on CartDiscountLineItemTarget and CartDiscountCustomLineItemTarget.
If not set, the default behavior is
ProportionateDistribution.- Parameters:
applicationMode- value to be set- Returns:
- Builder
-
getMoney
Money values in different currencies. An absolute 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 decreased by 10€ and the matching $ price will be decreased by 15$.
If the array is empty or has multiple values of the same currency, the API returns an InvalidOperation error.
- Returns:
- money
-
getApplicationMode
Determines how the discount applies on CartDiscountLineItemTarget and CartDiscountCustomLineItemTarget.
If not set, the default behavior is
ProportionateDistribution.- Returns:
- applicationMode
-
build
builds CartDiscountValueAbsoluteDraft with checking for non-null required values- Specified by:
buildin interfaceBuilder<CartDiscountValueAbsoluteDraft>- Returns:
- CartDiscountValueAbsoluteDraft
-
buildUnchecked
builds CartDiscountValueAbsoluteDraft without checking for non-null required values- Returns:
- CartDiscountValueAbsoluteDraft
-
of
factory method for an instance of CartDiscountValueAbsoluteDraftBuilder- Returns:
- builder
-
of
create builder for CartDiscountValueAbsoluteDraft instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-