API Endpoints & Error Handling — Test Cases
Feature version: v1.0
Reference doc: Deposit Technical Reference — API Endpoints
Result notation: ✅ Pass | ❌ Fail | ⏭ Skip | 🐛 Fail + bug report
Changelog
| Date | Version | Change | Author |
|---|---|---|---|
| 2026-05-10 | v1.0 | Initial creation | — |
TC-API-001 — Player-facing Endpoints 🆕 NEW
| # | Endpoint | Test case | Expected Result | Actual Result |
|---|---|---|---|---|
| 1 | POST /api/payment/deposit | No auth token | HTTP 401 | |
| 2 | POST /api/payment/deposit | Authenticated player, valid payload | Transaction created successfully; paymentUrl returned | |
| 3 | GET /api/payment/deposit-history | Authenticated player | Returns only that player's transactions (no cross-player data) | |
| 4 | GET /api/payment/balance | Authenticated player | Returns { balance, reservedBalance } | |
| 5 | GET /api/payment/reserved-balance-detail | Authenticated player | Returns a detailed breakdown of the reserved balance | |
| 6 | GET /api/payment/supported-methods | Authenticated player | Returns only active payment methods | |
| 7 | GET /api/payment/provider-fee-rate | Authenticated player, valid provider | Returns the correct fee rate | |
| 8 | GET /api/payment/zeroxprocessing/coins | Authenticated player | Returns the list of supported 0x coins |
TC-API-002 — Shop-facing Endpoints 🆕 NEW
| # | Endpoint | Test case | Expected Result | Actual Result |
|---|---|---|---|---|
| 1 | POST /api/shop/deposits | Shop auth; player belongs to shop; shop has credits | Credits transferred successfully | |
| 2 | POST /api/shop/deposits | Shop auth; player does not belong to shop | HTTP 400 or 403 | |
| 3 | POST /api/shop/deposits | No auth token | HTTP 401 | |
| 4 | GET /api/shop/deposits | Shop auth | Returns only that shop's deposit history (no cross-shop data) |
TC-API-003 — Error Responses 🆕 NEW
| # | Description | How to trigger | HTTP Status | Expected message |
|---|---|---|---|---|
| 1 | User inactive | Deposit with player status = 'inactive' | 403 | "Account is not active" |
| 2 | Invalid amount | amount = 0 or negative | 400 | "Invalid amount" |
| 3 | Unknown game provider | gameProviderId not found in DB | 400 | "Provider not found" |
| 4 | Payment adapter failure | Simulate gateway being down | 500 | "Gateway error" |
| 5 | Webhook signature invalid | Send webhook with incorrect HMAC | 403 | "Signature mismatch" |
| 6 | Invalid state transition | Attempt a disallowed status change | 409 | "Transition not allowed" |