activity.iso20022
Attributes
Classes
Functions
|
|
|
Yields the transaction entries from the given Camt.053 or Camt.054 |
|
Extracts the QR-bill reference number from the given text. |
|
|
|
Takes an ISO20022 camt.053 file and matches it with the invoice |
Module Contents
- 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.get_esr(booking_text: str) str | None [source]
Extracts the QR-bill reference number from the given text. QR-bill reference numbers are usually 26 or 27 characters long but can be of any length. The 27-character version includes a check digit at the end. The 26-character version doesn’t include the check digit. For any other length we don’t know if the check digit is included or not.
For example:
input: ‘Gutschrift QRR: 27 99029 05678 18860 27295 37059’ output: ‘269902905678188602729537059’
- Returns:
The extracted reference number or None if no reference number.
If the extracted reference number is only 26 characters long, the check digit is appended to the end.
- 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).