Skip to main content

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

DateVersionChangeAuthor
2026-05-10v1.0Initial creation

TC-SM-001 — Deposit valid transitions 🆕 NEW

Precondition: A deposit transaction exists in the correct starting state for each test case.

#TransitionHow to triggerExpected ResultActual Result
1pending → processingGateway returns in-progress statusAllowed; transaction status updated
2processing → completedGateway confirms successAllowed; wallet credited
3processing → failedGateway reports errorAllowed
4processing → expiredDEPOSIT_TIMEOUT_MS exceededAllowed
5processing → cancelledUser or admin cancelsAllowed
6awaiting_admin → completedAdmin approves manual game depositAllowed
7awaiting_admin → rejectedAdmin rejectsAllowed
8retry_scheduled → processingRetry worker picks up the transactionAllowed

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.

#TransitionHow to triggerExpected ResultActual Result
1completed → pendingAttempt to reverse a completed transactionHTTP 409 — Transition not allowed
2completed → processingAttempt to move completed back to processingHTTP 409 — Transition not allowed
3failed → completedAttempt direct jump without going through the correct pathHTTP 409 — Transition not allowed
4rejected → completedAttempt to complete a rejected transactionHTTP 409 — Transition not allowed
5Wallet unchanged on rejected transitionAttempt any invalid transition → Check walletbalance and reservedBalance remain unchanged

TC-SM-003 — Withdrawal valid transitions 🆕 NEW

#TransitionHow to triggerExpected ResultActual Result
1pending → approvedAdmin approvesAllowed
2approved → processingPayout adapter calledAllowed
3processing → completedPayout succeedsAllowed; wallet debited
4pending → rejectedAdmin rejectsAllowed; reserved balance released

TC-SM-004 — Withdrawal invalid transitions 🆕 NEW

#TransitionHow to triggerExpected ResultActual Result
1completed → pendingAttempt to reverseHTTP 409 — not allowed
2approved → rejectedAttempt to skip the processing stepHTTP 409 — not allowed
3rejected → approvedAttempt to recover a rejected withdrawalHTTP 409 — not allowed