Broadleaf Microservices
  • v1.0.0-latest-prod

Notable Service Components

OfferEngineService

The OfferEngineService is the entry point for the Offer Engine. This service is used by the OfferEngine endpoints. It handles orchestrating the application of offers to an order and returns the order with populated adjustments. The process of applying the offers consists of the following steps:

  1. Validating the order for key information, such as order items, pricing, etc.

  2. Fetching the applicable candidate offers based on the order information and applied codes.

  3. Building the various permutations of the candidate offers that can be applied to the order.

  4. Weighing the permutations based on total savings and choosing the best permutation of offers to apply.

  5. Applying the adjustments & the prorated adjustments to the order.

OfferCandidateService

This service determines the offers which could apply based on the provided order and context. This correlates to step 2 in the OfferEngineService flow. The process of finding the candidate offers consists of the following steps:

  1. Fetches all the offers from the database based on the user, codes, and automatically applied offers.

  2. Filters the fetched offers based on

    1. The order and time criteria

    2. The offer & offer code usage information

    3. The user targets

    4. The item qualifiers & targets

OfferApplicationService

This service applies the offer permutations to the order and calculates which provides the best discounts. This correlates to step 4 & 5 in the OfferEngineService flow. The process of evaluating the permutations consists of the following steps:

  1. Uses the OrderOfferProcessor, ItemOfferProcessor, and FulfillmentGroupProcessor to score the permutations.

  2. After the permutations have been scored, weighs the results and determines which permutation had the best results.

  3. Applies the adjustments and adjusts the prices based on the best permutation.

ProrationService

This service calculates and applies the prorated order, item, & fulfillment group adjustments. This correlates to step 5 in the OfferEngineService flow. The process of calculating and applying the prorated adjustments consists of the following steps for each type of adjustment:

  1. Determines if the adjustment should be prorated based on the offer type and proration type.

  2. Calculates the amount to prorate proportionally across the items.

  3. Rounds the prorated monetary amounts on the items to ensure that the sum is equal to the total.