8.3 Order Service - Application¶
Sprint: Sprint 08 - Order and Payment
Feature ID: 8.3
Subtasks: 8.3.1, 8.3.2, 8.3.3
Objective¶
Deliver "Order Service - Application" within Sprint 08 - Order and Payment.
Dependencies¶
Aggregated from the subtasks below (prerequisite task IDs and enablers):
- 8.2.2
- 8.3.1
Subtasks¶
8.3.1 Create order command and endpoint¶
- ID: 8.3.1
- Title: Implement POST /api/v1/orders with Idempotency-Key
- Description:
CreateOrderCommandcreating an order (DRAFT->PENDING_PAYMENT), persisting items with snapshots, initializingsaga_state, and publishingorder.created.v1via the outbox. Honor theIdempotency-Keyheader so a retried create returns the same order (FR-26 pattern reuse). - Business Purpose: Order placement that starts the saga (FR-09, FR-10).
- Inputs: FR-09, FR-10, event-catalog
order.created.v1. - Outputs: Command, handler, DTOs, endpoint, event, idempotency guard.
- Acceptance Criteria:
- A valid order returns 201, status PENDING_PAYMENT, emits
order.created.v1; replaying the sameIdempotency-Keyreturns the original order without a duplicate. - Dependencies: 8.2.2
- Complexity: L
8.3.2 Get order¶
- ID: 8.3.2
- Title: Implement GET /api/v1/orders/{id}
- Description:
GetOrderQueryreturning the order with items, status, and saga step asApiResult. - Business Purpose: Order visibility for clients and support.
- Inputs: analysis Section 8.3.
- Outputs: Query + endpoint.
- Acceptance Criteria:
- GET returns the order with current status; unknown id returns 404.
- Dependencies: 8.3.1
- Complexity: S
8.3.3 Cancel order and compensation event¶
- ID: 8.3.3
- Title: Implement POST /api/v1/orders/{id}/cancel emitting order.cancelled.v1
- Description:
CancelOrderCommandtransitioning to CANCELLED (only from allowed states) and publishingorder.cancelled.v1(consumed by payment and subscription for compensation, FR-12). - Business Purpose: Order cancellation triggering compensation (FR-12).
- Inputs: FR-12, event-catalog
order.cancelled.v1. - Outputs: Cancel command + endpoint + event.
- Acceptance Criteria:
- Cancelling a PENDING_PAYMENT/PAID order emits
order.cancelled.v1; cancelling a FULFILLED order is rejected with a business-rule error. - Dependencies: 8.3.1
- Complexity: M
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¶
- Command, handler, DTOs, endpoint, event, idempotency guard.
- Query + endpoint.
- Cancel command + endpoint + event.
Definition of Done¶
- All subtasks (8.3.1, 8.3.2, 8.3.3) completed and their acceptance criteria verified.
- All listed dependencies satisfied.
- Build and tests green per the global conventions in ../README.md (Section 3).