Problem statement
Design the object model and core APIs for a stored-value gift-card manager that issues cards, redeems them across purchases, and keeps balances correct, for a single retailer.
Operating context. A card is issued with an initial value and a unique redeemable identifier, then activated. It is debited by partial redemptions across many purchases, may be reloaded (topped up), and a prior redemption may be reversed. A balance must never go negative, and a card may pay for part of an order alongside other tenders. The same card can be presented at two terminals at once, so double-spend must be impossible. Cards may be frozen, and dormant/expired cards follow a validity rule. The whole thing is a single in-process service with money in one currency.
Out of scope. Payment-processor settlement, physical card printing/plastics, fraud detection, the order/checkout engine, and the admin UI.
What to produce. The class hierarchy (GiftCard, Money value object, the transaction ledger, GiftCardService facade), the public API each exposes, and the card lifecycle states (issued, active, frozen, depleted, expired). Be explicit about: how the balance is kept auditable and never negative, how two concurrent redemptions of one card cannot double-spend, and how partial redemption and reversal are represented.
Requirements
This assessment is a Premium feature.
The statement above is free to read. The functional and non-functional requirements, and the graded canvas that scores your design against them, come with Premium.
Topics
- System Design LLD
- Commerce Payments
- Concurrency Locks
- Patterns State
- Oop Solid