Tracking and cancelling (E-commerce Store (full stack))

Every status change (including the first paid) is recorded as {"at","status"}, where at is the number of the request (counting every request line from 1). GET /orders/<id/tracking → 200 {"events":[…],"status","tracking"} (tracking null until shipped). POST /orders/<id/cancel lets a customer cancel a paid or packed order → 200 {"order":…} with "refund":<total, and the items go back into stock; otherwise 409 {"error":"cannot cancel a <status order"}. Admin cancellations refund too.

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

  • Cancelling is just another status change, plus a refund and a restock.

More E-commerce Store (full stack) practice