WS-5: Buchungs-Gate launch-ready – proaktiver Dashboard-Hinweis
Das Abo-/Bestandsschutz-Gate (User::hasActiveBooking, BookingRequiredException,
Submit-Modal, API 402/422) war bereits implementiert und getestet. Ergänzt wird
die proaktive Block-UX:
- Kunden-Dashboard zeigt bei scharfem Gate (billing.enforce_booking=true) und
fehlender aktiver Buchung einen Banner "Buchung erforderlich, um zu
veröffentlichen" mit Link zur Buchungsseite. Bestandskunden (grandfathered)
sehen den Hinweis nicht; bei offenem Gate bleibt er unsichtbar.
- Tests: Banner aus (Gate offen) / an (Gate scharf, keine Buchung) /
Ausnahme für grandfathered.
Launch-Flip bleibt env-gesteuert (BILLING_ENFORCE_BOOKING), Dev-Default false –
.env.example und Detailplan (WS-5 ✅) dokumentieren den Schalter.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
afefa86711
commit
a0547208d3
4 changed files with 94 additions and 4 deletions
|
|
@ -1,11 +1,13 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\PressReleaseStatus;
|
||||
use App\Enums\UserPaymentOptionStatus;
|
||||
use App\Models\BillingAddress;
|
||||
use App\Models\Company;
|
||||
use App\Models\PressRelease;
|
||||
use App\Models\Profile;
|
||||
use App\Models\User;
|
||||
use App\Models\UserPaymentOption;
|
||||
use Database\Seeders\RolesAndPermissionsSeeder;
|
||||
use Livewire\Volt\Volt as LivewireVolt;
|
||||
use Tests\TestCase;
|
||||
|
|
@ -123,6 +125,52 @@ test('profile completeness hint with percentage appears for partial profiles', f
|
|||
->assertSee('33');
|
||||
});
|
||||
|
||||
test('the booking-required banner stays hidden while the gate is open', function () {
|
||||
/** @var TestCase $this */
|
||||
config()->set('billing.enforce_booking', false);
|
||||
|
||||
$customer = User::factory()->create(['is_active' => true]);
|
||||
$customer->assignRole('customer');
|
||||
|
||||
$this->actingAs($customer);
|
||||
|
||||
LivewireVolt::test('customer.dashboard')
|
||||
->assertDontSee(__('Buchung erforderlich, um zu veröffentlichen'));
|
||||
});
|
||||
|
||||
test('the booking-required banner appears when the gate is enforced and no booking exists', function () {
|
||||
/** @var TestCase $this */
|
||||
config()->set('billing.enforce_booking', true);
|
||||
|
||||
$customer = User::factory()->create(['is_active' => true]);
|
||||
$customer->assignRole('customer');
|
||||
|
||||
$this->actingAs($customer);
|
||||
|
||||
LivewireVolt::test('customer.dashboard')
|
||||
->assertSee(__('Buchung erforderlich, um zu veröffentlichen'))
|
||||
->assertSee(route('me.bookings.index'), false);
|
||||
});
|
||||
|
||||
test('a grandfathered bestandskunde does not see the booking-required banner', function () {
|
||||
/** @var TestCase $this */
|
||||
config()->set('billing.enforce_booking', true);
|
||||
|
||||
$customer = User::factory()->create(['is_active' => true]);
|
||||
$customer->assignRole('customer');
|
||||
|
||||
UserPaymentOption::factory()->create([
|
||||
'user_id' => $customer->id,
|
||||
'status' => UserPaymentOptionStatus::Grandfathered->value,
|
||||
'stripe_subscription_id' => null,
|
||||
]);
|
||||
|
||||
$this->actingAs($customer);
|
||||
|
||||
LivewireVolt::test('customer.dashboard')
|
||||
->assertDontSee(__('Buchung erforderlich, um zu veröffentlichen'));
|
||||
});
|
||||
|
||||
test('billing address hint disappears once address is complete', function () {
|
||||
/** @var TestCase $this */
|
||||
$customer = User::factory()->create(['is_active' => true]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue