Buchungskalender: Abgleich – gleichzeitige Zweitzahlung wird erstattet

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
knsoandClaude Opus 5.5 committed 2026-10-07 14:53:36 +00:00
1 parent f01e6def59
commit 95cbd473d0
2 files changed
+19 -1

No files matched your search

+5 -1
View File
@@ -111,7 +111,11 @@ export async function verbucheZahlung(ctx, anfrageId, paymentIntentId, { now = n
return vorher
}
try {
return await markiereBezahlt(ctx, anfrageId, { via: 'stripe', paymentIntentId: pi, now })
const bezahlt = await markiereBezahlt(ctx, anfrageId, { via: 'stripe', paymentIntentId: pi, now })
// gleichzeitige Zweitzahlung: zwischen dem Lesen oben und der Sperre hat eine andere Zahlung gebucht (markiereBezahlt gibt dann
// die bezahlte Anfrage ohne Fehler zurueck) -> die Zahlung, die nicht gebucht wurde, voll erstatten
if (pi && bezahlt?.stripePaymentIntentId !== pi) await erstatteUeberzaehligeZahlung(ctx, pi)
return bezahlt
} catch (err) {
if (!(err instanceof UkFehler) || err.status !== 409) throw err
const jetzt = await ladeAnfrage(anfrageId)