Interface DirectDiscountDraft
- All Superinterfaces:
Draft<DirectDiscountDraft>
Represents a CartDiscount that can only be associated with a single Cart or Order.
For an introduction to Direct Discounts and to understand how they work, see the Direct Discounts overview.
Example to create an instance using the builder pattern
DirectDiscountDraft directDiscountDraft = DirectDiscountDraft.builder()
.value(valueBuilder -> valueBuilder)
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic DirectDiscountDraftBuilderbuilder()builder factory method for DirectDiscountDraftstatic DirectDiscountDraftBuilderbuilder(DirectDiscountDraft template) create builder for DirectDiscountDraft instancecopyDeep()static DirectDiscountDraftdeepCopy(DirectDiscountDraft template) factory method to create a deep copy of DirectDiscountDraftIf set totrue, Direct Discounts compete against Product Discounts to apply the best deal. If set tofalse, 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 CartDiscountTargetDefines what segment of the Cart will be discounted.@NotNull @Valid CartDiscountValueDraftgetValue()Defines the effect the Discount will have.static DirectDiscountDraftof()factory methodstatic DirectDiscountDraftof(DirectDiscountDraft template) factory method to create a shallow copy DirectDiscountDraftvoidsetParticipateInBestDealSelection(Boolean participateInBestDealSelection) If set totrue, Direct Discounts compete against Product Discounts to apply the best deal. If set tofalse, 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) Defines what segment of the Cart will be discounted.voidsetValue(CartDiscountValueDraft value) Defines the effect the Discount will have.static tools.jackson.core.type.TypeReference<DirectDiscountDraft>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithDirectDiscountDraft(Function<DirectDiscountDraft, T> helper) accessor map function
-
Method Details
-
getValue
Defines the effect the Discount will have.
- Returns:
- value
-
getTarget
Defines what segment of the Cart will be discounted.
If
valueis set togiftLineItem, this must not be set.- Returns:
- target
-
getParticipateInBestDealSelection
Boolean getParticipateInBestDealSelection()- If set to
true, Direct Discounts compete against Product Discounts to apply the best deal. - If set to
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 set to
-
setValue
Defines the effect the Discount will have.
- Parameters:
value- value to be set
-
setTarget
Defines what segment of the Cart will be discounted.
If
valueis set togiftLineItem, this must not be set.- Parameters:
target- value to be set
-
setParticipateInBestDealSelection
- If set to
true, Direct Discounts compete against Product Discounts to apply the best deal. - If set to
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 set to
-
of
factory method- Returns:
- instance of DirectDiscountDraft
-
of
factory method to create a shallow copy DirectDiscountDraft- Parameters:
template- instance to be copied- Returns:
- copy instance
-
copyDeep
DirectDiscountDraft copyDeep() -
deepCopy
factory method to create a deep copy of DirectDiscountDraft- Parameters:
template- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for DirectDiscountDraft- Returns:
- builder
-
builder
create builder for DirectDiscountDraft instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-
withDirectDiscountDraft
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
-