Vorgangskern und geführte Vorgangsbearbeitung (Pakete 1 und 2, Prozessarchitektur v0.10)

- Buchung ist der einheitliche Vorgang: Eingangsart, Vorgangsart A1–A6, eingefrorenes
  Abwicklungsprofil, gespeicherter Verlauf (booking_events); Gast, Personen und Beträge
  dürfen unbekannt sein, Platzhalter-Gäste werden migriert und nicht mehr angelegt
- Einstellungen in Ebenen: Vermieterstandard (So arbeite ich), Abweichung der Wohnung
  (Experte), Abweichung je Portal und Eingangsart; ersetzt booking_model als Steuergröße
- Ein Weg für extern verbindliche Buchungen (TakeOverExternalBooking) statt
  RecordPortalBooking und "Akte anlegen"; Portalpreis als belegte Gesamtposition
- Startseite "Zu erledigen", neue Vorgangsseite mit nächstem Schritt, Automatik-Schalter,
  "Beenden" mit Storno statt Statusumschaltung; Status von Hand nur im Expertenmodus
- Migration übernimmt bisheriges Verhalten unverändert (abweichende Wohnungswerte bleiben
  als Abweichung), Bericht: php artisan process:settings-report

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-11-01 16:25:46 +01:00
1 parent 9005c12164
commit 3a728c3255
78 files changed
+4296 -1180

No files matched your search

+20 -17
View File
@@ -4,9 +4,11 @@
use App\Actions\CancelBooking;
use App\Actions\SendOffer;
use App\Enums\ActivityState;
use App\Enums\BookingStatus;
use App\Enums\BookingTaskKind;
use App\Enums\BookingTaskStatus;
use App\Enums\CaseType;
use App\Filament\Resources\Bookings\Pages\ListBookings;
use App\Filament\Resources\Bookings\Pages\ViewBooking;
use App\Filament\Resources\Bookings\RelationManagers\MessagesRelationManager;
@@ -18,12 +20,11 @@
use App\Models\Channel;
use App\Models\Property;
use App\Models\User;
use App\Support\BookingProgress;
use App\Process\CaseActivities;
use App\Support\Settings;
use Carbon\CarbonImmutable;
use Database\Seeders\PropertySeeder;
use Database\Seeders\SiteSeeder;
use Filament\Actions\Testing\TestAction;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;
@@ -53,31 +54,33 @@ protected function setUp(): void
public function test_next_step_follows_the_state_of_the_booking(): void
{
$request = Booking::factory()->for($this->property)->reserved(now()->addHours(48))->create(['arrival' => '2026-11-07', 'departure' => '2026-11-10']);
$this->assertSame('Anfrage prüfen', BookingProgress::next($request)['title']);
$this->assertSame('sendOffer', CaseActivities::next($request)?->action);
Mail::fake();
$offer = app(SendOffer::class)->handle($request);
$this->assertSame('Wartet auf den Gast', BookingProgress::next($offer)['title']);
$this->assertNull(CaseActivities::next($offer));
$this->assertStringContainsString('Angebot liegt beim Gast', CaseActivities::situation($offer));
$confirmed = Booking::factory()->for($this->property)->create(['status' => BookingStatus::Confirmed, 'arrival' => '2026-12-01', 'departure' => '2026-12-05', 'deposit_due_on' => '2026-10-25', 'balance_due_on' => '2026-11-20', 'total' => 100000, 'deposit' => 30000]);
$this->assertSame('Anzahlung offen', BookingProgress::next($confirmed)['title']);
$this->assertSame('resendConfirmation', CaseActivities::next($confirmed)?->action);
$this->travelTo(CarbonImmutable::parse('2026-12-02 12:00'));
$confirmed->update(['status' => BookingStatus::Paid, 'total' => 0, 'deposit' => 0]);
$this->assertSame('Gast ist vor Ort', BookingProgress::next($confirmed->fresh())['title']);
$this->assertContains('current', array_column(BookingProgress::steps($confirmed->fresh()), 'state'));
$this->assertStringContainsString('Gast ist vor Ort', CaseActivities::situation($confirmed->fresh()));
$this->assertSame(ActivityState::Waiting, collect(CaseActivities::for($confirmed->fresh()))->firstWhere('key', 'stay')->state);
}
public function test_portal_booking_is_recognised_without_payment_steps_and_asks_to_send_the_contract(): void
{
$portal = Channel::factory()->for($this->property)->create(['name' => 'FeWo-direkt', 'booking_model' => 'portal_booking']);
$portal = Channel::factory()->for($this->property)->create(['name' => 'FeWo-direkt', 'booking_model' => 'portal_booking', 'process_overrides' => ['booking' => ['payments' => 'portal']]]);
$booking = Booking::factory()->for($this->property)->create(['status' => BookingStatus::Confirmed, 'import_channel_id' => $portal->id, 'source' => 'portal', 'arrival' => '2026-12-01', 'departure' => '2026-12-05']);
$this->assertSame(BookingProgress::PORTAL_BOOKING, BookingProgress::kind($booking));
$this->assertStringContainsString('FeWo-direkt', BookingProgress::kindLabel($booking));
$this->assertSame('Vertrag senden', BookingProgress::next($booking)['title']);
$this->assertContains('Zahlung', array_column(BookingProgress::steps($booking), 'label'));
$this->assertNotContains('Anzahlung', array_column(BookingProgress::steps($booking), 'label'));
$this->assertSame(CaseType::A4, $booking->caseType());
$this->assertStringContainsString('Gebucht über FeWo-direkt', CaseActivities::situation($booking));
$this->assertSame('resendConfirmation', CaseActivities::next($booking)?->action);
$keys = array_map(fn ($activity) => $activity->key, CaseActivities::for($booking));
$this->assertContains('payment', $keys);
$this->assertNotContains('deposit', $keys);
}
public function test_every_booking_mail_lands_in_the_communication_log_with_its_audience(): void
@@ -121,7 +124,7 @@ public function test_cancellation_without_guest_mail_and_the_admin_action_offer_
$this->actingAs(User::factory()->create());
Livewire::test(ViewBooking::class, ['record' => $booking->getRouteKey()])
->callAction(TestAction::make('cancel')->arguments([]), ['notify_guest' => false, 'costs_task' => false])
->callAction('end', ['initiated_by' => 'landlord', 'reason' => 'Wasserschaden', 'notify' => false, 'costs_task' => false])
->assertNotified('Buchung storniert');
Mail::assertNotSent(BookingCancelled::class);
@@ -149,9 +152,9 @@ public function test_the_booking_page_shows_process_contract_tasks_and_mail_log(
$this->actingAs(User::factory()->create());
Livewire::test(ViewBooking::class, ['record' => $booking->getRouteKey()])
->assertSee('Nächster Schritt: Wartet auf den Gast')
->assertSee('Vertrag')
->assertSee('Angebot (PDF) Version 1');
->assertSee('Angebot liegt beim Gast')
->assertSee('Gast nimmt das Angebot an')
->assertSee('Angebot Version 1');
Livewire::test(MessagesRelationManager::class, ['ownerRecord' => $booking, 'pageClass' => ViewBooking::class])->assertSuccessful();
}