Skip to main content

Get All Customer Lock Deposit Amount Query

Query amount locks across all deposit accounts system-wide with advanced filtering, search, date ranges, pagination, and export capabilities.

Overview

The GetAllCustomerLockDepositAmountQuery retrieves amount locks across the entire banking system, not limited to a single account. This powerful query supports text search, date filtering, state filtering, pagination, and Excel export. It's used for system-wide monitoring, compliance reporting, reconciliation, and operational dashboards.

Key Capabilities

  • System-Wide Query: Searches across all deposit accounts
  • Text Search: Search by account number, block reference, or reason
  • Date Range Filtering: Filter by creation date range
  • State Filtering: Include or exclude unlocked/seized locks
  • Pagination Support: Handles thousands of locks efficiently
  • Excel Export: Generate compliance reports
  • Dynamic Filtering: Supports additional filter criteria
  • Ordered Results: Returns locks in reverse chronological order

API Endpoint

POST /api/bpm/cmd


Request Structure

{
"commandName": "GetAllCustomerLockDepositAmountQuery",
"data": {
"searchText": "string",
"includeUnlocked": "boolean",
"isExport": "boolean",
"startDate": "string (yyyy-MM-dd)",
"endDate": "string (yyyy-MM-dd)",
"pageNumber": "integer",
"pageSize": "integer"
}
}

Request Fields

FieldTypeRequiredDefaultDescription
searchTextstringNonullSearch in account number, block reference, or lock reason
includeUnlockedbooleanNofalseInclude UNLOCKED and SEIZED locks
isExportbooleanNofalseExport to Excel instead of JSON
startDatestringNonullFilter locks created on or after this date (yyyy-MM-dd)
endDatestringNonullFilter locks created on or before this date (yyyy-MM-dd)
pageNumberintegerNo1Page number for pagination
pageSizeintegerNo10Number of records per page

Response Structure

Success Response (Paginated)

{
"isSuccessful": true,
"message": "50/1250 records returned.",
"statusCode": "00",
"data": {
"items": [
{
"id": 12345,
"blockReference": "CARD-AUTH-20241217-001",
"lockAmount": 2500.00,
"lockReason": "Card pre-authorization",
"currencyCode": "USD",
"depositAccountNumber": "ACC001234567",
"state": "LOCKED",
"transactionKey": "8A3F2D1E9B5C4F7A6E8D2C1B3A9F5E7D",
"dateCreated": "2024-12-17T10:30:00Z",
"holdState": "HOLD"
}
],
"pageNumber": 1,
"pageSize": 50,
"totalPages": 25,
"totalRecords": 1250
},
"pages": 25,
"hasNext": true,
"hasPrevious": false,
"size": 50,
"count": 1250
}

Export Response

When isExport is true, returns Excel file binary data with all matching records.


Sample Requests

1. Get All Active Locks (Default)

{
"commandName": "GetAllCustomerLockDepositAmountQuery",
"data": {
"pageNumber": 1,
"pageSize": 50
}
}

Use Case: System dashboard showing all current amount locks.

2. Search for Card Authorization Locks

{
"commandName": "GetAllCustomerLockDepositAmountQuery",
"data": {
"searchText": "CARD-AUTH",
"pageNumber": 1,
"pageSize": 100
}
}

Use Case: Find all card pre-authorization locks for reconciliation.

3. Get Locks for Specific Date Range

{
"commandName": "GetAllCustomerLockDepositAmountQuery",
"data": {
"startDate": "2024-12-01",
"endDate": "2024-12-31",
"includeUnlocked": true,
"pageNumber": 1,
"pageSize": 100
}
}

Use Case: Monthly lock activity report for compliance.

4. Export All Locks to Excel

{
"commandName": "GetAllCustomerLockDepositAmountQuery",
"data": {
"includeUnlocked": true,
"isExport": true
}
}

Use Case: Generate Excel report for audit or management review.

5. Search Specific Account with Full History

{
"commandName": "GetAllCustomerLockDepositAmountQuery",
"data": {
"searchText": "ACC001234567",
"includeUnlocked": true,
"pageNumber": 1,
"pageSize": 50
}
}

Use Case: Customer service looking up specific account's lock history.

{
"commandName": "GetAllCustomerLockDepositAmountQuery",
"data": {
"searchText": "legal",
"startDate": "2024-01-01",
"endDate": "2024-12-31",
"includeUnlocked": true,
"pageNumber": 1,
"pageSize": 50
}
}

Use Case: Compliance reporting on legal holds and seizures.


Business Logic

Processing Workflow

Query Logic

  1. Extract Parameters: Get all filter, search, and pagination parameters
  2. Dynamic Predicate Building: Start with base predicate from request.Data
  3. State Filter:
    • If includeUnlocked = false: Add filter for LOCKED state only
    • If includeUnlocked = true: Include all states
  4. Text Search Filter (if searchText provided):
    • Search in DepositAccountNumber (contains)
    • Search in BlockReference (contains)
    • Search in LockReason (contains)
    • Combined with OR logic
  5. Start Date Filter (if provided):
    • Parse string to date
    • Filter CBSTransaction.DateCreated >= startDate (date only, time ignored)
  6. End Date Filter (if provided):
    • Parse string to date
    • Add one day, subtract one tick for inclusive end-of-day
    • Filter CBSTransaction.DateCreated less than or equal to endDateTime
  7. Data Retrieval:
    • Include CBSTransaction relationship
    • Order by DateCreated descending (newest first)
    • Apply pagination (skip if export)
  8. Response Mapping: Project to simplified model
  9. Export Handling: Generate Excel using ExcelExporter if requested
  10. Success Response: Return paginated results or Excel file

