Skip to content

Order Status Workflow

  • Complexity: High
  • Stack: Full-stack (Backend-heavy)

As an admin user, I want to update order statuses through a defined workflow so that customers can track their order progress.

Description

The Order entity currently has no status field - orders are created via OrderController (POST /api/orders) and processed by OrderService using the strategy pattern for stock allocation, but there is no lifecycle tracking after creation. This story introduces a status field, a state machine that defines valid transitions, and provides an interface to manage order progression. Customers see their order's current status in the orders-overview-page and order-detail-page.

Order Statuses

StatusDescription
NEWInitial state - every order that is not saved yet
SAVEDOrder is saved but still editable (add/remove products, change delivery address, etc.)
PLACEDOrder is placed and no longer editable (waiting for delivery)
CANCELEDOrder is not valid anymore (will not be delivered)

Order Status Flow

Acceptance Criteria

  • [ ] New orders are created with status NEW during the existing order creation flow in OrderService
  • [ ] User can save an order: NEW -> SAVED (order becomes editable)
  • [ ] User can place an order: NEW -> PLACED or SAVED -> PLACED
  • [ ] Admin can cancel an order: SAVED -> CANCELED or PLACED -> CANCELED
  • [ ] Placed and canceled orders cannot be modified further
  • [ ] Attempting an invalid transition (e.g., CANCELED -> NEW) returns a clear error
  • [ ] Admin order detail page shows the current status and only valid next-status actions
  • [ ] Customers see the current status of their orders in orders-overview-page (via order-card) and order-detail-page
  • [ ] Non-admin users cannot cancel orders
  • [ ] Status changes persist after page reload

Resources

Copyright © MSG Systems Romania AI Labs