Overview
The Loan Disbursement Workflow in Agatabo describes the process of creating loans, ensuring proper validation, and recording disbursement with accurate accounting.ACTIVE and disbursed immediately.PENDING status exists in the database schema but is not currently used by the API. A multi-stage approval workflow may be added in future versions.Workflow Overview
Stage 1: Pre-Loan Preparation
Who: Loan Officer or Administrator Before creating loan in system:Verify member eligibility
- Member has required savings balance (typically 20-30% of loan amount)
- Member has no existing ACTIVE or DEFAULTED loans
- Member has “member” role assigned (required for loan eligibility)
- Member is active in organization
Assess repayment capacity
- Review member’s income sources
- Check member’s loan history (past defaults?)
- Verify member can afford installment payments
- Assess overall creditworthiness
Collect securities
- Guarantors: Other active members who co-sign
- Collateral: Physical assets (property, equipment) with estimated values
- Savings requirement: Minimum savings balance member must maintain
- Documents: Photos, titles, appraisals, agreements
Calculate loan terms
- Determine principal amount (within organization limits)
- Decide loan period (months)
- Set interest rate (per organization policy)
- Choose interest calculation method
- Calculate estimated installments
- ✅ Member eligible for loan
- ✅ Securities adequate to cover loan amount
- ✅ Loan terms comply with organization policies
- ✅ Required documentation collected
- ✅ Loan committee approval obtained (if required by organization)
Stage 2: Loan Creation & Disbursement
Who: User withloans:write permission
API Endpoint: POST /loans
Request
What Happens Automatically
When loan is created, the system performs these actions atomically in one database transaction:Validate member eligibility
- Member exists in organization
- Member is active
- Member has “member” role assigned
- Member has no existing ACTIVE or DEFAULTED loans
Validate organization policies
- Principal amount within configured limits
- Period within maximum allowed (if configured)
- Principal ≤ (member savings × max_loan_percentage)
- Amount scale matches organization currency settings
Validate securities
- Total security value ≥ loan amount
- Guarantors are active members
- Savings requirement doesn’t exceed member’s available savings
- All security values use correct decimal precision
Calculate installments
- Computes EMI (Equated Monthly Installment)
- Generates installment schedule
- Calculates total interest
- Applies configured rounding rules
Create loan record
- Status set to ACTIVE (not PENDING)
- Loan assigned unique account number
- Installment schedule locked
- Securities stored as JSON
Create ledger accounts
- LOAN_RECEIVABLE account (principal tracking)
- INTEREST_RECEIVABLE account (interest tracking)
- PENALTY_RECEIVABLE account (penalty tracking)
Post disbursement journal entry
- If fee deducted from savings: Separate DISBURSEMENT_FEE_PAYMENT entry
- If interest paid in advance from savings: Separate INTEREST_PAID_IN_ADVANCE entry
- If interest paid in advance from cash: INTEREST_RECEIVABLE not debited, CASH reduced by interest
- If bank charge: Additional BANK_CHARGE entry
Send notification
- Email sent to borrower with loan details
- SMS sent with loan approval message
- Message includes installment amount and schedule
Response
Success (201 Created):Errors
Stage 3: Post-Disbursement
Who: Loan Officer, TreasurerImmediate Actions
Disburse funds to member
- System already deducted from member’s savings account
- Member receives cash: Principal - (fee if from cash) - (interest if from cash and in advance)
- Count cash with member present
- Member signs receipt
- Transfer from organization bank account to member’s account
- Record bank reference number
- Amount: Principal - (fees/interest deducted from cash)
- Withdraw from organization bank
- Give cash to member
- Member signs receipt
File loan documentation
- Signed loan agreement
- Collateral documents (titles, appraisals, photos)
- Guarantor agreements
- Disbursement receipt
- Security documents
Provide member with payment schedule
- Export installment schedule from system
- Print and give to member
- Explain payment methods
- Confirm due dates understood
- Provide treasurer contact information
Set up payment reminders
- Add loan to monitoring list
- Set up automatic payment reminders (3-5 days before due date)
- Note first payment due date
- Configure penalty rules if applicable
Ongoing Monitoring
Track payments
- Monitor installment due dates
- Send reminders before due dates
- Record payments promptly using
POST /loans/{loanId}/repay - Update payment status (on-time, late, missed)
Manage delinquencies
- Identify overdue payments immediately
- Follow up with member (phone call, visit)
- Apply penalties per organization policy
- Escalate to loan committee if needed
- Consider restructuring for hardship cases
Monitor loan health
- Review arrears regularly (Loans Outstanding report)
- Track days overdue
- Classify loans (current, 1-30 days, 31-90 days, 90+ days)
- Update status to DEFAULTED if necessary
Disbursement Fee & Interest Payment Options
Fee Deduction Options
Option 1: Fee deducted from cash (default):disbursementFeeFromSavings: true):
Interest Payment Timing Options
Option 1: Interest paid with installments (default):interestPaymentTiming: "IN_ADVANCE"):
interestPaymentTiming: "IN_ADVANCE" and advanceInterestFromSavings: true):
Configuration from Organization Settings
Several loan parameters default to organization-wide settings (fromloanSettings field):
Complete Workflow Checklist
Pre-Creation
- ✅ Member eligibility verified (savings, loan history, active status)
- ✅ Securities documented (guarantors, collateral, documents)
- ✅ Loan terms calculated and comply with policies
- ✅ Required documents collected
- ✅ Loan committee approval obtained (if required by organization)
- ✅ Member understands repayment terms
During Creation (via API)
- ✅
x-idempotency-keyheader provided - ✅ All required fields in request body
- ✅ Loan amount within policy limits
- ✅ Securities adequate to cover loan
- ✅ Member has no existing ACTIVE/DEFAULTED loans
- ✅ API call succeeds (201 response)
Post-Disbursement
- ✅ Funds disbursed to member (cash or bank transfer)
- ✅ Member signs disbursement receipt
- ✅ Loan documents filed
- ✅ Payment schedule provided to member
- ✅ Member added to payment reminder list
- ✅ First payment reminder scheduled
Ongoing
- ✅ Payments recorded promptly
- ✅ Overdue payments followed up immediately
- ✅ Penalties applied per policy
- ✅ Loan status updated as needed (COMPLETED, DEFAULTED)
Common Issues
Member already has active loan
Member already has active loan
- Wait until existing loan is fully repaid (status = COMPLETED)
- Or default the existing loan if appropriate (POST /loans//default)
- Cannot have multiple simultaneous loans per member
Insufficient securities
Insufficient securities
- Add more guarantors
- Increase collateral value
- Reduce loan amount
- Require higher savings balance
Principal exceeds max allowed
Principal exceeds max allowed
- Reduce loan amount
- Ask member to save more first
- Request organization to increase max_loan_percentage setting
Period exceeds maximum
Period exceeds maximum
- Reduce loan period
- Request organization to increase max_period setting
Need to cancel loan after creation
Need to cancel loan after creation
- Member can repay full principal immediately
- Record payment: POST /loans//repay
- Loan status changes to COMPLETED
- Member must repay according to schedule
- Or negotiate restructuring with loan officer
- Cannot delete disbursed loan (funds already given)
Loan settings not applying
Loan settings not applying
- Are organization
loanSettingsconfigured? - Do request body fields override settings?
- Verify settings with GET /organizations/
Future Enhancement: Multi-Stage Workflow
PENDING status exists in the database but is not currently used. A future version may implement:- POST /loans with status=PENDING (draft loan application)
- PUT /loans//approve endpoint to change PENDING → ACTIVE
- DELETE /loans/ to cancel PENDING loans
- Workflow states and approval process
- Loan applications submitted for review
- Committee approval before disbursement
- Separation of application and disbursement
- Cancellation of unapproved loans