Files
smom-dbis-138/packages/integration-foundation/dist/iso20022/CanonicalFinancialEvent.js
defiQUG d717b504a6
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m12s
CI/CD Pipeline / Security Scanning (push) Successful in 2m21s
CI/CD Pipeline / Lint and Format (push) Failing after 36s
CI/CD Pipeline / Terraform Validation (push) Failing after 22s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 25s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 23s
Validation / validate-genesis (push) Successful in 26s
Validation / validate-terraform (push) Failing after 21s
Validation / validate-kubernetes (push) Failing after 9s
Validation / validate-smart-contracts (push) Failing after 8s
Validation / validate-security (push) Failing after 1m15s
Validation / validate-documentation (push) Failing after 15s
OMNL reconcile anchor / Run omnl:reconcile and upload artifacts (push) Failing after 26s
Verify Deployment / Verify Deployment (push) Failing after 56s
feat(omnl): settlement terminal, compliance gates, and HYBX integration foundation
Add operator settlement terminal UI/API, swift-listener service, compliance
idempotency gates, GRU reserve dashboards, and @dbis/integration-foundation
for typed HYBX/ISO adapter contracts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-07 21:51:32 -07:00

40 lines
1.3 KiB
JavaScript

"use strict";
/** Extended canonical financial event aligned to ISO 20022 concepts (not full XML). */
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateCanonicalFinancialEvent = validateCanonicalFinancialEvent;
const REQUIRED_FIELDS = [
'schema_version',
'message_id',
'end_to_end_id',
'debtor',
'creditor',
'amount',
'currency',
'source_system',
'target_system',
'entity_id',
'tenant_id',
];
function validateCanonicalFinancialEvent(event) {
const errors = [];
for (const field of REQUIRED_FIELDS) {
const value = event[field];
if (value === undefined || value === null || value === '') {
errors.push(`Missing required field: ${field}`);
}
}
if (event.debtor && !event.debtor.id) {
errors.push('debtor.id is required');
}
if (event.creditor && !event.creditor.id) {
errors.push('creditor.id is required');
}
if (event.amount !== undefined && !/^\d+(\.\d+)?$/.test(event.amount)) {
errors.push('amount must be a numeric string');
}
if (event.currency !== undefined && !/^[A-Z]{3}$/.test(event.currency)) {
errors.push('currency must be a 3-letter ISO 4217 code');
}
return { valid: errors.length === 0, errors };
}