refunds: surface queued refunds, keep canceled apart from failed, settle from the webhook #87

Stängd
öppnade 2026-10-05 12:32:44 +00:00 av supernaut · 0 kommentarer
Ägare

Problem

Three gaps in refund handling:

  1. queued (Mollie is waiting for enough balance) maps to pending (src/provider/mollie.ts:110-122). The sweep polls it silently forever, so a customer's refund can sit unpaid with nobody noticing.
  2. canceled and failed both map to failed and trigger a re-owe (mollie.ts:112-114, billing.ts:454, :1403). A cancel is an operator action in the dashboard, a failure is not. The merged state loses why.
  3. Refund webhooks are recorded but do not settle the row (billing.ts:1043-1048). A failed refund waits for the next sweep.

Mollie docs

Fix

  • Store the raw Mollie refund status on the refund row.
  • Log, and expose as a metric for an alert, any refund queued or pending longer than 24 hours.
  • Settle the refund row from the refund webhook with the same update the sweep uses.

Done when

  • Unit tests for each of the three cases.

Found in the Mollie docs audit of 2026-10-05.

## Problem Three gaps in refund handling: 1. `queued` (Mollie is waiting for enough balance) maps to `pending` (`src/provider/mollie.ts:110-122`). The sweep polls it silently forever, so a customer's refund can sit unpaid with nobody noticing. 2. `canceled` and `failed` both map to `failed` and trigger a re-owe (`mollie.ts:112-114`, `billing.ts:454`, `:1403`). A cancel is an operator action in the dashboard, a failure is not. The merged state loses why. 3. Refund webhooks are recorded but do not settle the row (`billing.ts:1043-1048`). A `failed` refund waits for the next sweep. ## Mollie docs - Refunds: `queued` = awaiting sufficient balance; webhooks fire for `processing`, `refunded` and `failed` (https://docs.mollie.com/docs/refunds, https://docs.mollie.com/reference/webhooks). ## Fix - Store the raw Mollie refund status on the refund row. - Log, and expose as a metric for an alert, any refund `queued` or pending longer than 24 hours. - Settle the refund row from the refund webhook with the same update the sweep uses. ## Done when - Unit tests for each of the three cases. Found in the Mollie docs audit of 2026-10-05.
supernaut lade till detta till projektet Bitborg Payment 2026-10-05 12:34:46 +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#87
Ingen beskrivning angiven.