pain001.camt053 package#

Camt.053 bank statement parsing and generation utilities.

Submodules#

pain001.camt053.generator module#

Builder for ISO 20022 camt.053 bank-to-customer statements.

The complement to pain001.camt053.parse_camt053_statement(): build a well-formed camt.053 statement from structured data — useful for simulating a bank’s end-of-day statement in tests. Output round-trips cleanly back through the parser.

pain001.camt053.generator.VALID_CDT_DBT = frozenset({'CRDT', 'DBIT'})#

Recognised credit/debit indicators and entry statuses (ISO 20022).

pain001.camt053.generator.build_camt053_statement(statement_id: str, iban: str, currency: str, entries: list[dict[str, Any]], *, electronic_sequence_number: str = '1', version: str = 'camt.053.001.02') → str[source]#

Build a camt.053 bank-to-customer statement as an XML string.

Parameters:
  • statement_id – Statement identifier (Stmt/Id).

  • iban – Account IBAN (Stmt/Acct/Id/IBAN).

  • currency – Account currency (Stmt/Acct/Ccy, ISO 4217).

  • entries – One dict per booked entry. Recognised keys: amount (required), credit_debit_indicator (CRDT/DBIT, required), status (BOOK/PDNG/INFO, default BOOK), booking_date, value_date, entry_reference, remittance_information, and an optional per-entry currency (defaults to the account currency). A ValueError is raised for an entry missing amount or carrying an invalid credit/debit indicator or status code.

  • electronic_sequence_number – Statement sequence number.

  • version – camt.053 message version (drives the namespace).

Returns:

The statement as a UTF-8 XML string (with declaration).

pain001.camt053.parser module#

Parser for ISO 20022 camt.053 bank statements.

pain001.camt053.parser.parse_camt053_statement(xml_file_path: str, xsd_file_path: str | None = None) → dict[str, object][source]#

Parse a camt.053 statement into a compact Python structure.