Date Range Logic

// Start date: Beginning of day
if (startDate.HasValue)
{
var startDateOnly = startDate.Value.Date; // 2024-12-01 00:00:00
predicate = predicate.AndAlso(x => x.CBSTransaction.DateCreated >= startDateOnly);
}

// End date: End of day (inclusive)
if (endDate.HasValue)
{
var endDateOnly = endDate.Value.Date.AddDays(1).AddTicks(-1); // 2024-12-31 23:59:59.999...
predicate = predicate.AndAlso(x => x.CBSTransaction.DateCreated <= endDateOnly);
}

Text Search Logic

if (!string.IsNullOrWhiteSpace(searchText))
{
predicate = predicate.AndAlso(x =>
x.DepositAccountNumber.Contains(searchText) ||
x.BlockReference.Contains(searchText) ||
(x.LockReason != null && x.LockReason.Contains(searchText))
);
}

Response Fields

FieldTypeDescription
idintegerLock transaction ID
blockReferencestringUnique lock reference
lockAmountdecimalAmount locked
lockReasonstringReason for lock
currencyCodestringCurrency code
depositAccountNumberstringAccount number
statestringLOCKED / UNLOCKED / SEIZED
transactionKeystringAssociated transaction key
dateCreateddatetimeLock creation date/time
holdStatestringHOLD / CANCELLED / SETTLED

Code Examples

C# Implementation

public async Task<LockQueryResponse> GetAllLocksAsync(
string searchText = null,
bool includeUnlocked = false,
DateTime? startDate = null,
DateTime? endDate = null,
int pageNumber = 1,
int pageSize = 50)
{
var request = new
{
commandName = "GetAllCustomerLockDepositAmountQuery",
data = new
{
searchText,
includeUnlocked,
startDate = startDate?.ToString("yyyy-MM-dd"),
endDate = endDate?.ToString("yyyy-MM-dd"),
pageNumber,
pageSize
}
};

var json = JsonSerializer.Serialize(request);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await _httpClient.PostAsync($"{_baseUrl}/api/bpm/cmd", content);

return JsonSerializer.Deserialize<LockQueryResponse>(
await response.Content.ReadAsStringAsync());
}

JavaScript Implementation

async getAllLocks(options = {}) {
const request = {
commandName: 'GetAllCustomerLockDepositAmountQuery',
data: {
searchText: options.searchText,
includeUnlocked: options.includeUnlocked || false,
startDate: options.startDate, // 'yyyy-MM-dd' format
endDate: options.endDate,
pageNumber: options.pageNumber || 1,
pageSize: options.pageSize || 50
}
};

const response = await fetch(`${this.baseUrl}/api/bpm/cmd`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${this.accessToken}`,
'X-Tenant-ID': this.tenantId
},
body: JSON.stringify(request)
});

return await response.json();
}

Python Implementation

def get_all_locks(
self,
search_text: Optional[str] = None,
include_unlocked: bool = False,
start_date: Optional[str] = None, # 'yyyy-MM-dd' format
end_date: Optional[str] = None,
page_number: int = 1,
page_size: int = 50
) -> LockQueryResponse:
request_data = {
'commandName': 'GetAllCustomerLockDepositAmountQuery',
'data': {
'searchText': search_text,
'includeUnlocked': include_unlocked,
'startDate': start_date,
'endDate': end_date,
'pageNumber': page_number,
'pageSize': page_size
}
}

response = requests.post(
f'{self.base_url}/api/bpm/cmd',
headers=self.headers,
json=request_data
)

return response.json()

Business Rules

Validation Rules

  1. No Required Fields: All fields are optional
  2. Valid Page Number: pageNumber must be >= 1
  3. Valid Page Size: pageSize must be > 0
  4. Date Format: Dates must be in yyyy-MM-dd format

Operational Rules

  1. Default Behavior: Returns active locks only (LOCKED state)
  2. Include Unlocked: Set to true for full lock history
  3. Pagination: Default 10 records per page
  4. Ordering: Most recent locks first (descending by DateCreated)
  5. Export: isExport bypasses pagination and returns all matching records
  6. Text Search: Case-insensitive partial match on account, reference, or reason
  7. Date Range: Inclusive of both start and end dates
  8. Dynamic Filters: Supports additional filter criteria via DynamicPredicateBuilder
  9. Eager Loading: Loads CBSTransaction relationship for performance
  10. Read-Only: Query does not modify data (disableTracking: true)

Use Cases

1. Compliance Dashboard

Monitor all active locks across the system for regulatory reporting.

2. Fraud Investigation

Search for suspicious lock patterns across multiple accounts.

3. Reconciliation

Match bank locks with external system records using text search.

4. Operational Reporting

Generate daily/monthly/yearly lock activity reports.

5. Customer Service

Quickly find customer account locks when handling inquiries.

Track all legal holds and seizures with date range filtering.

7. System Monitoring

Monitor lock volume, trends, and anomalies.


  • GetLockDepositAmountQuery: Query locks for specific account
  • LockDepositAmountCommand: Create amount locks
  • DeleteDepositLockAmountCommand: Release locks
  • SeizeDepositLockAmountCommand: Seize locks

Performance Considerations

  • Large Result Sets: Use pagination instead of export for better performance
  • Date Filtering: Always use date range filters for large datasets
  • Text Search: Add specific search text to limit results
  • Export Caution: Exports can be slow with thousands of records
  • Index Usage: Query uses indexes on DepositAccountNumber and DateCreated

Support

For technical assistance: api-support@banklingo.com