Skip to content

Return debit replay reasons before authorization - #1078

Merged
shocknet-justin merged 1 commit into
dash2from
debit-preauth-replay-errors
Nov 9, 2026
Merged

shocknet-justin merged 1 commit into
dash2from
debit-preauth-replay-errors

Conversation

@shocknet-justin

Copy link
Copy Markdown
Member

Summary

Return the existing debit GFY-6 replay reasons before authorization, matching the behavior of the authorized payment path and CLINK spec PR #19.

Previously, a new/unapproved requestor presenting an already-paid or already-failed invoice reached withExclusiveInvoiceCheck, but only the in-progress error was translated into a CLINK error. Paid/failed errors escaped as ordinary exceptions and the transport returned generic code 2 (Temporary Failure).

The pre-authorization path now returns:

  • Code 6 with reason: "invoice_already_paid" for paid invoices.
  • Code 6 with reason: "invoice_already_failed" for failed invoices.
  • The existing code 6 with reason: "invoice_in_progress" for pending invoices, unchanged.

No approval prompt, notification, new k1 hold, or payment is created for these replays. The existing auth-reservation cleanup remains in place.

Verification

  • npm run build: passed.
  • New storage-backed regression test exercises the real database invoice-conflict check and CLINK transport for paid internal, paid external, failed external, and pending external invoices, with both lower- and uppercase BOLT11 inputs.
  • Asserts exact GFY-6 reason tokens, request/recipient tags, no k1 consumption or lingering auth occupancy, no prompts/notifications, and unchanged balance.
  • New pre-authorization replay test and existing CLINK transport suite passed locally.

Scope

Branched from dash2 and targets dash2. Contains only this error-mapping fix and its regression test, not the separate offer-quantity work. No SDK dependency, lockfile, payout-policy, or release changes.

Spec: shocknet/CLINK#19

@shocknet-justin
shocknet-justin merged commit 49cdb8b into dash2 Nov 9, 2026
6 of 7 checks passed
@shocknet-justin
shocknet-justin deleted the debit-preauth-replay-errors branch November 9, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants