public interface PromotionResultService
PromotionResult is associated with a single
AbstractPromotion and is either fired (getFired(PromotionResultModel)) or potentially could fire (
getCouldFire(PromotionResultModel)).
A result that has fired as met all the requirements of the promotion. A result that potentially could fire has not
met all the requirements of the promotion. When the result could fire the promotion also assigns a certainty value to
the result to indicate how close the result is to firing. This is a value in the range 0 to 1, where 1 indicates that
the promotion has fired. This value can be used to rank potential promotion results.
A promotion result holds a number of PromotionOrderEntryConsumed instances to represent the entries in the
order that have been consumed by the promotion in generating this result. If the promotion has fired then these
consumed entries are not available to other promotions. If the promotion has not fired then these consumed entries
are just an indication of the entries that will be consumed when the promotion can fire.
If the promotion has fired the promotion result also holds a number of AbstractPromotionAction instances to
represent the actions that the promotion takes. These actions are either applied or not (
isApplied(PromotionResultModel)). When the promotions are evaluated by
PromotionsManager.updatePromotions(de.hybris.platform.jalo.SessionContext, java.util.Collection,
de.hybris.platform.jalo.order.AbstractOrder, boolean, de.hybris.platform.promotions.jalo.PromotionsManager.AutoApplyMode,
de.hybris.platform.promotions.jalo.PromotionsManager.AutoApplyMode, java.util.Date)
a firing promotion result may be automatically applied depending on the parameters passed to the method. The actions
of a specific promotion result can be applied by calling the apply(PromotionResultModel) method.
The actions of a specific promotion result can be reversed by calling the undo(PromotionResultModel) method.| Modifier and Type | Method and Description |
|---|---|
boolean |
apply(PromotionResultModel promotionResult)
Apply all of the actions that this promotion generated to the order.
|
long |
getConsumedCount(PromotionResultModel promotionResult,
boolean includeCouldFirePromotions)
Get the total number of items consumed by this promotion.
|
boolean |
getCouldFire(PromotionResultModel promotionResult)
Is this a potential result.
|
java.util.Optional<java.util.Set<java.lang.String>> |
getCouponCodesFromPromotion(PromotionResultModel promotionResult)
Return give way coupon code for promotion.
|
java.lang.String |
getDescription(PromotionResultModel promotionResult)
Get the description of this promotion result.
|
java.lang.String |
getDescription(PromotionResultModel promotionResult,
java.util.Locale locale)
Get the description of this promotion result.
|
boolean |
getFired(PromotionResultModel promotionResult)
Returns true if the promotion fired and has produced a result.
|
java.util.List<PromotionResultModel> |
getFiredOrderPromotions(PromotionOrderResults promoResult,
AbstractPromotionModel promotion)
Return a list of results for promotions that fired and did not consume products.
|
java.util.List<PromotionResultModel> |
getFiredProductPromotions(PromotionOrderResults promoResult,
AbstractPromotionModel promotion)
Return a list of results for promotions that fired and consumed products.
|
java.util.List<PromotionResultModel> |
getPotentialOrderPromotions(PromotionOrderResults promoResult,
AbstractPromotionModel promotion)
Return a list of results for potential promotions that fired and did not consume products and have been applied.
|
java.util.List<PromotionResultModel> |
getPotentialProductPromotions(PromotionOrderResults promoResult,
AbstractPromotionModel promotion)
Return a list of results for potential promotions that fired and consumed products and have been applied.
|
double |
getTotalDiscount(PromotionResultModel promotionResult)
Get the total value of all discounts in this result.
|
boolean |
isApplied(PromotionResultModel promotionResult)
Returns true if the promotion fired and all of its actions have been applied to the order.
|
boolean |
isAppliedToOrder(PromotionResultModel promotionResult)
Returns true if the promotion fired and all of its actions have been applied to the order.
|
boolean |
undo(PromotionResultModel promotionResult)
Undo all of the changes that this promotion made to the order.
|
boolean isApplied(PromotionResultModel promotionResult)
promotionResult - - instance of PromotionResultModelboolean isAppliedToOrder(PromotionResultModel promotionResult)
promotionResult - - instance of PromotionResultModelboolean getFired(PromotionResultModel promotionResult)
promotionResult - - instance of PromotionResultModelboolean getCouldFire(PromotionResultModel promotionResult)
promotionResult - - instance of PromotionResultModeljava.lang.String getDescription(PromotionResultModel promotionResult)
promotionResult - - instance of PromotionResultModelgetDescription(PromotionResultModel, java.util.Locale)java.lang.String getDescription(PromotionResultModel promotionResult, java.util.Locale locale)
Locale specified is used to format any numbers, dates or currencies for display to the user. It is
important that this locale best represents the formatting options appropriate for display to the user. The default
currency for the locale is ignored. The currency is always explicitly taken from the
GeneratedAbstractOrder.getCurrency(). The currency is then formatted appropriately in
the locale specified. For example, this does mean that values in the EURO currency will be formatted differently
depending on the locale specified as each locale can specify currency specific formatting.
The currency formatting is part of the Java VM configuration to support multiple locales. If the formatting is
incorrect check your VM configuration for the locale and currency combination.locale - The locale to use to format the messages. This locale must support currency formatting, i.e. this should
be a region specific local. e.g de_DE, en_US, en_GBpromotionResult - - instance of PromotionResultModelboolean apply(PromotionResultModel promotionResult)
promotionResult - - instance of PromotionResultModelboolean undo(PromotionResultModel promotionResult)
promotionResult - - instance of PromotionResultModellong getConsumedCount(PromotionResultModel promotionResult, boolean includeCouldFirePromotions)
promotionResult - - instance of PromotionResultModelincludeCouldFirePromotions - include could fire promotionsdouble getTotalDiscount(PromotionResultModel promotionResult)
promotionResult - - instance of PromotionResultModeljava.util.List<PromotionResultModel> getPotentialProductPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion)
promoResult - - instance of PromotionOrderResultspromotion - - instance of AbstractPromotionModeljava.util.List<PromotionResultModel> getPotentialOrderPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion)
promoResult - - instance of PromotionOrderResultspromotion - - instance of AbstractPromotionModeljava.util.List<PromotionResultModel> getFiredProductPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion)
promoResult - - instance of PromotionOrderResultspromotion - - instance of AbstractPromotionModeljava.util.List<PromotionResultModel> getFiredOrderPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion)
promoResult - - instance of PromotionOrderResultspromotion - - instance of AbstractPromotionModeljava.util.Optional<java.util.Set<java.lang.String>> getCouponCodesFromPromotion(PromotionResultModel promotionResult)
promotionResult - - instance of PromotionResultModelCopyright © 2018 SAP SE. All Rights Reserved.