@fin.cx/camt

ISO 20022 CAMT.052/053/054 bank statement parser with exact integer-cent amounts and SEPA reference extraction. The go-forward statement format for EBICS banking (MT940 is legacy — see @fin.cx/mt940 for that).

Built as the ingestion layer for @fin.cx/bankrec (bank reconciliation) and the @fin.cx/skr accounting core: amounts never touch IEEE floats — they are parsed from the XML strings straight into integer cents.

Issue Reporting and Security

For reporting bugs, issues, or security vulnerabilities, please visit community.foss.global/. This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a code.foss.global/ account to submit Pull Requests directly.

What This Package Does

  • Parses camt.053 (statements), camt.052 (account reports), and camt.054 (debit/credit notifications), normalized into one statement model
  • Handles the namespace versions in circulation (.001.02 classic through .001.08+ post-2019 EBICS); structural differences are normalized
  • Exact integer-cent amounts (amountCents) — 0.01 parses to 1, never 0.010000000000000002
  • Extracts SEPA references (EndToEndId, MandateId, TxId), counterparty name/IBAN/BIC (direction-aware: debtor for credits, creditor for debits), unstructured and structured remittance info (RF creditor references), return reasons (e.g. AC04), reversal flags, and bank transaction codes
  • Statement-internal completeness check: opening booked balance + booked movement must equal the closing booked balance to the cent

Installation

pnpm add @fin.cx/camt

Usage

import { parseCamt, validateStatementConsistency } from '@fin.cx/camt';

const statements = parseCamt(camtXmlString);

for (const statement of statements) {
  const consistency = validateStatementConsistency(statement);
  if (!consistency.valid) {
    throw new Error(`Statement broken: ${consistency.issues.join('; ')}`);
  }
  for (const entry of statement.entries) {
    entry.amountCents; // integer cents, exact
    entry.creditDebit; // 'CRDT' | 'DBIT'
    entry.details[0]?.endToEndId;
    entry.details[0]?.counterpartyIban;
    entry.details[0]?.remittanceUnstructured;
  }
}

Cross-statement continuity (gapless statement sequences across files) is the job of @fin.cx/bankrec, which consumes this model.

Development

pnpm build
pnpm test

This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the license file.

Please note: The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.

Trademarks

This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.

Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.

Company Information

Task Venture Capital GmbH Registered at District Court Bremen HRB 35230 HB, Germany

For any legal inquiries or further information, please contact us via email at hello@task.vc.

By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.

S
Description
No description provided
Readme 138 KiB
Languages
TypeScript 100%