Skip to main content

Order state machine

Enforced by VALID_ORDER_TRANSITIONS in two files that were identical on 2026-10-01:

The header comment is not the map

The comment lists a shorter set of transitions. It omits ON_HOLD, and it omits several DISPUTED, PARTIALLY_RETURNED, and RETURNED edges that the map includes. The map is what isValidOrderTransition runs.

isValidOrderTransition returns true when from is null or undefined. That allows any initial status when there is no current status. Business intent of that shortcut is unknown.

Allowed transitions​

FromTo
PENDINGCONFIRMED, ON_HOLD, CANCELLED, DISPUTED
ON_HOLDPENDING, CONFIRMED, CANCELLED
CONFIRMEDON_HOLD, PARTIALLY_FULFILLED, FULFILLED, CANCELLED, DISPUTED
PARTIALLY_FULFILLEDFULFILLED, CANCELLED, DISPUTED
FULFILLEDDELIVERED, RETURN_REQUESTED, DISPUTED
DELIVEREDRETURN_REQUESTED, CLOSED, DISPUTED
CANCELLEDREFUNDED
RETURN_REQUESTEDRETURN_RECEIVED, CANCELLED, DISPUTED
RETURN_RECEIVEDPARTIALLY_RETURNED, RETURNED, REFUNDED, PARTIALLY_REFUNDED, DISPUTED
PARTIALLY_RETURNEDRETURNED, RETURN_REQUESTED, PARTIALLY_REFUNDED, REFUNDED, CLOSED, DISPUTED
RETURNEDREFUNDED, PARTIALLY_REFUNDED, CLOSED, DISPUTED
REFUNDEDCLOSED
PARTIALLY_REFUNDEDCLOSED, RETURN_REQUESTED, DISPUTED
DISPUTEDREFUNDED, CLOSED, PENDING
CLOSEDnone

The diagram omits a few edges that the table includes (PARTIALLY_RETURNED to refund and return-requested, RETURNED to PARTIALLY_REFUNDED, PARTIALLY_REFUNDED to RETURN_REQUESTED and DISPUTED) so it stays readable. The table is complete.

Cancellation​

CANCELLED is reachable from PENDING, ON_HOLD, CONFIRMED, PARTIALLY_FULFILLED, and RETURN_REQUESTED. Downstream stock release is whatever order.status.changed listeners do. Whether cancellation of a partially fulfilled order restocks picked units is unknown.

Which transitions the admin UI exposes​

Unknown. The map is the server rule. It does not say which buttons operators can click.