Skip to main content

Fee Calculation — Test Cases

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


Changelog

DateVersionChangeAuthor
2026-06-25v1.1Added withdrawal payment-gate minimum fee (paymentGateFeeMinUsd) test cases
2026-05-10v1.0Initial creation

TC-FEE-001 — Deposit Fee Logic 🆕 NEW

Precondition: Fee configured in payment_provider_fee_configs. A shop-linked player is needed to verify the shop USD wallet impact.

#DescriptionStepsExpected ResultActual Result
1Player receives full credits — fee is not deducted from creditsDeposit $10 with feeRate=10% → Check player walletPlayer receives 10 credits (not 9)
2Fee is deducted from the shop's USD shareShop receives USD after player deposits $10 with feeRate=10%Shop USD wallet: +$9 (shop receives $10 − $1 fee)
3Shop profit calculated correctlyshopRate=0.80; player deposits $10; fee=10%Shop profit = $9 − (10 × $0.80) = $9 − $8 = $1
4Fee lookup — exact match takes highest priorityFee config exists for both (provider, 'deposit', methodId) and (provider, 'deposit', 'all')The methodId exact-match fee rate is used
5Fee lookup — fallback to 'all' when no exact matchNo fee for specific methodId; fee exists for (provider, 'deposit', 'all')The 'all' fallback fee rate is used
6Fee lookup — default = 0 when nothing matchesNo fee config exists for the providerplatformFeeRate = 0, platformFeeAmount = 0
7Fee rate is an immutable snapshotCreate a transaction → Change the fee config → Check the old transactionThe fee on the old transaction does not change
8Fee resolution failure is non-blockingSimulate an error in resolveProviderFeeRate()Transaction proceeds with feeRate = 0

TC-FEE-002 — Withdrawal Payment Gate Minimum Fee 🆕 NEW

Precondition: Withdrawal fee config with paymentGateFeeRate and paymentGateFeeMinUsd set for a provider/method. NET receive model active.

#DescriptionStepsExpected ResultActual Result
1Minimum fee applies when percent is lowerConfigure gate 1%, min $2.60 → Player withdraws $10 NETgatewayFeeAmount = $2.60, gatewayPayoutUsd = $12.60
2Percent fee applies when higher than minimumSame config → Player withdraws $500 NETgatewayFeeAmount = $5.00 (1%), gatewayPayoutUsd = $505.00
3Zero minimum behaves as percent-onlypaymentGateFeeMinUsd = 0, gate 1% → withdraw $10 NETgatewayFeeAmount = $0.10, gatewayPayoutUsd = $10.10
4Min fee does not change player NET receiveAny withdrawal with min fee configuredPlayer still receives exactly the requested netPayoutUsd; extra cost is on funding tier + gateway payout
5Min fee snapshot is immutableComplete withdrawal → change min in admin config → check old transactionOld transaction keeps original gatewayFeeAmount / gatewayPayoutUsd
6Admin can configure min per provider/methodAdmin Portal → Provider Fees → withdrawal row → set "Payment gate min fee (USD)"Value saved in payment_provider_fee_configs.payment_gate_fee_min_usd
7Deposit fees ignore gate minimumDeposit with same provider config that has min on withdrawalDeposit fee uses percent on gross only; min not applied