About the Platform
The complete picture in one place
- los-webv1 is the borrower/customer-facing app — the loan applicant's own phone-OTP login, KYC/liveness onboarding wizard, loan application, and repayment experience. It is white-labelled across ~15 lending brands, with up to ~30 UI template variants per onboarding step.
- los-partner is not an external DSA/channel-partner submission portal despite its name. It is the internal staff back-office CRM — used by each lending brand's own employees (sales, credit, sanctioning, disbursement ops, collections, HR) to run the entire loan lifecycle. "Partner" here refers to each lending brand being a tenant/partner of the 8byte platform, not to external referrers.
AuthGuard/@AuthType mechanism — web for los-webv1, partner for los-partner — plus WhatsApp/voice channels and machine-to-machine partner/marketplace integrations. Every flow section below should be read with this in mind: steps described as "customer" or "borrower" actions happen in los-webv1; steps described as staff/executive/manager actions happen in los-partner. For full per-repo technical and product detail with flowcharts, see the module deep-dive hub.
👥 Two User Worlds
Borrowers/customers interact via los-webv1 (the web API surface). Internal staff — sales, credit, sanctioning, loan ops, collections, HR, admin — interact via los-partner, the staff CRM (the partner API surface). These are completely separate authenticated systems, each with its own JWT and login flow.
🏷️ Multi-Brand Platform
A single codebase serves 15+ white-label lending brands simultaneously: Qualoan, PaisaPop, Minutes Loan, Zepto Finance, Salary4Sure, FastSalary, SalaryBolt, SalaryBaba, JhatpatCash, CredNidhi, ShubLakshmi, PaisaAnytime, ToofanLoan, MySalaryLoan, SwiftPaisa, ExpressoLoan, DezireLoan, and more. Each brand has its own loan rules, theme, communication templates, staff, and settings — but shares the same infrastructure. Nearly every business rule described below (BRE engines, field visit requirement, reminder cadence, workflow steps, auto-disbursement) is independently toggleable per brand.
🔄 Full Lifecycle Coverage
From customer acquisition (UTM tracking, lead forms) → onboarding (KYC) → BRE auto-screen → sales → credit underwriting → sanction → e-sign → disbursement → repayment → collections → closure. Every step is tracked, logged, and auditable.
Full System Architecture
Every layer of the platform and how they connect
Client Layer
API Layer — los-backend, NestJS 11 (PM2: API Cluster + Cron-Worker)
Auth & Identity
Loan Engine
Payment Engine
Database
Cache & Queues
File Storage
External API Integrations (25+)
Multi-Brand Model
How one codebase serves many lending brands
/:brandId/loans, /:brandId/dashboard, etc. The backend extracts this brandId from the URL, validates that the logged-in partner user has access to that brand, and then filters all database queries by that brandId. Two staff at different brands cannot see each other's data even if they use the same app. los-webv1 resolves its brand from the request hostname instead (each brand is served on its own domain/subdomain) and applies the matching theme/workflow config at runtime.
Brand tenant row — its own theme, logo, loan rules, BRE engine selection, field-visit requirement, reminder cadence, and workflow steps, all independently configurable.
🎨 Brand Isolation
Each brand has its own: logo, color theme, loan rules (min/max amounts, tenures, interest rates), evaluation criteria, email templates, SMS templates, partner staff, and customers. Complete data isolation at the database level via brandId foreign keys.
⚙️ Brand Config Flow
On login, the partner portal fetches brand config via GET /settings/brand. This is stored in the Redux brand slice. The ThemeProviderContext injects the brand's colors as CSS variables. All subsequent API calls include the brandId automatically.
🔐 Brand Access Control
A partner user can be assigned to one or multiple brands (stored in PartnerUserBrandRole). They log in once and can switch between their brands. The Super Admin can access all brands via the /admin portal without brand scoping.
Complete Customer Journey
Every step from signup to loan closure
KYC / Onboarding Wizard Flow
los-webv1's borrower onboarding wizard, step by step
WorkflowPage + features/workflow/*), not in the staff CRM. Every step below is brand-configurable — a brand can skip, require, or reorder steps via BrandUserWorkflowEnum / workflow_steps config — and each step renders through one of up to ~30 per-brand UI templates (t1…t30). The order below is the typical current sequence; treat it as a default, not a fixed contract.Basic Info + Mobile OTP
Borrower enters phone number, passes Cloudflare Turnstile captcha, receives and submits OTP → account/session created, access + refresh tokens issued.
Email Verification
Borrower enters email → OTP/link verification confirms ownership.
Geo-location
Browser geolocation permission prompt captures the borrower's current location — feeds fraud/risk signals and address stability checks.
PAN / KYC Details
Borrower enters PAN → verified through a fallback vendor chain (Digitap → ScoreMe → Signzy, "PAN Details Plus") with per-vendor answer caching and duplicate-PAN guarding → name/DOB pre-filled.
Bank Account Verification
Borrower enters account number + IFSC → penny-drop verification confirms the account holder name matches the PAN name.
Income Proof
Either a bank-statement upload (parsed for salary credits/EMI obligations) or an Account Aggregator consent flow (RBI-framework, via Finduit/FIU + Xaler) — brand-configurable which is offered. See Account Aggregation Flow.
Aadhaar Verification
DigiLocker pull via Digitap v2 or Signzy (redirect-based flow) fetches Aadhaar/official documents directly from government sources — bypasses manual document review.
Liveness Capture
AWS Amplify face-liveness capture (ui-react-liveness) plus a webcam selfie/video, checked via AWS Rekognition — confirms a live person matching the KYC photo, not a static image.
Employment Details
Employer name, UAN, salary, joining date — cross-checked against EPFO where available.
Alternate Phone Number
Borrower adds a secondary contact number — used for collections/verification if the primary is unreachable.
Documents Upload
Remaining supporting documents (payslips, address proof, etc.) uploaded to S3 private bucket, status PENDING until staff review.
Existing-Loan / Debt-Consolidation Declaration
Borrower declares existing loans with other lenders — feeds the debt-consolidation product path (LoanConsolidationLine) if applicable.
Add Guarantor(s)
If required, borrower invites a guarantor by phone number. The guarantor logs in with their own OTP session (UserRoleEnum.GUARANTOR) and completes only their own KYC/consent subset — they never see the borrower's /apply screen.
BRE Wait Screen
Borrower sees a waiting screen while the underwriting-analysis orchestrator auto-screens the file. Outcome routes the borrower to /rejected (hard/BRE-reject), /review (soft-reject, manual pending), or onward to the loan-amount/tenure offer step. See Loan Application Flow.
Loan Application Flow — The Core Pipeline
The full stage pipeline a loan moves through, application to closure
status (what the loan is — PENDING, APPROVED, ACTIVE, REJECTED, etc.) and currentStage (who currently owes work on it). The stage pipeline below has grown significantly since this doc was last accurate — it is missing a standalone CREDIT stage (migration 110), ESIGN as its own stage rather than folded into approval (migration 128), and the optional ESTAMP and MANDATE stages, in older drafts. The current pipeline is shown below.
📋 Stages vs. Status
loan_stage_enum (who owes work): APPLICATION, SALES, CREDIT, FIELD_VISIT, MANAGER, ESTAMP, ESIGN, DISBURSEMENT, POST_DISBURSEMENT, COLLECTION_FIELD_VISIT, CLOSED, MANDATE. loan_status_enum (what the loan is): PENDING, BRE_APPROVED, APPROVED, ACTIVE, PARTIALLY_PAID, AWAITING_DISBURSEMENT, DEFAULTED, REJECTED, SOFT_REJECTED, HARD_REJECTED, BRE_REJECTED, CANCELLED, COMPLETED, SETTLED, WRITE_OFF, ON_HOLD, DORMANT, DELETED. loan_tasks is the append-only history of every stage entered — at most one open task per (loan, stage).
🚦 BRE Auto-Screen Branches
Path A (BRE_APPROVED, or SOFT/BRE_REJECTED if the brand's allow_restart flag permits) → straight to the human pipeline (SALES or FIELD_VISIT, brand-configured). Path B (DELETED, DORMANT) → back to PENDING, re-screened. Path C (HARD_REJECTED) → terminal; only a super-admin can revert it (hard_reject_revert_super_admin_only), which then rejoins Path B.
📊 Bank Statement / Income-Proof Analysis (feeds CREDIT)
During onboarding, the borrower supplies income proof either as a bank-statement upload (analyzed by CART, Finbox, or ScoreMe depending on brand config — salary credits, EMI debits, balance trends, stored as a BdaReport/BSA report) or via an Account Aggregator consent flow. This data is available to CREDIT_EXECUTIVE staff during the CREDIT stage and feeds the CAM Calculator (see CAM Calculator Flow).
Credit Assessment Flow
The unified underwriting orchestrator, run by CREDIT_EXECUTIVE staff in los-partner
src/features/underwriting-analysis), not a single BRE call. Four engines can run against a brand's configuration: Smart BRE, CRIF BRE, Neetix BRE (all auto-run) and Marketing Analysis (manual trigger only). All four write into one shared assessment table (loan_underwriting_assessment), and a brand picks which engines are active via brand_providers BRE_ENGINE rows — a brand with zero engines configured runs zero BRE checks (a silent no-op worth flagging operationally).Sanction Approval Flow
A separate MANAGER-stage review step, after CREDIT has produced its evaluation
loans.status actually changes: approve closes the task APPROVED and stamps approvalDate; reject sets SOFT_REJECTED/HARD_REJECTED/BRE_REJECTED and closes the task REJECTED. (Open question carried over from the underlying schema: whether this is a single-tier or two-tier CX-then-SM/SH approval — the schema keeps separate CX and SM/SH approval + amount columns, so brand configuration may determine which applies.)LoanAgreementProvisioner creates agreement recordsE-Signature Flow
ESIGN is its own pipeline stage (migration 128) — one or more agreements per brand's signing package
LoanAgreementProvisioner creates one loan_agreements row per entry in the brand's configured signing_package — a brand can require multiple documents (main agreement + annexures), each routed to a provider independently. Annexures marked requiresSignature = false never block stage completion. Optional ESTAMP (stamp duty, off by default) and MANDATE (UPI Autopay authorization) stages can sit between ESIGN and DISBURSEMENT.Agreement PDF Generated
Backend uses PDFKit/Puppeteer to generate each required loan agreement PDF with borrower details, loan amount, tenure, interest rate, repayment schedule, T&C. Saved to S3 private bucket.
E-Sign Request Sent
Backend routes each agreement to the brand-configured provider — SignDesk, Signzy v3, Digitap eSign, or Doqfy — with the PDF. Provider sends a signing link to the borrower's registered mobile/email.
Borrower Signs (in los-webv1 or via link)
Borrower opens the link, reviews the agreement, signs with Aadhaar OTP-based e-signature. The signature is legally valid under India's IT Act.
Webhook Confirmation
Provider sends a webhook to los-backend with signing status per agreement. Once every signature-requiring agreement in the package is SIGNED, the ESIGN stage completes and status = AWAITING_DISBURSEMENT — see Disbursement Flow.
Disbursement Flow
A deliberately separate, queued step from the workflow's stage-advance
AutoDisbursementJob, gated by BrandConfig.auto_disbursement_enabled) from the workflow's stage-advance transition — by design, a stage-advance must never itself trigger a payout. Once every signature-requiring ESIGN agreement is SIGNED (and optional ESTAMP/MANDATE steps clear), status becomes AWAITING_DISBURSEMENT; actual money movement happens as a separately-triggered payment_request (type DISBURSEMENT). This same "don't let the automatic step move money" principle also shows up in e-stamp's NEEDS_REVIEW terminal state and UPI Autopay's no-auto-retry-on-ambiguous-debit rule.
🔀 Single-Leg vs. Multi-Leg Disbursement
A plain loan disburses as one leg. A debt-consolidation loan (loan_type_id = 98, is_debt_consolidation_enabled per brand) disburses as multiple ordered legs (leg_index) against each loan_consolidation_line — e.g. paying off several existing lender balances directly before any remainder reaches the borrower. Each leg is tracked independently in the disbursement batch with its own status (PENDING → INITIATED → SUCCESS/FAILED/RETRYING/TIMEOUT/PARTIALLY_SETTLED) and UTR.
Collection Flow (Collection V2)
Repayment management from pre-due to write-off, queued by stage in los-partner
all, pre-collection, post-collection, NPA-collection, and legal-action-collection, plus a follow-up calendar and dedicated field-visit workflows (collection-field-visits). This COLLECTION_FIELD_VISIT stage is distinct from the pre-disbursement FIELD_VISIT stage covered in the Loan Application Flow — a single loan can pass through both over its lifetime, worked by different teams.📞 Telephony in Collection
Collection executives dial via Acefone (human-agent telephony, click-to-dial from the loan/user profile) or, increasingly, Sphoro Voice — an AI voice agent that both places outbound AI-dialed calls (no human) and offers in-browser AI voice chat, configured per-brand and per-telecaller caller-ID. Both share the user_calls schema. Backend creates a UserCall record per call; events (connected, ended, etc.) trigger UserCallEvent records; recordings link back to the customer's profile.
Payment Processing Flow
How money flows through the system — one-time collection vs. recurring Autopay
Payment Initiated
Borrower pays via the gateway checkout page (from los-webv1). OR a collection agent triggers a payment link from los-partner. OR an UPI Autopay mandate debit fires from the cron. Creates PaymentRequest record with PENDING status.
Gateway Processing
Payment gateway processes the transaction. Customer authorizes via UPI, card, or netbanking. Gateway holds the transaction in PROCESSING state.
Webhook Callback
Gateway sends a webhook to POST /partner/brand/:brandId/payment/webhook. Backend validates webhook signature. If SUCCESS: creates PaymentCollectionTransaction, updates Loan.outstandingAmount, marks EMI as paid in RepaymentTimeline.
Approval Queue (if applicable)
Certain payment types require manual approval. Loan Ops staff see these in the /:brandId/payment-approval queue. They review UTR number, amount, and approve or reject.
Ledger + Notifications
Creates LoanLedgerEntry for financial tracking. Sends payment receipt via SMS + email. If all EMIs paid: triggers loan closure flow → NDC generation → NOC email sent via SQS queue.
Authentication Flow (Both Sides)
los-webv1: OTP-only. los-partner: five distinct login methods.
loginV1…loginV8).
los-webv1 — Borrower Auth (Phone OTP + Turnstile)
Enter phone number on /phone-verification, pass Cloudflare Turnstile captcha
Backend generates OTP → sends via SMS (MSG91/Gupshup/TrustSignal/SMSGatewayHub/Nimbusit)
Borrower enters OTP → validated → access + refresh tokens issued (cookie + Redux)
A shared axios interceptor silently refreshes on 401; on refresh failure, force-logout + redirect to /phone-verification. This is the only login method — no password/TOTP/SSO exists on this app.
los-partner — Staff Auth (5 methods, 8 UI variants)
Password: POST /auth/partner/login — identifier + password + deviceId, bcrypt-compared.
OTP: send-login-otp → verify-login-otp.
TOTP (authenticator app): checks enrollment → issues a QR code to scan if not enrolled → verify-totp-login thereafter.
Admin-issued sign-in code: a 12-char one-time code an ADMIN/SUPER_ADMIN generates for a staff member (15min/1hr/24hr expiry, single-use, SHA-256 hashed at rest, blocked for ADMIN/SUPER_ADMIN accounts themselves to prevent impersonation).
Reset: send-reset-password-email → reset-password, plus change-password while authenticated.
Every method sends deviceId (FingerprintJS) for device tracking. Token stored in sessionStorage; a 403 PUNCH_IN_REQUIRED response can block the whole UI until the staff member punches in for attendance (brand-configurable).
Notification & Communication Flow
How messages reach customers and staff
UserNotification record- WhatsApp Flows (live) — a full conversational loan-application journey inside WhatsApp itself, using Meta's encrypted Flow protocol (direct calls to
graph.facebook.com/v21.0/{PHONE_NUMBER_ID}/messages). Collects bank account, runs DigiLocker + Account Aggregator consent, and submits a loan application without the borrower ever leaving WhatsApp. - Web chatbot widget (live) — an intent-classified chat widget on the public web (EMI calculation, eligibility check, loan application, tracking), using plain OpenAI (
gpt-4o-miniviaapi.openai.com) — not Azure, despite a stale code comment claiming otherwise. crm-chatbot(live, unrelated) — a thin proxy from los-partner to a separate "Central Chatbot" microservice so staff can ask an AI assistant questions inside the CRM. No WhatsApp involvement despite the directory name.- WhatsApp CRM staff inbox (not merged) — a two-way conversation/inbox for staff to message borrowers directly has a full, real commit history, but it lives entirely on
origin/feature/whatsapp-crm-abhi, which is not an ancestor of this branch. Only the Prisma schema (whatsapp_crm_enabledetc.) has landed here — no application code consumes it. Treat as in-development.
Auto-Allocation Flow
How work is assigned to staff — a three-tier permission model
FRESH_ALLOCATION / REPEAT_ALLOCATION (a user can receive newly-allocated work), ALLOCATE_FRESH / ALLOCATE_REPEAT (a user can assign currently-unowned work to someone else), and REALLOCATE_FRESH / REALLOCATE_REPEAT (a user can move work that's already owned by someone). These are independent permissions layered on top of role — allocation checks role and permission together, and supervisory roles (managers/heads) are deliberately excluded from receiving allocations even if they hold the permission.📋 Lead / Sales Auto-Allocation
When a lead converts or a loan application is submitted, the allocation engine assigns it to an available SALES-role user with FRESH_ALLOCATION permission, using round-robin/workload balancing. Checks PartnerUnavailabilityDate to skip staff on leave. Managers with ALLOCATE_FRESH/RELOCATE_LEAD can manually reassign unowned leads.
🔁 Reallocation
A manager or head holding REALLOCATE_FRESH/REALLOCATE_REPEAT can move a loan or lead away from its current owner to another eligible staff member — distinct from assigning previously-unowned work, and a stronger permission (moving someone else's active work). Applies symmetrically on the sales and collection desks.
💼 Collection Auto-Allocation
When a loan becomes overdue, the collection allocation engine assigns it to a COLLECTION_EXECUTIVE with FRESH_ALLOCATION/REPEAT_ALLOCATION based on: geographic proximity, current collection load, and performance ratings from partner_user_rating_matrix. NPA and legal-action queues follow the same permission tiers.
Complete Data Flow Map
Where data comes from and where it goes
📥 Inbound Data Sources
📤 Outbound Data Flows
Roles × Features Access Matrix
los-partner's staff roles — full lifecycle coverage, not just loan ops + collections
CUSTOMER, LOANS, DISBURSE_LOAN, LOAN_OPS, BRAND_SETTINGS) is the actual access gate. A user with role "Sales" but no matching permission has no access at all; a user with an unusual role but the right permission can still get in. The matrix below shows the typical role↔feature mapping, but treat it as a simplification of the real permission system.
| Feature | Super Admin | Admin | Sales | Sales Mgr/Head | Credit Exec | Sanction Mgr/Head | Loan Ops | Coll. Exec | Coll. Mgr/Head | NPA Exec | HR |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Dashboard | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Leads Queue | ✓ | ✓ | ✓ | ✓ | — | — | — | — | — | — | — |
| Customer / Loans List | ✓ | ✓ | ✓ | ✓ | ✓ | — | — | — | — | — | — |
| Credit / BRE Evaluation (CREDIT stage) | ✓ | ✓ | — | — | ✓ | — | — | — | — | — | — |
| Sanction / MANAGER stage | ✓ | ✓ | — | — | — | ✓ | — | — | — | — | — |
| Disbursement Queue | ✓ | ✓ | — | — | — | — | ✓ | — | — | — | — |
| Pre-/Post-Collection Queues | ✓ | ✓ | — | — | — | — | — | ✓ | ✓ | — | — |
| NPA / Legal-Action Collection | ✓ | ✓ | — | — | — | — | — | — | ✓ | ✓ | — |
| Write-Off Authority | ✓ | ✓ | — | — | — | — | — | — | ✓ | — | — |
| Coin Wallet (staff incentive, private beta) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | — | ✓ | ✓ | — | — |
| Attendance / Punch-In Admin | ✓ | ✓ | — | — | — | — | — | — | — | — | ✓ |
| Settings / Brand Config | ✓ | ✓ | — | — | — | — | — | — | — | — | — |
| Reports (per-report permission) | ✓ | ✓ | — | ✓ | — | — | — | — | ✓ | — | — |
| Staff Management (sign-in codes, roles) | ✓ | ✓ | — | — | — | — | — | — | — | — | — |
Reports are always assigned as independent permissions, not tied to role. CUSTOMER is a parent permission that auto-expands to 8 bucket permissions (pending/active/on-hold/BRE-rejected/hard-rejected/deleted/dormant/soft-rejected) — most users get CUSTOMER alone rather than individual buckets.
Integrations Map
Which external API is used at which stage
🆔 KYC Stage
📊 Credit Assessment Stage
✍️ Approval & eSign Stage
💸 Disbursement Stage
💳 Repayment/Collection Stage
📱 Communication (All Stages)
Security Layers
Every security mechanism in the platform
:userId routes — worth confirming before treating any :userId-scoped endpoint as safe by default.
🔏 Data Protection (new)
PII_DEK_1 / PII_INDEX_KEY)
Independent secret pre-load, separate from AWS Secrets Manager fetch
Read-replica DB roles: standard + PII-redacted
🔑 Authentication
🛡️ Authorization
🌐 Network Security
📦 Data Security
📱 Device & Session
📝 Audit & Compliance
Performance Architecture
How the platform handles scale
🚀 Frontend Performance
⚡ Backend Performance
📊 Database Performance
🔄 Async Performance
🏁 Summary — The Complete 8byte LOS Platform
This platform is a full-stack, production-grade loan origination system that covers every aspect of the Indian NBFC lending process:
The React frontend and NestJS backend are tightly coupled via a well-defined REST API, with JWT authentication, brand scoping, and role-based access enforced at every layer — from the Redux store and React Router guards in the frontend, all the way down to Prisma database queries filtered by brandId on the backend.
Account Aggregation (AA) Flow
RBI-framework consent-based financial data fetch via FINDUIT / CART providers
src/external/aa). This flow can be initiated either by los-partner staff during underwriting (as described below) or directly by the borrower inside the los-webv1 onboarding wizard's income-proof step — see KYC Flow.Credit Executive Initiates AA
From the loan detail page, a credit exec clicks "Initiate Account Aggregation". The frontend calls POST /partner/brand/:id/aa/consent-request with userId + loanId. Backend creates an AAConsentRequest record with status PENDING.
Consent Link Sent to Customer
Provider (FINDUIT/CART) generates a consent URL and sends it to the customer via SMS/WhatsApp. The AA consent record stores consentId, txnId, and the redirect URL for tracking.
Customer Approves Consent
Customer opens the link on their phone, authenticates with their bank's AA app (e.g. PhonePe, Perfios), and approves sharing 6–12 months of bank statement data. Consent status updates to APPROVED via webhook.
Data Fetch & Analysis
Backend automatically fetches the financial data from the AA provider once consent is approved. The data is stored and the credit exec can view the Bank Statement Analysis (BSA) report inside the loan profile — salary credits, EMI obligations, spending patterns.
Credit Assessment Integration
AA data feeds into the CAM Calculator (average salary, obligations) and the overall credit decision. The consent request list is available via GET /partner/brand/:id/aa/consent-requests with pagination and status filtering.
Lead Management Flow
Facebook Ad leads → CSV import → match to users → auto-process
CSV Upload
Admin or Sales team downloads the leads CSV from Facebook Ads Manager and uploads it via POST /partner/brand/:id/lead-forms/upload (multipart/form-data). Backend parses rows and stores each as a LeadForm record with status PENDING.
Deduplication Check
On upload, the system checks for duplicate entries (same phone/email within the same brand). Duplicates are marked with status DUPLICATE and excluded from further processing.
Sync / Process
Staff trigger sync via POST /partner/brand/:id/lead-forms/sync. The backend attempts to match each PENDING lead to an existing platform user by phone number. Matched leads get PROCESSED status; unmatched or errored leads get FAILED with an error message.
View & Filter
The Leads page shows paginated lead forms with search, status filter (PENDING / PROCESSED / FAILED / DUPLICATE), and stats cards (total / pending / processed / failed / duplicates). Staff can drill into each lead to see campaign info (ad ID, ad set, form name) and lead responses (salary, PAN, employment type).
Export & Bulk Delete
Leads can be exported as CSV (GET /lead-forms/export) for external use. Bulk delete is available via DELETE /lead-forms/bulk with an array of IDs. Organic leads (isOrganic=true) are tracked separately from paid campaign leads.
CAM Calculator Flow
Credit Appraisal Memo — how credit executives assess loan eligibility
Open CAM Form
Credit executive opens the loan profile and navigates to the CAM Calculator tab. The frontend fetches any existing CAM via GET /loans/cam-calculator/:loanId — if one exists, the form is pre-populated.
Enter Salary Data
Exec enters up to 3 months of salary credit dates and amounts (salaryCreditDate1-3, salaryAmount1-3). The system auto-calculates avgSalary. The next pay date (nextPayDate) is also captured for disbursement planning.
Compute Eligibility
Based on avg salary and existing obligations (obligations), the system computes: eligibleFoir (allowed FOIR%), foirAchieved (current FOIR%), proposedFoir (after new loan), eligibleLoan (max loan based on FOIR), and roi (rate of interest).
Set Recommended Amount
Exec enters loanRecommended (which may differ from the customer's requested loanApplied). Disbursal date, repayment date, and tenure are also set. The repaymentData JSON captures the full EMI/repayment schedule.
Save & Submit
On save, the frontend calls POST /loans/brand/:brandId/cam-calculator/save. Backend upserts the CAMCalculator record linked to loanId + userId + partnerUserId. The saved CAM becomes part of the loan file reviewed by sanction managers.
Reminder Scheduling Flow
How staff create, schedule, and track customer reminders
Create Reminder
Staff opens the Reminders page and clicks "Create Reminder". They select a user (customer), choose a channel (SMS / WhatsApp / Email), pick a message template (templateCode), set a future scheduledAt timestamp, and optionally fill template variables in the payload map.
Store in DB
The frontend calls POST /partner/brand/:id/user-reminders. Backend creates a UserReminder record with status PENDING. The record stores userId, channel, templateCode, scheduledAt, and payload.
Cron Job Dispatch
A background cron runs every minute (@Cron(CronExpression.EVERY_MINUTE)) and polls for reminders where scheduledAt ≤ now and status = PENDING. It dispatches the message via the appropriate provider (MSG91, Gupshup for SMS; AiSensey for WhatsApp; SendGrid for Email) using the template code.
Status Update
After dispatch attempt, status updates to SENT (success) or FAILED (error). If a providerMessageId was specified during creation, it's stored for delivery tracking. Every status change is audit-logged.
Monitor & Audit
Staff views all reminders via GET /partner/brand/:id/user-reminders with filters: channel, status, date range, search. The Audit Log for each reminder (GET /user-reminders/:id/audit-logs) shows every state transition with timestamps and actor.
Acefone VoIP Click-to-Dial Flow
End-to-end flow: staff initiates a call to a customer from the partner portal
Brand Enables Dialer
Admin enables dialer via Brand Settings → Acefone configuration (API credentials, extension numbers). The AcefoneDialerProvider in the React app wraps the entire application and initializes the dialer SDK on mount.
Staff Clicks Call Button
On any user/loan profile page, staff clicks the phone icon next to the customer's number. The useAcefoneDialer hook calls initiateCall() which posts to /acefone/dialer/initiate with userId, partnerUserId, brandId, and optional loanId.
Acefone API Call
The backend forwards the click-to-call request to Acefone's API using the configured credentials. Acefone bridges the call — first calling the agent's extension, then dialing the customer when the agent answers.
Call Logs Auto-Saved
After the call ends, Acefone sends a webhook to POST /acefone/dialer/outbound. Backend stores the call log — duration, call status (answered/missed/busy), recording URL — linked to the user/loan.
View History
Call logs are viewable per user (GET /acefone/dialer/user/:userId/calls) and per partner agent (GET /acefone/dialer/partner/:partnerUserId/calls). Individual call details via GET /acefone/dialer/call/:callId. Stats per user/agent via the /stats endpoints.
Report Generation Flow
How reports are generated, what types exist, and how they're exported
📋 User & Loan Reports
master-report — full user+loan dump (PAN, Aadhaar, employment, bank, references, all loan statuses).
disbursed-loan-report, non-disbursed-loan-report, disburse-non-disburse-report — disbursement tracking.
active-loans-by-due-date-report, completed-loan-with-no-repet-report, loan-close-report, outstanding-data-report, reject-report, total-approve-sanction-report, affiliate-report, login-sessions-report.
💼 Collection Reports
master-collection-report — overdue loans, amounts, agent assignments.
collection-loan-report, collection-due-report, collection-loan-report-by-approved-date — per-loan collection views.
collection-allocation-executive-report, credit-executive-allocation-report, collection-remarks-report, total-recovery-report, field-visit-report.
📣 Marketing & Credit Reports
marketing-report, internal-marketing-report, internal-marketing-analysis-report — lead funnel and campaign data.
daily-marketing-mis-report — daily MIS snapshot.
lead-total-report, cic-report (CIBIL/Equifax bureau pulls), equifax-credit-report, transunion-report.
Select Report Type & Date Range
Admin opens the Reports page, selects report type from dropdown (e.g. master-report, marketing-report, collection-loan-report, disbursed-loan-report), and sets fromDate / toDate. There are 29 report types total.
Fetch Data
Frontend calls GET /partner/brand/:id/report/:reportType?fromDate=&toDate=. Backend queries the DB with date filters and returns typed arrays — MasterReportUser[], MarketingReportItem[], CompletedNoRepaymentReportItem[], or BaseReportItem[] for other types.
Display & Export
Data renders in a table. Staff can export as CSV via GET /report/:reportType/csv or download via GET /report/:reportType/download. Both return a stream — browser triggers file download. The master report also supports POST /master-report/email for email delivery of large datasets.
Reloan Automation Flow
A fully rule-based repeat-borrower decision engine — no manual step unless it routes there
ReloanAutomationService auto-decides APPROVED / PENDING / REJECTED without a human in the loop, unless the file routes to manual review. Every decision — eligible or not — is logged to loan_automation_decision (automation_type = RELOAN) for RBI-compliance audit purposes.
Pre-checks & hard stops
Missing required data or a migrated previous-loan record routes to manual review. Immediate REJECTED if: the previous loan wasn't COMPLETED, its closure wasn't NORMAL (i.e. WRITE_OFF/SETTLEMENT), or DPD on the previous loan exceeded 30 days.
Recency & AA-approval time bucket
More than 90 days since the previous disbursement → manual review even if otherwise eligible. Time bucket is measured from the AA approval date (not disbursement date): under 90 days continues the automated path; 90+ days routes to manual review.
Due-date validation & AA availability
Requested due date must fall within ±3 days of a computed reference date, else manual review. No AA data on file → manual review, flagged BANK_STATEMENT_REQUIRED.
Salary-based amount cap
cap = max(min(prevAmount × 1.1, avgSalary × 0.6), prevAmount). Within cap → auto-APPROVED. Exceeds cap → manual review, flagged AMOUNT_INCREASE.
UPI Autopay Flow
Recurring EMI mandate collection — Cashfree / Razorpay / PhonePe
AutopayService.resolveProvider) picks between Cashfree, Razorpay, and PhonePe per brand.
Mandate created
A los-partner staff member triggers mandate creation on an active loan (or it's offered at disbursement time).
Borrower authorizes
Borrower completes a ₹1 authorization payment on a Cashfree/Razorpay/PhonePe checkout link. Webhook confirms mandate status ACTIVE (or BANK_APPROVAL_PENDING, which still allows disbursement to proceed if the loan is at that stage — see the optional MANDATE stage in Loan Application Flow).
Daily debit cron
An 8am IST cron finds loans due the next day with an active, not-yet-initiated mandate and triggers a debit.
Webhook resolves outcome
On success, the collection transaction can auto-approve (if COLLECTION_AUTO_APPROVE_ENABLED), unblocking ledger posting/closure logic. Manual collection is frozen while a debit is in flight to prevent double-collection — an ambiguous debit is never auto-retried (same money-safety principle as e-stamp's NEEDS_REVIEW state).
Coin Wallet Incentive Flow
A gamified staff rewards engine — additive only, never a write path into loan data
locked / available / reserved / debt / net balances. This is the platform's closest analogue to a "commission" system — an internal staff incentive program, not an external-partner payout ledger.
Coins earned
The coin engine reads loan_status_history/loan_tasks/payment tables as an event source (35 rule versions, FIFO coin lots with expiry) — it is strictly additive to CRM truth and can never block or roll back a business transaction. There is deliberately no public ingestion endpoint (prevents coin-minting abuse), and every coin ledger table is append-only (DB triggers reject UPDATE/DELETE).
Grant approval chain
Grant statuses: AWAITING_CONFIRMATION → UNDER_REVIEW/PENDING → CREDITED/APPLIED (or REVERSED/VOIDED). Discretionary/manual grants go through a maker-checker flow with velocity-review anti-gaming checks.
Redemption
Coins redeem via CASH_PAYROLL, VOUCHER, MERCHANDISE, or EXPERIENCE channels. Redemption statuses: PENDING_MANAGER → PENDING_FINANCE → APPROVED → IN_PAYOUT → FULFILLED (or REJECTED/CANCELLED/FAILED).
Wallet, leaderboard & admin
los-partner exposes a wallet view, a leaderboard, a manager/finance approvals queue, and brand-level coin-admin configuration (rate, min redemption, monthly cap, auto-approve threshold, tier system) — all gated behind CoinBetaRoute, a per-request server decision rather than a static permission check.