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:
| Command | Purpose | Documented |
|---|---|---|
GetCustomerBasicDetailsQuery | Get complete customer profile | View → |
GetCustomerKycInformationQuery | Get KYC verification status | View → |
GetCustomerAddressDetailsQuery | Get address information | View → |
GetCustomerBranchAssociationsQuery | Get customer's branch access | ⏳ Pending |
GetCustomerRoleAssociationsQuery | Get customer's role assignments | ⏳ Pending |
GetCustomerIdentityDetailsQuery | Get identity documents | ⏳ Pending |
GetCustomerNextOfKinDetailsQuery | Get next of kin details | ⏳ Pending |
GetCustomerEmploymentDetailsQuery | Get employment information | ⏳ Pending |
2. KYC Verification Commands
Commands for approving/rejecting KYC documents:
| Command | Purpose |
|---|---|
ApproveIdentityDocumentCommand | Approve identity document |
RejectIdentityDocumentCommand | Reject identity document |
ApproveCustomerAddressInformationCommand | Approve address verification |
RejectCustomerAddressInformationCommand | Reject address verification |
3. Loan Application Commands
Commands for managing loan applications:
| Command | Purpose | Documented |
|---|---|---|
GetCustomerLoanDetailsQuery | Get loan application details | View → |
GetCustomerLoanSalaryHistoryQuery | Get salary verification history | View → |
GetCustomerLoanCreditBureauSearchesQuery | Get credit bureau searches | View → |
GetCustomerLoanGuarantorsQuery | Get loan guarantors | View → |
4. Guarantor Management Commands
Commands for managing loan guarantors:
| Command | Purpose |
|---|---|
InitiateGuarantorVerificationCommand | Start guarantor verification |
ApproveGuarantorVerificationCommand | Approve guarantor |
DeclineGuarantorVerificationCommand | Decline 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:
| Role | Access Level |
|---|---|
RELATIONSHIP_MANAGER | Initiate loan applications |
BRANCH_MANAGER | Branch-level approval |
AREA_MANAGER | Area-level approval |
DIVISION_MANAGER | Division-level approval |
CREDIT_ADMIN | Credit review and approval |
HEAD_CREDIT_ADMIN | Senior credit review |
CONTROL_OFFICER | Compliance and final review |
FINANCE | Loan disbursement |
MD | Managing Director approval |
GMD | Group 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
| Code | Meaning | Description |
|---|---|---|
00 | Success | Operation completed successfully |
04 | Not Found | Resource not found or unauthorized |
99 | System Error | An 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: