Broadleaf Microservices
  • v1.0.0-latest-prod

Order Submission

Order Submission Sequence Diagram
Figure 1. Order Submission Sequence Diagram

When a Checkout Completion occurs, the Order Operation Service listens for it and goes through this workflow to generate a new order and fulfillment:

  1. CheckoutCompletionListener receives the checkout event, generates the Order from the Cart using CartOrderGenerationService and sends the event to the OrderCreatedProducer.CHANNEL channel with the generated Order.

    1. The new order isn’t generated if one already exists for the cart

    2. All relevant cart values are copied into the new order.

      1. Customer name will be assigned from a billing address if it’s not available directly from the cart’s customer

      2. If the CartItem has the dependent cart items they will be translated into OrderItem.dependentOrderItems, mimicking the same item to dependent item hierarchical relationships.

    3. OrderProvider sends the new order to OrderServices to persist

  2. CartOrderFulfillmentGenerationService generates new order fulfillment(s) for the cart fulfillments, if the new order was created successfully

    1. Initially, one OrderFulfillment is generated for each FulfillmentGroup in the cart

    2. All relevant fulfillment values are copied into the new order fulfillment

    3. Each new order fulfillment might then be split into multiple based on the vendor for its items

      1. After this, any given order fulfillment will only contain items from one vendor, with one fulfillment option, going to one destination

    4. Each order fulfillment is assigned an identifying "Order Fulfillment Number"

      1. For fulfillments with vendors, the number consists of the vendor reference, then a sequenced integer based on how many fulfillments share that vendor in this order (ex. "VENDOR-1" and "VENDOR-2")

      2. For fulfillments without vendors, the fulfillment option name will be used instead of the vendor reference. For example, "SHIPPING-1" and "SHIPPING-2".

    5. FulfillmentProvider sends the new order fulfillments to OrderServices to persist

  3. An Order Created message is published, containing the generated order and its fulfillments