Skip to main content

Update Loan Account

Overview

Updates modifiable information on an existing loan account.

Endpoint

POST /api/bpm/cmd

Request Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token for authentication
Content-TypestringYesMust be application/json
X-Tenant-IdstringYesTenant 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

ParameterTypeRequiredDescription
cmdstringYesMust be "UpdateLoanCommand"
dataobjectYesUpdate loan data object
↳ accountNamestringYesUpdated account name
↳ salesChannelstringNoSales channel code
associationInformationobjectYesLoan associations
  ↳ accountOfficerEncodedKeystringYesAccount officer encoded key
  ↳ branchEncodedKeystringYesBranch encoded key
  ↳ loanEncodedKeystringYesLoan account encoded key to update
accountInformationobjectYesUpdated account details
  ↳ loanAmountdecimalYesUpdated loan amount
  ↳ interestRatedecimalYesUpdated interest rate
  ↳ loanTenorintegerYesUpdated loan term in months
  ↳ notesstringNoUpdated notes
  ↳ firstRepaymentDatestringNoUpdated first repayment date (ISO 8601)
  ↳ moratoriumTypeintegerYesMoratorium type (0=None, 1=InterestOnly, 2=Full)
  ↳ moratoriumPeriodintegerYesMoratorium period in months
disbursementInformationobjectYesUpdated disbursement information
  ↳ disbursementAmountdecimalYesUpdated disbursement amount
  ↳ disbursementDatestringYesUpdated disbursement date (ISO 8601)
  ↳ disbursementMethodstringYesDisbursement method
  ↳ disbursmentChannelEncodedKeystringNoDisbursement channel encoded key
↳ commentsarray[string]NoUpdate 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

CodeDescription
200Loan updated successfully
400Invalid request data
401Unauthorized
404Loan not found
500Internal server error

Business Rules

  • Loan State Restrictions: Can only update loans in Partial_Application or Pending_Approval states
  • Full Editing: Complete editing is allowed for loans in pending states
  • Limited Editing: Loans in Active, Approved, or In_Arrears states 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