Transaction State Machine — Test Cases
Feature version: v1.0
Reference doc: Deposit Technical Reference — State Machine
Result notation: ✅ Pass | ❌ Fail | ⏭ Skip | 🐛 Fail + bug report
Changelog
| Date | Version | Change | Author |
|---|---|---|---|
| 2026-05-10 | v1.0 | Initial creation | — |
TC-SM-001 — Deposit valid transitions 🆕 NEW
Precondition: A deposit transaction exists in the correct starting state for each test case.
| # | Transition | How to trigger | Expected Result | Actual Result |
|---|---|---|---|---|
| 1 | pending → processing | Gateway returns in-progress status | Allowed; transaction status updated | |
| 2 | processing → completed | Gateway confirms success | Allowed; wallet credited | |
| 3 | processing → failed | Gateway reports error | Allowed | |
| 4 | processing → expired | DEPOSIT_TIMEOUT_MS exceeded | Allowed | |
| 5 | processing → cancelled | User or admin cancels | Allowed | |
| 6 | awaiting_admin → completed | Admin approves manual game deposit | Allowed | |
| 7 | awaiting_admin → rejected | Admin rejects | Allowed | |
| 8 | retry_scheduled → processing | Retry worker picks up the transaction | Allowed |
TC-SM-002 — Deposit invalid transitions 🆕 NEW
Precondition: A deposit transaction exists in the relevant starting state.
Key assertion: When a transition is rejected, the wallet must not be modified.
| # | Transition | How to trigger | Expected Result | Actual Result |
|---|---|---|---|---|
| 1 | completed → pending | Attempt to reverse a completed transaction | HTTP 409 — Transition not allowed | |
| 2 | completed → processing | Attempt to move completed back to processing | HTTP 409 — Transition not allowed | |
| 3 | failed → completed | Attempt direct jump without going through the correct path | HTTP 409 — Transition not allowed | |
| 4 | rejected → completed | Attempt to complete a rejected transaction | HTTP 409 — Transition not allowed | |
| 5 | Wallet unchanged on rejected transition | Attempt any invalid transition → Check wallet | balance and reservedBalance remain unchanged |
TC-SM-003 — Withdrawal valid transitions 🆕 NEW
| # | Transition | How to trigger | Expected Result | Actual Result |
|---|---|---|---|---|
| 1 | pending → approved | Admin approves | Allowed | |
| 2 | approved → processing | Payout adapter called | Allowed | |
| 3 | processing → completed | Payout succeeds | Allowed; wallet debited | |
| 4 | pending → rejected | Admin rejects | Allowed; reserved balance released |
TC-SM-004 — Withdrawal invalid transitions 🆕 NEW
| # | Transition | How to trigger | Expected Result | Actual Result |
|---|---|---|---|---|
| 1 | completed → pending | Attempt to reverse | HTTP 409 — not allowed | |
| 2 | approved → rejected | Attempt to skip the processing step | HTTP 409 — not allowed | |
| 3 | rejected → approved | Attempt to recover a rejected withdrawal | HTTP 409 — not allowed |