Orders and their status (E-commerce Store (full stack))

GET /orders → 200 {"orders":[{"id","status","total"}]} (your own, oldest first); GET /orders/<id → the full order, or 404 {"error":"order not found"} (also for someone else’s order). Admins move orders along: POST /admin/orders/<id/status {"status"}: paid → packed → shipped → delivered, and paid or packed → cancelled; anything else → 409 {"error":"cannot go from <a to <b"}. Shipping adds "tracking":"TRK-<order number with 6 digits" to the order.

Input: As before.

Output: As before.

Difficulty: Hard. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • A table of allowed next states per state.

More E-commerce Store (full stack) practice