ACCEPTANCE — GatewayQR-MunicVAllende (v1)
Every criterion closes only when a green test carries its ID in the name (test_ac01_...,
"AC-01: ...").
Exception, criteria verified on the POS (AC-29, AC-33): the CYRE POS is an MS-DOS program that
no test in this repository can drive. These criteria close on a recorded end-to-end run of the real
POS binary under DOSBox-X against the gateway and the muni-emulator, with the evidence committed
under docs/evidence/ and the POS build named. (human decision, 2026-11-18)
Payment flow (POS ↔ gateway ↔ municipal API)
- [x] AC-01 — When a configured branch calls
trxidthentrxpago, the gateway creates a municipal charge and answersPAGO_ENVIADOwithqrdata= municipalcodigoin under 2 s. (origin: agent, confirmed: 2026-11-16) - [x] AC-02 — When the payer pays,
GET /api/trxes/{id}returnsPAGO_APROBADOwithidTransaccionwithin one poll interval (5 s) plus 1 s. (origin: agent, confirmed: 2026-11-16) - [x] AC-03 — When the charge expires unpaid, the POS receives
REFUND_DENEGADOwith "QR expired" inmensajevarios. (origin: agent, confirmed: 2026-11-16) - [x] AC-04 — When the cashier presses Esc while waiting, the POS sends
trxanulacionfor the pending id, the gateway cancels the municipal charge immediately, and the attempt ends CANCELLED (SPEC §2, POS change 3). (origin: agent, confirmed: 2026-11-16) - [x] AC-05 — A new payment attempt after EXPIRED/CANCELLED comes with a new
trxid, usesreferenciaExterna = {branch}-{pos}-{trxid}and gets a new charge. (origin: agent, confirmed: 2026-11-16) - [x] AC-06 — Repeated
trxpagocalls with the sametrxidnever create a second charge, and two attempts with the samenroticketfiscalbut differenttrxidare independent (CONSTITUTION C4). (origin: agent, confirmed: 2026-11-16) - [x] AC-07 — A
trxidfrom an unconfiguredcomercio+sucursalis rejected with "Sucursal no configurada". (origin: agent, confirmed: 2026-11-16)
Failure behavior
- [x] AC-08 — E1: a timeout on create leaves the attempt UNCERTAIN, the gateway retries with the
same
referenciaExterna, and the POS only seesPAGO_ENVIADOuntil it resolves. (origin: agent, confirmed: 2026-11-16) - [x] AC-09 — E2: a municipal 400/401 on create ends the attempt at once and the POS's
first query receives
REFUND_DENEGADOwith the municipalmensaje; a 401 also raises a cockpit alert. (origin: agent, confirmed: 2026-11-16) - [x] AC-10 — E3:
totalcashback > 0is rejected with a clear message. (origin: agent, confirmed: 2026-11-16) - [x] AC-11 — C5: while UNCERTAIN the gateway never answers
REFUND_DENEGADO. (origin: agent, confirmed: 2026-11-16)
Timing (ADR-003, controllable clock)
- [x] AC-12 — A charge paid at second 115 of a 120 s lifetime is reported
PAGO_APROBADO. (origin: agent, confirmed: 2026-11-16) - [x] AC-13 — Safety net for a POS that cannot notify (hang, power or network loss): a pending attempt with no POS query for 20 s is cancelled at the municipal API. (origin: agent, confirmed: 2026-11-16)
- [x] AC-14 — A cancel answered 409 on a paid charge ends PAID_UNCONFIRMED with a cockpit alert. (origin: agent, confirmed: 2026-11-16)
- [x] AC-15 — After a gateway restart, every non-final attempt keeps being polled. (origin: agent, confirmed: 2026-11-16)
Security and data (CONSTITUTION)
- [x] AC-16 — The API key and
pagadoPorLegajonever appear in any log, including the wire log (C2, C3). (origin: agent, confirmed: 2026-11-16) - [x] AC-17 — A merchant configured as SANDBOX never reaches the production URL, and the reverse (C6). (origin: agent, confirmed: 2026-11-16)
- [x] AC-18 — Amounts are stored as
DECIMAL(12,2)and the amount sent equalstotalitemexactly (C1). (origin: agent, confirmed: 2026-11-16)
Cockpit
- [ ] AC-19 — An admin can create a merchant and a branch; the API key is never returned by any cockpit endpoint after it is saved (K1, K2′). (origin: agent, confirmed: 2026-11-16)
- [ ] AC-20 — The attempt list filters by date, branch, POS and status and shows the event timeline (K3). (origin: agent, confirmed: 2026-11-16)
- [ ] AC-21 — An alert can be marked resolved with a note, recorded as an event (K4). (origin: agent, confirmed: 2026-11-16)
Dev bench (ADR-004)
- [ ] AC-22 — An end-to-end payment runs from the simulated POS panel through the real gateway to the emulator and the payer panel and back. (origin: agent, confirmed: 2026-11-16)
Esc-vs-pay race
- [x] AC-23 — When the payer pays at the moment the cashier presses Esc (municipal cancel returns
409, charge PAID), the gateway denies the cancel, keeps the attempt PAID, and the POS's final
query receives
PAGO_APROBADO(SPEC §4 race rule). (origin: agent, confirmed: 2026-11-16)
Coverage of already-agreed scope
- [ ] AC-24 — K5: "Reconcile day X" lists credited movements with no local PAID attempt and local PAID attempts with no movement (only if the corpus shows a matching field, SPEC O3). (origin: agent, confirmed: 2026-11-16)
- [x] AC-25 — C5: an UNCERTAIN attempt the POS gave up on, later resolved as PAID, ends PAID_UNCONFIRMED with a cockpit alert; resolved as VENCIDO, it ends EXPIRED with no alert. (origin: agent, confirmed: 2026-11-16)
- [x] AC-26 — A PAID_UNCONFIRMED attempt re-queried by the POS ("Reintenta via Consulta")
returns
PAGO_APROBADO. (origin: agent, confirmed: 2026-11-16) - [x] AC-27 — C7: no code path updates or deletes a row in the event table (the repository exposes insert only). (origin: agent, confirmed: 2026-11-16)
- [x] AC-28 — C8: a fresh install has no admin user that can log in until one is created by the installer; passwords are stored BCrypt-hashed. (origin: agent, confirmed: 2026-11-16)
- [x] AC-29 — On a real CYRE POS against the bench: the QR is rendered from
qrdata, the poll interval follows the new profile key, and Esc cancels the pending charge (POS changes 1–3). (origin: agent, confirmed: 2026-11-16) Verified 2026-11-18 in the DOSBox-X POS E2E with S4c3ef254(the fullco.batoutput, hashes inpos_build.txt, the same build in every run: the QR render inPOS_MAIN.EXE, the PAGOQR flow inPOS_CTOQ.DLL), keys 543=1 and 496=240, evidence underdocs/evidence/2026-11-18/(see its README): - QR: shown from
qrdata(run3/,shots/T1_qr.png). - Poll interval follows key 564: with key 564 = 3 (run2 and run3) queries reach the gateway
6.4 s apart and the POS pauses 3.0 s between
Verificandolines (run2/); with key 564 = 2 (run4) they arrive 5.4 s apart (run4/proxy_L.log). The key values are recorded in the POS's boot dumps (pos_profile_dumps.txt: 13:00 and 13:30 show 3, 13:54 and later show 2). - Esc:
trxanulacionapproved, charge ANULADO, attempts 21 and 22 CANCELLED (run3/,shots/T1_esc.png,shots/T1_anul1.png).
Final query still pending
- [x] AC-30 — When the final query at
expira+ grace still answers PENDIENTE, the gateway cancels the charge before denying: cancel OK → EXPIRED andREFUND_DENEGADO; cancel 409 with the charge PAID → PAID handling (PAGO_APROBADO, or PAID_UNCONFIRMED if the POS abandoned); cancel timeout → UNCERTAIN, never a denial (ADR-003, C5). (origin: agent, confirmed: 2026-11-16)
Amount mismatch
- [ ] AC-31 — When the Muni reports PAGADO with an amount different from the sale (or an
unreadable amount), the attempt ends AMOUNT_MISMATCH, an AMOUNT_MISMATCH alert is raised, and
the POS receives
REFUND_DENEGADOwith "Monto acreditado distinto: NO cobrar de nuevo, verificar en cockpit" — neverPAGO_APROBADO. (human decision, 2026-11-17)
Held attempts
- [ ] AC-32 — An attempt held by a merchant mismatch or stuck on municipal refusals can be
closed from the cockpit only after
expira+ grace, with the admin's current password and a note; it endsCLOSED_BY_ADMIN, the POS receivesREFUND_DENEGADO"Cerrado por admin: NO cobrar de nuevo, verificar con la Muni", and its alert is not re-raised after a resolve while it stays held. (human decision, 2026-11-17)
Lost trxpago
- [x] AC-33 — On a real CYRE POS against the bench: when the first
trxpagodoes not reach the gateway (gateway stopped or unreachable while it is sent, back before the payment times out), the POS resends the sametrxpagofrom its query loop, the QR appears, and the payment completes with exactly one municipal charge for thattrxid; when the firsttrxpagodid arrive and only its answer was lost, the POS stops waiting after about 11 s, its first query shows the QR before the gateway's 20 s abandonment, and the payment completes with exactly one municipal charge. A resend or retry never creates a second charge (POS changes 4 and 5, C4). (human decision, 2026-11-17; lost-answer clause revised 2026-11-18 after the POS E2E, revision approved by the user 2026-11-18) Verified 2026-11-18 in the DOSBox-X POS E2E with S4c3ef254(same build as AC-29), evidence underdocs/evidence/2026-11-18/(see its README): - Lost answer:
run4/attempt 24 (key 564 = 2) andrun2/attempt 18. In both the first query came 11.2 s after thetrxpago, carriedqrdata, and the attempt was paid. The 20 s abandonment was in force in the run4 gateway process (run4/timing.json). - Gateway stopped, POS connecting directly:
run4/attempt 25. Thetrxpagoconnect failed, the two queries after the restart were answeredPAGO_ENVIADOwith noqrdata(POS day log), then the resend, QR, paid. This payment ran on a ticket restored after POS restarts and sentnroticketfiscal"0" (README, case G ticket). The charge was created after the resend (CREATING event at 14:05:16, emulatorexpira). - Gateway stopped behind a live proxy:
run2/attempt 20,run3/attempt 23. Answer timeout, then a resend with the same body, QR, paid. - One charge per
referenciaExternain every emulator file. - Covered elsewhere: "never a second charge" is backed by the AC-06 tests. The 3-resend limit is POS design, and no run exercised it.
Success metrics
trxpagop99 under 2 s against the emulator.- Zero second charges for the same
trxidin production (from the event log).