bank: run Nostro's callback reader beside ours, as a shadow
All checks were successful
Deploy / build-deploy (push) Successful in 7m33s
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:
parent
e0d3181840
commit
36a635fd48
8 changed files with 906 additions and 5 deletions
|
|
@ -639,6 +639,54 @@ export namespace Catcrafts::Server {
|
|||
void ConfigureBunqCallback(std::filesystem::path creditsPath,
|
||||
std::string secretPath);
|
||||
|
||||
// ── the callback shadow (temporary, since 2026-11-25) ─────────────
|
||||
//
|
||||
// A second reading of every bank callback, by Nostro's ReadCallback (the
|
||||
// module Nostro.Money of https://forgejo.catcrafts.net/Catcrafts/Nostro,
|
||||
// at its 1.1.0 release), set beside what ParseBunqCallback made of the
|
||||
// same body. It decides NOTHING: the handler has answered and written its
|
||||
// credit before this runs, and all that comes out is one log line.
|
||||
//
|
||||
// Why it exists: ParseBunqCallback is to be replaced by that reader, so
|
||||
// that this repo stops carrying bunq's wire format. The reader is
|
||||
// stricter. It wants a time, a counterparty and the account's own IBAN
|
||||
// where ours reads four members, and when this was written nobody had run
|
||||
// it on a callback bunq really sent: its shape came from a sample in
|
||||
// bunq's SDK dated 2017. Ours has settled real payments since 2026-08. So
|
||||
// the two run side by side until the log shows the reader agreeing on
|
||||
// real payments. Then it takes over, and this goes together with
|
||||
// ParseBunqCallback.
|
||||
//
|
||||
// The line carries no payment data, on purpose: no id, no amount, no name
|
||||
// and no reference, only whether the two readings match and a few fixed
|
||||
// words. A callback's body holds the payer's name and IBAN, which the
|
||||
// privacy notice says this shop does not copy out of the bank, and it may
|
||||
// repeat the address it was sent to, which is a secret.
|
||||
//
|
||||
// AGREE in method=sepa account=ours event=transactions
|
||||
// AGREE out method ours=MASTERCARD nostro=card account=other event=transactions
|
||||
// DIFFER nostro refused what ours reads as a payment: <nostro's sentence>
|
||||
// DIFFER id=same amount=DIFFERENT reference=same in method=sepa …
|
||||
//
|
||||
// AGREE means the id, the amount and the reference are the same, which is
|
||||
// everything settlement rests on. The method is reported beside it and is
|
||||
// allowed to differ: Nostro calls bunq's MASTERCARD a card payment, where
|
||||
// ours passes a type it does not know through as bunq wrote it. `account`
|
||||
// says whether the payment is on `ownIban`, which ours never looked at.
|
||||
//
|
||||
// `ours` is what ParseBunqCallback made of the same body, `bank` what a
|
||||
// Nostro connector to the bank is called ("bunq"), and `ownIban` the
|
||||
// account the shop is paid into; empty reports the account as unknown.
|
||||
// Whatever the reading or the comparison throws is caught and becomes the
|
||||
// verdict, in words that are not the body's.
|
||||
std::string ShadowCallbackVerdict(std::string_view bank, std::string_view body,
|
||||
const std::optional<BankCredit>& ours,
|
||||
std::string_view ownIban);
|
||||
|
||||
// Turn the shadow on for the callback endpoint, naming the shop's own
|
||||
// account. Without this call the endpoint behaves exactly as it did.
|
||||
void ConfigureCallbackShadow(std::string ownIban);
|
||||
|
||||
// One pull: read the account and append every credit not already in the
|
||||
// file to it, newest last. Returns the number appended, or nullopt if the
|
||||
// bank could not be reached. This is what `--pull-credits` runs, and it is
|
||||
|
|
|
|||
Loading…
Reference in a new issue