Skip to content

CAMT: join split Ustrd lines with a space, find names without Pty wrapper - #226

Open
bjorn wants to merge 1 commit into
raphaelm:masterfrom
bjorn:camt-join-repeated-elements
Open

CAMT: join split Ustrd lines with a space, find names without Pty wrapper#226
bjorn wants to merge 1 commit into
raphaelm:masterfrom
bjorn:camt-join-repeated-elements

Conversation

@bjorn

@bjorn bjorn commented Sep 14, 2026

Copy link
Copy Markdown

Two fixes in camt_parser.py, found while reading an ING account over FinTS.

Split remittance lines were glued together. Banks split RmtInf into several Ustrd elements, one field per line, and _parse_element concatenated repeated elements with nothing in between, so NR XXXX 1234 MUSTERSTADT DE + KAUFUMSATZ + 12.01 30.95 became ...MUSTERSTADT DEKAUFUMSATZ12.01 30.95. ING's own CSV export renders exactly these lines with a space between them, which is what a reader expects. A space is now inserted unless one side already borders on whitespace, so a chunk split mid-field with a trailing blank (CRED: + DE00ZZZ123456789, the case in the existing test) comes out unchanged.

Names were lost on camt.052.001.02. That schema, which ING serves, has no Pty wrapper around Nm, so applicant_name and recipient_name were always None there. Both spellings are now tried, for the names and for the creditor id.

Verified against a real 90-day ING report of 352 entries: every entry now gets a name, and the joined purpose text matches the bank's own export for the overlapping bookings. Existing tests pass; a new test file covers the 001.02 shape and the join rule.

Banks split the remittance information into several Ustrd elements,
one field per line, and _parse_element concatenated them with nothing
in between, so "NR XXXX 1234 MUSTERSTADT DE" + "KAUFUMSATZ" came out
as "...MUSTERSTADT DEKAUFUMSATZ". ING's own CSV export renders these
lines with a space, which is what a reader expects. A space is now
inserted unless one side already borders on whitespace, so chunks split
mid-field with a trailing blank ("CRED: " + "DE00ZZZ...", as in the
existing test) are unchanged.

camt.052.001.02, which ING serves, has no Pty wrapper around party
names, so applicant_name and recipient_name were always None there.
Both spellings are tried now.

Verified against a real 90-day ING report: all 352 entries get a name,
and the joined purpose matches the bank's own export text.
@bjorn
bjorn force-pushed the camt-join-repeated-elements branch from 6787b90 to 224342e Compare September 14, 2026 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant