Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .docs/banks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ A bank is in one of three states:
| Creditas | samples only | incoming and outgoing; counter-account, symbol, balance | transaction id, name, message; card holds refused | [creditas](cz/creditas/README.md) |
| Raiffeisenbank | samples only | transfers and card payments, from HTML; names, symbols, message, balance | transaction id | [raiffeisenbank](cz/raiffeisenbank/README.md) |
| UniCredit Bank | samples only | incoming, from HTML; counter-account and name, symbols, message | transaction id, balance, type; how an outgoing payment writes its direction | [unicredit](cz/unicredit/README.md) |
| ČSOB | samples only | CEB: incoming transfers and card payments, several in one e-mail (`readAll`); names, symbols, message | transaction id, balance time; SEPA, foreign and cash payments; its own internet banking's newer notification | [csob](cz/csob/README.md) |
| Komerční banka | not yet | | | [#14](https://github.com/landsman/bank-java/issues/14) |
| Česká spořitelna | not yet | | | [#15](https://github.com/landsman/bank-java/issues/15) |
| ČSOB | not yet | | several transactions in one e-mail | [#16](https://github.com/landsman/bank-java/issues/16) |
| Citfin | not yet | | | [#21](https://github.com/landsman/bank-java/issues/21) |
| Partners Banka | not yet | | sends no e-mail at all | [#25](https://github.com/landsman/bank-java/issues/25) |

Expand Down
51 changes: 51 additions & 0 deletions .docs/banks/cz/csob/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# How ČSOB's e-mail behaves

**Not seen as a real e-mail yet (2026-11-10).** The parser reads ČSOB's **CEB** notification from the fixtures of
[tomaj/bank-mails-parser](https://github.com/tomaj/bank-mails-parser/tree/master/tests/fixtures/csob-cz) (MIT, 43 of
them, 2018 to 2022), whose accounts fail the modulo 11 check. ČSOB signed as `d=csob.cz; s=alpha` in a 2020 e-mail
([remp2020's csob.eml](https://github.com/remp2020/crm-payments-module/blob/master/docs/csob.eml)); that key is gone, so
none is pinned and `withDns()` refuses every ČSOB e-mail as `Unverified`. See
[#16](https://github.com/landsman/bank-java/issues/16).

The newer notification of ČSOB's own internet banking (labels on their own lines, `Parametry platby`, as in
[myinvoice's sample](https://github.com/radekhulan/myinvoice/blob/master/api/tests/Unit/Bank/CsobBankEmailNoticeParserTest.php))
is not read yet.

## What it carries

Subject `CEB Info: Zaúčtování platby`. One block per booked transaction, **several in one e-mail at times**:

```
Dne 25.9.2018 byla na účtu 123456789 zaúčtovaná transakce typu: Došlá platba.

Název smlouvy: CRM International a.s.
Číslo smlouvy: 87654321
Majitel smlouvy: Shmelina a.s.
Účet: 123456789, CZK, CRM INTERNATION
Částka: +1 234,56 CZK
Účet protistrany: 1122334455/9999
Název protistrany: Capi Hnizdo a.s.
Variabilní symbol: 23456789
Konstantní symbol: 3456

Zůstatek na účtu po zaúčtování transakce: +1 234 567,89 CZK.
```

- **Read them all with `readAll()`.** `read()` refuses an e-mail with several, rather than return one of them.
- **The balances chain**: with several blocks, each balance has to be the previous one plus the block's amount, and
every block needs its balance. A block forged in a payer's message would take the real block's balance away or break
the chain; without balances it could not be told apart, so such an e-mail is refused. tomaj's parser names that case
a known limitation.
- **In each block** the sentence's account is the `Účet` line's (`/0300` is added), the amount's currency is the
account's, and the sign is the direction. The kinds read: `transakce typu: Došlá platba`, `Došlá úhrada`,
`Příchozí úhrada` (`okamžitá` too), and `transakce platební kartou` (no counter-account, `Z účtu: /`); an incoming kind
with a minus is refused. A SEPA transfer (`byl na účtu … zaúčtovaný SEPA převod`), a foreign or a cash one is a
sentence of its own, with an IBAN for the counter-party, and is `Unparsed` for now.
- **After `Zpráva příjemci`**, the payer's text, no labelled line may follow.
- **No transaction id**, and the balance has no time, so `balance()` is `null`. Deduplicate on a signed `messageId()`
(ČSOB signed `message-id` in 2020) and the position in `readAll()`'s list.

## Setting it up

[Fakturoid's guide](https://www.fakturoid.cz/podpora/parovani/csob): in CEB, Nastavení → CEB info → Účty a platby →
Nová notifikace → Zaúčtování platby → Všechny pohyby.
4 changes: 4 additions & 0 deletions .docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ See [raiffeisenbank.md](banks/cz/raiffeisenbank/README.md#setting-it-up). Not ve

See [unicredit](banks/cz/unicredit/README.md#setting-it-up). Not verified yet: no real UniCredit e-mail has been read.

## ČSOB

See [csob](banks/cz/csob/README.md#setting-it-up). Not verified yet: no real ČSOB e-mail has been read.

## Another bank

Not supported yet; see [banks](banks/README.md). Adding one starts from one of its real e-mails,
Expand Down
6 changes: 5 additions & 1 deletion .docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ try {
}
```

One e-mail can report several transactions (ČSOB's does): `readAll(rawMessage)` returns them all, in order, and
`read` refuses such an e-mail rather than return one of them. For any other bank `readAll` returns a list of one.

## The raw message

Hand `read` the message **exactly as it arrived**: the bytes your SMTP server, Cloudflare Email Worker or inbound
Expand Down Expand Up @@ -91,7 +94,8 @@ the same shape as in `moneta-api-java`.
about *your* account: a genuine notification of somebody else's account, sent to your address, verifies just as well.
If each customer has their own address, compare against that customer's account.

**Deduplicate on `transactionId()`**, per bank, or on a signed `messageId()` where a bank gives no transaction id.
**Deduplicate on `transactionId()`**, per bank, or on a signed `messageId()` where a bank gives no transaction id,
together with the position in `readAll()`'s list when one e-mail reports several transactions (ČSOB does).
Never on an unsigned `Message-ID` from your mail server: anyone holding a copy of the e-mail can change it while the
signature stays valid, and the same payment counts twice. The same e-mail can arrive twice, and two real payments can share an
amount, a variable symbol and a date.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ For Java 21+ and Kotlin, one jar, no framework required.

## Which banks

Air Bank and Fio banka CZ from real e-mails; MONETA, Creditas, Raiffeisenbank and UniCredit from public samples, until a real
Air Bank and Fio banka CZ from real e-mails; MONETA, Creditas, Raiffeisenbank, UniCredit and ČSOB from public samples, until a real
e-mail confirms them. Each bank, and what it reads: [banks](.docs/banks/README.md).

## Docs
Expand Down
1 change: 1 addition & 0 deletions llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Mistakes to avoid:
with `getMessage()` saying what to change in their banking.
- Never act on `Unverified`: anyone can send an e-mail that looks like the bank's.
- A valid signature does not prove the e-mail is about your account: compare `account()` with the one you expect.
- Use `readAll()` where one e-mail may report several transactions (ČSOB); `read()` refuses such an e-mail.
- Deduplicate on `transactionId()`, per bank: the same e-mail can arrive twice. `messageId()` is set only when the
bank signs it; never deduplicate on a `Message-ID` header read elsewhere, which a copy of the e-mail can change.
- `balance()` is the balance right after the payment and may be `null`; never take it for the account's current balance.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Date: Tue, 25 Sep 2018 09:15:44 +0200
From: CSOB Notification <noreply@csob.cz>
To: bruce.wayne@gothba.org
Message-ID: <0000@csob.cz>
Subject: =?utf-8?b?Q0VCIEluZm86IFphw7rEjXRvdsOhbsOtIHBsYXRieQ==?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Vážený kliente,

toto je automaticky generovaný e-mail ze služby ČSOB CEB, neodpovídejte na něj.

Dne 25.9.2018 byla na účtu 1234567899 zaúčtována transakce platební kartou.

Název smlouvy: Wayne Enterprises s.r.o.
Číslo smlouvy: 87654321
Majitel smlouvy: Wayne Enterprises s.r.o.
Účet: 1234567899, CZK, WAYNE ENTERPRIS
Částka: +1 234,56 CZK
Z účtu: /
Variabilní symbol: 23456789
Konstantní symbol: 3456
Specifický symbol: 4545454545

Zůstatek na účtu po zaúčtování transakce: +1 234 567,89 CZK.

S přáním krásného dne
Vaše ČSOB
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Date: Tue, 25 Sep 2018 09:15:44 +0200
From: CSOB Notification <noreply@csob.cz>
To: bruce.wayne@gothba.org
Message-ID: <0000@csob.cz>
Subject: =?utf-8?b?Q0VCIEluZm86IFphw7rEjXRvdsOhbsOtIHBsYXRieQ==?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Vážený kliente,

toto je automaticky generovaný e-mail ze služby ČSOB CEB, neodpovídejte na něj.

Dne 25.9.2018 byla na účtu 1234567899 zaúčtovaná transakce typu: Došlá platba.

Název smlouvy: Wayne Enterprises s.r.o.
Číslo smlouvy: 87654321
Majitel smlouvy: Wayne Enterprises s.r.o.
Účet: 1234567899, CZK, WAYNE ENTERPRIS
Částka: +1 234,56 CZK
Účet protistrany: 9876543211/0800
Název protistrany: Pennyworth Alfred
Variabilní symbol: 23456789
Konstantní symbol: 3456

Zůstatek na účtu po zaúčtování transakce: +1 234 567,89 CZK.

S přáním krásného dne
Vaše ČSOB
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Date: Tue, 25 Sep 2018 09:15:44 +0200
From: CSOB Notification <noreply@csob.cz>
To: bruce.wayne@gothba.org
Message-ID: <0000@csob.cz>
Subject: =?utf-8?b?Q0VCIEluZm86IFphw7rEjXRvdsOhbsOtIHBsYXRieQ==?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Vážený kliente,

toto je automaticky generovaný e-mail ze služby ČSOB CEB, neodpovídejte na něj.

Dne 25.9.2018 byla na účtu 1234567899 zaúčtovaná transakce typu: Došlá platba.

Název smlouvy: Wayne Enterprises s.r.o.
Číslo smlouvy: 87654321
Majitel smlouvy: Wayne Enterprises s.r.o.
Účet: 1234567899, CZK, WAYNE ENTERPRIS
Částka: +1 234,56 CZK
Účet protistrany: 9876543211/0800
Název protistrany: Pennyworth Alfred
Variabilní symbol: 23456789
Konstantní symbol: 3456

Zůstatek na účtu po zaúčtování transakce: +1 234 567,89 CZK.

Dne 25.9.2018 byla na účtu 1234567899 zaúčtovaná transakce typu: Došlá platba.

Název smlouvy: Wayne Enterprises s.r.o.
Číslo smlouvy: 87654321
Majitel smlouvy: Wayne Enterprises s.r.o.
Účet: 1234567899, CZK, WAYNE ENTERPRIS
Částka: +987,65 CZK
Účet protistrany: 5555555002/0100
Název protistrany: Gordon James
Variabilní symbol: 78787878
Konstantní symbol: 6789

Zůstatek na účtu po zaúčtování transakce: +1 235 555,54 CZK.

S přáním krásného dne
Vaše ČSOB
Loading
Loading