Undo Loan Approval
Overview
Reverses a loan approval before disbursement has occurred.
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": "UndoLoanApprovalCommand",
"data": {
"loanAccountId": 12345,
"reason": "Incorrect information discovered",
"comments": "Need to reverify credit history"
}
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| cmd | string | Yes | Must be "UndoLoanApprovalCommand" |
| data | object | Yes | Undo approval data |
| ↳ loanAccountId | integer | Yes | Loan account ID to undo approval for |
| ↳ reason | string | Yes | Reason for undoing approval |
| ↳ comments | string | No | Additional comments |
Response
Success Response (200 OK)
{
"success": true,
"message": "Loan approval undone successfully",
"data": {
"loanId": "LA-2024-00001",
"status": "Draft",
"approvalUndoneAt": "2024-01-16T09:00:00Z",
"undoneBy": "manager@bank.com",
"reason": "Additional documentation required"
}
}
Status Codes
| Code | Description |
|---|---|
| 200 | Approval undone successfully |
| 400 | Cannot undo approval (loan disbursed) |
| 401 | Unauthorized |
| 403 | Insufficient authority |
| 404 | Loan not found |
| 409 | Loan not in approved status |
| 500 | Internal server error |
Business Rules
- Can only undo before disbursement
- Requires supervisory authority
- Reason is mandatory
- Loan returns to draft status
- Re-approval required before disbursement
Code Examples
C# Example
public async Task<UndoApprovalResponse> UndoLoanApprovalAsync(string loanId, string reason)
{
var request = new { loanId, reason };
var json = JsonSerializer.Serialize(request);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await _httpClient.PostAsync("/api/administration/loan/undo-approval", content);
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<ApiResponse<UndoApprovalResponse>>(result).Data;
}
TypeScript Example
async function undoLoanApproval(loanId: string, reason: string): Promise<UndoApprovalResponse> {
const response = await fetch('/api/administration/loan/undo-approval', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${accessToken}`,
'X-Tenant-Id': tenantId
},
body: JSON.stringify({ loanId, reason })
});
const result = await response.json();
return result.data;
}
Notes
- Cannot undo after disbursement
- Requires higher authority than original approval
- All approval history maintained in audit trail
- Loan officer and customer notified
- Loan must go through approval again