Files
cbsnexora/src/app/clearing-network/clearing-status.ts
T
Jaanu423andClaude Sonnet 5 6d205c0ed2
Playwright E2E Tests / Run Playwright Tests (push) Canceled after 0s
Tests / testRigor (push) Canceled after 0s
build-run / Run Lint, Build and Deploy (push) Canceled after 0s
Publish Image in Docker Hub / build (push) Canceled after 0s
feat(clearing): add CTS/NACH clearing UI with real NPCI batch sessions
- CTS clearing module: inward batches (validate/pass/return), outward presentment
  capture, positive pay, settlement, reconciliation
- Outward Clearing merged into one screen: Pending Cheques + Batches tabs (a real
  clearing session per NPCI submission, either the 2-hourly job or manual send),
  drill into a batch to settle/dishonour its cheques
- Date-range, text, and quick (Today/Yesterday/All) filters with pagination across
  inward batches, outward presentments, outward batches, and batch detail
- NACH clearing module (mandates, batches, transaction decisioning)
- Shell/sidenav wiring for both new modules

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-21 15:57:45 +05:30

55 lines
1.4 KiB
TypeScript

/**
* Copyright since 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* Maps a clearing status/decision string to one of the three shared .pill classes
* (ok / bad / neutral). Shared by every CTS, NACH and settlement/reconciliation screen so the
* colour language stays consistent across the whole clearing feature.
*/
export function pillClass(status: string | null | undefined): 'ok' | 'bad' | 'neutral' {
const s = (status || '').toUpperCase();
const ok = [
'PASSED',
'PASS',
'POSTED',
'MATCHED',
'SETTLED',
'SENT',
'SENT_TO_CLEARING_HOUSE',
'PROCESSED',
'VALIDATED',
'ACTIVE',
'CLEARED',
'HONOURED',
'COMPLETED'
];
const bad = [
'RETURNED',
'RETURN',
'REJECTED',
'MISMATCH',
'DISHONOURED',
'CANCELLED',
'FAILED',
'FAIL',
'UNROUTABLE'
];
if (ok.includes(s)) {
return 'ok';
}
if (bad.includes(s)) {
return 'bad';
}
return 'neutral';
}
/** Extracts the most specific backend error message from a Fineract-style error response. */
export function clearingError(err: any, fallback = 'Request failed'): string {
return err?.error?.errors?.[0]?.defaultUserMessage ?? err?.error?.defaultUserMessage ?? fallback;
}