Orders (v1.0.0)

Manages the lifecycle of customer orders in the BookWorm e-commerce system

Overview

The Ordering domain represents a strategic core domain within the BookWorm system, responsible for managing the complete lifecycle of customer orders from creation through fulfillment. As a core domain, it embodies critical business capabilities that directly impact the organization’s competitive advantage.

Domain Characteristics

  • Bounded Context: The Ordering domain has a well-defined boundary with explicit integration points between its constituent services (Ordering, Basket, Finance, and Notification) through gRPC communication.

  • Service Architecture: The domain is composed of four specialized services:

    • Ordering Service: Core service managing order lifecycle and state
    • Basket Service: Handles shopping cart and item management
    • Finance Service: Manages payment processing and financial transactions
    • Notification Service: Handles customer communications and alerts
  • Event Sourcing: The domain implements event sourcing as its persistence mechanism, storing the complete history of order-related events rather than just the current state. This approach provides a comprehensive audit trail and enables temporal queries and state reconstruction at any point in time.

Event Storming Session

The event storming session for the Ordering domain was conducted to identify key events, commands, and aggregates. The session included stakeholders from various teams, including business analysts, developers, and product owners. The following key events were identified:

Business Rules and Invariants

  • Orders must contain at least one item to be submitted
  • Order status transitions follow a predefined state machine (e.g., Placed -> Completed or Cancelled)
  • Cancellation is only permitted before the “Shipped” status
  • Price calculations and summaries are validated against business rules
  • Basket items must be reserved before order confirmation
  • Financial transactions must be atomic and consistent

The domain handles complex business scenarios like partial fulfillment, order modifications, and cancellations while maintaining consistency and enforcing business rules throughout the order lifecycle.

Architecture diagram

Messages for this domain

Sends messages (12)

Quickly find the message you need by searching for the name, type, or summary.
NameVersionTypeSummary
User Checked Out
v1.0.0eventRepresents an integration event when a user has completed the checkout process
Order Staus Changed to Complete
v1.0.0eventRepresents an integration event when an order status is changed to complete
Order Status Changed To Cancel
v1.0.0eventRepresents an integration event when an order status is changed to cancel
Basket Deleted Complete
v1.0.0eventRepresents a domain event that is published when reverse basket is completed

Receives messages (32)

Quickly find the message you need by searching for the name, type, or summary.
NameVersionTypeSummary
Get Order Summary
v1.0.0queryGet order summary from event store
List Orders
v1.0.0queryGet orders in a paged format
Create Order
v1.0.0commandCreate order for a customer
Get Order
v1.0.0queryGet order detail by order id

Ordering process (sequence diagram)

Loading graph...