Depublikation: Kauf als eingelöst markieren, Rechnung & Bestätigungs-Mail
Drei Lücken im bezahlten Depublikations-Flow (T12) geschlossen: - Webhook setzt den Kauf jetzt auf status=consumed (vorher nur consumed_at) — erst damit erscheint er unter „Eingelöste Käufe". - Einmalkäufe (Depublikation, Einzel-PM, Credit-Topup) aktivieren invoice_creation im Stripe-Checkout: Ohne das Flag erzeugt Stripe im Payment-Mode keine Rechnung und die STR-Spiegelung lief ins Leere. Abo-Checkouts bleiben unverändert (Parameter dort unzulässig). - Neue Bestätigungs-Mail PressReleaseDepublished an den Käufer (nicht zwingend der PM-Autor) nach vollzogener Depublikation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
d57f6b5c66
commit
f6882b621a
7 changed files with 180 additions and 9 deletions
|
|
@ -341,7 +341,7 @@ class StripeCheckoutService
|
|||
$this->syncCustomerFromBillingAddress($user);
|
||||
|
||||
return $user->checkout([config('billing.single_pm_stripe_price_id') => 1], [
|
||||
...$this->sessionOptions($user),
|
||||
...$this->oneTimeSessionOptions($user),
|
||||
'metadata' => ['single_purchase_id' => (string) $purchase->id],
|
||||
]);
|
||||
}
|
||||
|
|
@ -358,7 +358,7 @@ class StripeCheckoutService
|
|||
return $user->checkout(
|
||||
[$this->adHocLineItem($purchase->price_cents, 'Depublikation einer Pressemitteilung')],
|
||||
[
|
||||
...$this->sessionOptions($user),
|
||||
...$this->oneTimeSessionOptions($user),
|
||||
'metadata' => ['single_purchase_id' => (string) $purchase->id],
|
||||
],
|
||||
);
|
||||
|
|
@ -376,9 +376,27 @@ class StripeCheckoutService
|
|||
return $user->checkout(
|
||||
[$this->adHocLineItem($topup->price_cents, "Credit-Guthaben ({$topup->credits} Credits)")],
|
||||
[
|
||||
...$this->sessionOptions($user),
|
||||
...$this->oneTimeSessionOptions($user),
|
||||
'metadata' => ['credit_topup_id' => (string) $topup->id],
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Session-Optionen für Einmalkäufe (Payment-Mode: Einzel-PM, Depublikation,
|
||||
* Credit-Topup). Anders als im Subscription-Mode erzeugt Stripe hier ohne
|
||||
* `invoice_creation` keine Rechnung — und damit auch kein
|
||||
* `invoice.payment_succeeded`, das die STR-Spiegelung anstoßen könnte.
|
||||
* Im Subscription-Mode ist der Parameter unzulässig, daher nicht in
|
||||
* sessionOptions() selbst.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function oneTimeSessionOptions(User $user): array
|
||||
{
|
||||
return [
|
||||
...$this->sessionOptions($user),
|
||||
'invoice_creation' => ['enabled' => true],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue