The Vanishing Credit
A declined return can appear in history without crediting the balance, blocking a later eligible return.
The bug report
You get the whole project — a React front end, an Express API, and Mongoose models — opened in a browser editor. Reproduce the symptom by reading the code, change what’s wrong, and run the hidden tests to prove it.
What the fix must prove
- creates an order and reads back its saved fields
- credits a successful return exactly once and records its history
- rejects a second return for the same order without changing credit
- declines an over-limit return without recording it and permits a later eligible return
- rejects invalid order and return input without changing records
- prevents another customer from reading or returning an order
- requires authentication without changing balances or returns
Related challenges
- The Missing Name — api contract bug, beginner
- The Ghost Update — async / race condition, intermediate
- The Silent Field — database / schema bug, beginner