Interface DirectDiscount
public interface DirectDiscount
Represents a CartDiscount that is only associated with a single Cart or Order.
Example to create an instance using the builder pattern
DirectDiscount directDiscount = DirectDiscount.builder()
.id("{id}")
.value(valueBuilder -> valueBuilder)
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic DirectDiscountBuilderbuilder()builder factory method for DirectDiscountstatic DirectDiscountBuilderbuilder(DirectDiscount template) create builder for DirectDiscount instancecopyDeep()static DirectDiscountdeepCopy(DirectDiscount template) factory method to create a deep copy of DirectDiscount@NotNull StringgetId()Unique identifier of the Direct Discount.Iftrue, Direct Discounts compete against Product Discounts to apply the best deal. Iffalse, Direct Discounts are ignored when calculating the best deal comparison, and are applied on top of the discount type that offers the best deal.@Valid CartDiscountTargetSegment of the Cart that is discounted.@NotNull @Valid CartDiscountValuegetValue()Effect of the Discount on the Cart.static DirectDiscountof()factory methodstatic DirectDiscountof(DirectDiscount template) factory method to create a shallow copy DirectDiscountvoidUnique identifier of the Direct Discount.voidsetParticipateInBestDealSelection(Boolean participateInBestDealSelection) Iftrue, Direct Discounts compete against Product Discounts to apply the best deal. Iffalse, Direct Discounts are ignored when calculating the best deal comparison, and are applied on top of the discount type that offers the best deal.voidsetTarget(CartDiscountTarget target) Segment of the Cart that is discounted.voidsetValue(CartDiscountValue value) Effect of the Discount on the Cart.static tools.jackson.core.type.TypeReference<DirectDiscount>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithDirectDiscount(Function<DirectDiscount, T> helper) accessor map function
-
Method Details
-
getId
Unique identifier of the Direct Discount.
- Returns:
- id
-
getValue
Effect of the Discount on the Cart.
- Returns:
- value
-
getTarget
Segment of the Cart that is discounted.
Absent if the
valueisgiftLineItem.- Returns:
- target
-
getParticipateInBestDealSelection
Boolean getParticipateInBestDealSelection()- If
true, Direct Discounts compete against Product Discounts to apply the best deal. - If
false, Direct Discounts are ignored when calculating the best deal comparison, and are applied on top of the discount type that offers the best deal.
This applies only when the DiscountCombinationMode for the Project is
BestDeal.- Returns:
- participateInBestDealSelection
- If
-
setId
Unique identifier of the Direct Discount.
- Parameters:
id- value to be set
-
setValue
Effect of the Discount on the Cart.
- Parameters:
value- value to be set
-
setTarget
Segment of the Cart that is discounted.
Absent if the
valueisgiftLineItem.- Parameters:
target- value to be set
-
setParticipateInBestDealSelection
- If
true, Direct Discounts compete against Product Discounts to apply the best deal. - If
false, Direct Discounts are ignored when calculating the best deal comparison, and are applied on top of the discount type that offers the best deal.
This applies only when the DiscountCombinationMode for the Project is
BestDeal.- Parameters:
participateInBestDealSelection- value to be set
- If
-
of
factory method- Returns:
- instance of DirectDiscount
-
of
factory method to create a shallow copy DirectDiscount- Parameters:
template- instance to be copied- Returns:
- copy instance
-
copyDeep
DirectDiscount copyDeep() -
deepCopy
factory method to create a deep copy of DirectDiscount- Parameters:
template- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for DirectDiscount- Returns:
- builder
-
builder
create builder for DirectDiscount instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-
withDirectDiscount
accessor map function- Type Parameters:
T- mapped type- Parameters:
helper- function to map the object- Returns:
- mapped value
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-