Class DefaultPromotionResultService
java.lang.Object
de.hybris.platform.servicelayer.internal.service.AbstractService
de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
de.hybris.platform.promotions.impl.AbstractPromotionsService
de.hybris.platform.promotions.impl.DefaultPromotionResultService
- All Implemented Interfaces:
PromotionResultService,Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
public class DefaultPromotionResultService
extends AbstractPromotionsService
implements PromotionResultService
DefaultPromotionResultService.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
AbstractService.SerializableDTO -
Field Summary
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
modelService, sessionService, txManagerFields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanapply(PromotionResultModel promotionResult) Apply all of the actions that this promotion generated to the order.longgetConsumedCount(PromotionResultModel promotionResult, boolean includeCouldFirePromotions) Get the total number of items consumed by this promotion.booleangetCouldFire(PromotionResultModel promotionResult) Is this a potential result.getCouponCodesFromPromotion(PromotionResultModel promotionResult) Return give way coupon code for promotion.getDescription(PromotionResultModel promotionResult) Get the description of this promotion result.getDescription(PromotionResultModel promotionResult, Locale locale) Get the description of this promotion result.booleangetFired(PromotionResultModel promotionResult) Returns true if the promotion fired and has produced a result.getFiredOrderPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion) Return a list of results for promotions that fired and did not consume products.getFiredProductPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion) Return a list of results for promotions that fired and consumed products.getPotentialOrderPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion) Return a list of results for potential promotions that fired and did not consume products and have been applied.getPotentialProductPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion) Return a list of results for potential promotions that fired and consumed products and have been applied.doublegetTotalDiscount(PromotionResultModel promotionResult) Get the total value of all discounts in this result.booleanisApplied(PromotionResultModel promotionResult) Returns true if the promotion fired and all of its actions have been applied to the order.booleanisAppliedToOrder(PromotionResultModel promotionResult) Returns true if the promotion fired and all of its actions have been applied to the order.booleanundo(PromotionResultModel promotionResult) Undo all of the changes that this promotion made to the order.Methods inherited from class de.hybris.platform.promotions.impl.AbstractPromotionsService
getCart, getOrder, getOrder, getProduct, getPromotion, getPromotion, getPromotion, getPromotionGroup, getResult, getSessionContext, refreshModifiedModelsAfterMethods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManagerMethods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplace
-
Constructor Details
-
DefaultPromotionResultService
public DefaultPromotionResultService()
-
-
Method Details
-
apply
Description copied from interface:PromotionResultServiceApply all of the actions that this promotion generated to the order.- Specified by:
applyin interfacePromotionResultService- Parameters:
promotionResult- - instance ofPromotionResultModel- Returns:
- true if calculateTotals() should be called to update the order totals.
-
getConsumedCount
public long getConsumedCount(PromotionResultModel promotionResult, boolean includeCouldFirePromotions) Description copied from interface:PromotionResultServiceGet the total number of items consumed by this promotion.- Specified by:
getConsumedCountin interfacePromotionResultService- Parameters:
promotionResult- - instance ofPromotionResultModelincludeCouldFirePromotions- include could fire promotions- Returns:
- The total number of items consumed
-
getCouldFire
Description copied from interface:PromotionResultServiceIs this a potential result. Returns true if the promotion believes it has a chance of firing, for instance if it requires 3 qualifying products but can only find 1.- Specified by:
getCouldFirein interfacePromotionResultService- Parameters:
promotionResult- - instance ofPromotionResultModel- Returns:
- Whether the promotion could fire
-
getDescription
Description copied from interface:PromotionResultServiceGet the description of this promotion result. This method uses the default locale (Locale.getDefault())- Specified by:
getDescriptionin interfacePromotionResultService- Parameters:
promotionResult- - instance ofPromotionResultModel- Returns:
- A description of the promotion result
- See Also:
-
getDescription
Description copied from interface:PromotionResultServiceGet the description of this promotion result. Gets the description for this promotion result. This description is based on the state of the result, the promotion that generated the result and the user supplied formatting strings. TheLocalespecified 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 theGeneratedAbstractOrder.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.- Specified by:
getDescriptionin interfacePromotionResultService- Parameters:
promotionResult- - instance ofPromotionResultModellocale- 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_GB- Returns:
- A description of the promotion result
-
getFired
Description copied from interface:PromotionResultServiceReturns true if the promotion fired and has produced a result.- Specified by:
getFiredin interfacePromotionResultService- Parameters:
promotionResult- - instance ofPromotionResultModel- Returns:
- Whether the promotion fired
-
getTotalDiscount
Description copied from interface:PromotionResultServiceGet the total value of all discounts in this result. This result will be the same regardless of the applied state of this result, i.e. if not applied this is the discount value that would be applied, if it is applied then it is the value of the discount.- Specified by:
getTotalDiscountin interfacePromotionResultService- Parameters:
promotionResult- - instance ofPromotionResultModel- Returns:
- The double value for the total discount value
-
isApplied
Description copied from interface:PromotionResultServiceReturns true if the promotion fired and all of its actions have been applied to the order.- Specified by:
isAppliedin interfacePromotionResultService- Parameters:
promotionResult- - instance ofPromotionResultModel- Returns:
- Whether the promotion has been applied
-
isAppliedToOrder
Description copied from interface:PromotionResultServiceReturns true if the promotion fired and all of its actions have been applied to the order. This method checks that all the actions are still applied to the order.- Specified by:
isAppliedToOrderin interfacePromotionResultService- Parameters:
promotionResult- - instance ofPromotionResultModel- Returns:
- Whether the promotion has been applied
-
undo
Description copied from interface:PromotionResultServiceUndo all of the changes that this promotion made to the order.- Specified by:
undoin interfacePromotionResultService- Parameters:
promotionResult- - instance ofPromotionResultModel- Returns:
- true if calculateTotals() should be called to update the order totals.
-
getPotentialProductPromotions
public List<PromotionResultModel> getPotentialProductPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion) Description copied from interface:PromotionResultServiceReturn a list of results for potential promotions that fired and consumed products and have been applied.- Specified by:
getPotentialProductPromotionsin interfacePromotionResultService- Parameters:
promoResult- - instance ofPromotionOrderResultspromotion- - instance ofAbstractPromotionModel- Returns:
- A list of the results of product promotions that fired and applied
-
getPotentialOrderPromotions
public List<PromotionResultModel> getPotentialOrderPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion) Description copied from interface:PromotionResultServiceReturn a list of results for potential promotions that fired and did not consume products and have been applied.- Specified by:
getPotentialOrderPromotionsin interfacePromotionResultService- Parameters:
promoResult- - instance ofPromotionOrderResultspromotion- - instance ofAbstractPromotionModel- Returns:
- A list of the results of order promotions that fired and applied
-
getFiredProductPromotions
public List<PromotionResultModel> getFiredProductPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion) Description copied from interface:PromotionResultServiceReturn a list of results for promotions that fired and consumed products.- Specified by:
getFiredProductPromotionsin interfacePromotionResultService- Parameters:
promoResult- - instance ofPromotionOrderResultspromotion- - instance ofAbstractPromotionModel- Returns:
- A list of the results of product promotions that fired
-
getFiredOrderPromotions
public List<PromotionResultModel> getFiredOrderPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion) Description copied from interface:PromotionResultServiceReturn a list of results for promotions that fired and did not consume products.- Specified by:
getFiredOrderPromotionsin interfacePromotionResultService- Parameters:
promoResult- - instance ofPromotionOrderResultspromotion- - instance ofAbstractPromotionModel- Returns:
- A list of the results of promotions that fired
-
getCouponCodesFromPromotion
Description copied from interface:PromotionResultServiceReturn give way coupon code for promotion.- Specified by:
getCouponCodesFromPromotionin interfacePromotionResultService- Parameters:
promotionResult- - instance ofPromotionResultModel- Returns:
- Optional Set of String containing give way coupon code
-