Class DefaultFulfillmentOptionService
java.lang.Object
com.broadleafcommerce.fulfillment.service.DefaultFulfillmentOptionService
- All Implemented Interfaces:
FulfillmentOptionService
Component to call each
FulfillmentCalculator
and aggregate and de-duplicate results.-
Constructor Summary
ConstructorDescriptionDefaultFulfillmentOptionService
(FulfillmentPricingConfigAccessor<? extends com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig> fulfillmentPricingConfigService, com.broadleafcommerce.common.extension.TypeFactory typeFactory, FulfillmentCalculatorService calculatorService) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.order.common.domain.PricedFulfillmentOption
buildGroupOptionForResponse
(EnhancedFulfillmentPricingGroup pricingGroup, String serviceLevel, GroupServiceLevelPriceResult result) protected com.broadleafcommerce.order.common.domain.PricedFulfillmentOption
buildItemOptionForResponse
(EnhancedFulfillmentPricingItem item, String serviceLevel, FulfillmentItemPriceResult result) protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse
buildOptions
(FulfillmentPricingContext fpContext, List<FulfillmentCalculator> calculators) Given a list of fulfillment calculators sorted in the order they should be run, build a FulfillmentResponse.protected String
determineFulfillmentType
(EnhancedFulfillmentPricingGroup pricingGroup, FulfillmentCalculator calculator) protected String
determineFulfillmentType
(EnhancedFulfillmentPricingGroup pricingGroup, GroupServiceLevelPriceResult result) protected String
com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse
findFulfillmentOptions
(com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Given theFulfillmentOptionRequest
, this method provides a map ofPriced Fulfillment Options
for the request.protected FulfillmentCalculatorService
protected FulfillmentPricingConfigAccessor<? extends com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig>
protected Comparator<com.broadleafcommerce.order.common.domain.PricedFulfillmentOption>
A comparator to sortPricedFulfillmentOptions
.protected com.broadleafcommerce.common.extension.TypeFactory
protected FulfillmentPricingContext
initializeFulfillmentPricingContext
(com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected void
populateGroupResponses
(com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse response, FulfillmentPricingContext context) protected void
populateItemResponses
(com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse response, FulfillmentPricingContext context) protected List<com.broadleafcommerce.order.common.domain.PricedFulfillmentOption>
populateOptionsForGroup
(com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse response, EnhancedFulfillmentPricingGroup group) protected List<com.broadleafcommerce.order.common.domain.PricedFulfillmentOption>
populateOptionsForItem
(com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse response, EnhancedFulfillmentPricingItem item) void
setShouldIncludeIncompleteGroups
(boolean shouldIncludeIncompleteGroups) protected boolean
-
Constructor Details
-
DefaultFulfillmentOptionService
public DefaultFulfillmentOptionService(@NonNull FulfillmentPricingConfigAccessor<? extends com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig> fulfillmentPricingConfigService, @NonNull com.broadleafcommerce.common.extension.TypeFactory typeFactory, @NonNull FulfillmentCalculatorService calculatorService)
-
-
Method Details
-
findFulfillmentOptions
public com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse findFulfillmentOptions(@NonNull com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:FulfillmentOptionService
Given theFulfillmentOptionRequest
, this method provides a map ofPriced Fulfillment Options
for the request. The map will be per item or per group depending on the client'sFulfillmentPricingConfig.getFulfillmentPricingStrategy()
.- Specified by:
findFulfillmentOptions
in interfaceFulfillmentOptionService
- Parameters:
request
- which represents a lightweight Cart for the purpose of determining shippingcontextInfo
- the context info providing tenancy and application data among other things- Returns:
- FulfillmentOptionResponse containing a map of PricedFulfillmentOptions
-
buildOptions
protected com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse buildOptions(FulfillmentPricingContext fpContext, List<FulfillmentCalculator> calculators) Given a list of fulfillment calculators sorted in the order they should be run, build a FulfillmentResponse.- Parameters:
fpContext
- TheFulfillmentPricingContext
of the request.calculators
- TheFulfillmentCalculators
to use.- Returns:
- A
FulfillmentOptionResponse
containing a List ofPricedFulfillmentOptions
, either asgroupFulfillmentOptions
oritemFulfillmentOptions
.
-
initializeFulfillmentPricingContext
protected FulfillmentPricingContext initializeFulfillmentPricingContext(com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
populateGroupResponses
protected void populateGroupResponses(com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse response, FulfillmentPricingContext context) -
populateItemResponses
protected void populateItemResponses(com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse response, FulfillmentPricingContext context) -
getPricedFulfillmentOptionComparator
protected Comparator<com.broadleafcommerce.order.common.domain.PricedFulfillmentOption> getPricedFulfillmentOptionComparator(FulfillmentPricingContext context) A comparator to sortPricedFulfillmentOptions
. Sort any options with theFulfillmentPricingContext.getDefaultServiceLevel()
to the beginning. Sort everything else by price.- Parameters:
context
- TheFulfillmentPricingContext
of the request.- Returns:
- A comparator to sort
PricedFulfillmentOptions
by default service level and price.
-
populateOptionsForGroup
protected List<com.broadleafcommerce.order.common.domain.PricedFulfillmentOption> populateOptionsForGroup(com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse response, EnhancedFulfillmentPricingGroup group) -
shouldIncludeOption
-
populateOptionsForItem
protected List<com.broadleafcommerce.order.common.domain.PricedFulfillmentOption> populateOptionsForItem(com.broadleafcommerce.fulfillment.common.domain.FulfillmentOptionResponse response, EnhancedFulfillmentPricingItem item) -
buildGroupOptionForResponse
protected com.broadleafcommerce.order.common.domain.PricedFulfillmentOption buildGroupOptionForResponse(EnhancedFulfillmentPricingGroup pricingGroup, String serviceLevel, GroupServiceLevelPriceResult result) -
buildItemOptionForResponse
protected com.broadleafcommerce.order.common.domain.PricedFulfillmentOption buildItemOptionForResponse(EnhancedFulfillmentPricingItem item, String serviceLevel, FulfillmentItemPriceResult result) -
determineFulfillmentType
protected String determineFulfillmentType(EnhancedFulfillmentPricingItem item, FulfillmentItemPriceResult result) -
determineFulfillmentType
protected String determineFulfillmentType(EnhancedFulfillmentPricingGroup pricingGroup, GroupServiceLevelPriceResult result) -
determineFulfillmentType
protected String determineFulfillmentType(EnhancedFulfillmentPricingGroup pricingGroup, FulfillmentCalculator calculator) -
getFulfillmentPricingConfigService
protected FulfillmentPricingConfigAccessor<? extends com.broadleafcommerce.fulfillment.common.domain.FulfillmentPricingConfig> getFulfillmentPricingConfigService() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getCalculatorService
-
setShouldIncludeIncompleteGroups
public void setShouldIncludeIncompleteGroups(boolean shouldIncludeIncompleteGroups)
-