Staging Test: Profit & Referral Distribution
Time: 20 minutesPrerequisites: Seed data loaded, tranches exist
Quick Reference
URLs
| Page | URL |
|---|---|
| Admin Cycles | https://zestamc.savibm.com/admin/cycles |
| Fund Admin Cycles | https://zestamc.savibm.com/fund-admin/cycles |
| Profits Page | https://zestamc.savibm.com/investor/profits |
Test Accounts
| Role | OTP | |
|---|---|---|
| Super Admin | admin@zestamc.com | Check email |
| Fund Admin | fundadmin@zestamc.com | Check email |
| Investor | testinvestor@zestamc.com | Check email |
| Institution | institution@zestamc.com | Check email |
Note: FUND_ADMIN users access cycles via/fund-admin/cycles. SUPER_ADMIN users access via/admin/cycles.
Permission Matrix
| Action | FUND_ADMIN | SUPER_ADMIN |
|---|---|---|
| View cycles | ✅ | ✅ |
| Create cycle | ❌ | ✅ |
| Start cycle | ❌ | ✅ |
| Set/update profit rate | ✅ | ❌ |
| Distribute profits | ❌ | ✅ |
| Distribute referrals | ❌ | ✅ |
Note: Rate setting is FUND_ADMIN only. Distribution is SUPER_ADMIN only.
Cycle Status Flow
Fee Split
| User Type | User Share | Platform | Referral Pool |
|---|---|---|---|
| Individual | 50% | 30% | 20% |
| Institution | 70% | 30% | 0% |
Single Fund Setup
The staging database uses a single fund for all users:| Fund | Code | UUID |
|---|---|---|
| Zest Growth Fund | ZGF | 33333333-3333-3333-3333-333333333333 |
Cycles
- Cycle 0: Seed cycle for test users
- Cycles 1-4: Historical cycles from migration (Oct-Nov 2025)
- Next cycle: Cycle 5 (when admin creates new)
Seed Data (Active Tranches - Test Users)
| User | Principal | Type | Linked to Cycle |
|---|---|---|---|
| testinvestor | $10,000 | Individual | Cycle 0 |
| test | $5,000 | Individual | Cycle 0 |
| l2investor | $2,000 | Individual | Cycle 0 |
| l3investor | $3,000 | Individual | Cycle 0 |
| institution | $100,000 | Institution | Cycle 0 |
| Total | $120,000 |
Note: Migrated users (~3,857) are linked to Cycles 1-4.
Test Cases
Test 1: Create Cycle
As:admin@zestamc.com (SUPER_ADMIN)
- Go to Admin → Cycles (
/admin/cycles) - Click “Create Cycle”
- Set dates: Start = today, End = tomorrow
- Click Create
PENDING, rate shows -
Test 1b: Cycle Date Overlap Prevention
As:admin@zestamc.com (SUPER_ADMIN)
Goal: Verify the system prevents creating cycles with overlapping dates
- Go to Admin → Cycles (
/admin/cycles) - Click “Create Cycle”
- Enter dates that overlap with an existing PENDING or PROCESSING cycle
- Observe the form
| Scenario | What You Should See |
|---|---|
| Overlapping dates | Red warning: “Dates overlap with: Cycle X” |
| Submit button | Disabled (cannot submit) |
| Adjacent dates | No warning (allowed: Cycle 1 ends Jan 10, Cycle 2 starts Jan 10 is OK) |
| Non-overlapping | No warning, can submit |
Test 2: Start Cycle
As:admin@zestamc.com (SUPER_ADMIN)
- Go to Admin → Cycles (
/admin/cycles) - Find PENDING cycle
- Click “Start Cycle”
- Enter OTP from email
PROCESSING
Test 3: Set Profit Rate
As:fundadmin@zestamc.com (FUND_ADMIN)
Permission Requirement: Setting profit rate requires FUND_ADMIN role. SUPER_ADMIN cannot set rates (separation of duties). FUND_ADMIN users access cycles via /fund-admin/cycles.
- Login as
fundadmin@zestamc.com(use OTP from email) - You will be redirected to Fund Admin → Cycles (
/fund-admin/cycles) - Find PROCESSING cycle
- Click “Set Rate”
- Enter OTP from email
- Enter:
2.5(for 2.5% profit) - Click Save
+2.50%
If you see 403 Forbidden: The account doesn’t have FUND_ADMIN role. Use fundadmin@zestamc.com which has the FUND_ADMIN role.
Test 4: Distribute Profits
As:admin@zestamc.com (SUPER_ADMIN)
- Go to Admin → Cycles (
/admin/cycles) - Find cycle with rate set
- Click “Distribute Profits”
- Enter OTP from email
- Confirm
PROFIT_DISTRIBUTED
Test 5: Distribute Referrals
As:admin@zestamc.com (SUPER_ADMIN)
- Go to Admin → Cycles (
/admin/cycles) - Find PROFIT_DISTRIBUTED cycle
- Click “Distribute Referrals”
- Enter OTP from email
- Confirm
COMPLETED
Test 6: Verify testinvestor Profit
As:testinvestor@zestamc.com
Expected Values (2.5% rate on $10,000 principal):
| Item | Calculation | Amount |
|---|---|---|
| Gross Profit | $10,000 × 2.5% | $250.00 |
| User Share | $250 × 50% | $125.00 |
| Platform Fee | $250 × 30% | $75.00 |
| Referral Pool | $250 × 20% | $50.00 |
- Go to Portfolio or Profits page
- Check available_profit increased by ~$125
Test 7: Verify Institution Profit
As:institution@zestamc.com
Expected Values (2.5% rate on $100,000 principal):
| Item | Calculation | Amount |
|---|---|---|
| Gross Profit | $100,000 × 2.5% | $2,500.00 |
| User Share | $2,500 × 70% | $1,750.00 |
| Platform Fee | $2,500 × 30% | $750.00 |
| Referral Pool | - | $0.00 |
Test 8: Verify Referral Bonuses
As:testinvestor@zestamc.com
Referral chain: testinvestor → test → l2investor → l3investor
Referral pool generated by testinvestor’s downline:
| From | Principal | Pool (20% of gross) | testinvestor gets |
|---|---|---|---|
| test | $5,000 | $25.00 | L1: 15% = $3.75 |
| l2investor | $2,000 | $10.00 | L2: 10% = $1.00 |
| l3investor | $3,000 | $15.00 | L3: 5% = $0.75 |
| Total | $5.50 |
Test 9: Loss Cycle
As:admin@zestamc.com (SUPER_ADMIN) and fundadmin@zestamc.com (FUND_ADMIN)
- As SUPER_ADMIN: Go to Admin → Cycles (
/admin/cycles) - As SUPER_ADMIN: Create new cycle
- As SUPER_ADMIN: Start cycle (use OTP from email)
- As FUND_ADMIN: Login as
fundadmin@zestamc.com, go to Fund Admin → Cycles (/fund-admin/cycles) - As FUND_ADMIN: Set rate:
-3.0(3% loss) (use OTP from email) - As SUPER_ADMIN: Switch back to
admin@zestamc.com, go to Admin → Cycles (/admin/cycles) - As SUPER_ADMIN: Distribute profits (use OTP from email)
- As SUPER_ADMIN: Distribute referrals (use OTP from email)
- Rate displays as
-3.00%(red) - Cycle completes successfully
- No referral bonuses (loss cycles = $0 referral pool)
Test 10: Verify Loss Applied
As:testinvestor@zestamc.com
Expected Values (-3% rate on $10,000 principal):
| Item | Calculation | Amount |
|---|---|---|
| Loss | $10,000 × -3% | -$300.00 |
| User Loss | 100% of loss | -$300.00 |
available_profitfirst- Then
principalif profit insufficient
Results Summary
| Test | Description | Status |
|---|---|---|
| 1 | Create Cycle | ⬜ |
| 1b | Overlap Prevention | ⬜ |
| 2 | Start Cycle | ⬜ |
| 3 | Set Rate (2.5%) | ⬜ |
| 4 | Distribute Profits | ⬜ |
| 5 | Distribute Referrals | ⬜ |
| 6 | testinvestor +$125 | ⬜ |
| 7 | institution +$1,750 | ⬜ |
| 8 | Referral bonus +$5.50 | ⬜ |
| 9 | Loss Cycle (-3%) | ⬜ |
| 10 | Loss applied -$300 | ⬜ |
Expected Values Quick Reference
After 2.5% Profit Cycle
| User | Principal | Profit Added | Bonus Added |
|---|---|---|---|
| testinvestor | $10,000 | +$125.00 | +$5.50 |
| test | $5,000 | +$62.50 | +$1.75 |
| l2investor | $2,000 | +$25.00 | +$0.75 |
| l3investor | $3,000 | +$37.50 | $0 |
| institution | $100,000 | +$1,750.00 | $0 |
After -3% Loss Cycle
| User | Principal Change | Profit Change |
|---|---|---|
| testinvestor | -$300 (or from profit) | Reduced first |
Troubleshooting
| Issue | Solution |
|---|---|
| ”Set Rate” not available | Cycle must be PROCESSING. Start it first. |
| ”Set Rate” shows 403 Forbidden | Use fundadmin@zestamc.com (FUND_ADMIN role). SUPER_ADMIN cannot set rates. |
| Can’t find cycles page | FUND_ADMIN users access /fund-admin/cycles, SUPER_ADMIN uses /admin/cycles. |
| ”Distribute” not available | Rate must be set first. |
| Distribution slow | Background job. Wait 10-30 sec, refresh. |
| Wrong profit amount | Check user type (50% vs 70% share). |
| No referral bonus | Institution users don’t generate referral pool. |