- Updated EarningsService to 1% calculation
- Updated WithdrawalService minimum to $20
- Updated referral handler dashboard messages
- Updated EarningsTransaction model description
- Updated TransactionManager to pass sellAmountUsd
- Updated all tests for new model
- Created validation script
npm test services/EarningsService.test.ts
npm test services/WithdrawalService.test.ts- All EarningsService tests pass
- All WithdrawalService tests pass
- Property-based tests pass
npm run validate-referral- Sample validation runs successfully
- Calculations are accurate (1% of volume)
- Break-even point is $25
npm run validate-referral:live- No invalid balances found
- CSV report generated successfully
- Transaction distribution looks reasonable
- Review EarningsService changes
- Review TransactionManager sellAmountUsd calculation
- Verify exchange rate direction (NGN/USD not USD/NGN)
- Check that 60 NGN spread is included
- Review test coverage
- Review REFERRAL_PERCENTAGE_UPDATE.md
- Review VALIDATION_QUICKSTART.md
- Update user-facing documentation
- Update API documentation (if applicable)
- Update FAQ/help docs
- Verify MONGODB_URI is set
- Verify OFFRAMP_FLAT_FEE_USD is set ($0.75)
- Verify OFFRAMP_SPREAD_NGN is set (60)
- Check all other environment variables
- Backup production database
- Verify database indexes are in place
- Check PointsBalance collection integrity
- Check EarningsTransaction collection
- Set up alerts for earnings calculation errors
- Set up alerts for withdrawal validation failures
- Set up dashboard for monitoring earnings
- Prepare to monitor first few transactions closely
# Deploy code to staging environment
git checkout main
git pull origin main
# Deploy to staging- Code deployed to staging
- Run validation script in staging
- Test complete offramp flow
- Verify earnings calculation
- Test withdrawal with $20 minimum
- Check logs for errors
Create test referral relationship and complete test transactions:
# In staging environment
npm run validate-referral:live -- --limit=10- Test $10 transaction (should earn $0.10)
- Test $25 transaction (should earn $0.25)
- Test $50 transaction (should earn $0.50)
- Test $100 transaction (should earn $1.00)
- Verify earnings are credited correctly
- Test withdrawal with $20 minimum
# Deploy to production
git checkout main
git pull origin main
# Deploy to production- Code deployed to production
- Verify deployment successful
- Check application is running
- Monitor logs for errors
- Monitor first 5 transactions closely
- Verify earnings calculations are correct
- Check for any errors in logs
- Verify points balances update correctly
- Review all earnings transactions
- Check withdrawal requests
- Monitor error rates
- Review user feedback (if any)
- Analyze earnings distribution
- Compare with projections
- Monitor withdrawal patterns
- Check for any anomalies
// MongoDB query
db.earningstransactions.find().sort({timestamp: -1}).limit(10)// For each transaction, verify:
// earnings = feeAmount
// feeAmount ≈ transactionAmount * 0.01 (within rounding)// Verify integrity
db.pointsbalances.find({
$expr: { $lt: ["$totalEarned", "$currentBalance"] }
})
// Should return 0 documentsIf critical issues are found:
- Stop processing new referral earnings
- Document the issue
- Notify team
# Revert to previous version
git revert <commit-hash>
git push origin main
# Deploy previous version- Review affected transactions
- Calculate correct earnings
- Manual adjustment if necessary
- Document all changes
Deployment is successful if:
- All tests pass
- Validation script runs without errors
- First 10 transactions calculate correctly
- No invalid balances detected
- Withdrawals work with $20 minimum
- No critical errors in logs
- User feedback is positive (or neutral)
- Average earnings per transaction
- Total earnings distributed per day
- Earnings distribution by transaction size
- Comparison with old model projections
- Number of withdrawals per day
- Average withdrawal amount
- Withdrawals in $20-$100 range (new minimum)
- Withdrawal approval time
- Error rate in earnings calculation
- Failed transactions
- Balance inconsistencies
- API response times
- Technical Lead: [Name/Contact]
- Database Admin: [Name/Contact]
- DevOps: [Name/Contact]
- Product Owner: [Name/Contact]
- Send update notification to users
- Update help documentation
- Monitor first transactions
- Review error logs
- Analyze earnings distribution
- Review withdrawal patterns
- Gather user feedback
- Optimize if needed
- Generate monthly report
- Compare with projections
- Identify optimization opportunities
- Plan next improvements
- Higher earnings on transactions > $25
- More transparent earnings (1% is easy to calculate)
- Lower withdrawal barrier ($20 vs $100)
- Better alignment with transaction value
- More predictable cost structure
- Incentivizes referring high-volume users
- Easier to explain to users
- Scales with platform growth
- Average earnings per transaction: Likely to increase
- Withdrawal frequency: May increase (lower minimum)
- User satisfaction: Should improve (more earnings)
- Referral activity: May increase (better incentives)
- This is a significant change to the referral system
- Monitor closely for the first week
- Be prepared to make adjustments
- Communicate clearly with users
- Document any issues and resolutions
Good luck with the deployment! 🚀