Business features
1. Hierarchy management
Super Agent manages the Agents → Shops → Players tree:
flowchart TB
SA[Super Agent] --> A1[Agent 1]
SA --> A2[Agent 2]
A1 --> S1[Shop A]
A1 --> S2[Shop B]
S1 --> P1[Player]
| Action | API |
|---|---|
| Move shop to another agent | PATCH /super-agent/shops/:id/move |
| Move player to another shop | PATCH /super-agent/players/:id/move |
| Suspend/unsuspend agent | PATCH .../agents/:id/suspend|unsuspend |
2. Create & configure Agent
Create new agent at /agents/new:
- Username, email, password, cost rate
- Popup permissions
- Game mappings
Agent detail (/agents/:agentId):
- Update rate, password, name
- Distribute/withdraw credits
- Enable/disable game providers
3. Wallet & Credits
Buy credits
- Crypto (Zerox static wallets) or USD → credits
- Payment return:
/payment/return
Credit distribution
| Flow | API |
|---|---|
| Super Agent → Managed Agent | POST /super-agent/agents/:id/credits/distribute |
| Super Agent → Shop | POST /agent/credits/distribute |
| Withdraw from agent | POST /super-agent/agents/:id/credits/withdraw |
4. Shop governance
- Create shop (
POST /agent/shops) - Suspend/unsuspend, change password, popup permission
- View separate CDN wallet + USD wallet ledger
- Update cost rate (
PATCH /super-agent/shops/:id/rates)
5. USD crypto withdrawal
Flow similar to Agent Portal:
- Check OTP eligibility
- Send/verify OTP
- Preview fees
- Create withdrawal
Limits: GET /super-agent/portal-withdrawal-limits
6. Fraud & Communication
- Fraud: filter by shop, profit analysis, resolve
- Broadcast: receive via bell, send if
can_delegate_popups - Popup: modes
once/sticky_daily
7. Comparison with Agent Portal
| Feature | Super Agent | Agent |
|---|---|---|
| Agent management | ✅ Create, suspend, rates | — |
| Move shop/player | ✅ | — |
| Shop management | ✅ System-wide | ✅ Own shops |
| Create shop | ✅ | ✅ |
| Game mappings (agent level) | ✅ | ✅ (shop level) |
| Provider fees | Read-only | Read-only |
Implementation notes
- Dev port 3003 — avoids clash with admin (3000); note agent also uses 3003 in
.env.example. - API prefix
/super-agent-authand/super-agent/*— not/agent-auth. - Repo README may be outdated — prefer actual code.
- Backend CORS: add domain to
domainstable orDISABLE_CORS=truefor dev.