Class AbstractOfferServiceExtensionHandler
java.lang.Object
org.broadleafcommerce.common.extension.AbstractExtensionHandler
org.broadleafcommerce.core.offer.service.AbstractOfferServiceExtensionHandler
- All Implemented Interfaces:
org.broadleafcommerce.common.extension.ExtensionHandler,OfferServiceExtensionHandler
public class AbstractOfferServiceExtensionHandler
extends org.broadleafcommerce.common.extension.AbstractExtensionHandler
implements OfferServiceExtensionHandler
- Author:
- Andre Azzolini (apazzolini), bpolster
-
Field Summary
Fields inherited from class org.broadleafcommerce.common.extension.AbstractExtensionHandler
enabled, priority -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.broadleafcommerce.common.extension.ExtensionResultStatusTypeaddAdditionalOffersForCode(List<Offer> offers, OfferCode offerCode) Allows module extensions to add additional offers for a given offer code.org.broadleafcommerce.common.extension.ExtensionResultStatusTypeapplyAdditionalFilters(List<Offer> offers, Order order) org.broadleafcommerce.common.extension.ExtensionResultStatusTypeapplyAdditionalRuleVariablesForItemOfferEvaluation(PromotableOrderItem orderItem, HashMap<String, Object> vars) Allows a module to append additional rule variables that may be needed for order item evaluationorg.broadleafcommerce.common.extension.ExtensionResultStatusTypeapplyItemOffer(PromotableOrder order, PromotableCandidateItemOffer itemOffer, Map<String, Object> contextMap) Modules may need to extend the applyItemOffer logicorg.broadleafcommerce.common.extension.ExtensionResultStatusTypebuildOfferCodeListForCustomer(org.broadleafcommerce.profile.core.domain.Customer customer, List<OfferCode> offerCodes) Allows module extension to add additional offer codes to the list, given the customerorg.broadleafcommerce.common.extension.ExtensionResultStatusTypecalculatePotentialSavings(PromotableCandidateItemOffer itemOffer, PromotableOrderItem item, int quantity, Map<String, Object> contextMap) Modules may extend the calculatePotentialSavings method.org.broadleafcommerce.common.extension.ExtensionResultStatusTypeAllows a module to finalize adjustments.org.broadleafcommerce.common.extension.ExtensionResultStatusTypecreateOrderItemPriceDetailAdjustment(org.broadleafcommerce.common.extension.ExtensionResultHolder<?> resultHolder, OrderItemPriceDetail itemDetail) Allows module extensions to add a create a new instance of OrderItemPriceDetailAdjustment.org.broadleafcommerce.common.extension.ExtensionResultStatusTyperemoveOfferCodeFromOrder(OfferCode offerCode, Order order) org.broadleafcommerce.common.extension.ExtensionResultStatusTypeModules may need to clear additional offer details when resetPriceDetails is called.org.broadleafcommerce.common.extension.ExtensionResultStatusTypeAllows a module to amend the data that synchronizes thePromotableOrderwith theOrderMethods inherited from class org.broadleafcommerce.common.extension.AbstractExtensionHandler
getPriority, isEnabled, setEnabled, setPriorityMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.broadleafcommerce.common.extension.ExtensionHandler
getPriority, isEnabled
-
Constructor Details
-
AbstractOfferServiceExtensionHandler
public AbstractOfferServiceExtensionHandler()
-
-
Method Details
-
applyAdditionalFilters
public org.broadleafcommerce.common.extension.ExtensionResultStatusType applyAdditionalFilters(List<Offer> offers, Order order) - Specified by:
applyAdditionalFiltersin interfaceOfferServiceExtensionHandler
-
buildOfferCodeListForCustomer
public org.broadleafcommerce.common.extension.ExtensionResultStatusType buildOfferCodeListForCustomer(org.broadleafcommerce.profile.core.domain.Customer customer, List<OfferCode> offerCodes) Description copied from interface:OfferServiceExtensionHandlerAllows module extension to add additional offer codes to the list, given the customer- Specified by:
buildOfferCodeListForCustomerin interfaceOfferServiceExtensionHandler- Returns:
-
calculatePotentialSavings
public org.broadleafcommerce.common.extension.ExtensionResultStatusType calculatePotentialSavings(PromotableCandidateItemOffer itemOffer, PromotableOrderItem item, int quantity, Map<String, Object> contextMap) Description copied from interface:OfferServiceExtensionHandlerModules may extend the calculatePotentialSavings method. Once the handlers run, the contextMap will be checked for an entry with a key of "savings". If that entry returns a non-null Money, that value will be returned from the calling method.Otherwise, the map will be checked for an entry with a key of "quantity". If a non-null Integer is returned, that value will replace the quantity call in the normal call to calculatePotentialSavings.
This extension is utilized by one or more BLC enterprise modules including Subscription.
- Specified by:
calculatePotentialSavingsin interfaceOfferServiceExtensionHandler- Returns:
-
resetPriceDetails
public org.broadleafcommerce.common.extension.ExtensionResultStatusType resetPriceDetails(PromotableOrderItem item) Description copied from interface:OfferServiceExtensionHandlerModules may need to clear additional offer details when resetPriceDetails is called.- Specified by:
resetPriceDetailsin interfaceOfferServiceExtensionHandler- Returns:
-
applyItemOffer
public org.broadleafcommerce.common.extension.ExtensionResultStatusType applyItemOffer(PromotableOrder order, PromotableCandidateItemOffer itemOffer, Map<String, Object> contextMap) Description copied from interface:OfferServiceExtensionHandlerModules may need to extend the applyItemOffer logicFor example, a subscription module might creates future payment adjustments.
The module add an attribute of type Boolean to the contextMap named "stopProcessing" indicating to the core offer engine that further adjustment processing is not needed.
- Specified by:
applyItemOfferin interfaceOfferServiceExtensionHandler- Returns:
-
synchronizeAdjustmentsAndPrices
public org.broadleafcommerce.common.extension.ExtensionResultStatusType synchronizeAdjustmentsAndPrices(PromotableOrder order) Description copied from interface:OfferServiceExtensionHandlerAllows a module to amend the data that synchronizes thePromotableOrderwith theOrder- Specified by:
synchronizeAdjustmentsAndPricesin interfaceOfferServiceExtensionHandler- Returns:
-
chooseSaleOrRetailAdjustments
public org.broadleafcommerce.common.extension.ExtensionResultStatusType chooseSaleOrRetailAdjustments(PromotableOrder order) Description copied from interface:OfferServiceExtensionHandlerAllows a module to finalize adjustments.- Specified by:
chooseSaleOrRetailAdjustmentsin interfaceOfferServiceExtensionHandler- Returns:
-
createOrderItemPriceDetailAdjustment
public org.broadleafcommerce.common.extension.ExtensionResultStatusType createOrderItemPriceDetailAdjustment(org.broadleafcommerce.common.extension.ExtensionResultHolder<?> resultHolder, OrderItemPriceDetail itemDetail) Description copied from interface:OfferServiceExtensionHandlerAllows module extensions to add a create a new instance of OrderItemPriceDetailAdjustment. The module should add the value to the resultHolder.getContextMap() with a key of "OrderItemPriceDetailAdjustment"- Specified by:
createOrderItemPriceDetailAdjustmentin interfaceOfferServiceExtensionHandler- Returns:
-
applyAdditionalRuleVariablesForItemOfferEvaluation
public org.broadleafcommerce.common.extension.ExtensionResultStatusType applyAdditionalRuleVariablesForItemOfferEvaluation(PromotableOrderItem orderItem, HashMap<String, Object> vars) Description copied from interface:OfferServiceExtensionHandlerAllows a module to append additional rule variables that may be needed for order item evaluation- Specified by:
applyAdditionalRuleVariablesForItemOfferEvaluationin interfaceOfferServiceExtensionHandler- Parameters:
orderItem- - the promotable order item in considerationvars- - the rule map- Returns:
-
addAdditionalOffersForCode
public org.broadleafcommerce.common.extension.ExtensionResultStatusType addAdditionalOffersForCode(List<Offer> offers, OfferCode offerCode) Description copied from interface:OfferServiceExtensionHandlerAllows module extensions to add additional offers for a given offer code.- Specified by:
addAdditionalOffersForCodein interfaceOfferServiceExtensionHandler- Returns:
-
removeOfferCodeFromOrder
public org.broadleafcommerce.common.extension.ExtensionResultStatusType removeOfferCodeFromOrder(OfferCode offerCode, Order order) - Specified by:
removeOfferCodeFromOrderin interfaceOfferServiceExtensionHandler
-