Skip to main content

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

ParameterTypeRequiredDescription
cmdstringYesMust be "UndoDepositApprovalCommand"
dataobjectYesUndo approval data
↳ accountEncodedKeystringYesDeposit account identifier
↳ commentstringNoReason 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

FieldTypeRequiredDescription
depositIdstringYesUnique identifier of the deposit account
reasonstringYesReason for undoing the approval

Business Rules

  1. Status Requirements

    • Account must be in "Active" or "Pending_Approval" status
    • Account must not have any transactions posted
  2. Authorization

    • User must have permission to undo approvals
    • Typically restricted to supervisors or system administrators
  3. Transaction Check

    • Cannot undo approval if account has posted transactions
    • Balance must be zero or initial deposit only

Error Codes

CodeDescriptionHTTP Status
DEPOSIT_NOT_FOUNDDeposit account does not exist404
CANNOT_UNDO_APPROVALAccount has transactions and cannot be reverted400
INVALID_STATUSAccount status does not allow undo operation400
INSUFFICIENT_PERMISSIONSUser does not have permission403
INTERNAL_ERRORAn unexpected error occurred500

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;
}