Skip to content

be: find a token's account by its iban, so a caller with several accounts needs no moneta id - #72

Merged
landsman merged 10 commits into
mainfrom
be/account-by-iban
Nov 12, 2026
Merged

landsman merged 10 commits into
mainfrom
be/account-by-iban

Conversation

@landsman

@landsman landsman commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Closes #68. A token opening several accounts left every app to match the stored IBAN against accounts() itself; moneta.accountByIban(token, iban) and me.accountByIban(iban) do it. Only an IBAN's letters and digits count, in either case, so one pasted from a PDF or a web page (no-break and zero-width spaces, dashes, dots) matches.

  • null, not an exception, when the token does not see the IBAN: for a poller that is an answer (revoked for that account, or another holder's token).
  • A blank IBAN, or one failing its ISO 13616 check digits, is an IllegalArgumentException before any request, so a caller's typo is not read as a revoked account.
  • Two accounts with one IBAN (one per currency, possibly) are an IllegalStateException naming their ids, not a guess.
  • Nothing remembered: one accounts request per call, so a revoked account shows on the next poll.
  • An account without an IBAN never matches. No transactions(iban) shortcut: it would hide the null case in an exception.

Tests: a match as printed and with every separator; an IBAN the token does not see; blank and mistyped ones, which send no request; a shared IBAN; the accounts read again per call. .docs/usage.md has it under "More than one account", in Java and Kotlin.

Comment thread .docs/usage.md Resolved

@landsman landsman left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second pass, on the code rather than the threads. The five findings from the first round are all addressed: the lookup is on MonetaClient with the holder delegating, a blank IBAN is refused before any request, a shared IBAN throws, the per-call regex is gone, and the doc caveat now matches the filter. Tests and spotlessCheck pass on the head.

What is left:

  1. .docs/usage.md now has two sections on one topic. Fold the new one into the existing ## More than one account.
  2. account(token, iban) has the shape of transactions(token, accountId) but takes an IBAN. Passing an id returns null, which the docs say to read as revoked. Rename it.
  3. "Spaces of any kind" still misses zero-width characters. Keeping letters and digits only fixes that and the dashes caveat together.
  4. A mistyped IBAN is still indistinguishable from a revoked one. The mod-97 check is the blank guard's argument applied to the common case.
  5. Two test nits.

None of this blocks the behaviour. 2 and 3 are worth settling before the method is published, since it is new and pre-1.0.

Comment thread .docs/usage.md Resolved
@landsman
landsman merged commit 0993a6a into main Nov 12, 2026
6 checks passed
@landsman
landsman deleted the be/account-by-iban branch November 12, 2026 19:43
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.

be: find a token's account by its iban, so a caller with several accounts needs no moneta id

1 participant