Define the canonical order lifecycle and transition guard framework.
Current status: first-release scaffold for early protocol compatibility.
app/domain/order/order_state.py
app/domain/order/order_aggregate.py
app/application/usecases/transition_order.py
app/application/services/order_event_publisher.py
create_order(intent_id, accepted_quote_id) initializes order in CREATED.
transition(order_id, action, actor, payload) validates and applies state move.
get_order_timeline(order_id) returns ordered transition history.
recover_pending_orders(now_ts) handles timeout and stuck states.
CREATED
NEGOTIATING
PAYMENT_PENDING
PAID
FULFILLING
COMPLETED
CANCELED
FAILED
ORDER_CREATED at initialization.
ORDER_COMPLETED when terminal success is reached.
runtime/src/domain/order-state-machine.js
runtime/tests and npm test in runtime/.
共 1 个版本