Skip to main content

Crypto Withdrawal Confirmation — Test Cases

Feature version: v1.0
Reference doc: Withdrawal — Crypto Amount Confirmation
Result notation: ✅ Pass | ❌ Fail | ⏭ Skip | 🐛 Fail + bug report


Changelog

DateVersionChangeAuthor
2026-05-10v1.0Initial creation — feature not yet deployed

TC-CRYPTO-001 — API /api/payment/crypto-estimate 🆕 NEW

Precondition: Player has a valid auth token. BTCPay and 0xProcessing are operational.

#DescriptionStepsExpected ResultActual Result
1BTC estimate (BTCPay path)GET /api/payment/crypto-estimate?withdrawalType=bitcoin_transfer&netUsd=98Returns { coin:'BTC', provider:'btcpay', estimatedCryptoAmount, rateUsd, source:'btcpay_rates_api', fetchedAt }
2LTC estimate (BTCPay path)withdrawalType=litecoin_transfer&netUsd=98coin: 'LTC'; estimate reflects current LTC/USD rate
3DOGE estimate (BTCPay path)withdrawalType=dogecoin_transfer&netUsd=98coin: 'DOGE'; estimate reflects current DOGE/USD rate
4USDT estimate (0xProcessing path)withdrawalType=zerox_usdt&netUsd=98{ coin:'USDT', provider:'zeroxprocessing', estimatedCryptoAmount ≈ 98, rateUsd ≈ 1 }
5ETH estimate (0xProcessing path)withdrawalType=zerox_eth&netUsd=98coin: 'ETH'; estimate reflects current ETH/USD rate
6Missing withdrawalType paramCall API without withdrawalTypeHTTP 400
7Missing netUsd paramCall API without netUsdHTTP 400
8netUsd = 0Pass netUsd=0Estimate skipped or returns 0
9Unsupported 0x coinwithdrawalType=zerox_fakecoinHTTP 422 with reason: 'coin_not_supported'
10No auth tokenCall API without a tokenHTTP 401
11fetchedAt is valid ISO-8601Check response fieldfetchedAt format: YYYY-MM-DDTHH:mm:ss.sssZ

TC-CRYPTO-002 — Confirm modal display (Frontend) 🆕 NEW

Precondition: Player has entered an amount and wallet address. Estimate API returns successfully.

#DescriptionStepsExpected ResultActual Result
1BTC: estimate shown with prefixWithdraw BTC → Open confirm modalShows ≈ 0.00101234 BTC
2BTC: rate line formatCheck the rate line in the BTC modalRate: 1 BTC = $XX,XXX.XX (live estimate)
3USDT: stablecoin note displayedWithdraw USDT → Open modalShows 1 USDT ≈ $1.00 — stablecoin
4Wallet address is maskedLong wallet address in modalDisplays as <first 6 chars>...<last 4 chars>
5BTCPay disclaimer is correctCheck modal for BTC withdrawalContains "Final amount determined by BTCPay at payout time"
60xProcessing disclaimer is correctCheck modal for USDT withdrawalContains "Final amount confirmed by 0xProcessing at payout time"
7Bank transfer shows no crypto sectionSelect bank_transfer → Open modalNo "Estimated crypto payout" section visible
8BTC: 8 decimal placesCheck BTC amount format0.00101234 (8 decimal places)
9DOGE: 2 decimal placesCheck DOGE amount formatXX.XX DOGE
10USDT: 2 decimal placesCheck USDT amount format98.00 USDT

TC-CRYPTO-003 — Edge cases 🆕 NEW

#DescriptionStepsExpected ResultActual Result
1Estimate API timeout → modal still opensSimulate API timeout (> 10 s)Modal opens without the crypto section; player can still submit
2Estimate API 500 error → modal still opensSimulate API HTTP 500Modal opens without the crypto section; submission is not blocked
3Modal open > 2 minutes → "Rate may be stale" badgeLeave the confirm modal open for more than 2 minutesBadge appears: "Rate may be stale — close and reopen to refresh"
4Rate does not auto-refresh inside modalWait > 2 minutes in modalRate is not automatically updated (prevents race conditions)
5BTCPay testnet → (testnet) labelUse a testnet environment(testnet) label displayed next to the coin symbol
6USDT rate deviates > 2% from $1.000xProcessing returns an anomalous rateResult is still displayed; warning is logged but user is not blocked

TC-CRYPTO-004 — Estimate snapshot stored in transaction metadata 🆕 NEW

Important: The snapshot is audit data only — it must never be used in any financial calculation on the backend.

#DescriptionStepsExpected ResultActual Result
1Snapshot saved to metadataSubmit a crypto withdrawal with cryptoEstimateSnapshot in the bodytransaction.metadata.cryptoEstimateSnapshot contains all required fields
2Snapshot contains all required fieldsCheck DB{ coin, rateUsd, estimatedCryptoAmount, source, fetchedAt } all present
3Snapshot does not affect payout amountSubmit a snapshot with a wrong rate → Admin approvesPayout amount is still computed from real-time netPayoutUsd
4Bank transfer → snapshot is nullSubmit a bank_transfer withdrawalmetadata.cryptoEstimateSnapshot = null or field absent
5Pre-feature transaction has no snapshotCheck a transaction created before this feature was deployedmetadata.cryptoEstimateSnapshot is null or absent