-
Notifications
You must be signed in to change notification settings - Fork 413
Open
Description
Hi, I found an issue in the money transfer logic.
When transferring money, the receiver’s balance doesn’t get incremented.
Instead, it gets replaced by the transfer amount.
The problem comes from this variable:
self.receiver_balance
It’s initialized to 0 and never updated from the database, so the code ends up doing:
balance = transfer_amount
This means the receiver’s old balance is lost.
Example:
If the receiver originally has 300 and I transfer 50 → the final balance becomes 50, not 350.
Expected:
The balance should increase by the transfer amount.
Suggestion:
Update the DB directly using something like:
UPDATE card SET balance = balance + ? WHERE number = ?
This way the balance is always based on the value stored in the database.
Metadata
Metadata
Assignees
Labels
No labels