Skip to main content

Deposit — Test Cases

Feature version: v1.0
Reference doc: Finance System · Deposit Technical Reference
Result notation: ✅ Pass | ❌ Fail | ⏭ Skip | 🐛 Fail + bug report


Changelog

DateVersionChangeAuthor
2026-05-10v1.0Initial creation

TC-DEP-001 — Flow 1: Player online deposit (Wallet-only) 🆕 NEW

Precondition: Player is a free player (not shop-linked), account is active, no game selected.

#DescriptionStepsExpected ResultActual Result
1Transaction created successfullyPlayer selects amount + method → POST /api/payment/depositReturns { transactionId, paymentUrl, status: 'pending', expiresAt }
2transactionId format at creationCheck the transactionId in the responseFormat is TEMP_{timestamp}_{userId}
3Initial status is pendingCheck DB after creationstatus = 'pending'
4Status transitions after IPN receivedSimulate a successful IPN from the gatewayStatus: pending → processing → completed
5Credits land in master wallet after completionComplete a $10 deposit → Check walletbalance += 10 credits
6Inactive player cannot depositSet player status = 'inactive' → Attempt depositHTTP 403 "Account is not active"
7Negative amount is rejectedPOST deposit with amount = -5HTTP 400 "Invalid amount"
8Zero amount is rejectedPOST deposit with amount = 0HTTP 400 "Invalid amount"

TC-DEP-002 — Flow 1 (variant): Direct-to-game deposit 🆕 NEW

Precondition: Player is active. Game provider exists and depositType ≠ 'manual'.

#DescriptionStepsExpected ResultActual Result
1walletFlow is set correctlyPOST deposit with a valid gameProviderId → Check transactionwalletFlow = 'master_to_game'
2Credits go to inGameBalanceComplete a $10 direct-to-game deposit → Check user_game_walletsinGameBalance += 10
3syncStatus = 'pending' after payment completesCheck after gateway callbacksyncStatus = 'pending'
4After game sync completesWait for async sync job to finishsyncStatus = 'completed'; walletBalance and inGameBalance match
5Unknown game provider is rejectedPOST deposit with a gameProviderId not in DBHTTP 400 "Provider not found"

TC-DEP-003 — Flow 2: Shop Player Deposit (CDN Flow) 🆕 NEW

Precondition: Player is linked to a Shop. Prepare two scenarios: shop with sufficient credit and shop with zero credit.

#DescriptionStepsExpected ResultActual Result
1Shop has credit — shop wallet is debitedShop has 50 credits; player deposits $10 → CompleteShop master wallet: −10 credits; Player master wallet: +10 credits
2Shop has credit — shop receives USD (fee=0)Check Shop USD wallet after player deposits $10 with feeRate=0%Shop USD wallet: +$10
3Shop has credit — shop receives USD minus feefeeRate=10%, player deposits $10Shop USD wallet: +$9 (fee $1 deducted)
4Shop lacks credit — online deposit blocked at APIShop = 0 credits; player attempts POST /api/payment/deposit or GET /deposit-precheckHTTP 400; message: The shop currently cannot process online deposit transactions. Please visit the shop in person to complete this action.; no payment URL created
5Shop lacks credit — no credits after gateway (defense in depth)Shop had credit at deposit creation but insufficient at IPN settlementSettlement fails (strictShopPayer); player does not receive credits; manual ops follow-up
6Free player unaffected when shop has zero creditPlayer has no shop_id; shop unrelatedDeposit proceeds; system payer credits player as Flow 1

TC-DEP-004 — Flow 3: Shop Counter Deposit (Cashier) 🆕 NEW

Precondition: Shop is active, player belongs to the shop, shop master wallet has sufficient credits.

#DescriptionStepsExpected ResultActual Result
1Staff transfers credits successfullyShop portal → "Transfer to Player" → Enter player + amount → ConfirmShop wallet: −amount; Player wallet: +amount
2CashierTransaction is created with the correct typeCheck DB after transfercashier_transactions.type = 'deposit_credits'
3paymentMethod = 'cash' is saved correctlyTransfer with paymentMethod = 'cash'cashier_transactions.paymentMethod = 'cash'
4paymentMethod = 'bank_transfer' is saved correctlyTransfer with paymentMethod = 'bank_transfer'cashier_transactions.paymentMethod = 'bank_transfer'
5Player not belonging to the shop is rejectedAttempt to transfer credits to a player from a different shopError — player does not belong to this shop
6Inactive shop cannot perform transferSet shop status = 'inactive' → Attempt cashier depositHTTP 4xx — shop is not active

TC-DEP-005 — Flow 4: Multi-Game Deposit 🆕 NEW

Precondition: Player is active. At least 2 game providers exist. One should have depositType = 'manual' to test the manual_pending branch.

#DescriptionStepsExpected ResultActual Result
1$50 allocated across 3 games (all auto)Create deposit with allocations: [{game1: $20}, {game2: $20}, {game3: $10}] → CompleteEach game wallet credited with the correct amount
2multiGameProcessedAt is set after processingCheck syncMetadata after completionsyncMetadata.multiGameProcessedAt contains an ISO timestamp
3Total allocation equals deposited amountCheck syncMetadata.totalAmountDepositedtotalAmountDeposited = 50
4Game with depositType = 'manual'manual_pendingInclude an allocation for a manual-type gameallocationResults[i].status = 'manual_pending'; manual deposit request created
5Idempotency — processing the same transaction twiceTrigger processMultiGameDeposit() a second time for the same transactionNo double-credit (skipped because multiGameProcessedAt already exists)

TC-DEP-006 — Flow 5: CDN Credit Purchase (Agent / Shop buying credits via gateway) 🆕 NEW

Precondition: Shop or Agent account exists. Payment gateway is operational.

#DescriptionStepsExpected ResultActual Result
1Shop buys credits successfullyShop pays $80 via gateway, costRate=0.80Shop credit wallet: +100 credits
2Credit amount calculated correctly from costRatecostRate=0.80; grossUsd=$80creditComputed = 80 / 0.80 = 100
3Shop USD wallet is credited after purchaseCheck shop USD wallet after CDN purchase completesbalanceGross += 80; balanceNet += 80 − fee
40x insufficient status above threshold → completed0x webhook returns status='insufficient' but receivedUsd ≥ expected × (1 − feeRate)Transaction marked completed; syncMetadata.receivedNetUsd stores the actual received amount
50x insufficient status below threshold → not settledreceivedUsd < expected × (1 − feeRate)Transaction is not settled