Class DefaultFulfillmentOptionService

java.lang.Object
com.broadleafcommerce.fulfillment.service.DefaultFulfillmentOptionService
All Implemented Interfaces:
FulfillmentOptionService

public class DefaultFulfillmentOptionService extends Object implements FulfillmentOptionService
Component to call each FulfillmentCalculator and aggregate and de-duplicate results.
  • 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 the FulfillmentOptionRequest, this method provides a map of Priced Fulfillment Options for the request. The map will be per item or per group depending on the client's FulfillmentPricingConfig.getFulfillmentPricingStrategy().
      Specified by:
      findFulfillmentOptions in interface FulfillmentOptionService
      Parameters:
      request - which represents a lightweight Cart for the purpose of determining shipping
      contextInfo - 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 - The FulfillmentPricingContext of the request.
      calculators - The FulfillmentCalculators to use.
      Returns:
      A FulfillmentOptionResponse containing a List of PricedFulfillmentOptions, either as groupFulfillmentOptions or itemFulfillmentOptions.
    • 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 sort PricedFulfillmentOptions. Sort any options with the FulfillmentPricingContext.getDefaultServiceLevel() to the beginning. Sort everything else by price.
      Parameters:
      context - The FulfillmentPricingContext 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

      protected boolean shouldIncludeOption(GroupServiceLevelPriceResult result)
    • 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

      protected FulfillmentCalculatorService getCalculatorService()
    • setShouldIncludeIncompleteGroups

      public void setShouldIncludeIncompleteGroups(boolean shouldIncludeIncompleteGroups)