How Many Tickets Can You Refund?
Track purchased, refunded, and remaining tickets through ordinary refunds, excessive quantities, replay, and negative input.
You’re reading a preview. Premium includes the full lesson and specialist practice. View the full curriculum.
Two tickets do not allow three refunds
Mia buys two tickets at £10 each. A refund request identifies her order and asks for a quantity. The server checks that she owns the order and uses its stored price. What else must it check before crediting her wallet?
It needs to know how many tickets remain refundable.
Keep the remaining quantity visible
| Purchased | Already refunded | Still refundable |
|---|---|---|
| 2 | 0 | 2 |
| 2 | 1 | 1 |
| 2 | 2 | 0 |
The original route never checks that the requested quantity is positive and within the remaining amount. It can calculate a price correctly for a quantity the customer has no right to refund.
The picker represents £10 as 1000 minor units so the arithmetic uses an integer. Its scenarios are separate fixtures; a selected scenario states its own purchased and refunded quantities.