Staging Test: Withdrawal Flow
Test Area: Withdrawal FlowEstimated Time: 20-25 minutes
Difficulty: Medium
Prerequisites: Complete 03-deposit-flow first. Investor needs active tranches with available profit/principal.
Overview
This guide tests the withdrawal request system. Investors can withdraw:- Profit from active tranches
- Principal from matured tranches
- Referral Bonuses from bonus wallet
Withdrawal Lifecycle
Standard Users (Individual, KYC-verified):Withdrawal Types
| Type | Source | When Available |
|---|---|---|
| PROFIT | Tranche available_profit | Anytime (if profit > 0) |
| PRINCIPAL | Tranche principal | After lock-in ends (matured) |
| REFERRAL_BONUS | Bonus wallet | Anytime (if balance > 0) |
Before You Start
URLs
| Page | URL |
|---|---|
| Login | https://zestamc.savibm.com/login |
| Investor Withdrawals | https://zestamc.savibm.com/investor/withdrawals |
| Admin Withdrawals | https://zestamc.savibm.com/admin/withdrawals |
Test Accounts
| Role | OTP | |
|---|---|---|
| Investor | testinvestor@zestamc.com | Check email |
| Admin | admin@zestamc.com | Check email |
Current Test Data
| User | Principal | Available Profit | Bonus Balance |
|---|---|---|---|
| testinvestor | $10,000 | $0 (initial) | $0 (initial) |
Note: Available profit will be $0 until a profit distribution cycle is run. Test profit withdrawal after running a cycle (see 06-profit-distribution.md).
Test Cases
Test 1: View Withdrawals Page
Goal: Verify investor can access the withdrawals page Steps:- Log in as
testinvestor@zestamc.com - Click “Withdrawals” in the left sidebar
- View the withdrawals page
| Element | What You Should See |
|---|---|
| Page title | ”Withdrawals” |
| Withdrawal history | List of past withdrawal requests (may be empty) |
| New withdrawal button | ”Request Withdrawal” or similar button |
| Available amounts | Shows available profit/principal/bonus |
Test 2: View Available Withdrawal Sources
Goal: Verify investor can see what’s available to withdraw Steps:- On the Withdrawals page
- Click “Request Withdrawal” button
- Look at the available sources
| Source | What You Should See |
|---|---|
| Profit sources | List of tranches with available profit |
| Principal sources | List of matured tranches (if any) |
| Bonus wallet | Referral bonus balance |
| Amounts | Dollar amounts for each source |
Test 3: Submit Profit Withdrawal
Goal: Verify investor can submit a profit withdrawal Preparation: This test requires available profit. If available_profit is $0, first run a profit distribution cycle (see 06-profit-distribution.md). Steps:- Log in as
testinvestor@zestamc.com - Go to “Withdrawals” page
- Click “Request Withdrawal”
- Select source: Choose a tranche with available profit
- Select type: “Profit”
- Enter amount (e.g.,
25or whatever’s available) - Click “Submit”
- When OTP dialog appears, enter OTP from email
- Confirm
| Step | What You Should See |
|---|---|
| Amount validation | Accepts amount up to available profit |
| After OTP | Success message “Withdrawal request submitted” |
| Status | New withdrawal shows “REQUESTED” status |
Test 4: Submit Referral Bonus Withdrawal
Goal: Verify investor can withdraw from bonus wallet Preparation:- Feature Flag Required: This test requires the referral feature to be enabled:
- Backend:
FEATURE_REFERRAL_ENABLED=true - Frontend:
VITE_FEATURE_REFERRAL_ENABLED=true(requires rebuild)
- Backend:
- Requires bonus balance > 0. Run a profit distribution cycle with referrals to generate bonus balance.
Note: If the referral feature is disabled, this test will fail with a 403 error. The bonus wallet option will not appear in the withdrawal sources list.Steps:
- Log in as
testinvestor@zestamc.com - Go to “Withdrawals” page
- Click “Request Withdrawal”
- Select source: “Bonus Wallet” or “Referral Bonus”
- Enter amount
- Click “Submit”
- Enter OTP from email
| Step | What You Should See |
|---|---|
| Bonus option | Bonus wallet shows as withdrawal source |
| Amount limit | Cannot exceed bonus balance |
| After submit | Success message |
| Status | Shows “REQUESTED” |
Test 5: View Withdrawal History
Goal: Verify investor can see their withdrawal requests Steps:- On the Withdrawals page
- Look at the withdrawal history list
- Find your recent withdrawal requests
| Element | What You Should See |
|---|---|
| List | Shows all withdrawal requests |
| Details | Amount, type, status, date visible |
| Status badges | Color-coded status (yellow=pending, green=completed) |
Test 6: Admin Views Pending Withdrawals
Goal: Verify admin can see pending withdrawal requests Steps:- Log out and log in as
admin@zestamc.com - Navigate to Admin → “Withdrawals” or “Withdrawal Approvals”
- Look for pending withdrawals
| Element | What You Should See |
|---|---|
| Pending list | Withdrawals with REQUESTED status |
| Details | User email, amount, type, wallet address |
| Actions | Approve/Reject buttons |
Test 7: Admin Approves Withdrawal (Standard User)
Goal: Verify admin can approve a withdrawal for standard (non-institution) users Steps:- Log in as
admin@zestamc.com - Go to “Withdrawal Approvals” (table view)
- Find a pending withdrawal from a standard user
- Click “Approve”
- Confirm
| Step | What You Should See |
|---|---|
| After approve | Success message |
| Status change | Withdrawal status → IN_PROCESS |
| Wallet info | User’s wallet address shown for payout |
| Payout button | ”Send Payout” button becomes available |
Test 8: Admin Sends Payout
Goal: Verify admin can trigger NOWPayments payout for approved withdrawal Steps:- Find the IN_PROCESS withdrawal from Test 7
- Click “Send Payout”
- Select payout network/currency if prompted
- Confirm
| Step | What You Should See |
|---|---|
| Payout dialog | Shows amount, wallet address, network |
| After send | Success message “Payout initiated” |
| Status | Stays IN_PROCESS (waiting for blockchain) |
| NOWPayments ID | Payout ID shown for tracking |
Test 9: Admin Completes Withdrawal Manually
Goal: Verify admin can manually complete a withdrawal (fallback if payout fails) Steps:- Find an IN_PROCESS withdrawal
- Click “Complete Manually” or “Mark Complete”
- Enter transaction hash:
0xCOMPLETE1234567890abcdef1234567890abcdef1234567890abcdef12345678 - Add optional notes
- Confirm
| Step | What You Should See |
|---|---|
| TX hash field | Required input |
| After complete | Success message |
| Status change | Withdrawal status → COMPLETED |
| History | Moves to completed withdrawals |
Test 10: Investor Sees Completed Withdrawal
Goal: Verify investor can see their completed withdrawal Steps:- Log in as
testinvestor@zestamc.com - Go to “Withdrawals” page
- Find the completed withdrawal
| Result | What You Should See |
|---|---|
| Status | Shows “COMPLETED” with green badge |
| Transaction info | May show payment transaction hash |
Test 11: Admin Rejects Withdrawal
Goal: Verify admin can reject a withdrawal Preparation: Submit a new withdrawal request as investor first Steps:- Submit a new withdrawal as
testinvestor@zestamc.com - Log in as
admin@zestamc.com - Go to “Withdrawal Approvals”
- Find the pending withdrawal
- Click “Reject”
- Enter reason: “Test rejection - suspicious activity”
- Confirm
| Step | What You Should See |
|---|---|
| Reject prompt | Requires rejection reason |
| After reject | Success message |
| Status | Withdrawal shows REJECTED |
| Funds | Amount returned to source (profit/bonus) |
Test 12: Withdrawal Amount Validation
Goal: Verify system validates withdrawal amounts Steps:- Log in as
testinvestor@zestamc.com - Start a new withdrawal request
- Try to enter an amount greater than available
| Test | What You Should See |
|---|---|
| Exceeds available | Error: “Insufficient balance” or similar |
| Form | Prevents submission |
Test 13: Withdrawal Requires Wallet
Goal: Verify system requires approved wallet for withdrawal Note: Only applicable if testing with account that has no approved wallet Steps:- Try to submit a withdrawal without an approved wallet
- Observe the error
| Result | What You Should See |
|---|---|
| Error | ”Please add a wallet address first” |
| No submission | Cannot proceed without wallet |
Test 14: Institution User - First Admin Approval
Goal: Verify institution user withdrawals require two-admin approval Preparation: Need an institution user account with withdrawal capability. If not available, skip this test. Steps:- Log in as an institution user
- Submit a withdrawal request
- Log in as
admin@zestamc.com - Go to “Withdrawal Approvals”
- Find the institution user’s withdrawal
- Click “Approve”
- Confirm
| Step | What You Should See |
|---|---|
| User type indicator | Shows “INSTITUTION” badge on the withdrawal |
| After first approve | Success message: “First approval recorded” |
| Status change | Withdrawal status → AWAITING_SECOND_APPROVAL |
| UI indication | Shows “Needs second approval” or similar |
Test 15: Institution User - Second Admin Approval
Goal: Verify second admin can complete institution withdrawal approval Preparation: Complete Test 14 first Steps:- Log in as a different admin (e.g., second admin account)
- Go to “Withdrawal Approvals”
- Find the withdrawal in AWAITING_SECOND_APPROVAL status
- Click “Approve” (second approval)
- Confirm
| Step | What You Should See |
|---|---|
| Second approval | Success message |
| Status change | Withdrawal status → IN_PROCESS |
| Ready for payout | ”Send Payout” button now available |
Test 16: Institution User - Same Admin Cannot Second-Approve
Goal: Verify same admin cannot provide both approvals Preparation: Have an institution withdrawal in AWAITING_SECOND_APPROVAL status Steps:- Log in as the admin who gave the first approval
- Go to “Withdrawal Approvals”
- Find the withdrawal in AWAITING_SECOND_APPROVAL
- Try to click “Approve” again
| Result | What You Should See |
|---|---|
| Error | ”Same admin cannot provide second approval” or disabled |
| No approval | Status remains AWAITING_SECOND_APPROVAL |
Test Results Summary
| Test | Status | Notes |
|---|---|---|
| Test 1: View Page | ⬜ Pass / ⬜ Fail | |
| Test 2: View Sources | ⬜ Pass / ⬜ Fail | |
| Test 3: Profit Withdrawal | ⬜ Pass / ⬜ Fail | |
| Test 4: Bonus Withdrawal | ⬜ Pass / ⬜ Fail | |
| Test 5: View History | ⬜ Pass / ⬜ Fail | |
| Test 6: Admin View | ⬜ Pass / ⬜ Fail | |
| Test 7: Admin Approve (Standard) | ⬜ Pass / ⬜ Fail | |
| Test 8: Admin Send Payout | ⬜ Pass / ⬜ Fail | |
| Test 9: Admin Complete Manually | ⬜ Pass / ⬜ Fail | |
| Test 10: Investor Verify | ⬜ Pass / ⬜ Fail | |
| Test 11: Admin Reject | ⬜ Pass / ⬜ Fail | |
| Test 12: Amount Validation | ⬜ Pass / ⬜ Fail | |
| Test 13: Wallet Required | ⬜ Pass / ⬜ Fail | |
| Test 14: Institution First Approve | ⬜ Pass / ⬜ Fail | |
| Test 15: Institution Second Approve | ⬜ Pass / ⬜ Fail | |
| Test 16: Same Admin Prevention | ⬜ Pass / ⬜ Fail |
Important Notes
Testing Withdrawals Without Profit
If available profit is $0, you need to first run a profit distribution cycle:- Log in as admin
- Go to Cycles page
- Create, start, set rate, and distribute a cycle
- This generates profit that can be withdrawn
Principal Withdrawal
Principal can only be withdrawn from matured tranches (lock-in period ended). The test tranches may still be in lock-in period.Referral Bonus Withdrawal (Test 4)
Feature Flag Dependency: Referral bonus withdrawals require the referral feature to be enabled:- Backend: Set
FEATURE_REFERRAL_ENABLED=truein environment variables - Frontend: Set
VITE_FEATURE_REFERRAL_ENABLED=trueand rebuild the application
- Bonus wallet will not appear as a withdrawal source
- Attempting to submit a referral bonus withdrawal will return a 403 error
- The error message: “Referral bonus withdrawals are currently disabled”
Troubleshooting
”Minimum withdrawal is $25” error
Withdrawal amount must be at least $25.”Insufficient balance” error
The amount you’re trying to withdraw exceeds what’s available. Check:- Available profit in the selected tranche
- Bonus wallet balance
- Matured principal (if withdrawing principal)
“Please add a wallet” error
- Go to Wallets page and add a wallet
- Wait for admin approval
- Then try withdrawing
Withdrawal stuck in REQUESTED
Admin needs to approve the withdrawal. Log in as admin and process it.Withdrawal stuck in AWAITING_SECOND_APPROVAL
This is an institution user withdrawal. A different admin must provide the second approval.No profit available to withdraw
Run a profit distribution cycle first. See 06-profit-distribution.md.Payout failed
If NOWPayments payout fails, admin can:- Retry the payout with “Send Payout” button
- Complete manually with a transaction hash from external wallet
”Referral bonus withdrawals are currently disabled” error (Test 4)
This error occurs when trying to withdraw referral bonuses but the feature flag is disabled:- Check backend environment:
FEATURE_REFERRAL_ENABLEDmust betrue - Check frontend environment:
VITE_FEATURE_REFERRAL_ENABLEDmust betrue - Rebuild frontend if you changed
VITE_FEATURE_REFERRAL_ENABLED - Restart backend if you changed
FEATURE_REFERRAL_ENABLED
Next Steps
After completing withdrawal flow testing, proceed to:- 05-reinvestment.md - Test reinvestment functionality