Undo Deposit Approval
Overview
The UndoDepositApprovalCommand allows users to retract a previously approved deposit account, reverting it to draft status.
Endpoint
POST /api/bpm/cmd
Request Body
{
"cmd": "UndoDepositApprovalCommand",
"data": {
"accountEncodedKey": "DEP-123456",
"comment": "Need to reverify documents"
}
}
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| cmd | string | Yes | Must be "UndoDepositApprovalCommand" |
| data | object | Yes | Undo approval data |
| ↳ accountEncodedKey | string | Yes | Deposit account identifier |
| ↳ comment | string | No | Reason for undoing approval |
## Response Structure
### Success Response
```json
{
"succeeded": true,
"message": "Deposit approval undone successfully",
"data": {
"depositId": "DEP001234",
"accountNumber": "1234567890",
"status": "Draft",
"undoneBy": "user@bank.com",
"undoneDate": "2024-01-16T11:00:00Z",
"reason": "Account information needs to be corrected before activation"
},
"statusCode": 200
}
Field Descriptions
| Field | Type | Required | Description |
|---|---|---|---|
depositId | string | Yes | Unique identifier of the deposit account |
reason | string | Yes | Reason for undoing the approval |
Business Rules
-
Status Requirements
- Account must be in "Active" or "Pending_Approval" status
- Account must not have any transactions posted
-
Authorization
- User must have permission to undo approvals
- Typically restricted to supervisors or system administrators
-
Transaction Check
- Cannot undo approval if account has posted transactions
- Balance must be zero or initial deposit only
Error Codes
| Code | Description | HTTP Status |
|---|---|---|
DEPOSIT_NOT_FOUND | Deposit account does not exist | 404 |
CANNOT_UNDO_APPROVAL | Account has transactions and cannot be reverted | 400 |
INVALID_STATUS | Account status does not allow undo operation | 400 |
INSUFFICIENT_PERMISSIONS | User does not have permission | 403 |
INTERNAL_ERROR | An unexpected error occurred | 500 |
Code Examples
C# Example
public async Task<CommanExecutionResponse> UndoDepositApprovalAsync(
string depositId,
string reason)
{
var command = new UndoDepositApprovalCommand
{
DepositId = depositId,
Reason = reason
};
var response = await _client.Deposits.UndoApprovalAsync(command);
if (response.Succeeded)
{
Console.WriteLine($"Deposit approval undone: {response.Data.AccountNumber}");
Console.WriteLine($"New Status: {response.Data.Status}");
}
return response;
}
JavaScript/TypeScript Example
async undoDepositApproval(depositId: string, reason: string) {
const command = {
depositId,
reason
};
const response = await this.client.deposits.undoApproval(command);
if (response.succeeded) {
console.log(`Deposit approval undone: ${response.data.accountNumber}`);
console.log(`New Status: ${response.data.status}`);
}
return response;
}
Related Commands
- Approve Deposit - Approve pending deposit
- Request Deposit Approval - Submit deposit for approval