fix: treat only a succeeded charge as settled in reconcile #70

Sammanfogat
supernaut sammanfogade 1 incheckning från fix/67-failed-not-settled in i main 2026-10-02 06:08:27 +00:00
Ägare

What

settled() now means status = 'succeeded', not status != 'pending'. Charge statuses are pending | succeeded | failed; refunds are a separate table and unaffected.

Effect in reconcile (all three callers): a provider-paid payment whose local charge is failed is no longer skipped or auto-resolved. The replay is a no-op (applyEvent only acts on pending charges), so it is recorded in reconcile_orphan, logged once, and kept alive by the summary line until resolved by hand.

Deliberately flag, not repair: moving failed to succeeded automatically would risk a double grant or invoice if the customer already retried or was refunded.

Verification

Postgres 17: 266/266. New test "flags a paid payment whose local charge failed, and never resolves it" fails without the fix (expected ["tr_..."], received []).

Closes #67

## What `settled()` now means `status = 'succeeded'`, not `status != 'pending'`. Charge statuses are `pending | succeeded | failed`; refunds are a separate table and unaffected. Effect in `reconcile` (all three callers): a provider-paid payment whose local charge is `failed` is no longer skipped or auto-resolved. The replay is a no-op (`applyEvent` only acts on `pending` charges), so it is recorded in `reconcile_orphan`, logged once, and kept alive by the summary line until resolved by hand. Deliberately flag, not repair: moving `failed` to `succeeded` automatically would risk a double grant or invoice if the customer already retried or was refunded. ## Verification Postgres 17: 266/266. New test "flags a paid payment whose local charge failed, and never resolves it" fails without the fix (`expected ["tr_..."], received []`). Closes #67
supernaut lade till 1 incheckning 2026-10-02 06:02:17 +00:00
fix: treat only a succeeded charge as settled in reconcile
Alla kontroller lyckades
ci / ci (pull_request) Successful in 1m59s
8a1636a617
A failed local charge counted as settled, so a payment paid at the provider was skipped and its orphan auto-resolved. It is now flagged for manual review.

Closes #67
supernaut sammanfogade incheckning 88c2fec986 till main 2026-10-02 06:08:27 +00:00
supernaut tog bort grenen fix/67-failed-not-settled 2026-10-02 06:08:27 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-10-02 18:00:10 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-10-02 19:17:47 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-payment!70
Ingen beskrivning angiven.