Broadleaf Microservices
  • v1.0.0-latest-prod

Key Components

Overview

This provides a summary of the most important service and utility components used to calculate fulfillment options and prices.

Key Terminology

Fulfillment Destination - A structure representing where an order is being shipped or picked up . Some calculators are only applicable if the order is shipped to a specific country, for example.

Fulfillment Origin - A structure representing where an order is being shipped from. The calculation may be different for items being shipped from one warehouse vs. another.

FulfillmentCalculatorConfigs - For DB calculators, the values that drive the calculator.

FulfillmentPricingConfig - Tenant or application settings used to drive fulfillment pricing including whether to provide options by group or by item and what to use for the default service level.

Priced Fulfillment Group - A group of items that are delivered to an address at a specific service level (e.g. express) .

Service Level - A description of the speed of fulfillment. Default is "STANDARD" and the values can be implementation specific By default, the system expects that every item can be fulfilled using the default service level if it can be fulfilled at all.

Services Used to Price Options

Fulfillment Option Service

Class is located at link:https://javadocs.ci.broadleafcommerce.com/broadleaf-fulfillment-services/{broadleaf -fulfillment-version}/com.broadleafcommerce.fulfillment.service.FulfillmentOptionService.html[com.broadleafcommerce.fulfillment.service.FulfillmentOptionService].

The FulfillmentOptionService is the entry point into the flow to find and price options. It first determines the list of eligible calculators using the Fulfillment Calculator Service and then loops through each calculator to price the groups or items from the FulfillmentOptionRequest.

Pricing items and groups can vary based on the order that the calculators are processed. Some implementations may want to run multiple versions of the fulfillment pricing algorithm based on criteria such as inventory location proximity, speed of delivery, etc. One way to accomplish this is to override this service and run the "#buildOptions" method multiple times with different sorting of the calculators.

FulfillmentCalculatorService

Class is located at link:https://javadocs.ci.broadleafcommerce.com/broadleaf-fulfillment-services/{broadleaf -fulfillment-version}/com.broadleafcommerce.fulfillment.service.FulfillmentCalculatorService.html[com.broadleafcommerce.fulfillment.service.FulfillmentCalculatorService].

This service provides the key hook to find and prioritize the calculators and to price the items and groups.

It utilizes the Fulfillment Calculator Filter Service to filter calculators that might be able to process the current request.

It utilizes the similarly named Fulfillment Calculation Service to perform the actual calculations for the request.

The service is configured with a list of Fulfillment Calculation Providers that can each provide a list of Fulfillment Calculators.

Providers like the ItemAttributeFlatRateProvider can be created through code. The primary list of calculators are built using the DBFulfillmentCalculatorProvider which reads the calculator configurations from the Database and builds a calculator for each one.

FulfillmentCalculatorFilterService

Class is located at link:https://javadocs.ci.broadleafcommerce.com/broadleaf-fulfillment-services/{broadleaf -fulfillment-version}/com.broadleafcommerce.fulfillment.service.FulfillmentCalculatorFilterService.html[com.broadleafcommerce.fulfillment.service.FulfillmentCalculatorFilterService].

This service provides the logic to filter calculators that don’t apply to a given order.

Filtering includes removing: - Disabled / inactive calculators - Calculators in a different currency - Calculators that cannot service the current Fulfillment Destination - Calculators that cannot service the current Fulfillment Origin

FulfillmentCalculationService

Class is located at link:https://javadocs.ci.broadleafcommerce.com/broadleaf-fulfillment-services/{broadleaf -fulfillment-version}/com.broadleafcommerce.fulfillment.service.FulfillmentCalculationService.html[com.broadleafcommerce.fulfillment.service.FulfillmentCalculationService].

This service is a utility service that is able to compute the fulfillment option price given a list of items. For details on the types of calculations supported, see Calculator Capabilities.

Helper Components

WeightCalculationHelper

Class is located at link:https://javadocs.ci.broadleafcommerce.com/broadleaf-fulfillment-services/{broadleaf -fulfillment-version}/com.broadleafcommerce.fulfillment.service.helper.WeightCalculationHelper.html[com.broadleafcommerce.fulfillment.service.helper.WeightCalculationHelper].

When using weight based calculators, the pricing tiers require a specific weight unit. This component is responsible for converting from one weight unit of measure to another. Broadleaf ships with a small number of weight conversions. Implementations may need to extend this component to provide broader support to meet their needs.

Data Services

FulfillmentCalculatorConfigService

Class is located at link:https://javadocs.ci.broadleafcommerce.com/broadleaf-fulfillment-services/{broadleaf -fulfillment-version}/com.broadleafcommerce.fulfillment.service.FulfillmentCalculatorConfigService.html[com.broadleafcommerce.fulfillment.service.helper.FulfillmentCalculatorConfigService].

Service supporting DB interactions for FulfillmentCalculatorConfigs.

FulfillmentPricingConfigService

Class is located at link:https://javadocs.ci.broadleafcommerce.com/broadleaf-fulfillment-services/{broadleaf -fulfillment-version}/com.broadleafcommerce.fulfillment.service.FulfillmentPricingConfigService.html[com.broadleafcommerce.fulfillment.service.helper.FulfillmentPricingConfigService].

Service supporting DB interactions for FulfillmentPricingConfigs.

FulfillmentOriginService

Class is located at link:https://javadocs.ci.broadleafcommerce.com/broadleaf-fulfillment-services/{broadleaf -fulfillment-version}/com.broadleafcommerce.fulfillment.service.FulfillmentOriginService.html[com.broadleafcommerce.fulfillment.service.helper.FulfillmentOriginService].

Service supporting DB interactions for FulfillmentOrigins.

FulfillmentDestinationService

Class is located at link:https://javadocs.ci.broadleafcommerce.com/broadleaf-fulfillment-services/{broadleaf -fulfillment-version}/com.broadleafcommerce.fulfillment.service.FulfillmentDestinationService.html[com.broadleafcommerce.fulfillment.service.helper.FulfillmentDestinationService].

Service supporting DB interactions for FulfillmentDestinations.