Files
CurrenciCombo/orchestrator/src/services/swift/index.ts
Devin 632f309ffc
Some checks failed
CI / Frontend Lint (pull_request) Failing after 5s
CI / Frontend Type Check (pull_request) Failing after 7s
CI / Frontend Build (pull_request) Failing after 6s
CI / Frontend E2E Tests (pull_request) Failing after 8s
CI / Orchestrator Build (pull_request) Failing after 6s
CI / Contracts Compile (pull_request) Failing after 7s
CI / Contracts Test (pull_request) Failing after 6s
Code Quality / SonarQube Analysis (pull_request) Failing after 19s
Code Quality / Code Quality Checks (pull_request) Failing after 5s
Security Scan / Dependency Vulnerability Scan (pull_request) Failing after 5s
Security Scan / OWASP ZAP Scan (pull_request) Failing after 4s
PR E: SWIFT gateway (MT760, pacs.009, MT202, camt.025/054) — arch step 6
Outbound generators:
- swift/mt760.ts: SBLC issuance (FIN Cat-7). 12-tag message built from
  InstrumentTerms with deterministic messageHash() for planHash
  anchoring. URDG 758 / UCP 600 aware.
- swift/pacs009.ts: FI-to-FI credit transfer (ISO 20022 XML,
  pacs.009.001.08). Fixes the pacs.008 mis-routing flagged in the
  gap-analysis (pacs.008 is customer-to-bank; pacs.009 is bank-to-bank).
  BIC validation on all four agents.
- swift/mt202.ts: FIN equivalent of pacs.009 for non-migrated corridors.
  32A amount formatted with SWIFT decimal comma.

Inbound parsers:
- swift/camt.ts: parseCamt025 (receipt / status), parseCamt054
  (credit/debit notification), reconcileCamt054 (diffs amount, ccy,
  direction, endToEndId so VALIDATING can feed mismatches into
  Data.valueMismatch()), parseCamt dispatcher on xmlns marker.

Public surface in swift/index.ts documents channel selection:
pacs.008 stays on the PSP customer leg; pacs.009/MT202 is the
interbank leg; COMMIT requires camt.025 ACSC or camt.054 CRDT
(arch §9.2 accepted !== settled).

Tests: swift.test.ts — 14 cases covering the happy path, validation
errors (bad BIC, malformed date, negative amount, missing pay step),
determinism of messageHash, camt parser + reconciliation.

tsc clean. 74 tests pass across 6 suites.
2026-04-22 17:17:19 +00:00

37 lines
1.3 KiB
TypeScript

/**
* SWIFT gateway — public surface (arch §4.2 + §4.3).
*
* Outbound generators:
* - generateMt760 : issuance of SBLC (Cat-7 FIN)
* - generatePacs009 : FI-to-FI credit transfer (ISO 20022 XML)
* - generateMt202 : FIN equivalent of pacs.009 for non-migrated
* corridors
*
* Inbound parsers:
* - parseCamt025 : receipt / status of a prior instruction
* - parseCamt054 : bank-to-customer credit/debit notification
* - reconcileCamt054: diff a camt.054 against the expected amount,
* currency, and end-to-end id
*
* Channel selection (arch §9.2 accepted !== settled):
* - pacs.008 remains the customer-initiated PSP channel (existing
* `services/iso20022.ts`). COMMIT must not fire on pacs.008
* "acceptance" alone.
* - pacs.009 / MT202 is the interbank settlement channel; COMMIT
* requires either camt.025 ACSC or camt.054 CRDT evidence here.
*/
export { generateMt760, messageHash, type Mt760Message } from "./mt760";
export { generatePacs009, type Pacs009Options, type Pacs009Result } from "./pacs009";
export { generateMt202, type Mt202Options, type Mt202Message } from "./mt202";
export {
parseCamt,
parseCamt025,
parseCamt054,
reconcileCamt054,
type Camt025Receipt,
type Camt054Notification,
type CamtMessage,
type ReconcileExpected,
} from "./camt";