Interface DirectDiscountDraft
- All Superinterfaces:
io.vrap.rmf.base.client.Draft<DirectDiscountDraft>
- All Known Implementing Classes:
DirectDiscountDraftImpl
Represents a CartDiscount that can only be associated with a single Cart or Order.
Direct Discounts are always active and valid, and have the default Stacking
StackingMode. They apply in the order in which they are listed in the directDiscounts
array of Carts or Orders, and do not have a sorting order like Cart Discounts.
If a Direct Discount is present, any matching Cart Discounts in the Project are ignored. Additionally, a Cart or Order supports either Discount Codes or Direct Discounts at the same time.
Example to create an instance using the builder pattern
DirectDiscountDraft directDiscountDraft = DirectDiscountDraft.builder()
.value(valueBuilder -> valueBuilder)
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic DirectDiscountDraftBuilder
builder()
builder factory method for DirectDiscountDraftstatic DirectDiscountDraftBuilder
builder
(DirectDiscountDraft template) create builder for DirectDiscountDraft instancestatic DirectDiscountDraft
deepCopy
(DirectDiscountDraft template) factory method to create a deep copy of DirectDiscountDraft@Valid CartDiscountTarget
Defines what segment of the Cart will be discounted.@NotNull @Valid CartDiscountValue
getValue()
Defines the effect the Discount will have.static DirectDiscountDraft
of()
factory methodstatic DirectDiscountDraft
of
(DirectDiscountDraft template) factory method to create a shallow copy DirectDiscountDraftvoid
setTarget
(CartDiscountTarget target) Defines what segment of the Cart will be discounted.void
setValue
(CartDiscountValue value) Defines the effect the Discount will have.static com.fasterxml.jackson.core.type.TypeReference<DirectDiscountDraft>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withDirectDiscountDraft
(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
value
is set togiftLineItem
, this must not be set.- Returns:
- target
-
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
value
is set togiftLineItem
, this must not be set.- Parameters:
target
- value to be set
-
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
-
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
-