Skip to content

8.2 Order Service - Domain and Validation

Sprint: Sprint 08 - Order and Payment
Feature ID: 8.2
Subtasks: 8.2.1, 8.2.2

Objective

Deliver "Order Service - Domain and Validation" within Sprint 08 - Order and Payment.

Dependencies

Aggregated from the subtasks below (prerequisite task IDs and enablers):

  • 8.1.2
  • 8.2.1
  • 6.3.1
  • 7.4.4

Subtasks

8.2.1 Order domain model and status machine

  • ID: 8.2.1
  • Title: Implement Order aggregate with status transitions
  • Description: Order aggregate enforcing DRAFT -> PENDING_PAYMENT -> PAID -> FULFILLED and -> CANCELLED transitions (FR-11), with OrderItem lines carrying a price snapshot. Illegal transitions throw BusinessRuleException.
  • Business Purpose: Encode the order lifecycle as invariants (FR-11).
  • Inputs: FR-11, analysis Section 10.3.
  • Outputs: Domain aggregate + entities.
  • Acceptance Criteria:
  • Valid transitions succeed; e.g. FULFILLED->PENDING_PAYMENT throws BusinessRuleException.
  • Dependencies: 8.1.2
  • Complexity: M

8.2.2 Synchronous customer and price validation (Feign + Resilience4j)

  • ID: 8.2.2
  • Title: Implement synchronous customer check and catalog price snapshot
  • Description: At order creation, synchronously call customer-service (customer exists and is ACTIVE) and product-catalog-service (price-quote 7.4.4) via OpenFeign, wrapped in a Resilience4j circuit breaker/retry. Store the returned price as an immutable snapshot on the order item (analysis 9.1).
  • Business Purpose: Immediate validation and price snapshotting before committing an order (FR-09).
  • Inputs: analysis Section 9.1, FR-09, NFR-10.
  • Outputs: Feign clients + circuit breakers + snapshot logic.
  • Acceptance Criteria:
  • Ordering for a non-existent/inactive customer is rejected; the order item stores the catalog price snapshot; downstream failure trips the breaker and surfaces DependencyFailureException.
  • Dependencies: 8.2.1, 6.3.1, 7.4.4
  • Complexity: L

Acceptance Criteria

Each subtask above carries its own objective, testable acceptance criteria. This feature is complete when every subtask's acceptance criteria are met.

Deliverables

  • Domain aggregate + entities.
  • Feign clients + circuit breakers + snapshot logic.

Definition of Done

  • All subtasks (8.2.1, 8.2.2) completed and their acceptance criteria verified.
  • All listed dependencies satisfied.
  • Build and tests green per the global conventions in ../README.md (Section 3).