Support for camt.054 / document type autodetection / minor updates/fixes #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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.party_compat()
, which should make the parser compatible with v06 and v08 documents. Addedend_to_end_uuid
.Minor changes:
account()
statement_group_header()
charges()
entry()
[remittance_information]etree.QName(tree).localname
to get the tag name without the xmlns prefix.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?