Changes between Initial Version and Version 1 of UC0003


Ignore:
Timestamp:
09/24/26 13:50:05 (4 days ago)
Author:
231285
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UC0003

    v1 v1  
     1= Use-case 0003 — Deposit virtual funds =
     2
     3'''Initiating actor:''' Trader
     4
     5'''Other actors:''' —
     6
     7A logged-in Trader tops up their virtual cash balance. This is a simulation-only operation; no real money changes hands. The operation writes to two tables — the user row and the ledger — inside a single transaction.
     8
     9== Scenario ==
     10
     11 1. Trader chooses "Deposit virtual funds" from the authenticated menu.
     12 2. System prompts for an amount in USD.
     13 3. Trader enters an amount.
     14 4. System validates: amount must parse as a positive number.
     15 5. System opens a transaction and increments the balance:
     16
     17{{{
     18BEGIN;
     19
     20UPDATE project.users
     21   SET available_balance = available_balance + $1,
     22       updated_at        = now()
     23 WHERE id = $2;
     24
     25INSERT INTO project.transactions (user_id, type, amount, currency, description)
     26VALUES ($2, 'deposit', $1, 'USD', 'Virtual deposit');
     27
     28COMMIT;
     29}}}
     30
     31 6. System confirms "Deposited X USD." and returns to the authenticated menu.
     32
     33=== Alternate flow 4a — invalid input ===
     34
     35If the amount is non-positive or non-numeric, system responds "Invalid amount." and scenario returns to step 2.
     36
     37=== Verification query ===
     38
     39To see the balance after the deposit, the Trader can trigger UC0006, or directly:
     40
     41{{{
     42SELECT available_balance, invested_balance
     43  FROM project.users
     44 WHERE id = $1;
     45}}}