activity.iso20022

Module Contents

Classes

Transaction

Functions

normalize_xml(→ str)

transaction_entries(→ Iterator[etree._Element])

Yields the transaction entries from the given Camt.053 or Camt.054

extract_transactions(→ Iterator[Transaction])

match_iso_20022_to_usernames(→ Iterator[Transaction])

Takes an ISO20022 camt.053 file and matches it with the invoice

Attributes

DOCUMENT_NS_EX

activity.iso20022.DOCUMENT_NS_EX[source]
activity.iso20022.normalize_xml(xml: str) str[source]
class activity.iso20022.Transaction(**kwargs: object)[source]
property order: tuple[int, int] | tuple[int, int, str][source]
property state: str[source]
__repr__() str[source]

Return repr(self).

references() set[str][source]
extract_references() Iterator[str][source]
activity.iso20022.transaction_entries(root: lxml.etree._Element) Iterator[etree._Element][source]

Yields the transaction entries from the given Camt.053 or Camt.054 xml. This works because for our purposes the entries of those two formats are identical.

activity.iso20022.extract_transactions(xml: str, invoice_schema: str) Iterator[Transaction][source]
activity.iso20022.match_iso_20022_to_usernames(xml: str, session: sqlalchemy.orm.Session, period_id: uuid.UUID, schema: str, currency: str = 'CHF') Iterator[Transaction][source]

Takes an ISO20022 camt.053 file and matches it with the invoice items in the database.

Raises an error if the given xml cannot be processed.

Returns:

An iterator of transactions found in the xml file, together with

the matching username and a confidence attribute indicating how certain the match is (1.0 indicating a sure match, 0.5 a possible match and 0.0 a non-match).