Phase 9E (Abschluss): Checkout-Flows und Plan-Kontingent statt Quota-Stub
- Checkout-Backend: me.checkout.subscription (Tarif-Abo monatlich/jährlich)
und me.checkout.single-pm (Einzel-PM 19 € netto, pending-Kauf mit
Webhook-Erfüllung); StripeCheckoutService als mockbarer Stripe-Wrapper;
Stripe Tax via Cashier::calculateTaxes() (Netto-Preise, USt-ID-Abfrage)
- Slot-Logik: Kontingent aus dem Tarif (plans.press_release_quota) plus
bezahlte Einmalkäufe; Verbrauch bei Veröffentlichung zuerst aus dem
Plan-Zähler, danach Einlösung des ältesten Einmalkaufs (consumed +
PM-Verknüpfung); Grandfathered = unbegrenzt (Entscheidung 12.06.2026,
Bestandsschutz); Stub-Spalte users.press_release_quota entfernt
- billing:sync-stripe-plans legt zusätzlich das Einzel-PM-Produkt an
(STRIPE_PRICE_SINGLE_PM); Test-Mode-Sync gelaufen
- Buchungs-Seite: Rückmeldung nach Checkout (erfolg/abbruch/Guard-Hinweis)
- Tests: PressReleaseQuotaTest auf Plan-Semantik neu geschrieben,
CheckoutFlowTest (8 Tests), Modal-/API-Tests angepasst; Suite 510 passed
- Doku: Billing-und-Rechnungskreise (Kontingent-Tabelle, Checkout-Routen,
Webhook-Events, Stripe-CLI-Hinweis), PHASE-9-Plan 9E ✅, Checkliste,
STATUS-ABGLEICH, PROGRESS
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
38fab64e10
commit
c8dc99c3c8
24 changed files with 775 additions and 100 deletions
|
|
@ -77,9 +77,53 @@ class SyncStripePlans extends Command
|
|||
$this->info("{$plan->slug}: {$productId} · monatlich {$monthlyId} · jährlich {$yearlyId}");
|
||||
}
|
||||
|
||||
$this->syncSinglePmPrice($stripe, $dryRun);
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Legt das Einmal-Produkt „Einzel-Pressemitteilung" an (Netto-Preis aus
|
||||
* billing.single_pm_price_cents). Die Price-ID landet bewusst in der ENV
|
||||
* (STRIPE_PRICE_SINGLE_PM) statt in einer Tabelle — es gibt genau einen
|
||||
* solchen Preis, und ohne ENV bleibt der Checkout deaktiviert.
|
||||
*/
|
||||
private function syncSinglePmPrice(object $stripe, bool $dryRun): void
|
||||
{
|
||||
if (config('billing.single_pm_stripe_price_id')) {
|
||||
$this->line('einzel-pm: bereits verknüpft (STRIPE_PRICE_SINGLE_PM), übersprungen.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$amount = (int) config('billing.single_pm_price_cents');
|
||||
|
||||
if ($dryRun) {
|
||||
$this->line(sprintf(
|
||||
'[dry-run] einzel-pm: Einmal-Produkt + Preis %s € (netto) anlegen.',
|
||||
number_format($amount / 100, 2, ',', '.'),
|
||||
));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$product = $stripe->products->create([
|
||||
'name' => 'Einzel-Pressemitteilung',
|
||||
'metadata' => ['purpose' => 'single_pm'],
|
||||
]);
|
||||
|
||||
$price = $stripe->prices->create([
|
||||
'product' => $product->id,
|
||||
'currency' => 'eur',
|
||||
'unit_amount' => $amount,
|
||||
'tax_behavior' => 'exclusive',
|
||||
'metadata' => ['purpose' => 'single_pm'],
|
||||
]);
|
||||
|
||||
$this->info("einzel-pm: {$product->id} · {$price->id}");
|
||||
$this->warn("Bitte in die .env eintragen: STRIPE_PRICE_SINGLE_PM={$price->id}");
|
||||
}
|
||||
|
||||
private function createPrice(object $stripe, string $productId, Plan $plan, int $unitAmount, string $interval): string
|
||||
{
|
||||
$price = $stripe->prices->create([
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue