CreateIdentityDocumentCommand
Overview
The CreateIdentityDocumentCommand allows you to create new identity documents for self-service users in the loan origination system. This command supports multiple identity document types and enables manual entry of identity information.
Handler File: CB.Administration.Api/Commands/BPM/SelfService/SelfServiceserDetailCommandHandlers.cs
Use Cases
- Manual entry of customer identity documents
- Uploading identity documents during loan application
- Recording identity information from physical documents
- Supporting customers who complete identity verification offline
Supported Identity Types
The command supports four types of identity documents:
| Type | Enum Value | Description |
|---|---|---|
| National ID | 1 | Government-issued national identity card |
| International Passport | 2 | International travel passport |
| Driver's License | 3 | Government-issued driver's license |
| Voter's Card | 4 | Electoral voter registration card |
Request Parameters
Required Parameters
| Parameter | Type | Description |
|---|---|---|
userId | long | The ID of the self-service user |
identityType | int | Identity document type (1-4) |
idNumber | string | The identity document number |
base64Doc | string | Document image encoded in base64 |
docExtension | string | File extension (e.g., ".jpg", ".pdf") |
Optional Parameters
| Parameter | Type | Description |
|---|---|---|
issuingAuthority | string | Organization that issued the document |
issueDate | string | Date document was issued (ISO format) |
expiryDate | string | Date document expires (ISO format) |
Request Example
{
"commandName": "CreateIdentityDocumentCommand",
"data": {
"userId": 123,
"identityType": 1,
"idNumber": "A12345678",
"issuingAuthority": "NIMC",
"base64Doc": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"docExtension": ".jpg",
"issueDate": "2020-01-01",
"expiryDate": "2030-01-01"
}
}
Response Format
Success Response
{
"isSuccessful": true,
"statusCode": "00",
"message": "Identity document created successfully.",
"data": {
"identityId": 456,
"userId": 123,
"identityType": 1,
"identityTypeDesc": "National ID",
"idNumber": "A12345678",
"verificationStatus": 0,
"verificationStatusDesc": "PENDING",
"createdAt": "2026-01-11T10:30:00Z"
}
}
Error Responses
User Not Found
{
"isSuccessful": false,
"statusCode": "04",
"message": "User not found."
}
Duplicate ID Number
{
"isSuccessful": false,
"statusCode": "04",
"message": "An identity document with this ID number already exists for this user and identity type."
}
Invalid Identity Type
{
"isSuccessful": false,
"statusCode": "04",
"message": "Invalid identity type. Must be 1-4."
}
Validation Rules
- User Existence: The
userIdmust reference an existing self-service user - No Duplicates: Cannot create multiple documents with the same
idNumber,identityType, anduserIdcombination - Valid Identity Type: The
identityTypemust be between 1 and 4 - Required Fields: All required parameters must be provided
Verification Status
When a document is created, it automatically receives a verification status of PENDING (0). The document must then go through the approval workflow:
- Created: Document is created with status = PENDING
- Admin Review: Admin uses
ApproveIdentityDocumentCommandorRejectIdentityDocumentCommand - Approved/Rejected: Status changes to APPROVED or REJECTED
Related Commands
- ApproveIdentityDocumentCommand - Approve a pending identity document
- RejectIdentityDocumentCommand - Reject a pending identity document
- GetCustomerIdentityDetailsQuery - Retrieve identity documents for a user
Integration Example
cURL Request
curl -X POST https://api.banklingo.com/execute \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"commandName": "CreateIdentityDocumentCommand",
"data": {
"userId": 123,
"identityType": 1,
"idNumber": "A12345678",
"issuingAuthority": "NIMC",
"base64Doc": "BASE64_ENCODED_IMAGE_HERE",
"docExtension": ".jpg",
"issueDate": "2020-01-01",
"expiryDate": "2030-01-01"
}
}'
JavaScript Example
const response = await fetch('https://api.banklingo.com/execute', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
commandName: 'CreateIdentityDocumentCommand',
data: {
userId: 123,
identityType: 1, // National ID
idNumber: 'A12345678',
issuingAuthority: 'NIMC',
base64Doc: base64EncodedImage,
docExtension: '.jpg',
issueDate: '2020-01-01',
expiryDate: '2030-01-01'
}
})
});
const result = await response.json();
console.log('Identity document created:', result.data.identityId);
C# Example
var command = new
{
CommandName = "CreateIdentityDocumentCommand",
Data = new
{
UserId = 123,
IdentityType = 1, // National ID
IdNumber = "A12345678",
IssuingAuthority = "NIMC",
Base64Doc = Convert.ToBase64String(imageBytes),
DocExtension = ".jpg",
IssueDate = "2020-01-01",
ExpiryDate = "2030-01-01"
}
};
var result = await _mediator.Send(command);
Best Practices
- Image Size: Compress images before encoding to base64 to reduce payload size
- File Formats: Use standard formats like JPG, PNG, or PDF
- Validation: Validate ID numbers against known formats before submission
- Expiry Dates: Check document expiry dates and warn users if documents are expiring soon
- Security: Always transmit document data over HTTPS
- Storage: The system stores the base64 encoded document - ensure adequate storage capacity
Technical Notes
- Entity:
SelfServiceIdentityInformation - Database Table:
BPMLoanSelfService.SelfServiceIdentityInformation - LoanQuoteId: This field is commented out in the entity - identity documents are user-level, not loan-specific
- Async Operation: This is a synchronous operation despite the async signature