Saltar a contenido

ACCEPTANCE — GatewayPrismaQR

Definition of Done. Each criterion closes only when a green test carries its ID in the name (e.g. ac07_...). All criteria below were proposed by the agent and confirmed by the human on 2026-10-02 (AC-01..30: "confirmá los 30 tal cual"; AC-31..32 and the rest: "confirmá los pendientes").

POS contract (v1, direct or behind RouterQR)

  • [x] AC-01 — When the POS sends POST /api/trxid with a known enabled merchant, branch and checkout, then the gateway answers 201 with a numeric id within 2 s; with an unknown or disabled one it answers a non-2xx error. (origin: agent, confirmed: 2026-10-02)
  • [x] AC-02 — When trxpago arrives in POS-native shape (totalitem) or RouterQR shape (importe, tipoautorizador), then both are processed identically. (origin: agent, confirmed: 2026-10-02)
  • [x] AC-03 — When a payment is approved, then the response carries estado = AUTORIZACION_DE_PAGO_APROBADA, numeric importe, autorizadortrxid, autorizadorintencionid, plus importe_final, importe_recdesc, cuotas, payment_method_id, payment_method_type, mediodepago, and importe + importe_recdesc == importe_final to the cent. (origin: agent, confirmed: 2026-10-02)
  • [x] AC-04 — When the POS retries trxpago with the same id, then the intention is never sent twice: the gateway resumes the wait or returns the stored result. (origin: agent, confirmed: 2026-10-02)
  • [x] AC-05 — GET /api/trxes/{id} returns the same shape as trxpago with the current estado and importe; for a payment the gateway has irreversibly decided as no sale (rejected, cancelled, superseded, expired, intention/complete failed, compensation pending/done/failed) the estado is REFUND_DENEGADO, the only denial that ends the Almacor POS polling. (amended by the human 2026-10-04 after the real POS E2E) (origin: agent, confirmed: 2026-10-02)

Prisma flow

  • [x] AC-06 — The create-intention request carries cuit, branch, checkout, mcc, currency, original_amount and bins_max_quantity = 99, and cbu when the merchant operates Transferencias 3.0. (origin: agent, confirmed: 2026-10-02)
  • [x] AC-07 — The BINs callback answers 204 in under 200 ms p95 and the complete intention reaches Prisma in under 3 s p99 (emulator), always within 27 s. (origin: agent, confirmed: 2026-10-02)
  • [x] AC-08 — Every payment method in the complete intention includes the 1-installment plan, and method 112 is always present. (origin: agent, confirmed: 2026-10-02)
  • [x] AC-09 — Callbacks without the apikey we issued, or with a wrong one, are rejected (fail-closed, constant-time comparison). (origin: agent, confirmed: 2026-10-02)
  • [x] AC-10 — The same callback received twice produces the same result and no double effect. (origin: agent, confirmed: 2026-10-02)

