withdrawal: make a double submit record one request and send one receipt #325
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-web#325
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "%!s()"
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?
What
processWithdrawalchecks for an open request, then inserts one. Two concurrent requests both insert.Why
The right of withdrawal is a consumer-law flow. Two rows mean two billing calls and two receipts. The audit trail is ambiguous.
Failing case
Send two concurrent POSTs to
/api/withdrawfor one account with one paid purchase. Twowithdrawal_requestsrows exist and two receipt mails go out.Fix
withdrawal_requests(sub) WHERE withdrawn_at IS NULL AND rejection IS NULL.receipt_sent_atis null.withdrawcall and note it in the PR.Done when
pnpm drizzle-kit checkpasses.