STR-Spiegelung: USt aus total_taxes lesen (Stripe-API ohne tax-Feld)

Aktuelle Stripe-API-Versionen liefern kein Top-Level-`tax` mehr auf der
Invoice — die Spiegelung buchte 0 USt und markierte die Rechnung als
netto (QA-Befund 07.07., STR-00001). Fallback-Kette: tax (alt) →
total_taxes (aktuell) → total_tax_amounts (Übergangsname).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-07-07 11:42:31 +00:00
parent 54213cac64
commit 2a8fd0179e
2 changed files with 23 additions and 1 deletions

View file

@ -74,7 +74,10 @@ class ProcessStripeWebhook
}
$subtotal = (int) ($stripeInvoice['subtotal'] ?? 0);
$tax = (int) ($stripeInvoice['tax'] ?? 0);
// Steuer je nach Stripe-API-Generation: `tax` (alt), sonst Summe aus
// `total_taxes` (aktuell) bzw. `total_tax_amounts` (Übergangsname).
$tax = (int) ($stripeInvoice['tax']
?? collect($stripeInvoice['total_taxes'] ?? $stripeInvoice['total_tax_amounts'] ?? [])->sum('amount'));
$total = (int) ($stripeInvoice['total'] ?? $subtotal + $tax);
$invoice = Invoice::query()->create([