From 6f14437855064d95db005a2e18000b9d37bd10b0 Mon Sep 17 00:00:00 2001 From: Lars Date: Thu, 5 Nov 2026 11:03:36 +0100 Subject: [PATCH] Test: Zahlungsanforderungen nur bei eigenem Inkasso, nie doppelt; Doku der operativen Stellen Co-Authored-By: Claude Sonnet 5.5 --- docs/Prozessarchitektur/SCHABLONEN.md | 10 +++++++++ .../Process/TemplateCompositionTest.php | 22 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/docs/Prozessarchitektur/SCHABLONEN.md b/docs/Prozessarchitektur/SCHABLONEN.md index b6f9848..9222e5f 100644 --- a/docs/Prozessarchitektur/SCHABLONEN.md +++ b/docs/Prozessarchitektur/SCHABLONEN.md @@ -57,6 +57,16 @@ ## 6. Umgang mit A3–A5 `external.booking@1` ist der Basisprozess für neue Konfigurationen. A3/A4/A5 (v1/v2) bleiben registriert (eingefrorene Pläne, Altkanäle) und sind im Konfigurator **Voreinstellungen** („Auf Schablonen umstellen“ / „Bekannte Kombinationen“). Gespeicherte Kanäle ändern sich nicht, bis jemand ausdrücklich speichert. `ProcessCatalogue::derivedModel` und die Altfall-Ableitung bleiben unverändert. +Stellen, an denen `CaseType`/A3–A5 vorher etwas entschieden, und was jetzt gilt: + +| Stelle | Vorher | Jetzt | +|---|---|---| +| `ProcessProfile::caseTypeFor` | Dokumente = Portal ⇒ immer A5 | A5 nur, wenn Portal Dokumente **und** Inkasso hat; sonst A4 (Inkasso Portal) bzw. A3 – reine Klassifikation | +| `ProcessPlan::freeze` (Modell zulässig für Vorgangsart) | Modell nennt genau eine Art | `external.booking` nennt A3–A5; die Schablonenwahl bestimmt den Ablauf | +| `ProcessCatalogue::derivedModel` | Altfall-/Ableitungspfad nach Vorgangsart | unverändert (Altfälle, Kanäle ohne gewähltes Modell) | +| `isExternallyBinding()` (Änderung/Storno/Anzeige) | A3–A5 | unverändert, gilt für alle vier Kombinationen | +| `payments()` / `documents()` (Zahlungsaufgaben, Dokumentenart, Abschluss, Auszahlung) | Wert aus Modell-`fixes()` | Wert aus der Schablone (Quelle `template`); die Module selbst blieben unverändert | + ## 7. Bewusste Grenzen / offen - Mahnstufen, Zahlungsplan je Kanal, Bank-Abgleich: Erweiterungen (`OwnCollection::extensions()`), nicht erfunden. diff --git a/tests/Feature/Process/TemplateCompositionTest.php b/tests/Feature/Process/TemplateCompositionTest.php index feff81d..80733c3 100644 --- a/tests/Feature/Process/TemplateCompositionTest.php +++ b/tests/Feature/Process/TemplateCompositionTest.php @@ -3,6 +3,7 @@ namespace Tests\Feature\Process; use App\Actions\ConfigureChannelProcess; +use App\Actions\SendBookingReminders; use App\Actions\TakeOverExternalBooking; use App\Enums\ActivityState; use App\Enums\CaseType; @@ -10,6 +11,7 @@ use App\Enums\ProcessSetting; use App\Enums\Responsibility; use App\Models\Booking; +use App\Models\BookingTask; use App\Models\Channel; use App\Models\Property; use App\Process\CaseActivities; @@ -154,6 +156,26 @@ public static function archetypes(): array ]; } + #[DataProvider('combinations')] + public function test_payment_requests_arise_from_own_collection_only_and_never_twice(string $collection, string $documents): void + { + $channel = $this->configured(['collection' => $collection, 'contract_documents' => $documents]); + $booking = app(TakeOverExternalBooking::class)->handle($this->property, $channel, CarbonImmutable::parse('2027-07-10'), CarbonImmutable::parse('2027-07-17'), [ + 'portal_reference' => 'ZAHL', 'portal_total' => 98000, 'guests' => 2, + 'guest' => ['first_name' => 'Pia', 'last_name' => 'Portal', 'email' => 'pia@example.org', 'street' => 'Weg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'], + ]); + $this->travelTo(CarbonImmutable::parse('2027-06-25 10:00')); + + app(SendBookingReminders::class)->handle(); + $first = BookingTask::query()->where('booking_id', $booking->id)->count(); + app(SendBookingReminders::class)->handle(); + $second = BookingTask::query()->where('booking_id', $booking->id)->count(); + + $this->assertSame($first, $second, 'repeated runs create no second request'); + $collection === 'collection.own' ? $this->assertGreaterThan(0, $first, 'we collect: payment tasks exist') : $this->assertSame(0, $first, 'the portal collects: no own payment request towards the guest'); + $this->assertNull($booking->fresh()->confirmation_sent_at, 'a portal event or reminder never creates or changes our contract'); + } + public function test_the_archetypes_are_presets_of_the_base_process(): void { $catalogue = app(ProcessCatalogue::class);