Class Offer
- java.lang.Object
-
- com.broadleafcommerce.promotion.offer.domain.Offer
-
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware,Serializable,Comparable<Offer>
public class Offer extends Object implements Serializable, Comparable<Offer>, com.broadleafcommerce.data.tracking.core.ContextStateAware
An Offer encapsulates information required to provide specialized discount pricing for orders, order items, or related entities This includes not just the discount amount but also important factors such as whether the discount is a percent off, amount off, or fixed price type and whether it should be applied immediately or provided as future credit to the user. Furthermore, an Offer allows for complex rules for determining what qualifies an order or item to receive its discount, whether multiple offers can be applied to the same target, how many times or how frequently an offer can be used.- Author:
- Nathan Moore (nathanmoore).
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected StringmaxUsesPerUserStrategyEnum that allows implementations to vary how user max uses will be interpreted.
-
Constructor Summary
Constructors Constructor Description Offer()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected booleancanEqual(Object other)protected StringcleanMethodType(String methodType)intcompareTo(Offer that)Compares priorities.booleanequals(Object o)InstantgetActiveEndDate()Defines the ending time for which this offer is active.InstantgetActiveStartDate()Defines the beginning time for which this offer is active.<T> TgetAttribute(String name)Map<String,Attribute>getAttributes()Dynamic attributes that are a part of the offer.protected BigDecimalgetBaseDiscountAmount()protected Optional<String>getBaseDiscountMethodType()Set<String>getCampaignTrackingIds()The tracking identifiers of the campaigns of which this offer is a part.StringgetCartLabel()A label for this offer typically used by the storefront.javax.money.MonetaryAmountgetCartSubtotal()The minimum cart subtotal to apply this offer.Set<CombinabilityOverride>getCombinabilityOverrides()TheCombinabilityOverridesthat override how this offer combines with other offers.StringgetCombinabilityType()Determines whether this offer can be combined with other offers.com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextStategetContextState()A subset ofTrackinginformation to expose the context state for this object.StringgetDescription()Description of this offer.DiscountgetDiscount()Basic discount information for this offer.List<DiscountTier>getDiscountTiers()List ofdiscount tiersdetermining the discount applied with this offer.BigDecimalgetEstimatedValue()Provide an estimated value for this offer.StringgetFreeProduct()Defines the id of the free product for this offer.StringgetFriendlyDiscountAmount()StringgetFriendlyOfferType()StringgetFulfillmentGroupCriteria()String expression used to determine if a fulfillment group qualifies for this offer.StringgetId()The context ID of the offer.ItemCriteriagetItemQualifierCriteria()Info related to determining what items are required so that an order or other items qualify to receive this offer's discount.StringgetItemRestrictionType(boolean isForQualifier)Translates the combination ofqualifiersCanBeTargetsandqualifiersCanBeQualifiersinto an enum value.javax.money.MonetaryAmountgetMaxSavingsPerOrder()Determines the maximum savings a single order can receive from this offer.intgetMaxUses()Determines the maximum number of times this offer can be used.intgetMaxUsesPerOrder()Determines the maximum number of times this offer can be used on a single order.intgetMaxUsesPerUser()Determines the maximum number of times this offer can be used by the same user.intgetMaxUsesPerUserFrequency()This field works in conjunction withmaxUsesPerUserto limit the frequency with which an individual user can use this offer.StringgetMaxUsesPerUserStrategy()Enum that allows implementations to vary how user max uses will be interpreted.javax.money.MonetaryAmountgetMinTotalOfQualifierPrices()Determines the price subtotal threshold that all qualifying items must reach in addition toitemQualifierCriteriain order to qualify an order items to receive this offer's discount.javax.money.MonetaryAmountgetMinTotalOfTargetPrices()Determines the price subtotal threshold that all targeted items must reach in addition totargetItemCriteriain order to receive this offer's discount.StringgetName()Display name for this offer.StringgetOfferDiscountStrategy()Returns the discount strategy.protected StringgetOfferTypeOnlyTarget()protected StringgetOfferTypOnlyMethod()StringgetOrderCriteria()String expression used in conjunction withitemQualifierCriteriato determine if an order qualifies for this offer.LonggetPriority()When multiple offers match a context, the offer with the higher priority is applied first, where smaller integer values represent higher priorities.LonggetPriorityForComparisons()Set<SharedCode>getSharedCodes()TheSharedCodesthat can be used to retrieve this offer.SubscriptionDiscountgetSubscriptionDiscount()Information around discounting subscription items that have recurring billing.StringgetTargetGroupingStrategy()The target grouping strategy.ItemCriteriagetTargetItemCriteria()Info related to determining what order items can receive this offer's discount.StringgetTimeCriteria()String expression used to determine whether this offer can be qualified for only at certain times or on certain days or months.Set<UserTarget>getUserTargets()Set of users directly targeted by this offer.StringgetVoucherCampaign()Defines the id of the campaign for this offer.inthashCode()booleanhasItemQualifierCriteriaRules()Whether this offer has item qualifier rules to be matched.booleanhasLimitedUsesPerOrder()Whether thisOfferhas limited uses per order.booleanhasTargetItemCriteriaRules()Whether this offer has target item rules to be matched.booleanisAutomaticallyConsidered()Determines whether this offer should be considered to be applied without needing anysharedCodesorcampaignTrackingIds(or some other, similar constraint).booleanisCombinable()Returns true if the combinabilityType isCombinabilityType.ANYOR if the combinabilityType isand the discount target type for the offer is {@link DiscountTargetType#ORDER_ITEM} ITEM. Otherwise, returns false.booleanisCombinableWithOtherTypes()booleanisDistributeOfferAmountToTargets()This property impacts the way that items share the same discount.booleanisFreeGift()Determines whether this is a free gift offer.booleanisFutureCredit()Future credit means that the associated adjustment will be discounted at a later time to the user via a credit.booleanisPreferCartBundling()This property provides a hint to the front-end application to perform grouping for items that share the same discount.booleanisQualifiersCanBeQualifiers()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).booleanisQualifiersCanBeTargets()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).booleanisQualifyFulfillmentAcrossAllItems()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.booleanisRequiresRelatedTargetAndQualifiers()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.booleanisStackable()Determines whether this offer can be stacked on top of other offers of the same type.booleanisTieredDiscount()Deprecated.since 1.6.booleanisTieredOffer()booleanisTotalitarian()booleanisUseQtyOnlyTierCalculation()Determines whether to match anoffer tier's min quantityagainst 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.booleanisVoucher()Determines whether this is a voucher offer.com.broadleafcommerce.promotion.offer.client.web.context.info.OfferRefpopulate(com.broadleafcommerce.promotion.offer.client.web.context.info.OfferRef offerRef)Populate anOfferRefwith the given information on thisOffer.voidsetActiveEndDate(Instant activeEndDate)Defines the ending time for which this offer is active.voidsetActiveStartDate(Instant activeStartDate)Defines the beginning time for which this offer is active.voidsetAttributes(Map<String,Attribute> attributes)Dynamic attributes that are a part of the offer.voidsetAutomaticallyConsidered(boolean automaticallyConsidered)Determines whether this offer should be considered to be applied without needing anysharedCodesorcampaignTrackingIds(or some other, similar constraint).voidsetCampaignTrackingIds(Set<String> campaignTrackingIds)The tracking identifiers of the campaigns of which this offer is a part.voidsetCartLabel(String cartLabel)A label for this offer typically used by the storefront.voidsetCartSubtotal(javax.money.MonetaryAmount cartSubtotal)The minimum cart subtotal to apply this offer.voidsetCombinabilityOverrides(Set<CombinabilityOverride> combinabilityOverrides)TheCombinabilityOverridesthat override how this offer combines with other offers.voidsetCombinabilityType(String combinabilityType)Determines whether this offer can be combined with other offers.voidsetContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)A subset ofTrackinginformation to expose the context state for this object.voidsetDescription(String description)Description of this offer.voidsetDiscount(Discount discount)Basic discount information for this offer.voidsetDiscountTiers(List<DiscountTier> discountTiers)List ofdiscount tiersdetermining the discount applied with this offer.voidsetDistributeOfferAmountToTargets(boolean distributeOfferAmountToTargets)This property impacts the way that items share the same discount.voidsetEstimatedValue(BigDecimal estimatedValue)Provide an estimated value for this offer.voidsetFreeGift(boolean freeGift)Determines whether this is a free gift offer.voidsetFreeProduct(String freeProduct)Defines the id of the free product for this offer.voidsetFulfillmentGroupCriteria(String fulfillmentGroupCriteria)String expression used to determine if a fulfillment group qualifies for this offer.voidsetId(String id)The context ID of the offer.voidsetItemQualifierCriteria(ItemCriteria itemQualifierCriteria)Info related to determining what items are required so that an order or other items qualify to receive this offer's discount.voidsetMaxSavingsPerOrder(javax.money.MonetaryAmount maxSavingsPerOrder)Determines the maximum savings a single order can receive from this offer.voidsetMaxUses(int maxUses)Determines the maximum number of times this offer can be used.voidsetMaxUsesPerOrder(int maxUsesPerOrder)Determines the maximum number of times this offer can be used on a single order.voidsetMaxUsesPerUser(int maxUsesPerUser)Determines the maximum number of times this offer can be used by the same user.voidsetMaxUsesPerUserFrequency(int maxUsesPerUserFrequency)This field works in conjunction withmaxUsesPerUserto limit the frequency with which an individual user can use this offer.voidsetMaxUsesPerUserStrategy(String maxUsesPerUserStrategy)Enum that allows implementations to vary how user max uses will be interpreted.voidsetMinTotalOfQualifierPrices(javax.money.MonetaryAmount minTotalOfQualifierPrices)Determines the price subtotal threshold that all qualifying items must reach in addition toitemQualifierCriteriain order to qualify an order items to receive this offer's discount.voidsetMinTotalOfTargetPrices(javax.money.MonetaryAmount minTotalOfTargetPrices)Determines the price subtotal threshold that all targeted items must reach in addition totargetItemCriteriain order to receive this offer's discount.voidsetName(String name)Display name for this offer.voidsetOfferDiscountStrategy(String offerDiscountStrategy)Represents the discount strategy for this offer.voidsetOrderCriteria(String orderCriteria)String expression used in conjunction withitemQualifierCriteriato determine if an order qualifies for this offer.voidsetPreferCartBundling(boolean preferCartBundling)This property provides a hint to the front-end application to perform grouping for items that share the same discount.voidsetPriority(Long priority)When multiple offers match a context, the offer with the higher priority is applied first, where smaller integer values represent higher priorities.voidsetQualifiersCanBeQualifiers(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).voidsetQualifiersCanBeTargets(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).voidsetQualifyFulfillmentAcrossAllItems(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.voidsetRequiresRelatedTargetAndQualifiers(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.voidsetSharedCodes(Set<SharedCode> sharedCodes)TheSharedCodesthat can be used to retrieve this offer.voidsetStackable(boolean stackable)Determines whether this offer can be stacked on top of other offers of the same type.voidsetSubscriptionDiscount(SubscriptionDiscount subscriptionDiscount)Information around discounting subscription items that have recurring billing.voidsetTargetGroupingStrategy(String targetGroupingStrategy)The target grouping strategy.voidsetTargetItemCriteria(ItemCriteria targetItemCriteria)Info related to determining what order items can receive this offer's discount.voidsetTieredDiscount(boolean tieredDiscount)Deprecated.voidsetTimeCriteria(String timeCriteria)String expression used to determine whether this offer can be qualified for only at certain times or on certain days or months.voidsetUseQtyOnlyTierCalculation(boolean useQtyOnlyTierCalculation)Determines whether to match anoffer tier's min quantityagainst 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.voidsetUserTargets(Set<UserTarget> userTargets)Set of users directly targeted by this offer.voidsetVoucher(boolean voucher)Determines whether this is a voucher offer.voidsetVoucherCampaign(String voucherCampaign)Defines the id of the campaign for this offer.StringtoString()
-
-
-
Field Detail
-
maxUsesPerUserStrategy
protected String maxUsesPerUserStrategy
Enum that allows implementations to vary how user max uses will be interpreted. By default the strategy will beUserMaxUsesStrategyType.CUSTOMER.
-
-
Method Detail
-
getAttribute
public <T> T getAttribute(String name)
-
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
public String getFriendlyOfferType()
- Returns:
- Friendly type of this offer combining the
Discount.getMethodType()andDiscount.getTargetType()
-
getFriendlyDiscountAmount
public String getFriendlyDiscountAmount()
- Returns:
- Friendly discount amount string using the
Discount.getAmount()or, if tiered, the first tier'sDiscountTier.amountwith a "%" appended if the discount method isDiscountMethodType.PERCENT_OFF.
-
isCombinable
public boolean isCombinable()
Returns true if the combinabilityType isCombinabilityType.ANYOR 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
public String getItemRestrictionType(boolean isForQualifier)
Translates the combination ofqualifiersCanBeTargetsandqualifiersCanBeQualifiersinto 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:
ItemRestrictionType
-
compareTo
public int compareTo(Offer that)
Compares priorities. Null is less than non-null.- Specified by:
compareToin 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
protected Optional<String> getBaseDiscountMethodType()
- Returns:
- the
Discount.getMethodType()of this offer or, if tiered, the first tier'sDiscountTier.methodType
-
getBaseDiscountAmount
protected BigDecimal getBaseDiscountAmount()
- Returns:
- the
Discount.getAmount()of this offer or, if tiered, the first tier'sDiscountTier.amount
-
getOfferTypeOnlyTarget
protected String getOfferTypeOnlyTarget()
-
getOfferTypOnlyMethod
protected String getOfferTypOnlyMethod()
-
hasLimitedUsesPerOrder
public boolean hasLimitedUsesPerOrder()
Whether thisOfferhas limited uses per order.- Returns:
- Whether this
Offerhas 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 anOfferRefwith the given information on thisOffer.- Parameters:
offerRef- theOfferRefto 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
public String 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 noofferDiscountStrategyis set and this isn't a tiered discount,OfferDiscountStrategy.STANDARDis assumed.- Returns:
- The discount strategy.
-
isTieredOffer
public boolean isTieredOffer()
-
getPriorityForComparisons
public Long getPriorityForComparisons()
-
isTieredDiscount
@Deprecated public boolean isTieredDiscount()
Deprecated.since 1.6. UseisTieredOffer()- Returns:
- Is this a tiered discount?
-
getId
public String getId()
The context ID of the offer.- Returns:
- the context ID of the offer.
-
getName
public String getName()
Display name for this offer.- Returns:
- the name of this offer
-
getDescription
public String getDescription()
Description of this offer.- Returns:
- Description of this offer.
-
getCartLabel
public String getCartLabel()
A label for this offer typically used by the storefront.- Returns:
- A label for this offer typically used by the storefront.
-
getDiscountTiers
public List<DiscountTier> getDiscountTiers()
List ofdiscount tiersdetermining the discount applied with this offer.- Returns:
- List of discount tiers for this offer
- See Also:
DiscountTier,tieredDiscount
-
getDiscount
public Discount getDiscount()
Basic discount information for this offer.
If
tieredDiscountis true, thenDiscount.getMethodType()andDiscount.getAmount()are overridden by the same fields in the tiers (seeDiscountTier).- Returns:
- The
Discountfor this offer
-
getPriority
public Long 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
public Instant getActiveStartDate()
Defines the beginning time for which this offer is active.- Returns:
- The date after which this offer is active
-
getActiveEndDate
public Instant getActiveEndDate()
Defines the ending time for which this offer is active. Must be later thanactiveStartDateor null which indicates that this offer applies indefinitely.- Returns:
- The date before which this offer is active
-
getCombinabilityOverrides
public Set<CombinabilityOverride> getCombinabilityOverrides()
TheCombinabilityOverridesthat override how this offer combines with other offers.- Returns:
- the combinabilityOverrides for this offer
- See Also:
CombinabilityOverrideType
-
getSharedCodes
public Set<SharedCode> getSharedCodes()
TheSharedCodesthat can be used to retrieve this offer. These codes would be used in situations where this offer is not automatically considered (meaningautomaticallyConsideredis false}- Returns:
- the codes that can be used to retrieve this offer
-
getCampaignTrackingIds
public Set<String> 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
-
getCombinabilityType
public String 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:
CombinabilityType
-
isStackable
public boolean isStackable()
Determines whether this offer can be stacked on top of other offers of the same type. This is different thanCombinabilityType.ANYwhich 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:
CombinabilityType
-
isAutomaticallyConsidered
public boolean isAutomaticallyConsidered()
Determines whether this offer should be considered to be applied without needing any
sharedCodesorcampaignTrackingIds(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
sharedCodesorcampaignTrackingIds(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
public ItemCriteria 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:
ItemCriteria
-
getMinTotalOfQualifierPrices
public javax.money.MonetaryAmount getMinTotalOfQualifierPrices()
Determines the price subtotal threshold that all qualifying items must reach in addition toitemQualifierCriteriain 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
itemQualifierCriteriain 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
public ItemCriteria 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:
ItemCriteria
-
getMinTotalOfTargetPrices
public javax.money.MonetaryAmount getMinTotalOfTargetPrices()
Determines the price subtotal threshold that all targeted items must reach in addition totargetItemCriteriain 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
targetItemCriteriain 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.
-
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 withmaxUsesPerUserFrequencyto 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 withmaxUsesPerUserto limit the frequency with which an individual user can use this offer. IfmaxUsesPerUser = 3andmaxUsesPerUserFrequency = 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 thismaxUsesPerUsertimes ever. Default is 0.- Returns:
- the length of time in days during which a user can use this offer
maxUsesPerUsertimes.
-
getMaxUsesPerUserStrategy
public String 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
public String getOrderCriteria()
String expression used in conjunction with
itemQualifierCriteriato determine if an order qualifies for this offer. WhereasitemQualifierCriteriaruns 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
itemQualifierCriteriato 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
-
getFulfillmentGroupCriteria
public String 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
public String 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
public Set<UserTarget> getUserTargets()
Set of users directly targeted by this offer.- Returns:
- Set of users directly targeted by this offer.
- See Also:
UserTarget
-
isUseQtyOnlyTierCalculation
public boolean isUseQtyOnlyTierCalculation()
Determines whether to match an
offer tier's min quantityagainst 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 quantityagainst 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
public SubscriptionDiscount 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 ofTrackinginformation to expose the context state for this object.- Specified by:
getContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Returns:
- a subset of
Trackinginformation to expose the context state for this object
-
getTargetGroupingStrategy
public String getTargetGroupingStrategy()
The target grouping strategy. This affects how order items are grouped when applying discounts. Optional. If not set, defaults toTargetGroupingStrategy.COSTLIEST.- See Also:
TargetGroupingStrategy
-
getAttributes
public Map<String,Attribute> 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
public String 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
public String getVoucherCampaign()
Defines the id of the campaign for this offer.- Returns:
- the id of the campaign for this offer
-
getEstimatedValue
public BigDecimal 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
-
setId
public void setId(String id)
The context ID of the offer.- Parameters:
id- the context ID of the offer.
-
setName
public void setName(String name)
Display name for this offer.- Parameters:
name- the name of this offer
-
setDescription
public void setDescription(String description)
Description of this offer.- Parameters:
description- Description of this offer.
-
setCartLabel
public void setCartLabel(String cartLabel)
A label for this offer typically used by the storefront.- Parameters:
cartLabel- A label for this offer typically used by the storefront.
-
setTieredDiscount
@Deprecated public void setTieredDiscount(boolean tieredDiscount)
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
public void setOfferDiscountStrategy(String offerDiscountStrategy)
Represents the discount strategy for this offer. Refer toOfferDiscountStrategyfor supported offer strategies.- Parameters:
offerDiscountStrategy- The offer discount strategy
-
setDiscountTiers
public void setDiscountTiers(List<DiscountTier> discountTiers)
List ofdiscount tiersdetermining the discount applied with this offer.- Parameters:
discountTiers- List of discount tiers for this offer- See Also:
DiscountTier,tieredDiscount
-
setDiscount
public void setDiscount(Discount discount)
Basic discount information for this offer.
If
tieredDiscountis true, thenDiscount.getMethodType()andDiscount.getAmount()are overridden by the same fields in the tiers (seeDiscountTier).- Parameters:
discount- TheDiscountfor this offer
-
setPriority
public 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. 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
public void setActiveStartDate(Instant activeStartDate)
Defines the beginning time for which this offer is active.- Parameters:
activeStartDate- The date after which this offer is active
-
setActiveEndDate
public void setActiveEndDate(Instant activeEndDate)
Defines the ending time for which this offer is active. Must be later thanactiveStartDateor null which indicates that this offer applies indefinitely.- Parameters:
activeEndDate- The date before which this offer is active
-
setCombinabilityOverrides
public void setCombinabilityOverrides(Set<CombinabilityOverride> combinabilityOverrides)
TheCombinabilityOverridesthat override how this offer combines with other offers.- Parameters:
combinabilityOverrides- the combinability overrides for this offer- See Also:
CombinabilityOverrideType
-
setSharedCodes
public void setSharedCodes(Set<SharedCode> sharedCodes)
TheSharedCodesthat can be used to retrieve this offer. These codes would be used in situations where this offer is not automatically considered (meaningautomaticallyConsideredis false}- Parameters:
sharedCodes- the codes that can be used to retrieve this offer
-
setCampaignTrackingIds
public void setCampaignTrackingIds(Set<String> campaignTrackingIds)
The tracking identifiers of the campaigns of which this offer is a part. Seecom.broadleafcommerce.promotion.campaign.domain.Campaign#id
-
setCombinabilityType
public void setCombinabilityType(String combinabilityType)
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:
CombinabilityType
-
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.ANYwhich 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:
CombinabilityType
-
setAutomaticallyConsidered
public void setAutomaticallyConsidered(boolean automaticallyConsidered)
Determines whether this offer should be considered to be applied without needing any
sharedCodesorcampaignTrackingIds(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 anysharedCodesorcampaignTrackingIds(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
public 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. 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:
ItemCriteria
-
setMinTotalOfQualifierPrices
public void setMinTotalOfQualifierPrices(javax.money.MonetaryAmount minTotalOfQualifierPrices)
Determines the price subtotal threshold that all qualifying items must reach in addition toitemQualifierCriteriain 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 toitemQualifierCriteriain 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.
-
setTargetItemCriteria
public void setTargetItemCriteria(ItemCriteria targetItemCriteria)
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:
ItemCriteria
-
setMinTotalOfTargetPrices
public void setMinTotalOfTargetPrices(javax.money.MonetaryAmount minTotalOfTargetPrices)
Determines the price subtotal threshold that all targeted items must reach in addition totargetItemCriteriain 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 totargetItemCriteriain 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.
-
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 withmaxUsesPerUserFrequencyto 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 withmaxUsesPerUserto limit the frequency with which an individual user can use this offer. IfmaxUsesPerUser = 3andmaxUsesPerUserFrequency = 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 thismaxUsesPerUsertimes ever. Default is 0.- Parameters:
maxUsesPerUserFrequency- the length of time in days during which a user can use this offermaxUsesPerUsertimes.
-
setMaxUsesPerUserStrategy
public void setMaxUsesPerUserStrategy(String maxUsesPerUserStrategy)
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
public void setOrderCriteria(String orderCriteria)
String expression used in conjunction with
itemQualifierCriteriato determine if an order qualifies for this offer. WhereasitemQualifierCriteriaruns 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 withitemQualifierCriteriato 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
-
setFulfillmentGroupCriteria
public void setFulfillmentGroupCriteria(String fulfillmentGroupCriteria)
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
public 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. 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
public void setUserTargets(Set<UserTarget> userTargets)
Set of users directly targeted by this offer.- Parameters:
userTargets- Set of users directly targeted by this offer.- See Also:
UserTarget
-
setUseQtyOnlyTierCalculation
public void setUseQtyOnlyTierCalculation(boolean useQtyOnlyTierCalculation)
Determines whether to match an
offer tier's min quantityagainst 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 quantityagainst 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
public void setSubscriptionDiscount(SubscriptionDiscount subscriptionDiscount)
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 ofTrackinginformation to expose the context state for this object.- Specified by:
setContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Parameters:
contextState- a subset ofTrackinginformation to expose the context state for this object
-
setTargetGroupingStrategy
public void setTargetGroupingStrategy(String targetGroupingStrategy)
The target grouping strategy. This affects how order items are grouped when applying discounts. Optional. If not set, defaults toTargetGroupingStrategy.COSTLIEST.- See Also:
TargetGroupingStrategy
-
setAttributes
public void setAttributes(Map<String,Attribute> attributes)
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
public void setFreeProduct(String freeProduct)
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
public void setVoucherCampaign(String voucherCampaign)
Defines the id of the campaign for this offer.- Parameters:
campaign- the id of the campaign for this offer
-
setEstimatedValue
public void setEstimatedValue(BigDecimal estimatedValue)
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
-
canEqual
protected boolean canEqual(Object other)
-
-