Skip to main content

Loan Origination Commands Overview

Introduction

The BankLingo Loan Origination system exposes a comprehensive set of commands for managing the entire loan lifecycle. All commands follow a consistent pattern and include performance monitoring capabilities.

Command Architecture

Command Pattern

All commands follow the CQRS (Command Query Responsibility Segregation) pattern:

{
"cmd": "CommandName",
"data": "{\"parameter\":\"value\"}"
}

Response Structure

All commands return a consistent response structure:

{
"ok": true,
"message": "Operation completed successfully",
"statusCode": "00",
"outData": {
// Command-specific data
}
}

Performance Monitoring

Many commands include performance timing data:

{
"ok": true,
"outData": {
"...": "data",
"PerformanceTimings": {
"0_TotalExecutionTime": 245,
"1_ParseParameters": 2,
"2_FetchData": 180,
"3_ProcessData": 50
},
"PerformanceSummary": {
"TotalExecutionTimeMs": 245,
"SlowestOperation": "2_FetchData"
}
}
}

Command Categories

1. Customer Management Commands

Commands for managing customer information and KYC:

CommandPurposeDocumented
GetCustomerBasicDetailsQueryGet complete customer profileView →
GetCustomerKycInformationQueryGet KYC verification statusView →
GetCustomerAddressDetailsQueryGet address informationView →
GetCustomerBranchAssociationsQueryGet customer's branch access⏳ Pending
GetCustomerRoleAssociationsQueryGet customer's role assignments⏳ Pending
GetCustomerIdentityDetailsQueryGet identity documents⏳ Pending
GetCustomerNextOfKinDetailsQueryGet next of kin details⏳ Pending
GetCustomerEmploymentDetailsQueryGet employment information⏳ Pending

2. KYC Verification Commands

Commands for approving/rejecting KYC documents:

CommandPurpose
ApproveIdentityDocumentCommandApprove identity document
RejectIdentityDocumentCommandReject identity document
ApproveCustomerAddressInformationCommandApprove address verification
RejectCustomerAddressInformationCommandReject address verification

3. Loan Application Commands

Commands for managing loan applications:

CommandPurposeDocumented
GetCustomerLoanDetailsQueryGet loan application detailsView →
GetCustomerLoanSalaryHistoryQueryGet salary verification historyView →
GetCustomerLoanCreditBureauSearchesQueryGet credit bureau searchesView →
GetCustomerLoanGuarantorsQueryGet loan guarantorsView →

4. Guarantor Management Commands

Commands for managing loan guarantors:

CommandPurpose
InitiateGuarantorVerificationCommandStart guarantor verification
ApproveGuarantorVerificationCommandApprove guarantor
DeclineGuarantorVerificationCommandDecline guarantor

Authorization

User Classifications

Commands check user classification for authorization:

  • BACKOFFICE_ADMINISTRATORS: Full access to all customer data
  • Organization Users: Limited to their organization's data

Role-Based Access

Some commands require specific roles:

RoleAccess Level
RELATIONSHIP_MANAGERInitiate loan applications
BRANCH_MANAGERBranch-level approval
AREA_MANAGERArea-level approval
DIVISION_MANAGERDivision-level approval
CREDIT_ADMINCredit review and approval
HEAD_CREDIT_ADMINSenior credit review
CONTROL_OFFICERCompliance and final review
FINANCELoan disbursement
MDManaging Director approval
GMDGroup Managing Director approval

Common Parameters

userId

Type: long (integer)
Required: Yes (in most commands)
Description: The ID of the customer/user

Example:

{
"cmd": "GetCustomerBasicDetailsQuery",
"data": "{\"userId\":\"129\"}"
}

loanQuoteId

Type: long (integer)
Required: Yes (in loan-specific commands)
Description: The ID of the loan application

Example:

{
"cmd": "GetCustomerLoanDetailsQuery",
"data": "{\"userId\":\"129\",\"loanQuoteId\":\"110\"}"
}

Error Handling

Standard Error Codes

CodeMeaningDescription
00SuccessOperation completed successfully
04Not FoundResource not found or unauthorized
99System ErrorAn unexpected error occurred

Error Response Example

{
"ok": false,
"statusCode": "04",
"message": "User not found or unauthorized",
"outData": null
}

Performance Optimization

Use Dedicated Commands

Instead of fetching all data with GetCustomerBasicDetailsQuery, use dedicated commands for specific data:

❌ Slow - Fetches everything (245ms):

{
"cmd": "GetCustomerBasicDetailsQuery",
"data": "{\"userId\":\"129\"}"
}

✅ Fast - Fetches only KYC (85ms, 65% faster):

{
"cmd": "GetCustomerKycInformationQuery",
"data": "{\"userId\":\"129\"}"
}

Parallel Requests

When fetching independent data, make parallel requests:

const [kyc, branches, roles] = await Promise.all([
api.query({ cmd: "GetCustomerKycInformationQuery", data: "{\"userId\":\"129\"}" }),
api.query({ cmd: "GetCustomerBranchAssociationsQuery", data: "{\"userId\":\"129\"}" }),
api.query({ cmd: "GetCustomerRoleAssociationsQuery", data: "{\"userId\":\"129\"}" })
]);

// Total time: ~85ms (slowest query)
// vs GetCustomerBasicDetailsQuery: ~245ms

Next Steps

Explore specific command categories: