reconcile: a failed local charge counts as settled #67

Stängd
öppnade 2026-10-01 20:53:15 +00:00 av supernaut · 0 kommentarer
Ägare

Problem

settled() in src/billing.ts uses ne(charge.status, "pending"), so a local charge with status failed counts as settled. Reconcile then skips a payment that is paid at the provider but whose local charge failed. Since #66, the second pass also marks such an orphan resolved automatically.

Found in the review of #66. Pre-existing, not introduced there.

Fix

Treat only the success states as settled. Add a test with a provider-paid payment whose local charge is failed: it must be replayed or flagged, never marked resolved.

## Problem `settled()` in `src/billing.ts` uses `ne(charge.status, "pending")`, so a local charge with status `failed` counts as settled. Reconcile then skips a payment that is paid at the provider but whose local charge failed. Since #66, the second pass also marks such an orphan resolved automatically. Found in the review of #66. Pre-existing, not introduced there. ## Fix Treat only the success states as settled. Add a test with a provider-paid payment whose local charge is `failed`: it must be replayed or flagged, never marked resolved.
supernaut lade till detta till projektet Bitborg Payment 2026-10-01 20:56:03 +00:00
supernaut refererade till detta ärende från en incheckning 2026-10-02 18:00:10 +00:00
supernaut refererade till detta ärende från en incheckning 2026-10-02 19:17:47 +00:00
Logga in för att delta i denna konversation.
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#67
Ingen beskrivning angiven.