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
SimpleStatements::load— parse a.xmlfile (or.ziparchive) into a list ofSimpleStatements, one per account.SimpleStatement::to_mt940— render a statement as an MT940 message.CamtError— the single error type returned by all fallible operations in this crate.
Modules§
- schema
- Rust representation of the ISO 20022 Bank-to-Customer Statement message,
supporting both
camt.053.001.02(camt.053.001.02.xsdin/doc) and the newercamt.053.001.08(camt.053.001.08.xsdin/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. - Simple
Statement - A statement: opening/closing balance plus the transactions in between.
- Simple
Statements - A collection of statements, similar to a CAMT.053 Document.
- Simple
Transaction - A single booked transaction, reduced to the fields required for most use cases.
Enums§
- Camt
Error - The single error type returned by all fallible operations in this crate.