Skip to main content

Crate camt053

Crate camt053 

Source
Expand description

A Rust library for parsing CAMT.053 (ISO 20022 Bank-to-Customer Statement) XML files and converting them to MT940 format.

CAMT.053 is a verbose, deeply nested XML schema used by many European banks to deliver account statements. This crate parses that schema and reduces it to a small, ergonomic model (SimpleStatement / SimpleTransaction) suitable for use in applications, plus a convenience method to render the result as MT940 text for legacy banking software.

§Example

use camt053::SimpleStatements;

let statements = SimpleStatements::load("statement.xml")?;
for statement in &statements.statements {
    println!("Account: {}", statement.account);
    for transaction in &statement.transactions {
        println!("{transaction}");
    }
}

SimpleStatements::load also accepts a .zip archive containing one or more camt.053 XML files (as commonly delivered by banks for multi-day exports); the contained statements are merged per account.

§Feature overview

Modules§

schema
Rust representation of the ISO 20022 Bank-to-Customer Statement message, supporting both camt.053.001.02 (camt.053.001.02.xsd in /doc) and the newer camt.053.001.08 (camt.053.001.08.xsd in /doc), and constrained by the Dutch Banking Association (DPA) Implementation Guidelines for this message (used by ABN/SNS/ING and other NL banks).

Structs§

Document
Root <Document> element.
SimpleStatement
A statement: opening/closing balance plus the transactions in between.
SimpleStatements
A collection of statements, similar to a CAMT.053 Document.
SimpleTransaction
A single booked transaction, reduced to the fields required for most use cases.

Enums§

CamtError
The single error type returned by all fallible operations in this crate.