bank: run Nostro's callback reader beside ours, as a shadow
All checks were successful
Deploy / build-deploy (push) Successful in 7m33s

ParseBunqCallback is to be replaced by ReadCallback of Nostro.Money
(Nostro 1.1.0), so that this repo stops carrying bunq's wire format.
That reader is stricter than ours: it wants a time, a counterparty and
the account's own IBAN where ours reads four members, and nobody has
run it on a callback bunq really sent. Ours has settled real payments
since 2026-08. So before anything is swapped, both run.

- The handler is untouched and still decides alone. Once it has
  answered and written its credit, Nostro's reader reads the same body
  and one line goes to the log: `bank callback shadow: AGREE ...` when
  the id, the amount and the reference are the same in both readings,
  and `DIFFER ...` with what parted them otherwise.
- The line carries no payment data: no id, amount, name or reference,
  only whether values match and a few fixed words. A body holds the
  payer's name and IBAN, and may repeat the secret address.
- It is on wherever BUNQ_WEBHOOK_PATH is set, with no setting of its
  own.
- project.cpp takes Nostro with --product=money --banks=bunq, at the
  commit of its 1.1.0 release: the module alone, which brings no
  credential and no Crafter.Network, Crafter.DB or OpenSSL of its own.

ShouldCompareCallbackReaders pins every verdict, and that none repeats
anything a body carried. ShouldReceiveBankCallbacks posts callbacks to
the real endpoint: an order settles from one, a payment Nostro's reader
refuses is credited all the same, and the server's log holds nothing of
what was posted.

Built and run in a copy of this tree with crafter-build 6.4.1: the
server and the wasm bundle build, and every suite passes but
ShouldServePostPages, which fails the same way without this change
where the post media is not mirrored. The binary needs the same shared
libraries as before.

Temporary: once real payments read AGREE the reader takes over, and
this goes together with ParseBunqCallback. deploy/README.md says how to
read the result.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Jorijn van der Graaf 2026-11-25 14:21:55 +01:00
commit 36a635fd48
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
8 changed files with 906 additions and 5 deletions

View file

@ -510,6 +510,45 @@ key after the home address changed), the pull fails and its unit says so, but
nothing tells the shop. Settlement then rests on the webhook alone, so a
failing `catcrafts-credits` unit is worth noticing.
#### The callback shadow (temporary, since 2026-11-25)
The webhook's parser (`ParseBunqCallback`) is to be replaced by Nostro's
`ReadCallback`, so that this repo stops carrying bunq's wire format. That
reader is stricter than ours and had never been run on a callback bunq really
sent, while ours has settled real payments since 2026-08. So for now both run:
ours decides exactly as before, and Nostro's reads the same body afterwards and
logs what it made of it. It cannot change the answer or the credit, and it
turns on by itself wherever `BUNQ_WEBHOOK_PATH` is set.
Read the result on the server, after any payment in or out of the account:
```sh
journalctl -u catcrafts-server | grep 'bank callback shadow'
```
- `AGREE in method=sepa account=ours event=transactions`: both readers read
the same id, amount and reference. This line on a real incoming transfer is
what the test is for.
- `AGREE … method ours=MASTERCARD nostro=card …`: still agreement. Only the
name for how the money arrived differs, which is expected for card payments.
- `account=other`: the payment is on another account than `TRANSFER_IBAN`. Our
parser never looked at that, and the replacement must.
- `DIFFER nostro refused what ours reads as a payment: <sentence>`: Nostro's
reader would have dropped a payment ours credited. The sentence names the
check that failed, and that is a fix for Nostro, not for this repo.
- `DIFFER id=… amount=… reference=…`: both read a payment and not the same one.
The line carries no payment data: no id, no amount, no name and no reference.
`ShouldCompareCallbackReaders` pins the verdicts and
`ShouldReceiveBankCallbacks` the endpoint, including that a payment Nostro's
reader refuses is credited all the same.
When real payments read `AGREE`, the reader takes over, and the shadow goes
together with `ParseBunqCallback`
(`server/implementations/Catcrafts.Server-CallbackShadow.cpp` and its call in
`Catcrafts.Server-Http.cpp`). Nostro's module is built in through
`project.cpp`, named at the commit of its 1.1.0 release.
#### The old reader: `--pull-credits`
`catcrafts-server --pull-credits` is this repo's own bunq client. It onboards