Loading LLD design...
Design an object-oriented digital wallet service that supports user registration with KYC, wallet management (credit, debit, freeze/unfreeze), peer-to-peer transfers, and multiple payment methods (bank account, credit card, UPI).
Every transaction follows a lifecycle (PENDING → COMPLETED / FAILED / REVERSED). The system ensures balance integrity (no negative balance), atomic transfers, and provides transaction history. Payment methods are abstracted via the Strategy pattern for extensibility.
Register user and create wallet
Sign up a user, auto-create a wallet with zero balance
Add funds (top-up)
Load money into the wallet from a linked payment method (bank, card, UPI)
Withdraw funds
Transfer money from wallet back to a linked payment method
Peer-to-peer transfer
Send money from one user's wallet to another user's wallet
Refund a transaction
Reverse a completed transaction, restoring both wallets
View balance and statement
Check current balance and view recent transaction history
Freeze / unfreeze wallet
Temporarily block all transactions on a wallet (fraud, request)
KYC verification
Verify user identity; may gate higher transaction limits
Before diving into code, clarify the use cases and edge cases. Understanding the problem deeply leads to better class design.
Identify the primary actions users will perform. For a parking lot: park vehicle, exit vehicle, check availability. Each becomes a method.
Who interacts with the system? Customers, admins, automated systems? Each actor type may need different interfaces.
What are the limits? Max vehicles, supported vehicle types, payment methods. Constraints drive your data structures.
What happens on overflow? Concurrent access? Payment failures? Thinking about edge cases reveals hidden complexity.