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
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\PressReleaseStatus;
|
||||
use App\Models\Plan;
|
||||
use Database\Seeders\RolesAndPermissionsSeeder;
|
||||
use Illuminate\Support\Facades\Queue;
|
||||
use Livewire\Volt\Volt as LivewireVolt;
|
||||
|
|
@ -17,8 +18,17 @@ beforeEach(function (): void {
|
|||
|
||||
test('customer show renders the publish confirmation modal with legal note and quota', function () {
|
||||
/** @var TestCase $this */
|
||||
// Das Kontingent erscheint nur mit scharfem Launch-Schalter und Tarif —
|
||||
// unbegrenzte User (Schalter aus, Bestandsschutz) sehen den Block nicht.
|
||||
config()->set('billing.enforce_booking', true);
|
||||
|
||||
['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a();
|
||||
$customer->update(['press_release_quota' => 3, 'press_release_quota_used_this_month' => 1]);
|
||||
$customer->update(['press_release_quota_used_this_month' => 1]);
|
||||
$plan = Plan::factory()->create([
|
||||
'press_release_quota' => 3,
|
||||
'stripe_price_id_monthly' => 'price_test_m_modal',
|
||||
]);
|
||||
subscribeUserToPlan($customer, $plan);
|
||||
$this->actingAs($customer);
|
||||
|
||||
LivewireVolt::test('customer.press-releases.show', ['id' => $pr->id])
|
||||
|
|
@ -28,10 +38,21 @@ test('customer show renders the publish confirmation modal with legal note and q
|
|||
->assertSee('2 / 3');
|
||||
});
|
||||
|
||||
test('the quota block is hidden for users with an unlimited quota', function () {
|
||||
/** @var TestCase $this */
|
||||
['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a();
|
||||
$this->actingAs($customer);
|
||||
|
||||
// Launch-Schalter aus → Kontingent unbegrenzt → kein Quota-Block.
|
||||
LivewireVolt::test('customer.press-releases.show', ['id' => $pr->id])
|
||||
->assertSee('Pressemitteilung zur Prüfung einreichen')
|
||||
->assertDontSee('PM-Kontingent diesen Monat');
|
||||
});
|
||||
|
||||
test('submitting from the show modal moves the draft into review without consuming quota', function () {
|
||||
/** @var TestCase $this */
|
||||
['customer' => $customer, 'pr' => $pr] = makeCustomerForShowPhase8a();
|
||||
$customer->update(['press_release_quota' => 3, 'press_release_quota_used_this_month' => 0]);
|
||||
$customer->update(['press_release_quota_used_this_month' => 0]);
|
||||
$this->actingAs($customer);
|
||||
|
||||
LivewireVolt::test('customer.press-releases.show', ['id' => $pr->id])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue