python-sepa
python-sepa copied to clipboard
Support for camt.054 / document type autodetection / minor updates/fixes
We've been using the library for a while now for camt.053 files. Now we needed support for camt.054, which I have added here. Along the way we also added auto-detection of the document type and updated/fixed a few other things to make it work for our documents (Swiss banks).
Major changes:
- Added support for camt.054 (bank_to_customer_debit_credit_notification)
- Auto-detection of document type from xml namespace: If
parse()
is called withstructure=None
, the matching structure is selected automatically based on the xmlns attribute of the document and thestandard
andcompatible_standards
attributes of thesepa_messages
objects. If no matching structure is found, theUnsupportedDocumentType
exception is raised. The document type is returned asdocument_type
in the data. - Better support for 2019 versions of camt (v08): Added
party_compat()
, which should make the parser compatible with v06 and v08 documents. Addedend_to_end_uuid
.
Minor changes:
- Added 'Ownr' to
account()
- Added 'AddtlInf' to
statement_group_header()
- Implemented structure for 'Chrgs' in
charges()
- Implemented structure for 'Strd' in
entry()
[remittance_information] - Use
etree.QName(tree).localname
to get the tag name without the xmlns prefix. - Fixed typos: 'ClrSysMmdId' > 'ClrSysMmbId', 'AddtInf' > 'AddtlInf'
- Added schemas for v04 and v08 of camt.053 and camt.054
I would be happy to contribute those changes to the main repository.
Note: It is not clear to me what the best way to support multiple versions of a document type (e.g. camt.053.06 and camt.053.08) at the same time. Currently it seems to works, but it doesn't seem to be very clean or consistent. Is there a strategy to address that in the future?