fix(billing): end access on a full refund outside the withdrawal flow #167

Sammanfogat
supernaut sammanfogade 4 incheckningar från feat/refund-rules in i main 2026-10-12 19:20:31 +00:00
Ägare

A refund made outside the withdrawal flow, such as in the Mollie dashboard, now changes access.

  • A full refund ends access and stops the renewal, as a chargeback does. Full means the refunded total of the payment reaches the charge's gross amount, so partial refunds that add up count. Only the charge that pays the current period (its period end equals the subscription's) ends access. A full refund of an older period is logged for review and changes nothing else. A full refund counts only when we issued no refund of our own on that payment. A partial refund changes nothing.
  • Withdrawal refunds and refunds the service issued keep their own handling and are not affected.
  • A refund at the provider that matches no local refund is logged once per refund: [reconcile] refund <id> on <payment> has no local record; needs manual review. The existing BillingReconcileManualReview alert matches it.
  • Reconciliation re-reads refunded payments created in the last 14 days, so a lost webhook is caught. Replays change nothing.
  • A refund Mollie refuses with a 422 that says the payment is already refunded or the amount is above the refundable remainder is marked failed and logged once for manual review: [reconcile] refund <id> refused by the provider: <why>; needs manual review. Any other 422 is retried. An open chargeback suppresses the line, and a chargeback that re-owed the refund is flagged.
  • The reconcile error line for a failed replay now reads [reconcile] refunds or chargebacks of <payment> not applied: <why>.
  • README: never refund a settled charge in the Mollie dashboard; use the withdrawal flow.

Tests cover full, partial and summed partial refunds, replays, the unmatched-refund log, withdrawal refunds, the reconcile re-read and the refused refund.

Closes #133
Closes #146

Version 0.11.4.

A refund made outside the withdrawal flow, such as in the Mollie dashboard, now changes access. - A full refund ends access and stops the renewal, as a chargeback does. Full means the refunded total of the payment reaches the charge's gross amount, so partial refunds that add up count. Only the charge that pays the current period (its period end equals the subscription's) ends access. A full refund of an older period is logged for review and changes nothing else. A full refund counts only when we issued no refund of our own on that payment. A partial refund changes nothing. - Withdrawal refunds and refunds the service issued keep their own handling and are not affected. - A refund at the provider that matches no local refund is logged once per refund: `[reconcile] refund <id> on <payment> has no local record; needs manual review`. The existing `BillingReconcileManualReview` alert matches it. - Reconciliation re-reads refunded payments created in the last 14 days, so a lost webhook is caught. Replays change nothing. - A refund Mollie refuses with a 422 that says the payment is already refunded or the amount is above the refundable remainder is marked failed and logged once for manual review: `[reconcile] refund <id> refused by the provider: <why>; needs manual review`. Any other 422 is retried. An open chargeback suppresses the line, and a chargeback that re-owed the refund is flagged. - The reconcile error line for a failed replay now reads `[reconcile] refunds or chargebacks of <payment> not applied: <why>`. - README: never refund a settled charge in the Mollie dashboard; use the withdrawal flow. Tests cover full, partial and summed partial refunds, replays, the unmatched-refund log, withdrawal refunds, the reconcile re-read and the refused refund. Closes #133 Closes #146 Version 0.11.4.
supernaut lade till 4 incheckningar 2026-10-12 19:17:54 +00:00
A refund seen at the provider with no local record is logged for manual review. A withdrawal refund the provider refuses is failed and logged, not retried every sweep.
Only a 422 saying the payment is already refunded or the amount exceeds the refundable remainder stops the retries. A refused refund goes through the failed-refund flag. Only the charge whose period end is the subscription's ends access on a full refund.
chore(release): 0.11.4
Alla kontroller lyckades
ci / ci (pull_request) Successful in 2m5s
b16e734621
supernaut schemalade den här ändringsförfrågan för automatisk sammanfogning när alla kontroller lyckas 2026-10-12 19:20:26 +00:00
supernaut sammanfogade incheckning 48988a2526 till main 2026-10-12 19:20:31 +00:00
supernaut tog bort grenen feat/refund-rules 2026-10-12 19:20:32 +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!167
Ingen beskrivning angiven.