Class Offer
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware
,com.broadleafcommerce.money.CurrencyConsumer
,ActiveDateEntity
,Serializable
,Comparable<Offer>
,javax.money.CurrencySupplier
- Author:
- Nathan Moore (nathanmoore).
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
Enum that allows implementations to vary how user max uses will be interpreted.For testing. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
protected String
cleanMethodType
(String methodType) int
Compares priorities.boolean
Defines the ending time for which this offer is active.Defines the beginning time for which this offer is active.boolean
<T> T
getAttribute
(String name) Dynamic attributes that are a part of the offer.protected BigDecimal
The tracking identifiers of the campaigns of which this offer is a part.A label for this offer typically used by the storefront.javax.money.MonetaryAmount
The minimum cart subtotal to apply this offer.TheCombinabilityOverrides
that override how this offer combines with other offers.Determines whether this offer can be combined with other offers.com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState
A subset ofTracking
information to expose the context state for this object.javax.money.CurrencyUnit
The currency that anEnhancedOrder.getCurrency()
must be for this offer to apply.Description of this offer.Basic discount information for this offer.List ofdiscount tiers
determining the discount applied with this offer.Provide an estimated value for this offer.boolean
This is an arbitrary ID, typically assigned by or used by 1st or 3rd party systems that are not Broadleaf.javax.money.MonetaryAmount
The minimum total for all items in a fulfillment group to apply this offer.Defines the id of the free product for this offer.String expression used to determine if a fulfillment group qualifies for this offer.For Fulfillment offers, restrict the discount to a specific service level.getId()
The context ID of the offer.Info related to determining what items are required so that an order or other items qualify to receive this offer's discount.getItemRestrictionType
(boolean isForQualifier) Translates the combination ofqualifiersCanBeTargets
andqualifiersCanBeQualifiers
into an enum value.javax.money.MonetaryAmount
Determines the maximum savings a single order can receive from this offer.javax.money.MonetaryAmount
Determines the maximum savings this offer is valid for.int
Determines the maximum number of times this offer can be used.int
Determines the maximum number of times this offer can be used on a single order.int
Determines the maximum number of times this offer can be used by the same user.int
This field works in conjunction withmaxUsesPerUser
to limit the frequency with which an individual user can use this offer.Enum that allows implementations to vary how user max uses will be interpreted.javax.money.MonetaryAmount
Determines the price subtotal threshold that all qualifying items must reach in addition toitemQualifierCriteria
in order to qualify an order items to receive this offer's discount.javax.money.MonetaryAmount
Determines the price subtotal threshold that all targeted items must reach in addition totargetItemCriteria
in order to receive this offer's discount.getName()
Display name for this offer.Theshared codes
that can be used to retrieve this offer.Returns the discount strategy.protected String
protected String
String expression used in conjunction withitemQualifierCriteria
to determine if an order qualifies for this offer.When multiple offers match a context, the offer with the higher priority is applied first, where smaller integer values represent higher priorities.For testing.The segments to which this offer can apply.Information around discounting subscription items that have recurring billing.The target grouping strategy.Info related to determining what order items can receive this offer's discount.String expression used to determine whether this offer can be qualified for only at certain times or on certain days or months.Set of users directly targeted by this offer.Defines the id of the campaign for this offer.int
hashCode()
boolean
Whether this offer has item qualifier rules to be matched.boolean
Whether thisOffer
has limited uses per order.boolean
Whether this offer has target item rules to be matched.boolean
boolean
Determines whether this offer should be considered to be applied without needing anyshared codes
(or some other, similar constraint).boolean
Returns true if the combinabilityType isCombinabilityType.ANY
OR if the combinabilityType isand the discount target type for the offer is {@link DiscountTargetType#ORDER_ITEM} ITEM. Otherwise, returns false.
boolean
boolean
This property impacts the way that items share the same discount.boolean
Determines whether this is a free gift offer.boolean
Future credit means that the associated adjustment will be discounted at a later time to the user via a credit.boolean
This property provides a hint to the front-end application to perform grouping for items that share the same discount.boolean
Determines whether items that qualify an order to receive this offer's discount can also be used as qualifiers for other offers of the same type (e.g., Order, Order Item, Fulfillment).boolean
Determines whether items that qualify an order to receive this offer's discount can also receive discounts from other offers of the same type (e.g., Order, Order Item, Fulfillment).boolean
Whether items across the entire order should be considered as potential qualifiers for fulfillment groups instead of just the items in the same fulfillment group.boolean
Determines whether a qualifier must be matched to targets that are in its lineage, that is, targets must either be descended from or an ancestor of a qualifier.boolean
Determines whether this offer can be stacked on top of other offers of the same type.boolean
Deprecated.since 1.6.boolean
boolean
boolean
Determines whether to match anoffer tier's min quantity
against the number of items in an order or to match it against the number of target item sets that match anoffer's target item criteria
.boolean
Determines whether this is a voucher offer.com.broadleafcommerce.promotion.offer.client.web.context.info.OfferRef
populate
(com.broadleafcommerce.promotion.offer.client.web.context.info.OfferRef offerRef) Populate anOfferRef
with the given information on thisOffer
.void
setActiveEndDate
(Instant activeEndDate) Defines the ending time for which this offer is active.void
setActiveStartDate
(Instant activeStartDate) Defines the beginning time for which this offer is active.void
setApplyDiscountToAllTargets
(Boolean applyDiscountToAllTargets) Returns TRUE if this ITEM offer should be applied to all discountable target items in the order.void
setApplyRemainderToFulfillment
(Boolean applyRemainderToFulfillment) This property applies to amount off Order offers.void
setAttributes
(Map<String, Attribute> attributes) Dynamic attributes that are a part of the offer.void
setAutomaticallyConsidered
(boolean automaticallyConsidered) Determines whether this offer should be considered to be applied without needing anyshared codes
(or some other, similar constraint).void
setCampaignTrackingIds
(Set<String> campaignTrackingIds) The tracking identifiers of the campaigns of which this offer is a part.void
setCartLabel
(String cartLabel) A label for this offer typically used by the storefront.void
setCartSubtotal
(javax.money.MonetaryAmount cartSubtotal) The minimum cart subtotal to apply this offer.void
setCombinabilityOverrides
(Set<CombinabilityOverride> combinabilityOverrides) TheCombinabilityOverrides
that override how this offer combines with other offers.void
setCombinabilityType
(String combinabilityType) Determines whether this offer can be combined with other offers.void
setContextState
(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTracking
information to expose the context state for this object.void
setCurrency
(javax.money.CurrencyUnit currency) The currency that anEnhancedOrder.getCurrency()
must be for this offer to apply.void
setDescription
(String description) Description of this offer.void
setDiscount
(Discount discount) Basic discount information for this offer.void
setDiscountTiers
(List<DiscountTier> discountTiers) List ofdiscount tiers
determining the discount applied with this offer.void
setDistributeOfferAmountToTargets
(boolean distributeOfferAmountToTargets) This property impacts the way that items share the same discount.void
setEstimatedValue
(BigDecimal estimatedValue) Provide an estimated value for this offer.void
setExcludeDiscountedItemsFromTotals
(Boolean excludeDiscountedItemsFromTotals) This property controls how order and fulfillment group offers consider subtotal qualifications.void
setExternalId
(String externalId) This is an arbitrary ID, typically assigned by or used by 1st or 3rd party systems that are not Broadleaf.void
setFgItemSubtotal
(javax.money.MonetaryAmount fgItemSubtotal) The minimum total for all items in a fulfillment group to apply this offer.void
setFreeGift
(boolean freeGift) Determines whether this is a free gift offer.void
setFreeProduct
(String freeProduct) Defines the id of the free product for this offer.void
setFulfillmentGroupCriteria
(String fulfillmentGroupCriteria) String expression used to determine if a fulfillment group qualifies for this offer.void
setFulfillmentServiceLevel
(String fulfillmentServiceLevel) For Fulfillment offers, restrict the discount to a specific service level.void
setGeneralMaxUsageStatus
(String generalMaxUsageStatus) If an offer has been deemed to have exceeded is max usage threshold, this field will be set with a reason as denoted byMaxUsageStatusType
.void
The context ID of the offer.void
setItemQualifierCriteria
(ItemCriteria itemQualifierCriteria) Info related to determining what items are required so that an order or other items qualify to receive this offer's discount.void
setMaxSavingsPerOrder
(javax.money.MonetaryAmount maxSavingsPerOrder) Determines the maximum savings a single order can receive from this offer.void
setMaxTotalDiscount
(javax.money.MonetaryAmount maxTotalDiscount) Determines the maximum savings this offer is valid for.void
setMaxUses
(int maxUses) Determines the maximum number of times this offer can be used.void
setMaxUsesPerOrder
(int maxUsesPerOrder) Determines the maximum number of times this offer can be used on a single order.void
setMaxUsesPerUser
(int maxUsesPerUser) Determines the maximum number of times this offer can be used by the same user.void
setMaxUsesPerUserFrequency
(int maxUsesPerUserFrequency) This field works in conjunction withmaxUsesPerUser
to limit the frequency with which an individual user can use this offer.void
setMaxUsesPerUserStrategy
(String maxUsesPerUserStrategy) Enum that allows implementations to vary how user max uses will be interpreted.void
setMinTotalOfQualifierPrices
(javax.money.MonetaryAmount minTotalOfQualifierPrices) Determines the price subtotal threshold that all qualifying items must reach in addition toitemQualifierCriteria
in order to qualify an order items to receive this offer's discount.void
setMinTotalOfTargetPrices
(javax.money.MonetaryAmount minTotalOfTargetPrices) Determines the price subtotal threshold that all targeted items must reach in addition totargetItemCriteria
in order to receive this offer's discount.void
Display name for this offer.void
setOfferCodes
(Set<OfferCode> offerCodes) Theshared codes
that can be used to retrieve this offer.void
setOfferDiscountStrategy
(String offerDiscountStrategy) Represents the discount strategy for this offer.void
setOrderCriteria
(String orderCriteria) String expression used in conjunction withitemQualifierCriteria
to determine if an order qualifies for this offer.void
setPreferCartBundling
(boolean preferCartBundling) This property provides a hint to the front-end application to perform grouping for items that share the same discount.void
setPriority
(Long priority) When multiple offers match a context, the offer with the higher priority is applied first, where smaller integer values represent higher priorities.void
setQualifiersCanBeQualifiers
(boolean qualifiersCanBeQualifiers) Determines whether items that qualify an order to receive this offer's discount can also be used as qualifiers for other offers of the same type (e.g., Order, Order Item, Fulfillment).void
setQualifiersCanBeTargets
(boolean qualifiersCanBeTargets) Determines whether items that qualify an order to receive this offer's discount can also receive discounts from other offers of the same type (e.g., Order, Order Item, Fulfillment).void
setQualifyFulfillmentAcrossAllItems
(boolean qualifyFulfillmentAcrossAllItems) Whether items across the entire order should be considered as potential qualifiers for fulfillment groups instead of just the items in the same fulfillment group.void
setRequiresRelatedTargetAndQualifiers
(boolean requiresRelatedTargetAndQualifiers) Determines whether a qualifier must be matched to targets that are in its lineage, that is, targets must either be descended from or an ancestor of a qualifier.void
setRoundDiscountsByItemUnit
(Boolean roundDiscountsByItemUnit) For testing.void
setSegment
(String segment) The segments to which this offer can apply.void
setStackable
(boolean stackable) Determines whether this offer can be stacked on top of other offers of the same type.void
setSubscriptionDiscount
(SubscriptionDiscount subscriptionDiscount) Information around discounting subscription items that have recurring billing.void
setTargetGroupingStrategy
(String targetGroupingStrategy) The target grouping strategy.void
setTargetItemCriteria
(ItemCriteria targetItemCriteria) Info related to determining what order items can receive this offer's discount.void
setTieredDiscount
(boolean tieredDiscount) Deprecated.SeeofferDiscountStrategy
.void
setTimeCriteria
(String timeCriteria) String expression used to determine whether this offer can be qualified for only at certain times or on certain days or months.void
setUseQtyOnlyTierCalculation
(boolean useQtyOnlyTierCalculation) Determines whether to match anoffer tier's min quantity
against the number of items in an order or to match it against the number of target item sets that match anoffer's target item criteria
.void
setUserTargets
(Set<UserTarget> userTargets) Set of users directly targeted by this offer.void
setVoucher
(boolean voucher) Determines whether this is a voucher offer.void
setVoucherCampaign
(String voucherCampaign) Defines the id of the campaign for this offer.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.promotion.offer.domain.ActiveDateEntity
checkActiveDates, checkActiveDates
-
Field Details
-
maxUsesPerUserStrategy
Enum that allows implementations to vary how user max uses will be interpreted. By default the strategy will beUserMaxUsesStrategyType.CUSTOMER
. -
roundDiscountsByItemUnit
For testing. Future enhancement to allow population via a JpaOrder property.
-
-
Constructor Details
-
Offer
public Offer()
-
-
Method Details
-
getAttribute
-
isFutureCredit
public boolean isFutureCredit()Future credit means that the associated adjustment will be discounted at a later time to the user via a credit. It is up to the implementor to decide how to achieve this. -
getFriendlyOfferType
- Returns:
- Friendly type of this offer combining the
Discount.getMethodType()
andDiscount.getTargetType()
-
getFriendlyDiscountAmount
- Returns:
- Friendly discount amount string using the
Discount.getAmount()
or, if tiered, the first tier'sDiscountTier.amount
with a "%" appended if the discount method isDiscountMethodType.PERCENT_OFF
.
-
isCombinable
public boolean isCombinable()Returns true if the combinabilityType isCombinabilityType.ANY
OR if the combinabilityType isand the discount target type for the offer is {@link DiscountTargetType#ORDER_ITEM} ITEM. Otherwise, returns false.
- Returns:
-
isCombinableWithOtherTypes
public boolean isCombinableWithOtherTypes() -
isTotalitarian
public boolean isTotalitarian() -
getItemRestrictionType
Translates the combination ofqualifiersCanBeTargets
andqualifiersCanBeQualifiers
into an enum value.- Parameters:
isForQualifier
- whether the item in question is a qualifier instead of a target- Returns:
- the item restriction type (e.g.,
ItemRestrictionType
) for the item type (e.g., target or qualifier) - See Also:
-
compareTo
Compares priorities. Null is less than non-null.- Specified by:
compareTo
in interfaceComparable<Offer>
- Parameters:
that
- Offer to which we are comparing.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
getBaseDiscountMethodType
- Returns:
- the
Discount.getMethodType()
of this offer or, if tiered, the first tier'sDiscountTier.methodType
-
getBaseDiscountAmount
- Returns:
- the
Discount.getAmount()
of this offer or, if tiered, the first tier'sDiscountTier.amount
-
getOfferTypeOnlyTarget
-
getOfferTypOnlyMethod
-
cleanMethodType
-
hasLimitedUsesPerOrder
public boolean hasLimitedUsesPerOrder()Whether thisOffer
has limited uses per order.- Returns:
- Whether this
Offer
has limited uses per order.
-
populate
public com.broadleafcommerce.promotion.offer.client.web.context.info.OfferRef populate(com.broadleafcommerce.promotion.offer.client.web.context.info.OfferRef offerRef) Populate anOfferRef
with the given information on thisOffer
.- Parameters:
offerRef
- theOfferRef
to populate with thisOffer
.- Returns:
- the populated
OfferRef
-
hasItemQualifierCriteriaRules
public boolean hasItemQualifierCriteriaRules()Whether this offer has item qualifier rules to be matched.- Returns:
- Whether this offer has item qualifier rules to be matched.
-
hasTargetItemCriteriaRules
public boolean hasTargetItemCriteriaRules()Whether this offer has target item rules to be matched.- Returns:
- Whether this offer has target item rules to be matched.
-
getOfferDiscountStrategy
Returns the discount strategy. SeeOfferDiscountStrategy
.For backwards compatibility (offers created in 1.4 and earlier), if the deprecated
isTieredDiscount()
is true, this returnsOfferDiscountStrategy.TIERED_ITEM_QTY
. If noofferDiscountStrategy
is set and this isn't a tiered discount,OfferDiscountStrategy.STANDARD
is assumed.- Returns:
- The discount strategy.
-
isTieredOffer
public boolean isTieredOffer() -
getPriorityForComparisons
-
isApplyDiscountToAllTargets
public boolean isApplyDiscountToAllTargets() -
isTieredDiscount
Deprecated.since 1.6. UseisTieredOffer()
- Returns:
- Is this a tiered discount?
-
getExcludeDiscountedItemsFromTotals
public boolean getExcludeDiscountedItemsFromTotals() -
getApplyRemainderToFulfillment
public boolean getApplyRemainderToFulfillment() -
getGeneralMaxUsageStatus
-
getId
The context ID of the offer.- Returns:
- the context ID of the offer.
-
getExternalId
This is an arbitrary ID, typically assigned by or used by 1st or 3rd party systems that are not Broadleaf.- Returns:
- an external ID
-
getName
Display name for this offer.- Returns:
- the name of this offer
-
getDescription
Description of this offer.- Returns:
- Description of this offer.
-
getCartLabel
A label for this offer typically used by the storefront.- Returns:
- A label for this offer typically used by the storefront.
-
getDiscountTiers
List ofdiscount tiers
determining the discount applied with this offer.- Returns:
- List of discount tiers for this offer
- See Also:
-
DiscountTier
tieredDiscount
-
getDiscount
Basic discount information for this offer.
If
tieredDiscount
is true, thenDiscount.getMethodType()
andDiscount.getAmount()
are overridden by the same fields in the tiers (seeDiscountTier
).- Returns:
- The
Discount
for this offer
-
getCurrency
@Nullable public javax.money.CurrencyUnit getCurrency()The currency that anEnhancedOrder.getCurrency()
must be for this offer to apply.This is typically used for offers where currency matters more. For example, an offer with
Discount.getAmount()
of 5 has different values inUSD
andEUR
.- Specified by:
getCurrency
in interfacejavax.money.CurrencySupplier
-
getPriority
When multiple offers match a context, the offer with the higher priority is applied first, where smaller integer values represent higher priorities. When used for comparisons, null should treated as lowest priority pergetPriorityForComparisons()
.- Returns:
- the relative precedence of this offer vs others that can also be applied in the same context
-
getActiveStartDate
Defines the beginning time for which this offer is active.- Specified by:
getActiveStartDate
in interfaceActiveDateEntity
- Returns:
- The date after which this offer is active
-
getActiveEndDate
Defines the ending time for which this offer is active. Must be later thanactiveStartDate
or null which indicates that this offer applies indefinitely.- Specified by:
getActiveEndDate
in interfaceActiveDateEntity
- Returns:
- The date before which this offer is active
-
getCombinabilityOverrides
TheCombinabilityOverrides
that override how this offer combines with other offers.- Returns:
- the combinabilityOverrides for this offer
- See Also:
-
getOfferCodes
Theshared codes
that can be used to retrieve this offer. These codes would be used in situations where this offer is not automatically considered (meaningautomaticallyConsidered
is false}- Returns:
- the codes that can be used to retrieve this offer
-
getCampaignTrackingIds
The tracking identifiers of the campaigns of which this offer is a part. Seecom.broadleafcommerce.promotion.campaign.domain.Campaign#id
- Returns:
- The tracking codes of the campaigns of which this offer is a part
-
getSegment
The segments to which this offer can apply. Segments are useful for systems that create offers for portions of the cart. For example, a vendor might have 10% off all items in the "vendor A" segment. Another example, is a site that uses a shared cart for 3 different store concepts (aka banners). A value of null, empty or "ANY" is the most common usage and means that this offer can apply to any qualifying part of the order. This field qualifies items using theEnhancedLineItem.getSegment()
property.- Returns:
- The segment of the order that this offer applies to
-
getCombinabilityType
Determines whether this offer can be combined with other offers. Default isCombinabilityType.ANY
, meaning this offer is combinable with any other offer.- Returns:
- the type of combinability this offer has with other offers
- See Also:
-
isStackable
public boolean isStackable()Determines whether this offer can be stacked on top of other offers of the same type. This is different thanCombinabilityType.ANY
which indicates tha two offers can coexist in the same order but doesn't allow them to apply to the same target. For example, consider two offers where the first is "10% off jeans" and the second is "5% off clothing". If these are not stackable, then any jeans in the order will get 10% off while other clothing will get 5% off. If they are stackable, the jeans will get both offers and be 15% off.- Returns:
- the type of combinability this offer has with other offers
- See Also:
-
isAutomaticallyConsidered
public boolean isAutomaticallyConsidered()Determines whether this offer should be considered to be applied without needing any
shared codes
(or some other, similar constraint). Default is false.Setting to true does not guarantee that the offer will be applied. All criteria and rules associated with this offer must still be met (e.g.,
targetItemCriteria
,itemQualifierCriteria
,orderCriteria
, andtimeCriteria
).- Returns:
- whether this offer should be considered to be applied without needing any
shared codes
(or some other, similar constraint)
-
isPreferCartBundling
public boolean isPreferCartBundling()This property provides a hint to the front-end application to perform grouping for items that share the same discount. The intended use is for offers with multiple targets such as a "bundle offer" - that is setup as Buy 2 for $10" As the offer engine supports the concept of an item being part of more than one bundle, applications will need to make decisions on how to interpret this flag.- Returns:
- Whether applications should attempt to group items that share this discount
-
isDistributeOfferAmountToTargets
public boolean isDistributeOfferAmountToTargets()This property impacts the way that items share the same discount. The intended use is for offers with multiple targets such as a "bundle offer" - that is setup as Buy 2 for $10"- Returns:
- Whether the amount property should be distributed to targets
-
isRequiresRelatedTargetAndQualifiers
public boolean isRequiresRelatedTargetAndQualifiers()Determines whether a qualifier must be matched to targets that are in its lineage, that is, targets must either be descended from or an ancestor of a qualifier. This is discovered by repeatedly calling the qualifier'sEnhancedOrderLineItem.getParent()
to find the root ancestor; then, from the root, repeatedly callingEnhancedOrderLineItem.getChildren()
to find if a potential order item is a descendant thereof, that is, in the same lineage as the qualifier.- Returns:
- whether a qualifier must be matched to targets that are in its lineage
-
getItemQualifierCriteria
Info related to determining what items are required so that an order or other items qualify to receive this offer's discount. If these items should not just qualify but also receive the discount, then setDiscount.getProrationType()
toProrationType.TARGET_AND_QUALIFIER
.- Returns:
- Info related to determining how an entity can qualify to receive this offer.
- See Also:
-
getMinTotalOfQualifierPrices
public javax.money.MonetaryAmount getMinTotalOfQualifierPrices()Determines the price subtotal threshold that all qualifying items must reach in addition toitemQualifierCriteria
in order to qualify an order items to receive this offer's discount. That is, the system will find all qualifying items (based onitemQualifierCriteria
) for the given offer and sum their prices before any discounts are applied. If that sum reaches or exceeds thisminTotalOfQualifierPrices
, then the targets of the offer "qualify" to receive the discount.- Returns:
- the price subtotal threshold that all qualifying items must reach in addition to
itemQualifierCriteria
in order to qualify an order items to receive this offer's discount.
-
isQualifiersCanBeQualifiers
public boolean isQualifiersCanBeQualifiers()Determines whether items that qualify an order to receive this offer's discount can also be used as qualifiers for other offers of the same type (e.g., Order, Order Item, Fulfillment). For example, if an offer requires that an order contains a "red t-shirt" item in order to qualify for a 10% discount and another offer also requires that a "red t-shirt" be present to qualify for a 10% shipping discount, then this field determines whether that red t-shirt can be used by both offers to qualify the order for both 10% off the subtotal and 10% off shipping or if only the better offer can be applied. Default is false: A single qualifier cannot cause more than 1 offer to be applied.- Returns:
- whether items that qualify an order to receive this offer's discount can also be used as qualifiers by other offers.
-
isQualifiersCanBeTargets
public boolean isQualifiersCanBeTargets()Determines whether items that qualify an order to receive this offer's discount can also receive discounts from other offers of the same type (e.g., Order, Order Item, Fulfillment). For example, if this offer requires that an order contains a "red t-shirt" be present to qualify for a 10% discount on another item (think BOGO) and another offer targets that same "red t-shirt" for a 10% discount (rather than as a qualifier), then this field determines whether that red t-shirt can both qualify the another item for a 10% discount and itself receive a 10% discount or just 1 can be discounted. Default is false: A qualifier cannot also receive an individual discount.- Returns:
- Determines whether items that qualify an order to receive this offer's discount can also receive discounts from other offers.
-
getTargetItemCriteria
Info related to determining what order items can receive this offer's discount.- Returns:
- Info related to determining what items can receive this offer's discount.
- See Also:
-
getMinTotalOfTargetPrices
public javax.money.MonetaryAmount getMinTotalOfTargetPrices()Determines the price subtotal threshold that all targeted items must reach in addition totargetItemCriteria
in order to receive this offer's discount. That is, the system will find all targeted items in an order and sum their prices before any discounts are applied. If the sum reaches or exceeds thisminTotalOfTargetPrices
, then the targets can receive the discount.- Returns:
- the price subtotal threshold that all targeted items must reach in addition to
targetItemCriteria
in order to receive this offer's discount.
-
getMaxUses
public int getMaxUses()Determines the maximum number of times this offer can be used. A value of 0 indicates unlimited usage. Default is 0.- Returns:
- the maximum number of times this offer can be used.
-
getMaxTotalDiscount
public javax.money.MonetaryAmount getMaxTotalDiscount()Determines the maximum savings this offer is valid for. For example, this offer can discount a total of $5000 before it is considered unavailable for further usage. A value of 0 indicates unlimited usage. Default is 0.- Returns:
- the maximum savings this offer is valid for.
-
getMaxUsesPerOrder
public int getMaxUsesPerOrder()Determines the maximum number of times this offer can be used on a single order. A value of 0 indicates unlimited usage. Default is 0.- Returns:
- the maximum number of times this offer can be used on a single order.
-
getMaxSavingsPerOrder
public javax.money.MonetaryAmount getMaxSavingsPerOrder()Determines the maximum savings a single order can receive from this offer. For example, suppose this field has a value of $50 and this is a 10% off offer. If the order's total is $600, then it would receive a $50 discount instead of $60 (i.e., 10%). A value of 0 indicates unlimited usage. Default is 0.- Returns:
- The maximum savings a single order can receive from this offer.
-
getMaxUsesPerUser
public int getMaxUsesPerUser()Determines the maximum number of times this offer can be used by the same user. Works in conjunction withmaxUsesPerUserFrequency
to limit the frequency with which an individual user can use this offer. A value of 0 indicates unlimited usage. Default is 0.- Returns:
- the maximum number of times this offer can be used by the same user.
-
getMaxUsesPerUserFrequency
public int getMaxUsesPerUserFrequency()This field works in conjunction withmaxUsesPerUser
to limit the frequency with which an individual user can use this offer. IfmaxUsesPerUser = 3
andmaxUsesPerUserFrequency = 5
, then a user cannot use this offer more than 3 times in any 5 day period. Note that this is a sliding-window of opportunity. If a user uses this offer on days 1, 4, and 5, then they can use it on 6 but not on 7 since day 7 is within 5 days of days 4, 5, and 6. A value of 0 indicates that a user can only use thismaxUsesPerUser
times ever. Default is 0.- Returns:
- the length of time in days during which a user can use this offer
maxUsesPerUser
times.
-
getMaxUsesPerUserStrategy
Enum that allows implementations to vary how user max uses will be interpreted. By default the strategy will beUserMaxUsesStrategyType.CUSTOMER
.- Returns:
- the strategy for determining user max uses.
-
getOrderCriteria
String expression used in conjunction with
itemQualifierCriteria
to determine if an order qualifies for this offer. WhereasitemQualifierCriteria
runs against an order's items, these criteria are run against general order attributes like locale, currencyCode, subtotal, etc. For example, this allows for restricting this offer only to orders with subtotals greater than $100.Can be a string representation of a
SpelExpression
, e.g.,name == 'some-name' || id == '1'
, or that of some other expression language.- Returns:
- String expression used in conjunction with
itemQualifierCriteria
to determine if an order qualifies for this offer.
-
getCartSubtotal
public javax.money.MonetaryAmount getCartSubtotal()The minimum cart subtotal to apply this offer. If this value is specified, this offer will only apply if the cart subtotal is equal to or greater than this value.- Returns:
- the minimum cart subtotal to apply this offer
-
getFgItemSubtotal
public javax.money.MonetaryAmount getFgItemSubtotal()The minimum total for all items in a fulfillment group to apply this offer. This is only relevant to fulfillment group offers and has no effect on other offer types. This property supports promotions like free shipping if you spend $200 in ship to home products.- Returns:
- the minimum fulfillment group item subtotal to apply this offer
-
getFulfillmentGroupCriteria
String expression used to determine if a fulfillment group qualifies for this offer. For example, this allows for restricting this offer only to fulfillment groups with shipping price greater than $100.
Can be a string representation of a
SpelExpression
, e.g.,name == 'some-name' || id == '1'
, or that of some other expression language.- Returns:
- String expression used to determine if a fulfillment group qualifies for this offer.
-
getTimeCriteria
String expression used to determine whether this offer can be qualified for only at certain times or on certain days or months. For example, this allows an offer to only be applicable on Fridays or the last day of any month.
Can be a string representation of a
SpelExpression
, e.g.,name == 'some-name' || id == '1'
, or that of some other expression language. -
getUserTargets
Set of users directly targeted by this offer.- Returns:
- Set of users directly targeted by this offer.
- See Also:
-
isUseQtyOnlyTierCalculation
public boolean isUseQtyOnlyTierCalculation()Determines whether to match an
offer tier's min quantity
against the number of items in an order or to match it against the number of target item sets that match anoffer's target item criteria
.Consider the following offer:
- Has 2 tiers:
- 1st tier min quantity: 1
- 2nd tier: 5
- An order must meet the following target item criteria
- Has 3 items in the "Hot Sauces" category
- and 1 item in the "Merchandise" category
When
useQtyOnlyTierCalculation = false
, the 2nd tier would apply if the order had 3 hot sauces, 1 t-shirt, and at least 1 of an item in any category. When it's true, then the order must have 5 sets of 3 hot sauces and 1 t-shirt, that is, 15 hot sauces and 5 t-shirts to match this offer.- Returns:
- whether to match an
offer tier's min quantity
against the number of items in an order or to match it against the number of target item set that match anoffer's target item criteria
.
- Has 2 tiers:
-
getSubscriptionDiscount
Information around discounting subscription items that have recurring billing.- Returns:
- Information around discounting subscription items that have recurring billing.
-
isQualifyFulfillmentAcrossAllItems
public boolean isQualifyFulfillmentAcrossAllItems()Whether items across the entire order should be considered as potential qualifiers for fulfillment groups instead of just the items in the same fulfillment group. Default behavior is to use only the items within the fulfillment group as qualifiers.- Returns:
- Whether items across the entire order should be considered in item-level qualifiers for a given fulfillment group.
-
getContextState
public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()A subset ofTracking
information to expose the context state for this object.- Specified by:
getContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Returns:
- a subset of
Tracking
information to expose the context state for this object
-
getTargetGroupingStrategy
The target grouping strategy. This affects how order items are grouped when applying discounts. Optional. If not set, defaults toTargetGroupingStrategy.COSTLIEST
.- See Also:
-
getAttributes
Dynamic attributes that are a part of the offer. This is an admin-centered concept- Returns:
- dynamic attributes that are a part of the offer
-
isFreeGift
public boolean isFreeGift()Determines whether this is a free gift offer.- Returns:
- whether this is a free gift offer
-
getFreeProduct
Defines the id of the free product for this offer.- Returns:
- the sku of the free product for this offer
-
isVoucher
public boolean isVoucher()Determines whether this is a voucher offer.- Returns:
- whether this is a voucher offer
-
getVoucherCampaign
Defines the id of the campaign for this offer.- Returns:
- the id of the campaign for this offer
-
getEstimatedValue
Provide an estimated value for this offer. This is used when comparing one offer combination with another.This property was added for voucher offers where a voucher can represent a later value. If two vouchers are not combinable, the one with the higher estimated value will be used. Likewise, if a there is a voucher offer and an order offer that are not combinable, the one with the higher value will be used.
This property is used for free gift offers as well.
- Returns:
- the id of the campaign for this offer
-
getFulfillmentServiceLevel
For Fulfillment offers, restrict the discount to a specific service level. For most applications, a fulfillment group has a single service level but some implementations allow the items in the group to have a variety of service levels (e.g. some NEXTDAY, some STANDARD). When this value is set, it will only impact the amount for the selected service levels. If this value is not set, the discount will apply to the group fulfillment price as a whole.- Returns:
- the fulfillment service level this offer is targeting
-
getRoundDiscountsByItemUnit
For testing. Future enhancement to allow population via a JpaOrder property. -
setId
The context ID of the offer.- Parameters:
id
- the context ID of the offer.
-
setExternalId
This is an arbitrary ID, typically assigned by or used by 1st or 3rd party systems that are not Broadleaf.- Parameters:
externalId
- an external ID, often a DB or business ID, from a system outside of Broadleaf
-
setName
Display name for this offer.- Parameters:
name
- the name of this offer
-
setDescription
Description of this offer.- Parameters:
description
- Description of this offer.
-
setCartLabel
A label for this offer typically used by the storefront.- Parameters:
cartLabel
- A label for this offer typically used by the storefront.
-
setTieredDiscount
Deprecated.SeeofferDiscountStrategy
. Offers with this value set to true are now considered to have a discount strategy ofOfferDiscountStrategy.TIERED_ITEM_QTY
. To check if an offer is tiered, useisTieredOffer()
Determines whether this offer uses tiered discounts such that the discount changes per item quantity. For example, an offer could have 3 tiers:
- Tier 1: if 0-3 items, then the discount is 10%
- Tier 2: if 4-10 items, then the discount is 15%
- Tier 3: if 11+ items, then the discount is 20%
If true, then
Discount.getMethodType()
andDiscount.getAmount()
are overridden by the same fields in the tiers (seeDiscountTier
).- Parameters:
tieredDiscount
- whether this offer uses tiered discounts- See Also:
-
DiscountTier
discountTiers
-
setOfferDiscountStrategy
Represents the discount strategy for this offer. Refer toOfferDiscountStrategy
for supported offer strategies.- Parameters:
offerDiscountStrategy
- The offer discount strategy
-
setDiscountTiers
List ofdiscount tiers
determining the discount applied with this offer.- Parameters:
discountTiers
- List of discount tiers for this offer- See Also:
-
DiscountTier
tieredDiscount
-
setDiscount
Basic discount information for this offer.
If
tieredDiscount
is true, thenDiscount.getMethodType()
andDiscount.getAmount()
are overridden by the same fields in the tiers (seeDiscountTier
).- Parameters:
discount
- TheDiscount
for this offer
-
setCurrency
public void setCurrency(@Nullable javax.money.CurrencyUnit currency) The currency that anEnhancedOrder.getCurrency()
must be for this offer to apply.This is typically used for offers where currency matters more. For example, an offer with
Discount.getAmount()
of 5 has different values inUSD
andEUR
.- Specified by:
setCurrency
in interfacecom.broadleafcommerce.money.CurrencyConsumer
-
setPriority
When multiple offers match a context, the offer with the higher priority is applied first, where smaller integer values represent higher priorities. When used for comparisons, null should treated as lowest priority pergetPriorityForComparisons()
.- Parameters:
priority
- the relative precedence of this offer vs others that can also be applied in the same context
-
setActiveStartDate
Defines the beginning time for which this offer is active.- Parameters:
activeStartDate
- The date after which this offer is active
-
setActiveEndDate
Defines the ending time for which this offer is active. Must be later thanactiveStartDate
or null which indicates that this offer applies indefinitely.- Parameters:
activeEndDate
- The date before which this offer is active
-
setCombinabilityOverrides
TheCombinabilityOverrides
that override how this offer combines with other offers.- Parameters:
combinabilityOverrides
- the combinability overrides for this offer- See Also:
-
setOfferCodes
Theshared codes
that can be used to retrieve this offer. These codes would be used in situations where this offer is not automatically considered (meaningautomaticallyConsidered
is false}- Parameters:
offerCodes
- the codes that can be used to retrieve this offer
-
setCampaignTrackingIds
The tracking identifiers of the campaigns of which this offer is a part. Seecom.broadleafcommerce.promotion.campaign.domain.Campaign#id
-
setSegment
The segments to which this offer can apply. Segments are useful for systems that create offers for portions of the cart. For example, a vendor might have 10% off all items in the "vendor A" segment. Another example, is a site that uses a shared cart for 3 different store concepts (aka banners). A value of null, empty or "ANY" is the most common usage and means that this offer can apply to any qualifying part of the order. This field qualifies items using theEnhancedLineItem.getSegment()
property. -
setCombinabilityType
Determines whether this offer can be combined with other offers. Default isCombinabilityType.ANY
, meaning this offer is combinable with any other offer.- Parameters:
combinabilityType
- the type of combinability this offer has with other offers- See Also:
-
setStackable
public void setStackable(boolean stackable) Determines whether this offer can be stacked on top of other offers of the same type. This is different thanCombinabilityType.ANY
which indicates tha two offers can coexist in the same order but doesn't allow them to apply to the same target. For example, consider two offers where the first is "10% off jeans" and the second is "5% off clothing". If these are not stackable, then any jeans in the order will get 10% off while other clothing will get 5% off. If they are stackable, the jeans will get both offers and be 15% off.- Parameters:
combinabilityType
- the type of combinability this offer has with other offers- See Also:
-
setAutomaticallyConsidered
public void setAutomaticallyConsidered(boolean automaticallyConsidered) Determines whether this offer should be considered to be applied without needing any
shared codes
(or some other, similar constraint). Default is false.Setting to true does not guarantee that the offer will be applied. All criteria and rules associated with this offer must still be met (e.g.,
targetItemCriteria
,itemQualifierCriteria
,orderCriteria
, andtimeCriteria
).- Parameters:
automaticallyConsidered
- whether this offer should be considered to be applied without needing anyshared codes
(or some other, similar constraint)
-
setPreferCartBundling
public void setPreferCartBundling(boolean preferCartBundling) This property provides a hint to the front-end application to perform grouping for items that share the same discount. The intended use is for offers with multiple targets such as a "bundle offer" - that is setup as Buy 2 for $10" As the offer engine supports the concept of an item being part of more than one bundle, applications will need to make decisions on how to interpret this flag.- Parameters:
preferCartBundling
- Whether applications should attempt to group items that share this discount
-
setDistributeOfferAmountToTargets
public void setDistributeOfferAmountToTargets(boolean distributeOfferAmountToTargets) This property impacts the way that items share the same discount. The intended use is for offers with multiple targets such as a "bundle offer" - that is setup as Buy 2 for $10"- Parameters:
distributeOfferAmountToTargets
- Should the amount property be distributed to all targets
-
setRequiresRelatedTargetAndQualifiers
public void setRequiresRelatedTargetAndQualifiers(boolean requiresRelatedTargetAndQualifiers) Determines whether a qualifier must be matched to targets that are in its lineage, that is, targets must either be descended from or an ancestor of a qualifier. This is discovered by repeatedly calling the qualifier'sEnhancedOrderLineItem.getParent()
to find the root ancestor; then, from the root, repeatedly callingEnhancedOrderLineItem.getChildren()
to find if a potential order item is a descendant thereof, that is, in the same lineage as the qualifier.- Parameters:
requiresRelatedTargetAndQualifiers
- whether a qualifier must be matched to targets that are in its lineage
-
setItemQualifierCriteria
Info related to determining what items are required so that an order or other items qualify to receive this offer's discount. If these items should not just qualify but also receive the discount, then setDiscount.getProrationType()
toProrationType.TARGET_AND_QUALIFIER
.- Parameters:
itemQualifierCriteria
- Info related determining how an entity can qualify to receive this offer.- See Also:
-
setMinTotalOfQualifierPrices
public void setMinTotalOfQualifierPrices(javax.money.MonetaryAmount minTotalOfQualifierPrices) Determines the price subtotal threshold that all qualifying items must reach in addition toitemQualifierCriteria
in order to qualify an order items to receive this offer's discount. That is, the system will find all qualifying items (based onitemQualifierCriteria
) for the given offer and sum their prices before any discounts are applied. If that sum reaches or exceeds thisminTotalOfQualifierPrices
, then the targets of the offer "qualify" to receive the discount.- Parameters:
minTotalOfQualifierPrices
- the price subtotal threshold that all qualifying items must reach in addition toitemQualifierCriteria
in order to qualify an order items to receive this offer's discount.
-
setQualifiersCanBeQualifiers
public void setQualifiersCanBeQualifiers(boolean qualifiersCanBeQualifiers) Determines whether items that qualify an order to receive this offer's discount can also be used as qualifiers for other offers of the same type (e.g., Order, Order Item, Fulfillment). For example, if an offer requires that an order contains a "red t-shirt" item in order to qualify for a 10% discount and another offer also requires that a "red t-shirt" be present to qualify for a 10% shipping discount, then this field determines whether that red t-shirt can be used by both offers to qualify the order for both 10% off the subtotal and 10% off shipping or if only the better offer can be applied. Default is false: A single qualifier cannot cause more than 1 offer to be applied.- Parameters:
qualifiersCanBeQualifiers
- whether items that qualify an order to receive this offer's discount can also be used as qualifiers by other offers.
-
setQualifiersCanBeTargets
public void setQualifiersCanBeTargets(boolean qualifiersCanBeTargets) Determines whether items that qualify an order to receive this offer's discount can also receive discounts from other offers of the same type (e.g., Order, Order Item, Fulfillment). For example, if this offer requires that an order contains a "red t-shirt" be present to qualify for a 10% discount on another item (think BOGO) and another offer targets that same "red t-shirt" for a 10% discount (rather than as a qualifier), then this field determines whether that red t-shirt can both qualify the another item for a 10% discount and itself receive a 10% discount or just 1 can be discounted. Default is false: A qualifier cannot also receive an individual discount.- Parameters:
qualifiersCanBeTargets
- Determines whether items that qualify an order to receive this offer's discount can also receive discounts from other offers.
-
setApplyDiscountToAllTargets
Returns TRUE if this ITEM offer should be applied to all discountable target items in the order. Setting this value to TRUE will not requiregetTargetItemCriteria()
to be entered for an ITEM promotion. If the value is null, delegates tohasTargetItemCriteriaRules()
. -
setExcludeDiscountedItemsFromTotals
This property controls how order and fulfillment group offers consider subtotal qualifications. Some offers may only want to consider items that have not already received a discount as part of the subtotal calculation. -
setApplyRemainderToFulfillment
This property applies to amount off Order offers. When set, it allows the amount off to apply to both the Order total and the Fulfillment total. For example, if the offer amount was $50 and the order subtotal was $45 and the fulfillment price was $10, this property will allow the order offer to adjust the order by $45 and then use the remainder ($5) off of the fulfillment price leaving a cart total of $5. -
setTargetItemCriteria
Info related to determining what order items can receive this offer's discount.- Parameters:
targetItemCriteria
- Info related to determining what items can receive this offer's discount.- See Also:
-
setMinTotalOfTargetPrices
public void setMinTotalOfTargetPrices(javax.money.MonetaryAmount minTotalOfTargetPrices) Determines the price subtotal threshold that all targeted items must reach in addition totargetItemCriteria
in order to receive this offer's discount. That is, the system will find all targeted items in an order and sum their prices before any discounts are applied. If the sum reaches or exceeds thisminTotalOfTargetPrices
, then the targets can receive the discount.- Parameters:
minTotalOfTargetPrices
- the price subtotal threshold that all targeted items must reach in addition totargetItemCriteria
in order to receive this offer's discount.
-
setMaxUses
public void setMaxUses(int maxUses) Determines the maximum number of times this offer can be used. A value of 0 indicates unlimited usage. Default is 0.- Parameters:
maxUses
- the maximum number of times this offer can be used.
-
setMaxTotalDiscount
public void setMaxTotalDiscount(javax.money.MonetaryAmount maxTotalDiscount) Determines the maximum savings this offer is valid for. For example, this offer can discount a total of $5000 before it is considered unavailable for further usage. A value of 0 indicates unlimited usage. Default is 0.- Parameters:
maxTotalDiscount
- the maximum savings this offer is valid for.
-
setGeneralMaxUsageStatus
If an offer has been deemed to have exceeded is max usage threshold, this field will be set with a reason as denoted byMaxUsageStatusType
. This reason applies to general offer usage as specified by eithergetMaxUses()
, orgetMaxTotalDiscount()
. Exceeding max thresholds for specific order or users scenarios is not tracked here. Status will beMaxUsageStatusType.VIABLE
when the offer has not exceeded thresholds yet, or is not bound by max usage thresholds. -
setMaxUsesPerOrder
public void setMaxUsesPerOrder(int maxUsesPerOrder) Determines the maximum number of times this offer can be used on a single order. A value of 0 indicates unlimited usage. Default is 0.- Parameters:
maxUsesPerOrder
- the maximum number of times this offer can be used on a single order.
-
setMaxSavingsPerOrder
public void setMaxSavingsPerOrder(javax.money.MonetaryAmount maxSavingsPerOrder) Determines the maximum savings a single order can receive from this offer. For example, suppose this field has a value of $50 and this is a 10% off offer. If the order's total is $600, then it would receive a $50 discount instead of $60 (i.e., 10%). A value of 0 indicates unlimited usage. Default is 0.- Parameters:
maxSavingsPerOrder
- The maximum savings a single order can receive from this offer.
-
setMaxUsesPerUser
public void setMaxUsesPerUser(int maxUsesPerUser) Determines the maximum number of times this offer can be used by the same user. Works in conjunction withmaxUsesPerUserFrequency
to limit the frequency with which an individual user can use this offer. A value of 0 indicates unlimited usage. Default is 0.- Parameters:
maxUsesPerUser
- the maximum number of times this offer can be used by the same user.
-
setMaxUsesPerUserFrequency
public void setMaxUsesPerUserFrequency(int maxUsesPerUserFrequency) This field works in conjunction withmaxUsesPerUser
to limit the frequency with which an individual user can use this offer. IfmaxUsesPerUser = 3
andmaxUsesPerUserFrequency = 5
, then a user cannot use this offer more than 3 times in any 5 day period. Note that this is a sliding-window of opportunity. If a user uses this offer on days 1, 4, and 5, then they can use it on 6 but not on 7 since day 7 is within 5 days of days 4, 5, and 6. A value of 0 indicates that a user can only use thismaxUsesPerUser
times ever. Default is 0.- Parameters:
maxUsesPerUserFrequency
- the length of time in days during which a user can use this offermaxUsesPerUser
times.
-
setMaxUsesPerUserStrategy
Enum that allows implementations to vary how user max uses will be interpreted. By default the strategy will beUserMaxUsesStrategyType.CUSTOMER
.- Parameters:
maxUsesPerUserStrategy
- the strategy for determining user max uses.
-
setOrderCriteria
String expression used in conjunction with
itemQualifierCriteria
to determine if an order qualifies for this offer. WhereasitemQualifierCriteria
runs against an order's items, these criteria are run against general order attributes like locale, currencyCode, subtotal, etc. For example, this allows for restricting this offer only to orders with subtotals greater than $100.Can be a string representation of a
SpelExpression
, e.g.,name == 'some-name' || id == '1'
, or that of some other expression language.- Parameters:
orderCriteria
- String expression used in conjunction withitemQualifierCriteria
to determine if an order qualifies for this offer.
-
setCartSubtotal
public void setCartSubtotal(javax.money.MonetaryAmount cartSubtotal) The minimum cart subtotal to apply this offer. If this value is specified, this offer will only apply if the cart subtotal is equal to or greater than this value.- Parameters:
cartSubtotal
- the minimum cart subtotal to apply this offer
-
setFgItemSubtotal
public void setFgItemSubtotal(javax.money.MonetaryAmount fgItemSubtotal) The minimum total for all items in a fulfillment group to apply this offer. This is only relevant to fulfillment group offers and has no effect on other offer types. This property supports promotions like free shipping if you spend $200 in ship to home products.- Parameters:
fgItemSubtotal
- the minimum total of all items in a fulfillment group required to apply this offer
-
setFulfillmentGroupCriteria
String expression used to determine if a fulfillment group qualifies for this offer. For example, this allows for restricting this offer only to fulfillment groups with shipping price greater than $100.
Can be a string representation of a
SpelExpression
, e.g.,name == 'some-name' || id == '1'
, or that of some other expression language.- Parameters:
fulfillmentGroupCriteria
- String expression used to determine if a fulfillment group qualifies for this offer.
-
setTimeCriteria
String expression used to determine whether this offer can be qualified for only at certain times or on certain days or months. For example, this allows an offer to only be applicable on Fridays or the last day of any month.
Can be a string representation of a
SpelExpression
, e.g.,name == 'some-name' || id == '1'
, or that of some other expression language. -
setUserTargets
Set of users directly targeted by this offer.- Parameters:
userTargets
- Set of users directly targeted by this offer.- See Also:
-
setUseQtyOnlyTierCalculation
public void setUseQtyOnlyTierCalculation(boolean useQtyOnlyTierCalculation) Determines whether to match an
offer tier's min quantity
against the number of items in an order or to match it against the number of target item sets that match anoffer's target item criteria
.Consider the following offer:
- Has 2 tiers:
- 1st tier min quantity: 1
- 2nd tier: 5
- An order must meet the following target item criteria
- Has 3 items in the "Hot Sauces" category
- and 1 item in the "Merchandise" category
When
useQtyOnlyTierCalculation = false
, the 2nd tier would apply if the order had 3 hot sauces, 1 t-shirt, and at least 1 of an item in any category. When it's true, then the order must have 5 sets of 3 hot sauces and 1 t-shirt, that is, 15 hot sauces and 5 t-shirts to match this offer.- Parameters:
useQtyOnlyTierCalculation
- whether to match anoffer tier's min quantity
against the number of items in an order or to match it against the number of target item set that match anoffer's target item criteria
.
- Has 2 tiers:
-
setSubscriptionDiscount
Information around discounting subscription items that have recurring billing.- Parameters:
subscriptionDiscount
- Information around discounting subscription items that have recurring billing.
-
setQualifyFulfillmentAcrossAllItems
public void setQualifyFulfillmentAcrossAllItems(boolean qualifyFulfillmentAcrossAllItems) Whether items across the entire order should be considered as potential qualifiers for fulfillment groups instead of just the items in the same fulfillment group. Default behavior is to use only the items within the fulfillment group as qualifiers.- Parameters:
qualifyFulfillmentAcrossAllItems
- Whether items across the entire order should be considered in item-level qualifiers for a given fulfillment group.
-
setContextState
public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) A subset ofTracking
information to expose the context state for this object.- Specified by:
setContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Parameters:
contextState
- a subset ofTracking
information to expose the context state for this object
-
setTargetGroupingStrategy
The target grouping strategy. This affects how order items are grouped when applying discounts. Optional. If not set, defaults toTargetGroupingStrategy.COSTLIEST
.- See Also:
-
setAttributes
Dynamic attributes that are a part of the offer. This is an admin-centered concept- Parameters:
attributes
- dynamic attributes that are a part of the offer
-
setFreeGift
public void setFreeGift(boolean freeGift) Determines whether this is a free gift offer.- Parameters:
freeGift
- whether this is a free gift offer
-
setFreeProduct
Defines the id of the free product for this offer.- Parameters:
freeProduct
- the sku of the free product for this offer
-
setVoucher
public void setVoucher(boolean voucher) Determines whether this is a voucher offer.- Parameters:
voucher
- whether this is a voucher offer
-
setVoucherCampaign
Defines the id of the campaign for this offer.- Parameters:
campaign
- the id of the campaign for this offer
-
setEstimatedValue
Provide an estimated value for this offer. This is used when comparing one offer combination with another.This property was added for voucher offers where a voucher can represent a later value. If two vouchers are not combinable, the one with the higher estimated value will be used. Likewise, if a there is a voucher offer and an order offer that are not combinable, the one with the higher value will be used.
This property is used for free gift offers as well.
- Parameters:
estimatedValue
- a value in the currency of the order
-
setFulfillmentServiceLevel
For Fulfillment offers, restrict the discount to a specific service level. For most applications, a fulfillment group has a single service level but some implementations allow the items in the group to have a variety of service levels (e.g. some NEXTDAY, some STANDARD). When this value is set, it will only impact the amount for the selected service levels. If this value is not set, the discount will apply to the group fulfillment price as a whole.- Parameters:
fulfillmentServiceLevel
- The service level (e.g. STANDARD or NEXTDAY)
-
setRoundDiscountsByItemUnit
For testing. Future enhancement to allow population via a JpaOrder property. -
toString
-
equals
-
canEqual
-
hashCode
public int hashCode()
-