feat(billing): refund review, provider refund state, mandate checks, card replacement #175
Inga granskare
Etiketter
Inga etiketter
area/backups
area/ci
area/control-panel
area/identity
area/infra
area/observability
area/payments
area/security
area/storage
area/web
blocked
needs-info
needs-triage
priority
high
priority
low
priority
medium
ready-for-implementation
type
bug
type
chore
type
docs
type
epic
type
feature
type
task
wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
Inga beroenden satta
Referens
bitborg/bitborg-payment!175
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "feat/payment-batch-3"
Borttagning av en gren är permanent. Även om den borttagna grenen kan fortsätta existera en kort tid innan den faktiskt tas bort, kan det INTE ångras i de flesta fall. Vill du fortsätta?
Refunds: log failed refunds until reviewed (#115)
refund.reviewed_at(migration 0014, nullable).[reconcile] <n> failed refund(s) unreviewed, oldest <id> since <time>; needs manual reviewwhile a failed refund has noreviewed_at. A refund under an open chargeback is left out.UPDATE refund SET reviewed_at = now() WHERE id = '<refund id>';step.reviewed_atis set. A reviewed refund and one under an open chargeback are not counted.Closes #115
Refunds: provider state, webhook settle, stale refunds (#87)
refund.provider_statuskeeps Mollie's own state (queued,processing,canceled, ...). Migration 0015, nullable.getRefundStatusreturns{ status, providerStatus }.refund()and the refund event carryproviderStatus.canceled at the provider; customer still owed, apart fromfailed. Both stayfailedinstatusand are reviewed the same way.settleRefund). A failure is flagged once, after commit, whichever of the two sees it first.[reconcile] <n> refund(s) pending over 24 h, oldest <id> since <time>, provider status <state>; needs manual review. There is no metrics endpoint, so the alert keys on this log line, as for chargebacks.Closes #87
Checkout: check the mandate (#84)
The card expiry from the mandate was already stored for first payments (0.13.0). What was missing:
validandpendingare usable; any other word reads asinvalid. A failed read leaves it unset, which counts as usable.invalidmandate is refunded and not activated, like one with no mandate.payment_method.statusstores the mandate status (was alwaysvalid). Apendingmethod is also revoked when its subscription ends.Closes #84
Subscriptions: replace the card (#85)
replaceCard(contract 0.13.0, additive: new input schema, new error reasonsnot_renewingandsubscription_ended).card_replacementrow (migration 0016), not a charge: no invoice, period or VAT. One may be pending per subscription; one never completed is dropped after an hour.replaceSubscriptionMandate), apayment_methodrow is added, the old mandate is revoked after the switch, and the check is refunded through the normalrefundrow.[card] card replacement ... not applied: <why>.refund.charge_idis nullable, withcard_replacement_idbeside it and a check that exactly one is set. Existing rows are unchanged.subscription_ended). Mollie cannot update it. Those customers check out again after the grace, as before.past_duesubscription and see the next renewal charge the new mandate.cardReplacementIdthe payment carries.past_duecustomers, the staging check must pass: Mollie retries a failedpast_duepayment on the new mandate.replaceCard, handles the new reasons, and pollssubscriptionStatusafter the return.Closes #85
Reconcile trigger (#14)
The adapter wiring shipped in #73. What this adds: each trigger request logs
[reconcile-trigger] kick reason=payment, the line bitborg-web already logs. The silent-event-path alert can then count kicks from the billing container too (bitborg-infra#533, "Alerting gap"). That alert change and the prod check (a testtier_progrant showskick reason=paymentin the shim log) are not part of this PR.Refs #14
Not in this PR
past_dueandgraceEndsAt. A suspended or cancelled Mollie subscription, which is what an invalid mandate causes, is already markedpast_dueby the hourly renewal check. The mail belongs to bitborg-web, whose renewal-reminder run already readssubscriptionStatusper account and dedupes with a claim row. It needs a past-due branch there.Version 0.14.0.