Plans, surcharges and discounts

  • [ ] ~~AC-11 — Mode A: for each BIN, per installment count, the first POS promotion row by order whose prefix and payment method match wins; ranges longer than the BIN are skipped and logged; no match gives 1 payment without adjustment.~~ (withdrawn: Mode A removed by human decision 2026-10-28) (origin: agent, confirmed: 2026-10-02)
  • [ ] ~~AC-12 — Mode A with a base: the adjustment is computed on the base (capped at the QR amount) and converted to an effective percentage over the QR amount.~~ (withdrawn: Mode A removed by human decision 2026-10-28) (origin: agent, confirmed: 2026-10-02)
  • [x] AC-13 — Mode B: plans are filtered by validity, weekday and minimum amount, and the most specific wins (BIN range > bank > payment method; branch > merchant); the console refuses two plans that tie. (origin: agent, confirmed: 2026-10-02)
  • [x] AC-14 — Amounts use the POS rounding (half away from zero, the single rounding of the POS payment-method promotion engine, ROUND_DOUBLE((ROUND_DOUBLE(base) × ROUND_DOUBLE(pct)) / 100), not RoundExp100) and produce the same adjustment as the pinpad for the same card and plan. (closed 2026-10-29 by measurement on the real Almacor POS: its payment-method promotion engine and the gateway give the same adjustment for surcharges and discounts, including sub-cent cases, .5-cent ties and large-base ties; D-133) (origin: agent, confirmed: 2026-10-02)
  • [ ] AC-15 — For a plan with a surcharge, TNA and CFT are sent and are consistent with the adjustment; for an interest-free plan or a discount they are 0. (origin: agent, confirmed: 2026-10-02)
  • [ ] AC-16 — Cuotas MiPyME plans (13 and 16) are offered with their plan code when configured. (origin: agent, confirmed: 2026-10-02)
  • [x] AC-17 — The adjustment never applies to cashback; cashback is only offered with Visa Débito in 1 payment. (Read as "a cashback is never approved on any other method or installment count: it is compensated", because v27's complete intention has no field to offer cashback; accepted by the human 2026-10-04, pending Prisma questions 21-22.) (origin: agent, confirmed: 2026-10-02)
  • [x] AC-18 — Plans come only from the gateway's configuration per merchant and branch (Mode B); a POS-sent promotion list is ignored. (origin: agent, confirmed: 2026-10-02)

Timeout, cancellation and compensation

  • [x] AC-19 — When the payment wait expires, the POS receives a denied answer before RouterQR's read timeout, the intention is cancelled at Prisma, and the POS never receives SINRESPUESTA. (origin: agent, confirmed: 2026-10-02)
  • [x] AC-20 — When the wallet approves after the POS was told "denied" or after a cancellation, the gateway annuls the payment automatically (INV-01), and the compensation intent was persisted before the POS answer (INV-02; see the INV-02 exception). (origin: agent, confirmed: 2026-10-02)
  • [x] AC-21 — A late notification is always accepted and applied (INV-03). (origin: agent, confirmed: 2026-10-02)
  • [x] AC-22 — Compensation prefers forced annulment over forced refund; before re-sending a forced operation the gateway queries its status; after the retry limit the payment ends in COMPENSATION_FAILED with an alert. (origin: agent, confirmed: 2026-10-02)
  • [x] AC-23 — trxanulacion is idempotent: requested by the POS, by RouterQR's sweeper and by our job for the same payment, it produces one reversal at Prisma and answers 2xx (AUTORIZACION_DE_ANULACION_APROBADA) also for payments never approved. (origin: agent, confirmed: 2026-10-02)
  • [x] AC-24 — A cashier-initiated annulment of an approved payment issues a forced annulment (same batch) or forced refund (earlier batch) and answers the POS AUTORIZACION_DE_ANULACION_APROBADA in both cases: the gateway always tries the annulment and schedules the refund only when Prisma says the annulment is no longer possible, which is not known when the cashier asks (D-S4-9). (amended and accepted by the human 2026-10-28) (origin: agent, confirmed: 2026-10-02)

  • [x] AC-31 — When the cashier cancels while trxpago is still waiting (POS sends trxanulacion for the in-flight payment), then the payment takes the compensation path: the intention is cancelled, any later approval is annulled, and both calls answer consistently. (origin: agent, confirmed: 2026-10-02)

  • [x] AC-32 — When a new payment starts on the same checkout while a previous one is pending, then the previous payment is marked superseded and, if the wallet had already paid it, it is annulled automatically. (origin: agent, confirmed: 2026-10-02)

Robustness and operation

  • [x] AC-25 — Killing a node in the middle of a payment loses nothing: another node finishes the payment or its compensation. (origin: agent, confirmed: 2026-10-02)
  • [x] AC-26 — Terminal trace and ticket numbers are unique and gap-free per terminal under concurrent payments. (origin: agent, confirmed: 2026-10-02)
  • [x] AC-27 — Every call to Prisma and every callback is persisted (wire log) with the payment id; secrets and full benefit card numbers never appear in logs. (origin: agent, confirmed: 2026-10-02)
  • [x] AC-28 — The POS API listens only on the configured VPN-side address; Prisma callbacks listen on a separate HTTPS port. (origin: agent, confirmed: 2026-10-02)
  • [x] AC-29 — The console manages merchants, branches, checkouts, terminals, establishments and plans, has a plan simulator (amount + BIN → offered plans), and searches payments with their full trail. (origin: agent, confirmed: 2026-10-02)
  • [x] AC-30 — The Prisma emulator reproduces approval, rejection, missing BINs, missing notification, duplicate notification, late notification, forced annulment and forced refund. (origin: agent, confirmed: 2026-10-02)

Success metrics

  • Zero customers charged without a sale (compensation backlog = 0 at the end of each day).
  • Complete intention p99 < 3 s in production.
  • Approval rate and offered vs chosen plans visible on the console dashboard.