Update Loan Account
Overview
Updates modifiable information on an existing loan account.
Endpoint
POST /api/bpm/cmd
Request Headers
| Header | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Bearer token for authentication |
| Content-Type | string | Yes | Must be application/json |
| X-Tenant-Id | string | Yes | Tenant identifier |
Request Body
{
"cmd": "UpdateLoanCommand",
"data": {
"accountName": "Updated Business Loan - ABC Company",
"salesChannel": "BRANCH",
"associationInformation": {
"accountOfficerEncodedKey": "8a8e8e8e7f0000017f0000000001",
"branchEncodedKey": "8a8e8e8e7f0000017f0000000002",
"loanEncodedKey": "8a8e8e8e7f0000017f0000000099"
},
"accountInformation": {
"loanAmount": 550000.00,
"interestRate": 14.5,
"loanTenor": 30,
"notes": "Updated loan terms after review",
"firstRepaymentDate": "2024-03-15T00:00:00Z",
"moratoriumType": 1,
"moratoriumPeriod": 2
},
"disbursementInformation": {
"disbursementAmount": 550000.00,
"disbursementDate": "2024-02-15T00:00:00Z",
"disbursementMethod": "BankTransfer",
"disbursmentChannelEncodedKey": "8a8e8e8e7f0000017f0000000003"
},
"comments": ["Terms updated after credit review", "Approved by manager"]
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| cmd | string | Yes | Must be "UpdateLoanCommand" |
| data | object | Yes | Update loan data object |
| ↳ accountName | string | Yes | Updated account name |
| ↳ salesChannel | string | No | Sales channel code |
| ↳ associationInformation | object | Yes | Loan associations |
| ↳ accountOfficerEncodedKey | string | Yes | Account officer encoded key |
| ↳ branchEncodedKey | string | Yes | Branch encoded key |
| ↳ loanEncodedKey | string | Yes | Loan account encoded key to update |
| ↳ accountInformation | object | Yes | Updated account details |
| ↳ loanAmount | decimal | Yes | Updated loan amount |
| ↳ interestRate | decimal | Yes | Updated interest rate |
| ↳ loanTenor | integer | Yes | Updated loan term in months |
| ↳ notes | string | No | Updated notes |
| ↳ firstRepaymentDate | string | No | Updated first repayment date (ISO 8601) |
| ↳ moratoriumType | integer | Yes | Moratorium type (0=None, 1=InterestOnly, 2=Full) |
| ↳ moratoriumPeriod | integer | Yes | Moratorium period in months |
| ↳ disbursementInformation | object | Yes | Updated disbursement information |
| ↳ disbursementAmount | decimal | Yes | Updated disbursement amount |
| ↳ disbursementDate | string | Yes | Updated disbursement date (ISO 8601) |
| ↳ disbursementMethod | string | Yes | Disbursement method |
| ↳ disbursmentChannelEncodedKey | string | No | Disbursement channel encoded key |
| ↳ comments | array[string] | No | Update comments |
Response
Success Response (200 OK)
{
"success": true,
"message": "Loan updated successfully",
"data": {
"loanId": "LA-2024-00001",
"loanAccountNumber": "3001234567890",
"loanOfficerId": "OFFICER-456",
"repaymentAccountId": "ACC-99999",
"lastModifiedAt": "2024-01-20T15:30:00Z",
"lastModifiedBy": "admin@bank.com"
}
}
Status Codes
| Code | Description |
|---|---|
| 200 | Loan updated successfully |
| 400 | Invalid request data |
| 401 | Unauthorized |
| 404 | Loan not found |
| 500 | Internal server error |
Business Rules
- Loan State Restrictions: Can only update loans in
Partial_ApplicationorPending_Approvalstates - Full Editing: Complete editing is allowed for loans in pending states
- Limited Editing: Loans in
Active,Approved, orIn_Arrearsstates have restricted updates - Cannot Update Core Terms: After disbursement, some fields become immutable
- Branch and product must exist and be active
- Account officer must be active and authorized
Code Examples
C# Example
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
public class LoanService
{
private readonly HttpClient _httpClient;
public async Task<LoanResponse> UpdateLoanAsync(object loanData)
{
var commandRequest = new
{
cmd = "UpdateLoanCommand",
data = loanData
};
var json = JsonSerializer.Serialize(commandRequest);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await _httpClient.PostAsync(
"/api/bpm/cmd",
content
);
response.EnsureSuccessStatusCode();
var responseJson = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<LoanResponse>(responseJson);
}
}
// Usage
var loanData = new
{
accountName = "Updated Business Loan - ABC Company",
salesChannel = "BRANCH",
associationInformation = new
{
accountOfficerEncodedKey = "8a8e8e8e7f0000017f0000000001",
branchEncodedKey = "8a8e8e8e7f0000017f0000000002",
loanEncodedKey = "8a8e8e8e7f0000017f0000000099"
},
accountInformation = new
{
loanAmount = 550000.00m,
interestRate = 14.5m,
loanTenor = 30,
notes = "Updated loan terms after review",
firstRepaymentDate = DateTime.Parse("2024-03-15"),
moratoriumType = 1,
moratoriumPeriod = 2
},
disbursementInformation = new
{
disbursementAmount = 550000.00m,
disbursementDate = DateTime.Parse("2024-02-15"),
disbursementMethod = "BankTransfer",
disbursmentChannelEncodedKey = "8a8e8e8e7f0000017f0000000003"
},
comments = new[] { "Terms updated after credit review", "Approved by manager" }
};
var result = await loanService.UpdateLoanAsync(loanData);
Console.WriteLine($"Loan updated: {result.Data.LoanId}");
TypeScript/JavaScript Example
interface UpdateLoanCommandRequest {
cmd: string;
data: {
accountName: string;
salesChannel?: string;
associationInformation: {
accountOfficerEncodedKey: string;
branchEncodedKey: string;
loanEncodedKey: string;
};
accountInformation: {
loanAmount: number;
interestRate: number;
loanTenor: number;
notes?: string;
firstRepaymentDate?: string;
moratoriumType: number;
moratoriumPeriod: number;
};
disbursementInformation: {
disbursementAmount: number;
disbursementDate: string;
disbursementMethod: string;
disbursmentChannelEncodedKey?: string;
};
comments?: string[];
};
}
async function updateLoan(loanData: UpdateLoanCommandRequest['data']): Promise<any> {
const commandRequest: UpdateLoanCommandRequest = {
cmd: 'UpdateLoanCommand',
data: loanData
};
const response = await fetch('/api/bpm/cmd', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${accessToken}`,
'X-Tenant-Id': tenantId
},
body: JSON.stringify(commandRequest)
});
if (!response.ok) {
throw new Error(`Loan update failed: ${response.statusText}`);
}
return await response.json();
}
// Usage
const loanData = {
accountName: 'Updated Business Loan - ABC Company',
salesChannel: 'BRANCH',
associationInformation: {
accountOfficerEncodedKey: '8a8e8e8e7f0000017f0000000001',
branchEncodedKey: '8a8e8e8e7f0000017f0000000002',
loanEncodedKey: '8a8e8e8e7f0000017f0000000099'
},
accountInformation: {
loanAmount: 550000.00,
interestRate: 14.5,
loanTenor: 30,
notes: 'Updated loan terms after review',
firstRepaymentDate: '2024-03-15T00:00:00Z',
moratoriumType: 1,
moratoriumPeriod: 2
},
disbursementInformation: {
disbursementAmount: 550000.00,
disbursementDate: '2024-02-15T00:00:00Z',
disbursementMethod: 'BankTransfer',
disbursmentChannelEncodedKey: '8a8e8e8e7f0000017f0000000003'
},
comments: ['Terms updated after credit review', 'Approved by manager']
};
const result = await updateLoan(loanData);
console.log('Loan updated:', result.data.loanId);
Notes
- State-Dependent Updates: Different loan states allow different levels of modification
- Partial/Pending States: Full editing capabilities available
- Active/Approved States: Limited field updates allowed
- Audit Trail: All updates are logged with user and timestamp information
- Validation: System validates all changes against loan product rules and state constraints
- For major term changes after approval, consider loan restructuring functionality