From ef2783ecfb76963ed6d4823b35f444513e3a5c72 Mon Sep 17 00:00:00 2001 From: Lars Date: Wed, 4 Nov 2026 08:58:51 +0100 Subject: [PATCH 1/9] =?UTF-8?q?Erg=C3=A4nzungsvorschlag=20Kanalkonfigurato?= =?UTF-8?q?r:=20Schablonen,=20Schritte,=20Nachweise,=20Vorschau=20(nicht?= =?UTF-8?q?=20normativ)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- .../Vorschläge/KANALKONFIGURATOR.md | 163 ++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 docs/Prozessarchitektur/Vorschläge/KANALKONFIGURATOR.md diff --git a/docs/Prozessarchitektur/Vorschläge/KANALKONFIGURATOR.md b/docs/Prozessarchitektur/Vorschläge/KANALKONFIGURATOR.md new file mode 100644 index 0000000..67d3143 --- /dev/null +++ b/docs/Prozessarchitektur/Vorschläge/KANALKONFIGURATOR.md @@ -0,0 +1,163 @@ +# Ergänzungsvorschlag: Kanalkonfigurator (Schablonen, Schritte, Nachweise, Vorschau) + +**Stand:** 04.11.2026 · **Status:** Vorschlag zur Ergänzung der Spezifikation v0.11, **nicht normativ**. Normativ wird er erst, wenn der Betreiber die offenen Entscheidungen (§9) trifft und der Inhalt in die betroffenen Kapitel übernommen ist (02 Abwicklungsprofile, Konfiguration und Wirksamkeit, Gates und Nachweise, Archetypen). + +Anlass: Abstimmung mit dem Betreiber am 03./04.11.2026. Heute gibt es am Kanal eine flache Liste von Einstellungen, deren Wirkung auf den Ablauf nicht erkennbar ist. Die Spezifikation fordert dagegen: „die konkreten Wirkungen und Herkunftswerte müssen sichtbar bleiben“ (02). Neue Portale verhalten sich unterschiedlich; künftig soll auch eine Direktbuchung auf der eigenen Webseite möglich sein. + +--- + +## 1. Ziel + +Je **Kanal** und je **Eingangsart** (unverbindliche Anfrage, feste Buchung) wird der Ablauf an **einer** Stelle eingerichtet: + +1. **Schablone wählen:** Die Archetypen A1–A5 dienen als Vorlage, dazu die Antwortform „Auskunft“. +2. **Schritte anpassen:** Jeder Schritt des Ablaufs zeigt nur die Einstellungen, die ihn betreffen, und ob er fest, abschaltbar oder an das Portal übertragbar ist. +3. **Wirkung sehen:** Eine Vorschau zeigt den Ablauf eines Beispielvorgangs mit genau diesen Einstellungen, so wie er später im Vorgang steht. + +Damit lassen sich neue Kanäle einrichten, ohne den Code anzupassen, solange sie in die Archetypen passen. + +## 2. Grenzen (unverändert aus v0.11) + +- **Keine zweite Ablaufsteuerung.** `CaseActivities` und `CaseAutomation` bleiben führend. Der Konfigurator schaltet nur Schritte, die der gemeinsame Prozess kennt; er erfindet keine neuen. +- **Keine zweite Konfigurationsquelle.** Alle Werte bleiben im bestehenden Einstellungssystem: Vermieterstandard → Wohnung → Kanal × Eingangsart → Vorgang, wobei „leer“ erbt und `0`, „nein“ oder „entfällt“ eigene Werte sind. Eine Schablone belegt nur vor. +- **Der Archetyp wird weiter abgeleitet** (E-022, 01). Er ist eine Geschäftskonstellation aus tatsächlicher Eingangsart und Verantwortung, kein gespeichertes Auswahlfeld, das den Einstellungen widersprechen könnte. +- **Feste Prüfregeln sind nicht abschaltbar:** + - Pflichtangaben vor eigenem Angebot und vor der Wunschbestätigung (G2a); + - Verfügbarkeitsprüfung, auch vor jeder eigenen Bindung; + - Verbindlichkeit externer Buchungen (E-036); + - Testbetriebs-Schranke für Mails; + - Mandantentrennung. +- **Laufende Vorgänge** behalten ihr beim Eingang eingefrorenes Profil. + +## 3. Schablonen + +Eine Schablone ist ein benannter Satz von Startwerten für die Einstellungen einer Eingangsart. Sie wird beim Kanal gewählt und schreibt die Werte in die Kanalebene. Ändert man danach einen Wert, zeigt der Kanal z. B. „A4 – angepasst“ und welche Werte abweichen. + +| Schablone | Eingangsart | Wesentliche Startwerte | Abgeleiteter Archetyp | +|---|---|---|---| +| **Eigenes Angebot mit Reservierung** | Anfrage | Angebotsreservierung ja, Angebot mit Annahmelink, Unterlagen, Zahlungen und Gästemails „wir“ | A1 (Webseite, Telefon) bzw. A2 (Portal) | +| **Unverbindliche Auskunft** (enthält die „Preisanfrage“) | Anfrage | Angebotsreservierung nein → Auskunft unter Vorbehalt, Gast fragt Buchung an, erneute Prüfung | A1/A2 | +| **Portalbuchung, wir wickeln ab** | feste Buchung | Unterlagen, Zahlungen, Mahnung, Storno und Gästemails „wir“ | A3 (z. B. Destination Solutions) | +| **Portalbuchung, Portal kassiert** | feste Buchung | Unterlagen „wir“; Zahlungen, Mahnung und Storno/Erstattung „Portal“; Gästemails je Portal | A4 (z. B. FeWo-direkt) | +| **Portalbuchung, Portal wickelt ab** | feste Buchung | Unterlagen, Zahlungen, Mahnung, Storno und Gästemails „Portal“; nur lokale Aufgaben bei uns | A5 | +| **Direktbuchung auf der eigenen Webseite** (später, §7) | feste Buchung, nur Webseite | Gast bucht verbindlich nach Prüfung; Unterlagen, Zahlungen „wir“ | A1 | + +Die Schablonen liegen im Code als Katalog der Spezifikation. Der Betreiber kann sie fachlich erweitern, die Vermieterin wählt nur aus. + +## 4. Schritte und ihre Einstellungen + +Zeichen: 🔒 fest · ⚙ einstellbar · ↗ an das Portal übertragbar (mit Nachweis, §5) · ⊘ kann entfallen + +### 4.1 Unverbindliche Anfrage (A1/A2) + +| # | Schritt | Einstellungen am Schritt | Fest | +|---|---|---|---| +| 1 | **Eingang** | ⚙ angenommene Eingangswege (Webformular, Portal-Mail, Telefon/Hand); ⚙ Pflichtfelder im Webformular (z. B. Anschrift); ⚙ Portal-Mails auswerten ja/nein; ⚙ KI-Auswertung ja/nein | 🔒 Vorgang je Geschäftsfall, Dubletten-Schutz | +| 2 | **Angaben vervollständigen** | ⚙ Rückfrage automatisch / Freigabe / selbst; ⚙ Erinnerungen, Folgefragen, Abstand; ⚙ Gültigkeit des Links | 🔒 Pflichtangaben für Angebot bzw. Bestätigung | +| 3 | **Klärungsreservierung** | ⚙ Minuten bei automatischer bzw. freigegebener Rückfrage, `0` = keine | 🔒 nur bei freiem Zeitraum, keine Verlängerung durch Nachrichten | +| 4 | **Antwort an den Gast** | ⚙ Angebot mit Reservierung oder Auskunft (Schablone); ⚙ Gültigkeit/Haltefrist; ⚙ automatisch / Sie geben frei; ⚙ Vertragsvorlage | 🔒 Verfügbarkeitsprüfung, G2a vor dem Angebot | +| 5 | **Annahme bzw. Buchungswunsch** | ⚙ Bestätigung des Wunsches automatisch / von Hand | 🔒 erneute Prüfung, G2a vor der Bestätigung, Annahme nur über signierten Link | +| 6 | **Andere Portale sperren** | ⚙ je Portal „zusätzlich von Hand sperren“; ⚙ Mindestnachweis der Sperre | 🔒 iCal-Export | +| 7 | **Bestätigung mit Vertrag** | ⚙ Vorlage; ⚙ automatisch / Sie geben frei | 🔒 bei eigenem Angebot schicken immer wir | +| 8 | **Zahlungen und Mahnungen** | ⚙ Anzahlungsfrist (Betrieb); ⚙ Mahnungen ja/nein ⊘ | – | +| 9 | **Vorbereitung** | ⚙ Anreisezeit erfragen (Wohnung); ⚙ Aufgaben je Aufenthalt (Wohnung) | – | +| 10 | **Anreise-Info** | ⚙ wir / ⊘ entfällt; ⚙ Tage vorher | – | +| 11 | **Aufenthalt, Aufenthalt abschließen** | – | 🔒 | +| 12 | **Bewertungsbitte** | ⚙ wir / ⊘ entfällt | – | +| 13 | **Kaufmännisch abschließen** | – | 🔒 inklusive Nachweisprüfung (§5) | + +### 4.2 Feste Buchung (A3–A5) + +| # | Schritt | Einstellungen am Schritt | Fest | +|---|---|---|---| +| 1 | **Eingang** | ⚙ erkannte Buchungen übernehmen: aus / beobachten / anlegen / anlegen und weiter; ⚙ Portal-Mails auswerten; ⚙ KI-Auswertung; ⚙ **akzeptierte Angaben aus diesem Kanal** (z. B. Gastname, Anschrift, Personenzahl, Preis) | 🔒 iCal-Ereignisverarbeitung, gleiche Nächte nur ohne Widerspruch | +| 2 | **Beim Portal fest gebucht** | – | 🔒 verbindlich von Anfang an (E-036), keine Klärungsreservierung, kein Angebot | +| 3 | **Gastangaben vervollständigen** | ⚙ Rückfrage automatisch / Freigabe / selbst | 🔒 nur administrative Angaben, nie Vertragsinhalt | +| 4 | **Gesamtpreis laut Portal** | ⚙ Quelle: Portal-Mail / Eintrag | 🔒 Portalpreis maßgeblich, keine eigene Neuberechnung | +| 5 | **Unterlagen / Vertrag** | ⚙ wir / ↗ Portal / ⊘ entfällt; ⚙ Vorlage („gibt nur Portalbedingungen wieder“) | 🔒 keine neuen, nicht vereinbarten Pflichten | +| 6 | **Zahlung des Gastes** | ⚙ wir / ↗ Portal | – | +| 7 | **Mahnungen** | ⚙ wir / ↗ Portal / ⊘ entfällt | – | +| 8 | **Auszahlung des Portals prüfen** | erscheint, wenn das Portal kassiert; ⚙ Frist nach Abreise | – | +| 9 | **Andere Portale sperren** | wie 4.1 Nr. 6 | 🔒 | +| 10 | **Storno und Erstattung** | ⚙ wir / ↗ Portal | 🔒 Stornowunsch ist noch keine Stornierung | +| 11 | **Anreise-Info, Bewertungsbitte** | ⚙ wir / ↗ Portal / ⊘ entfällt | – | +| 12 | **Lokale Leistungen** (Reinigung, Schlüssel, Wäsche) | ⚙ Aufgaben je Aufenthalt (Wohnung), ⚙ zuständig: wir / Dienstleister | – | +| 13 | **Abschlüsse** | – | 🔒 inklusive Nachweisprüfung | + +Neu gegenüber dem heutigen Stand sind: +- die Verantwortung für **Mahnung**, **Storno/Erstattung** und **lokale Leistungen**; +- die Wahl **„entfällt“** bei Unterlagen, Anreise-Info und Bewertung; +- **akzeptierte Angaben** je Kanal; +- der **Mindestnachweis** je übertragenem Schritt. + +Alles Übrige gibt es bereits und bekommt nur einen neuen Platz. + +## 5. Nachweisregel für Schritte, die das Portal übernimmt + +„Extern *verantwortet* ist nicht automatisch extern *erledigt*“ (Gates und Nachweise). Darum behält jeder übertragene Schritt bei uns: + +1. **Die Angaben, die der Vorgang braucht:** beim Vertrag die gebuchten Bedingungen und die Portal-Referenz; bei Zahlungen Gesamtpreis, Raten und „laut Portal bezahlt“ (wie Paket 8); bei Storno die Stornomeldung mit Datum und Betrag. +2. **Einen Nachweis mit Stufe:** + + | Stufe | Bedeutung | Typische Quelle | + |---|---|---| + | angekündigt | das Portal übernimmt den Schritt laut Profil | Einstellung | + | laut Portal erledigt | das Portal meldet die Erledigung | Portal-Mail, Eintrag der Vermieterin | + | nachgewiesen | Beleg liegt bei uns | Datei, Screenshot, Abrechnung, Kontoauszug | + +3. **Eine Mindeststufe je Schritt und Kanal:** ⚙, mit Vorgabe aus der Schablone. Solange sie nicht erreicht ist, bleibt der Schritt mit „Nachweis fehlt“ offen. +4. **Prüfung beim kaufmännischen Abschluss:** Fehlende Nachweise erscheinen dort als offene Punkte, so wie heute schon die Auszahlung des Portals. Ein begründeter Abschluss bleibt möglich. + +Die Stufen der Portalsperren (veranlasst / im Zielportal erkennbar / nachweislich wirksam, E-018) bleiben unverändert und folgen derselben Regel. + +## 6. Vorschau + +Der Konfigurator rechnet mit den gewählten Einstellungen einen **Beispielvorgang** durch, ohne etwas zu speichern, und zeigt die Ablaufliste, wie sie im Vorgang erscheint. Eine Zeile sieht etwa so aus: „Zahlung des Gastes an FeWo-direkt – übernimmt das Portal, Nachweis: laut Portal erledigt“. + +Grundlage ist dieselbe Ablauflogik wie im Vorgang, deshalb weicht die Vorschau nicht vom späteren Verhalten ab. + +Jede Änderung aktualisiert die Vorschau sofort. Ein Hinweis erscheint, wenn sich Eingangsart („Was kommt über dieses Portal?“) und Einstellungen widersprechen; das ist die bekannte Lücke in Konfiguration und Wirksamkeit §7. + +## 7. Direktbuchung auf der eigenen Webseite (spätere Ausbaustufe) + +- **Fachlich:** + - Neue Eingangsart „feste Buchung“ auch für die Webseite. + - Pflichtangaben und Verfügbarkeit werden **vor** dem Absenden geprüft, das Absenden macht die Buchung verbindlich. + - Danach gilt der Ablauf wie nach einer angenommenen Annahme: Bestätigung mit Vertrag, Zahlungen. +- **Zusätzliche Schritte:** Einbeziehung der Bedingungen vor dem Klick; Bestellknopf mit eindeutiger Beschriftung; gegebenenfalls Anzahlung und Zahlungsweg. +- **Voraussetzung:** eigene Betreiberentscheidung und Rechtsprüfung, unter anderem § 312j BGB (Bestellknopf) und Einbeziehung der AGB. Bis dahin ist die Schablone im Katalog vorgesehen, aber nicht wählbar. + +## 8. Umsetzung (Vorschlag, nach Freigabe) + +1. **Schrittansicht und Vorschau** über den bestehenden Einstellungen. Keine Datenmodelländerung; „Ihre Standards“ nutzt dieselbe Ansicht ohne Kanalbezug. +2. **Schablonenkatalog** mit Anwendung und der Kennzeichnung „angepasst“. +3. **Fehlende Schritt-Einstellungen** als neue Fälle im bestehenden `ProcessSetting`: Mahnung, Storno/Erstattung, lokale Leistungen, „entfällt“, akzeptierte Angaben je Kanal, Mindestnachweis je übertragenem Schritt. +4. **Nachweis** je übertragenem Schritt: Stufe, Quelle, Beleg. Dafür wird das vorhandene Nachweismuster der Portalsperren und Portalbeträge wiederverwendet; der kaufmännische Abschluss prüft sie. +5. **Später:** Direktbuchung auf der Webseite (§7). + +Die heutige Liste der Einstellungen am Kanal entfällt danach als Hauptansicht. „Wirksame Einstellungen“ bleibt als Prüfsicht für Experten. + +## 9. Offene Entscheidungen + +| # | Frage | Empfehlung | +|---|---|---| +| D1 | „Generelle Preisanfrage“ als eigener Eingangstyp? | **Nein:** Sie ist die Schablone „Unverbindliche Auskunft“ der Anfrage. Eine Frage ohne Termine bleibt im Posteingang und wird bei Bedarf zur Anfrage (CH-06). | +| D2 | Verhalten der Schablone nach Anpassung | Startwert mit Kennzeichnung „angepasst“. Erneutes Anwenden nur ausdrücklich, mit Vorschau der überschriebenen Werte. | +| D3 | Vorgaben für den Mindestnachweis je Schablone | A4: Zahlung „laut Portal erledigt“, Auszahlung „nachgewiesen“ (Kontoauszug). A5: Unterlagen und Storno „laut Portal erledigt“. Portalsperren wie bisher. | +| D4 | Granularität der „akzeptierten Angaben“ | Je Kanal eine Auswahl der Felder (Name, E-Mail, Anschrift, Telefon, Personenzahl, Preis). Nicht ausgewählte Felder werden zur Prüfung vorgelegt statt übernommen. | +| D5 | Wer darf den Konfigurator ändern? | Administratoren des Mandanten (wie heute „So arbeite ich“); Schablonenkatalog nur der Betreiber. | +| D6 | Direktbuchung Webseite | Eigene Entscheidung nach Rechtsprüfung; bis dahin nicht wählbar. | + +## 10. Abnahmekriterien (für die spätere Umsetzung) + +| # | Kriterium | +|---|---| +| K01 | Je Kanal und Eingangsart lässt sich eine Schablone wählen. Der abgeleitete Archetyp stimmt mit der Schablone überein und mit dem, den ein Vorgang dieses Kanals tatsächlich erhält. | +| K02 | Jeder Schritt zeigt nur seine Einstellungen; feste Schritte sind als fest gekennzeichnet und nicht änderbar. | +| K03 | Die Vorschau entspricht der Ablaufliste eines danach eingehenden echten Vorgangs. | +| K04 | Ein an das Portal übertragener Schritt ohne Mindestnachweis bleibt offen und erscheint beim kaufmännischen Abschluss. | +| K05 | Eine Anpassung nach der Schablone wird als „angepasst“ angezeigt; laufende Vorgänge ändern sich nicht. | +| K06 | Werte bleiben in der bestehenden Vererbung; „Wirksame Einstellungen“ zeigt dieselben Werte wie der Konfigurator. | +| K07 | Pflichtangaben, Verfügbarkeitsprüfung, Verbindlichkeit externer Buchungen und Testbetriebs-Schranke lassen sich durch keine Einstellung umgehen (Regressionstests v0.11). | + +[Zur Startseite](../README.md) · [Abwicklungsprofile](../02_Abwicklungsprofile_und_Dokumente.md) · [Archetypen](../01_Buchungsarchetypen.md) · [Konfiguration und Wirksamkeit](../KONFIGURATION_UND_WIRKSAMKEIT.md) · [Gates und Nachweise](../Querschnitt/Gates_und_Nachweise.md) From 86f2d0aa07df203c1c74a815fba1e40f84765f59 Mon Sep 17 00:00:00 2001 From: Lars Date: Wed, 4 Nov 2026 09:59:14 +0100 Subject: [PATCH 2/9] Architekturplan: kontrolliert modulare Prozessarchitektur, Kanalkonfigurator, Prozess-Tester (Planung) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bewertung, Fachmodulkatalog mit Verträgen, Prozessmodelle und Erweiterungspunkte (Loyalty-Nachweis), Kanalkonfigurator, isolierter Prozess-Tester, Änderungsanalyse, Migrations- und Umsetzungsplan sowie Management-Zusammenfassung. Keine Codeänderung. Co-Authored-By: Claude Opus 5.5 --- .../00_MANAGEMENT_ZUSAMMENFASSUNG.md | 79 ++++ .../Architektur/01_ARCHITEKTURBEWERTUNG.md | 159 ++++++++ .../Architektur/02_FACHMODUL_ARCHITEKTUR.md | 370 ++++++++++++++++++ .../Architektur/03_KANALKONFIGURATOR.md | 173 ++++++++ .../Architektur/04_PROZESS_TESTER.md | 206 ++++++++++ .../05_AENDERUNGSANALYSE_UND_TESTS.md | 119 ++++++ .../06_MIGRATIONS_UND_UMSETZUNGSPLAN.md | 220 +++++++++++ docs/Prozessarchitektur/README.md | 1 + .../Vorschläge/KANALKONFIGURATOR.md | 2 + docs/STATUS.md | 1 + 10 files changed, 1330 insertions(+) create mode 100644 docs/Prozessarchitektur/Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md create mode 100644 docs/Prozessarchitektur/Architektur/01_ARCHITEKTURBEWERTUNG.md create mode 100644 docs/Prozessarchitektur/Architektur/02_FACHMODUL_ARCHITEKTUR.md create mode 100644 docs/Prozessarchitektur/Architektur/03_KANALKONFIGURATOR.md create mode 100644 docs/Prozessarchitektur/Architektur/04_PROZESS_TESTER.md create mode 100644 docs/Prozessarchitektur/Architektur/05_AENDERUNGSANALYSE_UND_TESTS.md create mode 100644 docs/Prozessarchitektur/Architektur/06_MIGRATIONS_UND_UMSETZUNGSPLAN.md diff --git a/docs/Prozessarchitektur/Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md b/docs/Prozessarchitektur/Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md new file mode 100644 index 0000000..c0fa5f5 --- /dev/null +++ b/docs/Prozessarchitektur/Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md @@ -0,0 +1,79 @@ +# Management-Zusammenfassung: Kontrolliert modulare Prozessarchitektur + +Stand: 04.11.2026 · Analyse- und Planungsergebnis. Es wurden kein Code, keine Migration und keine Buchung oder Kanalkonfiguration geändert. + +Dokumente: + +1. [01 Architekturbewertung](01_ARCHITEKTURBEWERTUNG.md) +2. [02 Fachmodul-Architektur](02_FACHMODUL_ARCHITEKTUR.md) +3. [03 Kanalkonfigurator](03_KANALKONFIGURATOR.md) +4. [04 Prozess-Tester](04_PROZESS_TESTER.md) +5. [05 Änderungsanalyse und Tests](05_AENDERUNGSANALYSE_UND_TESTS.md) +6. [06 Migrations- und Umsetzungsplan](06_MIGRATIONS_UND_UMSETZUNGSPLAN.md) + +Kennzeichnung: **[Befund]** (im Code nachgewiesen), **[Vorschlag]**, **[Entscheidung offen]**. + +--- + +## Empfohlener Ansatz [Vorschlag] + +Empfohlen wird ein **Modulkatalog mit Prozessmodellen im Code**. Es gibt keine Workflow-Engine und keine Modellpflege in der Datenbank. + +- Rund **20 Fachmodule** entlang P01–P05. Jedes Modul hat einen Vertrag: Aufgabe, Daten, Ergebnisse, Voraussetzungen, Seiteneffekte, Parameter, Abschaltbarkeit und Tests. Die Module rufen die **bestehenden Actions** auf. +- **Versionierte Prozessmodelle** (`a1.offer`, `a2.information`, `a4.portal_booking` …) mit festen **Erweiterungspunkten**. Varianten entstehen durch Einfügen vorhandener Module. Die Archetypen A1–A6 bleiben reine Klassifikation. +- **Kanalkonfigurator:** Je Kanal und Eingangsart wählt der Vermieter ein zulässiges Modell. Er stellt die Schritte direkt am Schritt ein und sieht sofort eine Vorschau. Gespeichert wird in den **bestehenden JSON-Spalten**. Laufende Vorgänge behalten ihren eingefrorenen Plan. +- **Prozess-Tester „Ablauf testen“:** Er nutzt dieselben Module und Actions. Isoliert wird durch einen eigenen synthetischen Datenspeicher (SQLite-Datei je Lauf), einen Schreibwächter auf der echten Datenbank, simulierte Mail/HTTP/Dateien/Connectors und eine simulierte Uhr. Ein Rollback allein reicht nicht. +- **Kanalereignisse** (`IncomingBooking`, `PaymentReported` …) trennen iCal, Mail und künftige APIs vom Fachprozess. + +Einfachere Ansätze wurden geprüft und verworfen, siehe `01` §3. Zusätzliche Einstellungen allein oder eine Beschreibungsschicht über unverändertem Code erfüllen Konfigurator und Tester nicht. Konfigurator und Vorschau würden dann einen anderen Ablauf zeigen als den ausgeführten. + +## Was erhalten bleibt [Befund] + +Unverändert bleiben: + +- alle 56 Actions; +- `PriceCalculator` und `PriceQuote`; +- die Faktenaufnahme mit Herkunft (`ContributeCaseFacts`); +- Datenbeschaffung, Nachrichteneingang und KI-Auswertung (BYOK); +- die Mail-Schranke (`EnforceMailTestMode`); +- die Vererbung der Einstellungen samt Herkunft und Einfrieren (`ProcessSettings`, `ProcessProfile`); +- Connectors und Parser; +- die Datenmodelle; +- die gesamte Testsuite (683 Feature-Tests) als Regressionsnetz. + +## Was sich tatsächlich ändert [Vorschlag] + +1. `CaseActivities::for` und `CaseAutomation::step` sind heute fest verdrahtet [Befund]. Sie werden zu **einem Ablaufkern über Module**. Die öffentlichen Methoden bleiben, damit Oberfläche und Kommandos stabil bleiben. Abgesichert wird das per Golden-Master-Vergleich über etwa 150 Fallkonstellationen. +2. Ein **Preis-Erweiterungspunkt** (`CasePricing`) vor der Preisfestlegung. Er ist die einzige Änderung im Preisweg. +3. `PortalIntake` nimmt **Ereignisse** statt `BlockedPeriod` an. +4. Neu hinzu kommen der Konfigurator, der Tester und die Analysebefehle `process:impact` und `process:check`. +5. Datenmodell: **eine** neue Tabelle für Testberichte. Alles andere passt in bestehende JSON-Spalten. + +**Loyalty-Nachweis:** Nötig sind zwei neue Module, eine Variante von `a1.offer`, ein Registereintrag und Tests. A2–A6, `PriceCalculator`, `SendOffer`, Dokumente, Konfigurator und Tester bleiben unverändert (`02` §6.2). + +## Aufwand (Schätzung) + +Geschätzt sind **32–41 Entwicklertage** einschließlich Tests und Abnahme. Hinzu kommen 1–2 Tage Betreiberzeit. Die größte Unsicherheit liegt im Umbau des Ablaufkerns (U-A). + +Es gibt eine **gemeinsame Betreiberfreigabe** nach der Ende-zu-Ende-Abnahme auf stommer.info. Konfigurator und schadensfreier Tester werden zusammen abgenommen. + +## Wichtigste technische Risiken + +1. **Unbemerkte Verhaltensänderung beim Umbau.** Gegenmaßnahmen: Golden Master, unveränderte Bestandstests, Abnahme je Kanal. +2. **`pdo_sqlite` auf Strato ungeklärt.** Das ist vor Beginn zu prüfen. Andernfalls dient eine eigene MariaDB-Datenbank als Sandbox. +3. **Leck im Tester durch einen künftigen neuen Effektweg.** Gegenmaßnahmen: Schreibwächter, Sperre fremder HTTP-Aufrufe, generischer Modul-Vertragstest. +4. **Laufzeit des Testers auf Shared Hosting.** Gegenmaßnahmen: vorbereitete Sandbox-Vorlage, Laufzeitgrenzen, schrittweise Läufe. + +## Vor der Implementierung zu entscheiden [Entscheidung offen] + +| # | Frage | Empfehlung | +|---|---|---| +| E1 | Legt das gewählte Modell die Verantwortungen (Dokumente/Zahlungen) fest? | ja | +| E2 | Zulässige Modelle je Portal | FeWo-direkt: Anfrage A2, Buchung A4/A5; Destination Solutions: A3 – bitte bestätigen | +| E3 | Kanaländerung in laufende Vorgänge übernehmen? | nein | +| E4 | Sandbox: SQLite oder eigene MariaDB-Datenbank | SQLite, falls verfügbar | +| E5–E7 | Loyalty: Verhalten bei Änderung, Kombination mit Sonderangeboten, produktiv wählbar? | übernehmen statt neu rechnen; nicht kombinierbar; wählbar, Vorgabe aus | +| E8–E9 | Testerberechtigung, Aufbewahrung, Szenario-Freiheit | Administratoren, 90 Tage, nur vorgegebene Eingaben | +| D3, D4, D6 | Mindestnachweise, akzeptierte Angaben je Kanal, Direktbuchung | aus dem Vorschlag Kanalkonfigurator übernommen, weiter offen | + +Weitere Voraussetzungen: v0.11 ist auf stommer.info abgenommen, und die offenen Feature-Zweige sind zusammengeführt. Erst dann beginnt U-A. diff --git a/docs/Prozessarchitektur/Architektur/01_ARCHITEKTURBEWERTUNG.md b/docs/Prozessarchitektur/Architektur/01_ARCHITEKTURBEWERTUNG.md new file mode 100644 index 0000000..421091e --- /dev/null +++ b/docs/Prozessarchitektur/Architektur/01_ARCHITEKTURBEWERTUNG.md @@ -0,0 +1,159 @@ +# 01 – Architekturbewertung: kontrolliert modulare Prozessarchitektur + +Stand: 04.11.2026 · Grundlage: Branch `feature/aufenthalt` (Commit `ef2783e`), Prozessarchitektur v0.11, Vorschlag `Vorschläge/KANALKONFIGURATOR.md` +Status: **Analyse und Planung** – keine Codeänderung, keine Migration, keine Änderung an Buchungen oder Kanälen. + +Kennzeichnung in allen Dokumenten dieser Reihe: + +- **[Befund]** – im Code oder in Tests nachgewiesen (mit Klasse/Methode) +- **[Vorschlag]** – begründete Architekturempfehlung +- **[Entscheidung offen]** – vor der Umsetzung vom Betreiber zu treffen (gesammelt in `06`, Abschnitt 9) + +--- + +## 1. Bestand in Zahlen [Befund] + +| Bereich | Umfang | +|---|---| +| Actions (`app/Actions`) | 56 Klassen, 35 davon mit `DB::transaction` | +| Ablaufsteuerung (`app/Process`) | 13 Klassen. Davon `CaseActivities` 459 Zeilen, `CaseAutomation` 75, `ProcessSettings` 120, `ProcessProfile` 213 Zeilen | +| Einstellungen | `ProcessSetting`: 16 Werte (8 seit v0.10, 8 seit v0.11) | +| Kanalanbindung | `ChannelConnector` (nur iCal-Import), `PortalIntake` (489 Zeilen), `ProcessPortalMail`, `MailboxReader` | +| Tests | 683 Feature-Testmethoden; die PHPUnit-Suite läuft vollständig auf **SQLite in-memory** (`phpunit.xml`: `DB_CONNECTION=sqlite`) | +| Zeitgesteuert | 15 Scheduler-Einträge (`routes/console.php`), angestoßen von n8n jede Minute | + +--- + +## 2. Verpflichtender Soll-Ist-Abgleich + +### 2.1 Bereits sauber gekapselte Fähigkeiten [Befund] + +Die einzelnen Geschäftsoperationen sind gut gekapselt: Jede Action prüft ihre Voraussetzungen selbst, arbeitet transaktional und protokolliert über `CaseLog::record`. + +| Fähigkeit | Kapselung | Bewertung | +|---|---|---| +| Preis berechnen | `PriceCalculator::calculate(Property, StayRequest)` → unveränderliches `PriceQuote` mit `QuoteLine`s (Typen u. a. `Discount`, `Adjustment`) | sehr gut; seiteneffektfrei, stark getestet (`PriceCalculatorTest`, `SpecialOfferPricingTest`, `MinimumStayRulesTest`) | +| Verfügbarkeit | `AvailabilityChecker::isAvailable`, `CalendarClearance::reasons/refresh` | gut; die einzige Stelle für Kalenderwahrheit | +| Verbindliches Angebot | `SendOffer::handle` (versioniert, `quoteFor` mit `Adjustment`-Zeile), `deliver` (Mail getrennt) | gut; Preisfestlegung an einer Stelle | +| Annahme / Ablehnung | `AcceptOffer`, `RejectOffer` (Versionsprüfung) | gut | +| Verbindlichkeit | `ConfirmBooking`, `TakeOverExternalBooking` | gut | +| Fakten und Herkunft | `ContributeCaseFacts` → `case_facts` (Quelle, Beleg, Sicherheit, Konflikt) | sehr gut; einheitlicher Eingang für alle Quellen (`FactSource`) | +| Datenbeschaffung | `RequestCaseData` + `data_requests` + `GuestDataController` | gut | +| Halten | `RequestHold` (Zweck offer/clarification), `ExpireReservations`, `ReleaseReservation` | gut | +| Dokumente | `DocumentComposer` → `DocumentComposition::toConfirm`, `SendBookingDocuments`, `RentalContract` | gut | +| Portalbeträge | `RecordPortalAmounts`, `CaseMoney` | gut | +| Nachrichteneingang | `ReceiveInboundMessage`, `MessageMatcher`, `ExtractMessageFacts`, `LlmClient` (BYOK) | gut; KI liefert nur Vorschläge in `ContributeCaseFacts` | +| Mail-Schranke | `EnforceMailTestMode` (MessageSending, jeder Mailer); `MailTestModeGateTest` verhindert Umgehungen | sehr gut; ein zentraler Effektpunkt | +| Nachweis | `CaseLog`, `CaseRecorder` (Observer-gestützt), `BookingEvent` | gut | + +**Folgerung:** Die Fachmodule existieren inhaltlich schon. Es fehlt nicht die Logik, sondern eine **Beschreibung und Komposition** dieser Logik. + +### 2.2 Über mehrere Komponenten verteilte Geschäftsregeln [Befund] + +| Regel | Fundstellen | +|---|---| +| „Wer liefert die Dokumente?“ (`documents() ===`) | `CaseActivities`, `CaseAutomation`, `ViewBooking`, `BookingInfolist`, `DocumentKind` | +| „Wer kassiert?“ (`payments() ===`) | `CaseActivities`, `CancelBooking`, `DocumentComposer`, `PaymentsRelationManager`, `Booking::needsPaymentMonitoring` (Z. 472) | +| „Wer schreibt dem Gast?“ (`guestMessages() ===`) | `CaseActivities`, `RequestReviews`, `SendBookingReminders` | +| Anfrage oder Buchung (`IntakeKind::Booking`) | 14 Dateien, u. a. `PortalIntake`, `RequestCaseData`, `ProvideGuestContact`, `DocumentComposer` | +| Vorreservierung ja/nein (`preReservation()`) | 15 Dateien, u. a. `AutoOffer`, `RequestCaseData`, `DocumentComposer`, `SendPendingAutoOffers` | +| Interne Belegung (`isInternal()`) | 11 Dateien | +| Pflichtangaben je Schritt | `CaseRequirements` (zentral) – aber das Warten auf diese Angaben ist in `CaseActivities` (Kontakt-, Angebots- und Wunschschritt), `AutoOffer::blockers` und `RequestCaseData` jeweils eigens ausgewertet | + +Diese Regeln sind **korrekt**, aber nur implizit ein „Prozess“. Ein neuer Schritt (z. B. Loyalty) müsste heute an mehreren dieser Stellen bedacht werden. + +### 2.3 Fest verdrahtete Prozesse und Archetypen [Befund] + +1. **Ablaufliste:** `CaseActivities::for()` baut die Schritte als eine lange Folge von `if`-Blöcken. Sie verzweigt nach `$inquiry`, `$binding`, `preReservation()`, `documents()`, `payments()` und `isInternal()`; Letzteres führt nach `internal()`. Reihenfolge, Bedingung, Zustand und Aktion jedes Schritts stehen inline. Die Schlüssel sind Zeichenketten: `intake`, `contact`, `information`, `wish`, `wish_check`, `offer`, `acceptance`, `binding`, `price`, `documents`, `channel_block`, `payment`, `payout`, `deposit`, `balance`, `change_proposed`, `arrival_details`, `arrival_info`, `data_request`, `stay`, `review`, `closure`, `settlement`, `task_*`. +2. **Automatik:** `CaseAutomation::step()` kennt genau zwei Fälle (Angebot/Auskunft einer Anfrage, Unterlagen einer verbindlichen Buchung). Beide sind als eigene Bedingungen codiert und laufen nicht entlang der Ablaufliste. +3. **Archetyp:** `ProcessProfile::caseTypeFor()` leitet A1–A6 aus Eingangsart, „über Kanal“ und Verantwortungen ab. **Der Archetyp steuert nichts** (`CaseType::A` kommt nur in `ProcessProfile` vor). Er ist eine reine Klassifikation – genau das, was der Auftrag für Archetypen vorsieht. +4. **Schrittdetails:** `ActivityDetails::EVENT_TYPES` ordnet Verlaufsereignisse über die Schritt-Zeichenketten zu. Das ist eine zweite, parallel gepflegte Liste. +5. **Aktionen der Oberfläche:** `ViewBooking` bildet Aktionsnamen (`provideContact`, `approveDataRequest`, `portalPrice` …) auf Schritte ab. + +### 2.4 Tatsächlich vorhandene Konfiguration [Befund] + +- Hierarchie `ProcessSettings::resolve`: System (`ProcessSetting::default`) → Vermieter (`tenants.process_defaults`) → Wohnung (`properties.process_overrides`, Vertragsvorlage) → Kanal × Eingangsart (`channels.process_overrides[intake]`) beziehungsweise Webseite (`forWebsite`). +- Nicht gesetzte Werte erben; ein bewusst gesetztes `0`/„nein“/„manuell“ bleibt erhalten (`ProcessSetting::normalize`). Jeder Wert trägt seine Herkunft (`ProcessProfile::source`, `sourceLabel`). +- Die Einstellungen werden beim Eingang eingefroren (`CaseRecorder::freeze` → `bookings.profile`). Ausnahme: `ProcessProfile::LIVE = [ContractTemplate]`. +- Kanalebene: `ProcessSetting::channelIntakes()` begrenzt, welche Einstellung je Eingangsart überhaupt am Kanal gilt. +- Oberflächen: `HandlingSettings` (Vermieter), `PropertyForm` (Wohnung), `ChannelForm`/`EditChannel` (Kanal), `EffectiveSettings` (Wirksamkeit). + +**Damit ist Ebene C (Kanalkonfiguration) zur Hälfte vorhanden:** Vererbung, Herkunft und Einfrieren sind gelöst. Es fehlen die Auswahl eines Ablaufs und die Darstellung entlang der Schritte. + +### 2.5 Spezifizierte, aber nicht umgesetzte Freiheitsgrade [Befund] + +| Freiheitsgrad (v0.10/v0.11, Vorschlag Kanalkonfigurator) | Stand | +|---|---| +| Ablaufmodell je Kanal × Eingangsart wählen | fehlt; ergibt sich implizit aus `booking_model` und Verantwortungen | +| Optionale Schritte an-/abschalten (Bewertungsbitte, Erinnerungen, Adressprüfung) | nur teilweise über Einzelwerte (`GuestMessages`, `FormRequiresAddress`); Bewertungsbitte hängt an `guestMessages()` | +| Schrittweise Automatik (automatisch / nach Freigabe / manuell je Schritt) | nur global `Processing` sowie `DataRequest` (eigener Modus) | +| Nachweisstufe für ans Portal übertragene Schritte | fehlt (Vorschlag §5: angekündigt / laut Portal erledigt / nachgewiesen) | +| Vorschau „was passiert bei diesem Kanal“ | fehlt (`EffectiveSettings` zeigt Werte, keinen Ablauf) | +| Erweiterungspunkte (z. B. vor Preisfestlegung) | fehlen; Preis kommt direkt aus `PriceCalculator` in `CreateReservation`, `SendOffer::quoteFor`, `ChangeBooking` | +| Prozess durchspielen ohne Auswirkungen | fehlt; einzig die Testsuite (Entwickler) und der Mail-Testbetrieb (keine Datenisolation) | + +### 2.6 Ohne grundlegenden Umbau weiterverwendbar [Befund → Vorschlag] + +Alle Actions aus 2.1, `PriceCalculator`, `CaseRequirements`, `ContributeCaseFacts`, `CaseLog`/`CaseRecorder`, `ProcessSettings` samt Vererbung, `ProcessProfile` samt Einfrieren, `EnforceMailTestMode`, `PortalIntake` (fachliche Annahme), die Connectors und Parser, die Datenmodelle (`bookings.profile`, `channels.process_overrides` sind JSON-Spalten und nehmen die neuen Angaben **ohne Migration** auf) sowie die gesamte Testsuite als Regressionsnetz. + +### 2.7 Wirklich notwendige Architekturänderungen [Vorschlag] + +1. **`CaseActivities` und `CaseAutomation` werden zu einer Ablaufsteuerung über Module.** Jeder heutige `if`-Block wird zu einem Schritt eines Fachmoduls mit eigenem Vertrag. Die Reihenfolge kommt aus einem versionierten Prozessmodell, nicht mehr aus der Methode. Das ist der Kern und keine bloße Abstraktionsschicht: Die alte Methode verschwindet. +2. **Ein Erweiterungspunkt im Preisweg:** `SendOffer::quoteFor` (und die anderen Aufrufer für verbindliche Preise) holen den Preis über eine kleine Fassade `CasePricing`. Sie ruft `PriceCalculator` unverändert und ergänzt Preisbeiträge aktiver Module als `QuoteLine`s. +3. **Kanalereignisse statt `BlockedPeriod`-zentrierter Annahme:** `PortalIntake` nimmt künftig ein normalisiertes Ereignis an (`IncomingBooking` …). iCal, Mail und spätere APIs liefern dieses Ereignis. +4. **Isolierte Ausführungsumgebung für den Prozess-Tester** (getrennte Datenverbindung + Effekt-Ports + simulierte Zeit). +5. **Kanalkonfigurator als Oberfläche über dem Prozessmodell**, gespeichert in den bestehenden JSON-Spalten. + +Alles andere bleibt. + +--- + +## 3. Vergleich realistischer Architekturvarianten + +| | V0 Status quo + mehr Einzeleinstellungen | V1 Beschreibungsschicht über bestehender Logik | **V2 Modulkatalog + Prozessmodelle im Code (empfohlen)** | V3 Workflow-Engine / Zustandsmaschinen-Paket | +|---|---|---|---|---| +| Idee | weitere `ProcessSetting`s, `CaseActivities` erweitern | Schrittbeschreibungen für Konfigurator und Vorschau; `CaseActivities` bleibt verdrahtet | Fachmodule mit Vertrag; Modelle als versionierte PHP-Definitionen; `CaseActivities`/`CaseAutomation` iterieren das eingefrorene Modell | z. B. `symfony/workflow` oder eigene Engine mit Zuständen/Übergängen in DB | +| Loyalty-Nachweis (N3) | `if` in `CaseActivities`, `SendOffer`, `AutoOffer`; Einstellungswildwuchs | Beschreibung **und** Code an mehreren Stellen – Doppelpflege | 2 Module + 1 Variante + Test; Kern unverändert | Modell in Engine + Adapter auf Actions | +| Konfigurator | Feldsammlung (heutiges Problem) | möglich, aber Beschreibung kann von Wirklichkeit abweichen | Oberfläche liest dieselbe Definition, nach der ausgeführt wird | möglich | +| Tester mit gleicher Logik | nicht möglich | nur Vorschau, kein Durchlauf | Durchlauf über dieselben Module und Actions | möglich, aber zweite Steuerlogik neben Actions | +| Neue Abhängigkeit | nein | nein | nein | ja (Auftrag: nicht erwünscht) | +| Risiko für laufende Vorgänge | gering | gering | mittel, beherrschbar durch Referenzvergleich (Golden Master, `05` §4) | hoch (zweite Engine, Datenmigration) | +| Aufwand | klein, wächst je Änderung | klein–mittel | mittel (einmalig) | hoch | +| Erfüllt Auftrag | nein (§2, §11) | nein („bloße Abstraktionsschicht genügt nicht“, §6) | ja | nein (§6 „keine zweite Engine“, §11) | + +**Empfehlung: V2.** V1 ist als Rückfallebene ungeeignet: Der Konfigurator würde einen Ablauf zeigen, der nicht der ausgeführte ist. Für den Tester gilt dasselbe. + +### Was V2 bewusst nicht ist + +- Kein Vermieter-Designer; Modelle und Varianten entstehen nur im Code (Pull Request, Tests). +- Keine Bedingungen durch Endanwender – nur deklarierte Parameter und deklarierte optionale Schritte. +- Keine Speicherung von Modellen in der Datenbank; dort liegen nur **Auswahl und Parameter** (bestehende JSON-Spalten). +- Kein dynamisches Laden: Module sind in einem festen Katalog (`config/process.php`) registriert, wie heute die Connectors in `config/channels.php`. + +--- + +## 4. Risiken + +| Risiko | Wirkung | Gegenmaßnahme | +|---|---|---| +| Umbau von `CaseActivities` ändert Verhalten unbemerkt | falsche nächste Schritte, falsche Automatik | Golden-Master-Vergleich alt/neu über alle Testfälle und eine Fallmatrix (`05` §4); Umstellung erst, wenn identisch | +| Laufende Vorgänge ohne Modellangabe | Ablauf ändert sich mitten im Vorgang | Abbildung `legacy` → Modell v1 aus `caseType`+`intake`+Profilwerten; v1 reproduziert heutige Liste exakt (`06` §4) | +| Tester greift doch auf echte Daten zu | Schaden an Buchungen, Mails, Portalen | mehrschichtige Isolation, Schreibwächter auf der echten Verbindung, Sicherheitstests (`04` §3) | +| SQLite auf Strato nicht verfügbar | Tester ohne getrennte Datenhaltung | Voraussetzung vorab prüfen (`php -m`); Ausweichlösung eigene MariaDB-Datenbank des Tarifs (`04` §3.6) | +| Modulvertrag wird zu formal | Mehraufwand ohne Nutzen | Vertrag als PHP-Definition mit wenigen Pflichtfeldern; Prüfung automatisch im Vertragstest | +| Zu feine Module | Konfigurator unübersichtlich | ca. 20 Module entlang der Prozesslandkarte, nicht je Methode (`02` §2) | + +--- + +## 5. Abschließende kritische Prüfung (Auftrag §15) + +1. **Sinnvoll gekapselt oder umbenannt?** Die Actions bleiben, wie sie sind – das ist gewollt, sie sind gut. Neu ist, was heute fehlt: Jeder Schritt erhält Bedingung, Zustand, Automatik, Parameter, Seiteneffekte und Nachweis an einer Stelle (Modul) statt verteilt über `CaseActivities`, `CaseAutomation`, `ActivityDetails::EVENT_TYPES` und `ViewBooking`. Die Verteilung aus 2.2 wird beseitigt, nicht umbenannt. +2. **Varianten ohne Sonderprogrammierung?** Ja, solange die Variante nur vorhandene Module kombiniert oder an Erweiterungspunkten ergänzt (N3). Ein neues Fachmodul braucht weiterhin Code und Tests – so verlangt. +3. **Modellauswahl praktisch nutzbar?** Die Auswahl ist je Kanal × Eingangsart auf die zulässigen Modelle eingeschränkt, meist 1–2 Optionen. Ein Standard wird aus dem heutigen Verhalten vorbelegt (`03` §2). +4. **Schritte verständlich, Einstellungen am Schritt?** Ja: Der Konfigurator rendert die Schrittliste aus dem Modell; Parameter hängen am Modul (`03` §3). +5. **Loyalty ohne Eingriff in andere Archetypen?** Ja; nachgewiesen in `02` §6 mit vollständiger Liste geänderter und unveränderter Komponenten. Einmalig nötig ist der generische Preis-Erweiterungspunkt; er ist kein Loyalty-Code. +6. **Änderungen nachvollziehbar?** Ja über den Katalog: Modell × Modul × Parameter × Testgruppe (`05` §2); `php artisan process:impact ` liest dieselben Definitionen. +7. **Tester mit derselben Logik?** Ja: Er führt dieselben Actions und dieselbe Ablaufsteuerung aus, nur mit getrennter Datenverbindung und ausgetauschten Effekt-Ports (`04` §2). +8. **Seiteneffekte technisch ausgeschlossen?** Mehrschichtig: andere Datenverbindung (physisch andere Datei), Schreibwächter auf der echten Verbindung, Mail/HTTP/Dateien/Warteschlange auf Fakes, keine Connector-Netzzugriffe, Abbruch bei jeder unerwarteten Effektart. Ein Rollback allein wird nicht verwendet. +9. **Neue Portal-APIs?** Ja über Kanalereignisse; ein API-Adapter liefert `IncomingBooking` wie heute iCal/Mail (N7, `02` §8). +10. **Komplexität gerechtfertigt?** Ja, weil drei Ziele (Konfigurator, Tester, Erweiterbarkeit) dieselbe Grundlage brauchen, die Actions erhalten bleiben und keine neue Abhängigkeit, keine Engine und keine Datenbankmigration für Modelle entsteht. Einfachere Varianten (V0/V1) erfüllen Konfigurator **und** Tester nicht. Bewusst weggelassen: frei kombinierbare Bedingungen, grafische Modelle, Modellpflege in der Datenbank, eine eigene Ereignis-/Zustandsmaschine. diff --git a/docs/Prozessarchitektur/Architektur/02_FACHMODUL_ARCHITEKTUR.md b/docs/Prozessarchitektur/Architektur/02_FACHMODUL_ARCHITEKTUR.md new file mode 100644 index 0000000..660d0df --- /dev/null +++ b/docs/Prozessarchitektur/Architektur/02_FACHMODUL_ARCHITEKTUR.md @@ -0,0 +1,370 @@ +# 02 – Fachmodul-Architektur: Module, Prozessmodelle, Erweiterungspunkte, Ausführung + +Stand: 04.11.2026 · Kennzeichnung: **[Befund]**, **[Vorschlag]**, **[Entscheidung offen]** (siehe `01`) + +--- + +## 1. Begriffe und Ebenen [Vorschlag] + +| Begriff | Bedeutung | Ort im Code | +|---|---|---| +| **Archetyp** (A1–A6) | Geschäftsklassifikation aus Herkunft, Verbindlichkeit und Verantwortung. Er **steuert nichts**, sondern dient nur der Klassifikation und Plausibilisierung. | `CaseType`, `ProcessProfile::caseTypeFor` (unverändert) | +| **Fachmodul** | Wiederverwendbare fachliche Fähigkeit mit Vertrag. Es bietet einen oder mehrere **Schritte** an. | `app/Process/Modules/*` (neu); nutzt die bestehenden Actions | +| **Prozessmodell** | Zentral definierte, versionierte, geordnete Folge von Schritten mit Erweiterungspunkten. Es ist für bestimmte Archetypen und Eingangsarten zulässig. | `app/Process/Models/*` (neu, PHP) | +| **Prozessvariante** | Zulässige Ausprägung eines Modells: zusätzliche Module an Erweiterungspunkten und/oder andere Vorgaben. Sie hat **denselben Archetyp**. | im Modell deklariert | +| **Kanalkonfiguration** | Auswahl Modell/Variante je Kanal × Eingangsart, dazu Parameter und optionale Schritte | `channels.process_overrides[intake]` (bestehende JSON-Spalte) | +| **Vorgangsinstanz** | Ein Fall mit eingefrorenem **Prozessplan** (Modell@Version, Variante, Modul-Versionen, aktive Schritte, Parameter mit Herkunft) | `bookings.profile` (bestehende JSON-Spalte, Schlüssel `plan`) | + +Ebene A = Module, B = Modelle/Varianten, C = Kanalkonfiguration, D = Ausführung (`ProcessRunner`) und Tester (`04`). + +--- + +## 2. Granularität [Vorschlag] + +**Regel:** Ein Modul entspricht einer fachlichen Verantwortung, die im Vorgang als eigener Schritt sichtbar ist. Es kann eigenständig aktiv oder inaktiv sein, oder es hat eigene Parameter. Was nur gemeinsam sinnvoll ist, bleibt ein Modul, auch wenn es mehrere Actions nutzt (Beispiel `offer.binding`: Angebot erstellen und versenden). „Anschrift prüfen“, „Gast identifizieren“ und „Gastdaten validieren“ werden **Parameter** von `guest.details`, keine eigenen Module. Sie teilen dieselben Daten (`case_facts`), dieselbe Pflichtfeldlogik (`CaseRequirements`) und denselben Eingang (`ContributeCaseFacts`). Eine Trennung würde nur Übergaben erzeugen. + +Querschnittsdienste wie Preisberechnung, Mail-Schranke, Verlauf, Mandant und Nachrichtenzuordnung sind **keine Schritte**. Module nutzen sie, und im Konfigurator erscheinen sie nicht als Schritt. + +Ergebnis: **22 Module** (20 aus dem Bestand, 2 neu für Loyalty) und **5 Querschnittsdienste**, entlang P01–P05. + +--- + +## 3. Modulvertrag [Vorschlag] + +### 3.1 Technische Form + +Der Vertrag besteht aus PHP-Klassen. Es gibt kein JSON, keine Datenbank und kein Paket. + +```php +namespace App\Process\Modules; + +interface ProcessModule +{ + /** Stable key and version, e.g. 'offer.binding' / 2. */ + public static function key(): string; + public static function version(): int; + + /** Everything the configurator, the impact analysis and the contract tests read (pure data, no I/O). */ + public static function definition(): ModuleDefinition; + + /** Whether the step belongs to this case at all (condition), from case data and plan parameters. */ + public function applies(CaseContext $case): bool; + + /** Where the step stands – today's inline match blocks in CaseActivities. */ + public function activity(CaseContext $case): Activity; + + /** What keeps the step from being carried out now (plain words, empty = may run). */ + public function blockers(CaseContext $case): array; + + /** Carry the step out by calling the existing Action(s); only for steps with an automatic mode. */ + public function run(CaseContext $case): StepResult; +} +``` + +Zusätzlich gibt es einen optionalen Untervertrag für Preisbeiträge: + +```php +interface ContributesToPrice +{ + /** Lines added before the price is fixed; never touches a binding case (enforced by CasePricing). */ + public function priceLines(CaseContext $case, PriceQuote $quote): PriceContribution; // lines + basis + outcome +} +``` + +`CaseContext` bündelt den `Booking`, den eingefrorenen `ProcessPlan`, die Parameter dieses Moduls und die aktuelle Zeit (aus `now()`; im Tester simuliert). Module halten **keinen** eigenen Zustand. Der Zustand steht weiter in `bookings`, `case_facts`, `booking_tasks`, `data_requests` und `booking_events`, genau wie heute. + +### 3.2 Pflichtangaben in `ModuleDefinition` + +| Vertragsfeld (Auftrag §4) | Feld | Beispiel `offer.binding` | +|---|---|---| +| Kennung und Version | `key()`, `version()` | `offer.binding` / 1 | +| Fachliche Aufgabe | `purpose` (Klartext für Konfigurator) | „Verbindliches Angebot mit Vertragsentwurf erstellen und dem Gast senden“ | +| Benötigte Eingabedaten | `needs`: Felder aus `CaseRequirements` / Fallattribute | `CaseRequirements::OFFER`, Zeitraum, Gästezahl, E-Mail | +| Produzierte Ergebnisse | `produces` | `offer_version`, `offer_terms`, `total`, Status `OfferSent`, signierter Link | +| Voraussetzungen | `requires`: Module, die vorher `Done` sein müssen | `availability.check`, `guest.details` | +| Zulässige Phasen | `phases` (P01–P05) | P02 | +| Erlaubte Seiteneffekte | `effects`: Aufzählung `Effect` | `CaseWrite`, `GuestMail`, `Document`, `CalendarHold` | +| Fehler- und Wartezustände | `states`: erlaubte `ActivityState`s + Bedeutung | `Later` = „wartet auf Angaben“, `Problem` = Zeitraum belegt | +| Auslösende Ereignisse | `triggers` | `facts.complete`, `hold.started`, Hand: `sendOffer` | +| Idempotenz/Wiederholung | `idempotency` | `expected_version`; erneuter Lauf ohne Wirkung (heute in `SendOffer` per Versionsprüfung) | +| Abhängigkeiten | `uses`: Dienste/Module | `pricing` (Dienst), `documents` (Dienst) | +| Konfigurierbare Parameter | `parameters`: `ProcessSetting`s oder `ModuleParameter`s mit Frage, Typ, Grenzen | `Processing`, `HoldHours` | +| Aktivierung | `toggle`: `Mandatory` / `Optional(defaultOn)` / `Conditional` / `Transferable` | `Mandatory` | +| Sicherheits-/Vertragsgrenzen | `guards` (Klartext + Test) | nie ohne Verfügbarkeit; nie ohne freigegebene Mietbedingungen im Livebetrieb (`AutoOffer::contractTextsReleased`) | +| Vertragstests | `#[Group('module:offer.binding')]` + generischer `ModuleContractTest` | siehe `05` §3 | + +Der **generische Vertragstest** prüft für jedes registrierte Modul automatisch: + +- Die Definition ist vollständig, und die Parameter sind gültige `ProcessSetting`s. +- `applies`/`activity`/`blockers` schreiben nichts. +- `run` erzeugt nur die deklarierten `effects`. Gemessen wird das im Tester-Sandkasten über die Effekt-Ports (`04` §3). +- Ein zweiter `run` ist wirkungslos (Idempotenz). + +So wird der Vertrag nicht zu Papier: Ein Verstoß bricht die Suite. + +--- + +## 4. Fachmodulkatalog + +Spalte „heute“ = **[Befund]**, Rest = **[Vorschlag]**. Schlüssel in Klammern = heutige Schrittschlüssel in `CaseActivities`. + +### P01 Eingang und Daten + +| Modul | Aufgabe | heute | Aktivierung | Parameter | +|---|---|---|---|---| +| `intake.record` (`intake`) | Eingang festhalten, Plan einfrieren | `CreateReservation`, `TakeOverPortalInquiry`, `TakeOverExternalBooking`, `CaseRecorder::freeze` | Pflicht | – | +| `guest.details` (`contact`) | Gast identifizieren, Angaben zusammenführen und prüfen (inkl. Anschrift) | `ContributeCaseFacts`, `ProvideGuestContact`, `CaseRequirements`, `AssignOccupationGuest` | Pflicht, wenn wir mit dem Gast korrespondieren (heute `$needsContact`) | `FormRequiresAddress`, Pflichtfelder je Folgeschritt (fest) | +| `guest.data_request` (`data_request`) | Fehlende Angaben beim Gast anfragen | `RequestCaseData`, `DataRequest`, `GuestDataController` | Optional (Modus „aus“ = entfällt) | `DataRequest`, `DataRequestRemindersMax`, `DataRequestFollowupsMax`, `DataRequestReminderHours`, `GuestLinkValidDays` | +| `guest.loyalty_status` (neu) | Stammgaststatus ermitteln | – | Optional (nur Variante „Stammgast“) | Mindestaufenthalte, Rückblick in Jahren | + +### P01/P02 Belegung und Verbindlichkeit + +| Modul | Aufgabe | heute | Aktivierung | Parameter | +|---|---|---|---|---| +| `availability.check` | Zeitraum frei, Kanäle aktuell | `AvailabilityChecker`, `CalendarClearance` | **Pflicht, nicht abschaltbar** | – | +| `hold` | Klärungs- bzw. Angebotsvorreservierung | `RequestHold`, `ExpireReservations`, `ReleaseReservation` | Bedingt (Anfrage) | `PreReservation`, `HoldHours`, `ClarificationHoldAutoMinutes`, `ClarificationHoldManualMinutes` | +| `binding.portal` (`binding`, `price`) | Verbindlichkeit beim Portal feststellen, Portalpreis | `TakeOverExternalBooking`, `PortalIntake`, `RecordPortalAmounts` | Pflicht bei Eingangsart Buchung | Nachweisstufe | +| `channels.block` (`channel_block`) | Andere Kanäle sperren/freigeben | `CreateChannelTasks`, Observer, `RemindChannelTasks`, `ICalFeed` | **Pflicht** (nicht abschaltbar, wirkt je Kanal mit `requires_manual_blocking`) | – | + +### P02 Preis, Angebot und Annahme + +| Modul | Aufgabe | heute | Aktivierung | Parameter | +|---|---|---|---|---| +| `pricing.loyalty_discount` (neu) | Stammgastrabatt als Preiszeile | – | Optional (Variante) | Prozent, Höchstbetrag, mit Sonderangeboten kombinierbar | +| `offer.information` (`information`, `wish`, `wish_check`) | Unverbindliche Auskunft → Buchungswunsch → verbindlich bestätigen | `SendInformation`, `SubmitBookingWish`, `DecideBookingWish` | Alternative zu `offer.binding` (Modellwahl) | `Processing` | +| `offer.binding` (`offer`) | Verbindliches Angebot erstellen und senden | `SendOffer`, `OfferTerms`, `DocumentComposer` | Alternative zu `offer.information` | `Processing`, `ContractTemplate` | +| `offer.acceptance` (`acceptance`) | Annahme/Ablehnung, dann Bestätigung | `AcceptOffer`, `RejectOffer`, `ConfirmBooking` | Pflicht nach `offer.binding` | – | + +### P03 Abwicklung und Geld + +| Modul | Aufgabe | heute | Aktivierung | Parameter | +|---|---|---|---|---| +| `documents.send` (`documents`) | Buchungsunterlagen an den Gast | `SendBookingDocuments`, `RentalContract`, `CaseAutomation::documentBlockers` | Übertragbar (Portal) | `Documents`, Nachweisstufe | +| `payments.monitor` (`payment`, `deposit`, `balance`) | Zahlungen überwachen, erinnern | `RecordPayment`, `SendBookingReminders`, `SendPaymentReminder` | Übertragbar (Portal) | `Payments`, Erinnerungen an/aus (heute in `GuestMessages`) | +| `portal.payout` (`payout`) | Auszahlung des Portals prüfen | `RecordPortalAmounts`, `CaseMoney` | Bedingt (`Payments = Portal`) | – | +| `change.proposal` (`change_proposed`) | Änderungsvorschlag beim Gast | `ChangeBooking` | Ereignisgetrieben (kein Planplatz, s. 4.1) | – | + +### P04 Aufenthalt + +| Modul | Aufgabe | heute | Aktivierung | Parameter | +|---|---|---|---|---| +| `arrival.details` (`arrival_details`) | Anreisedaten, Dienstleister | `PrepareStays` (Aufgaben, `services`) | Optional | – | +| `arrival.info` (`arrival_info`) | Anreise-Informationen | `PrepareStays` | Übertragbar | `GuestMessages`, `ArrivalInfoDaysBefore` | +| `stay` (`stay`) | Aufenthalt | `CloseStay` | Pflicht | – | + +### P05 Abschluss + +| Modul | Aufgabe | heute | Aktivierung | Parameter | +|---|---|---|---|---| +| `review.request` (`review`) | Bitte um Bewertung | `RequestReviews` | **Optional** | an/aus (heute an `GuestMessages` gekoppelt) | +| `case.closure` (`closure`) | Aufenthalt abschließen | `CaseClosure` | Pflicht | – | +| `case.settlement` (`settlement`) | Kaufmännisch abschließen | `CaseClosure` | Pflicht | – | + +### 4.1 Ereignisgetriebene Sonderprozesse [Vorschlag] + +Stornierung (`CancelBooking`, `CancelBookingByGuest`, `RecordCancellation`), Änderung (`ChangeBooking`) und Ablauf (`ExpireReservations`) laufen **quer** zum Plan. Sie bleiben Actions und erscheinen als Module ohne festen Planplatz (`toggle = EventDriven`). Der Plan zeigt sie, wenn ihr Ereignis vorliegt. Ihr Code bleibt unverändert. + +### 4.2 Querschnittsdienste (keine Schritte) + +`pricing` (`PriceCalculator` + neue Fassade `CasePricing`), `messages` (`ReceiveInboundMessage`, `MessageMatcher`, `ExtractMessageFacts`), `mail` (Laravel-Mailer + `EnforceMailTestMode`), `log` (`CaseLog`, `CaseRecorder`), `tenancy` (`TenantContext`, `TenantConfig`). + +### 4.3 Interne Belegungen (A6) + +`CaseActivities::internal()` wird zum Modell `a6.internal` (Module `intake.record`, `channels.block`, `documents.send` optional, `payments.monitor` ohne Erinnerungen, `stay`, `case.closure`). Ein Kanal kommt hier nicht vor, also gibt es keine Kanalkonfiguration. + +--- + +## 5. Prozessmodelle, Varianten, Erweiterungspunkte [Vorschlag] + +### 5.1 Definition im Code + +```php +final class A1OfferModel extends ProcessModel +{ + public static function key(): string { return 'a1.offer'; } + public static function version(): int { return 1; } + public static function caseTypes(): array { return [CaseType::A1]; } // plausibility, never derived from the model + public static function intakes(): array { return [IntakeKind::Inquiry]; } + public static function channelKinds(): array { return [Channel::KIND_WEBSITE, 'direct']; } + + public function steps(): array + { + return [ + Step::module('intake.record'), + Step::module('guest.details'), + Step::module('guest.data_request'), + Step::point(Point::AfterGuestIdentified), + Step::module('hold'), + Step::module('availability.check'), + Step::point(Point::BeforePriceFixing), + Step::module('offer.binding'), + Step::point(Point::BeforeBindingOffer), + Step::module('offer.acceptance'), + Step::point(Point::AfterBinding), + Step::module('channels.block'), + Step::module('documents.send'), + Step::module('payments.monitor'), + Step::module('arrival.details'), Step::module('arrival.info'), + Step::point(Point::BeforeStay), + Step::module('stay'), + Step::module('review.request'), + Step::point(Point::BeforeSettlement), + Step::module('case.closure'), Step::module('case.settlement'), + ]; + } + + public function variants(): array + { + return [ + Variant::make('standard', 'Angebot mit Vorreservierung'), + Variant::make('loyalty', 'Angebot mit Stammgastrabatt') + ->insert(Point::AfterGuestIdentified, 'guest.loyalty_status') + ->insert(Point::BeforePriceFixing, 'pricing.loyalty_discount'), + ]; + } +} +``` + +**Erweiterungspunkte** (fest, Auftrag §5): `AfterGuestIdentified`, `BeforePriceFixing`, `BeforeBindingOffer`, `AfterBinding`, `BeforeStay`, `BeforeSettlement`. Jedes Modul deklariert, an welchen Punkten es stehen darf. `ProcessCatalogue::validate()` prüft das beim Booten im Test sowie in `php artisan process:check`. + +### 5.2 Modellkatalog (Startumfang) + +| Modell | Archetyp | Eingang | Ersetzt heutigen Zweig | +|---|---|---|---| +| `a1.offer` (Varianten `standard`, `loyalty`) | A1 | Anfrage, direkt/Webseite | `preReservation() = true` | +| `a1.information` | A1 | Anfrage, direkt/Webseite | `preReservation() = false` (Auskunft → Wunsch) | +| `a2.offer`, `a2.information` | A2 | Anfrage über Portal | wie A1, mit `intake` über `TakeOverPortalInquiry` | +| `a3.portal_booking` | A3 | Buchung | `documents = Landlord`, `payments = Landlord` | +| `a4.portal_booking` | A4 | Buchung | `payments = Portal` | +| `a5.portal_booking` | A5 | Buchung | `documents = Portal` | +| `a6.internal` | A6 | intern | `CaseActivities::internal()` | + +A2 nutzt dieselben Module wie A1. Die Modelle sind getrennt, weil Eingang und Kanalbezug fachlich verschieden sind (A2 bleibt A2). Gemeinsame Schrittfolgen werden als PHP-Methode der Basisklasse geteilt, nicht kopiert. + +**[Entscheidung offen E1]** Für A3–A5 gibt es zwei Möglichkeiten: Entweder steuern die Verantwortungs-Einstellungen `Documents`/`Payments` weiter, welches Modell gilt (Modell wird abgeleitet), oder der Vermieter wählt das Modell, und dieses legt die Verantwortungen fest. Empfehlung: **Modell wählen, Verantwortungen folgen aus dem Modell.** Das entspricht dem Auftrag (§7.1) und verhindert unzulässige Kombinationen. `caseTypeFor` bleibt als Plausibilitätsprüfung erhalten. + +### 5.3 Versionierung + +- Modell und Modul tragen je eine ganze Zahl als Version. Erhöht wird bei jeder fachlich wirksamen Änderung der Schrittfolge oder des Modulverhaltens. Reine Textänderungen erhöhen nicht. +- Beim Eingang wird ein **Prozessplan** eingefroren: `profile.plan = {model: 'a1.offer@1', variant: 'loyalty', modules: {'guest.loyalty_status': {v: 1, on: true, params: {...}, source: {...}}}, configured_at}`. Das erweitert den bestehenden `CaseRecorder::freeze` und braucht keine Migration. +- Die Klassen alter Modellversionen bleiben im Code, solange offene Vorgänge sie nutzen. `php artisan process:check` meldet Versionen ohne offene Vorgänge, und erst dann wird entfernt. +- Modulversionen ändern das Verhalten laufender Vorgänge **nur**, wenn das Modul eine abwärtskompatible Korrektur deklariert (`compatibleWith: [1]`). Sonst bleibt die alte Klasse aktiv (z. B. `LoyaltyDiscountV1`). Das ist selten: Die meisten Module rufen Actions auf, und deren Fehlerkorrekturen gelten wie heute für alle Vorgänge. + +### 5.4 Eine Variante täuscht keine Geschäftsart vor + +Das Modell deklariert `caseTypes()`. Beim Einfrieren prüft `ProcessPlan::freeze`, ob `caseTypeFor(...)` darin liegt. Bei Abweichung gibt es einen klaren Fehler und **kein** stilles Umdeuten. Der Archetyp bleibt immer die abgeleitete Klassifikation. + +--- + +## 6. Architektur-Nachweis Loyalty (N3) + +### 6.1 Ablauf in der Variante `a1.offer:loyalty` + +1. `guest.details` identifiziert den Gast (E-Mail, wie heute über `CreateReservation`/`Guest`). +2. **`guest.loyalty_status`** (Punkt `AfterGuestIdentified`) zählt abgeschlossene Aufenthalte desselben Gastes beim selben Mandanten. Gezählt werden `BookingStatus::Completed`, nicht storniert, im Rückblickzeitraum. Das Ergebnis wird als Fakt `loyalty_status` über `ContributeCaseFacts` gespeichert (neue `FactSource::System`), mit Beleg „3 Aufenthalte: 2024-0012, 2025-0031, 2026-0007“. + - Ergebnisse: `Qualified` / `NotQualified` / `Unknown`. `Unknown` gilt bei fehlender E-Mail, mehrdeutiger Zuordnung oder technischem Fehler. +3. **`pricing.loyalty_discount`** (Punkt `BeforePriceFixing`, `ContributesToPrice`). Bei `Qualified` entsteht eine `QuoteLine(QuoteLineType::Discount, 'Stammgastrabatt (3 frühere Aufenthalte)', …)`, berechnet auf `PriceQuote::rent()` mit Höchstbetrag. + - Bei `NotQualified` gibt es keine Zeile. Bei `Unknown` auch keine Zeile; zusätzlich erscheint die Schrittanzeige „Status nicht feststellbar – kein Rabatt“ sowie eine optionale Aufgabe „Stammgast prüfen“. + - **Der Angebotsversand wird nie blockiert.** Das ist das definierte fachliche Ergebnis eines Fehlers. +4. `offer.binding` ruft `SendOffer` auf. `SendOffer::quoteFor` holt den Preis nun über `CasePricing::quote($booking, $stay)`. Die Rabattzeile steht damit im versionierten Angebot (`offer_terms`), im Vertragsentwurf und im Verlauf (`CaseLog::record($booking, 'price', …, data: ['basis' => …])`). +5. Ab `offer.acceptance`/`ConfirmBooking` ist der Preis fest. `CasePricing` ruft für verbindliche Vorgänge (`$booking->isBinding()`) **keine** Beiträge mehr auf. Bei `ChangeBooking` wird die gespeicherte Rabattzeile übernommen, nicht neu berechnet. **[Entscheidung offen E5]**: Soll bei einer Verlängerung der Rabatt auf die neuen Nächte ausgedehnt werden? Empfehlung: nein, stattdessen ein Hinweis für eine manuelle `Adjustment`-Zeile. + +### 6.2 Was geändert wird und was unverändert bleibt + +| Komponente | Änderung | +|---|---| +| `app/Process/Modules/Guest/LoyaltyStatusCheck.php` | **neu** | +| `app/Process/Modules/Pricing/LoyaltyDiscount.php` | **neu** | +| `A1OfferModel::variants()` | **+1 Variante** (3 Zeilen) | +| `config/process.php` (Modulregister) | **+2 Einträge** | +| `FactSource` | **+1 Fall** `System`, falls bis dahin nicht vorhanden; wird auch von anderen Systemfeststellungen genutzt | +| Tests `LoyaltyStatusCheckTest`, `LoyaltyDiscountTest`, Tester-Szenario „Stammgast“ | **neu** | +| `PriceCalculator`, `PriceQuote`, `QuoteLine`, `QuoteLineType` | unverändert | +| `SendOffer`, `AcceptOffer`, `ConfirmBooking`, `DocumentComposer`, `RentalContract` | unverändert. Die Rabattzeile ist eine normale `Discount`-Zeile und wird schon heute gedruckt. | +| `CaseActivities`/`ProcessRunner`, `CaseAutomation` | unverändert. Beide iterieren den Plan. | +| Modelle `a1.information`, `a2.*`, `a3`–`a6` | unverändert | +| Kanalkonfigurator | unverändert. Er rendert Variante und Parameter aus der Definition. | +| Prozess-Tester | unverändert. Nur ein Szenario wird ergänzt. | + +**Einmalige Voraussetzung (kein Loyalty-Code):** die Fassade `CasePricing` mit dem Erweiterungspunkt `BeforePriceFixing`. Ihre Aufrufer sind `SendOffer::quoteFor`, der Preis der Auskunft in `SendInformation` und `DecideBookingWish`. `CreateReservation` (Richtpreis der Anfrage) und `ChangeBooking` für nicht verbindliche Fälle kommen hinzu. Sie wird mit Paket U-B gebaut (`06`) und dort mit einem Testmodul geprüft, das eine Preiszeile ergänzt. + +**[Entscheidung offen E6]** Ist ein Stammgastrabatt mit Sonderangeboten kombinierbar? `PriceCalculator::bestOffers` wählt das beste Angebot je Nacht; Loyalty steht außerhalb. Empfehlung: Der Parameter „mit Sonderangeboten kombinierbar“ steht per Vorgabe auf **nein**, dann gilt der höhere Nachlass. + +--- + +## 7. Ausführungslogik [Vorschlag] + +### 7.1 Ein Ablaufkern statt zwei verdrahteter Klassen + +`ProcessRunner` ersetzt die Inhalte von `CaseActivities::for` und `CaseAutomation::step`. Die öffentlichen Methoden bleiben als dünne Fassaden erhalten: `CaseActivities::for/next/situation` und `CaseAutomation::advance/documentBlockers`. So bleiben `ViewBooking`, `BookingInfolist`, `WorkList`, `ActivityDetails`, Kommandos und Tests stabil. + +``` +ProcessRunner::activities(Booking): list + plan = ProcessPlan::of(booking) // frozen plan or legacy mapping (06 §4) + for step in plan.steps (in order): + module = registry.module(step) // exact frozen version + if not step.enabled or not module.applies(ctx): continue (recorded as skipped + reason) + activity = module.activity(ctx) + apply the over/closed rule (today's $later closure in CaseActivities::for) centrally + + event-driven modules with an open event, + open BookingTasks (today's tasks()) + +ProcessRunner::advance(Booking): list // today's CaseAutomation::advance + only when processing() is automatic (or the step's own mode is automatic, see 03 §3.3) + first step with state Open whose mode is automatic: + blockers = module.blockers(ctx); if blockers: return blockers (shown as task, as today) + result = module.run(ctx) inside CaseLog::context(actor: system) + repeat for the next step until nothing runs (bounded loop, max = number of steps) +``` + +- Die Zustandsermittlung bleibt **abgeleitet**, wie heute: aus Falldaten, nicht aus einer gespeicherten Zustandsmaschine. Es gibt also keine zweite Wahrheit, die auseinanderlaufen kann. +- Die Regel „nach Vorgangsende ist nichts mehr zu tun“ (`$later` in `CaseActivities::for`) liegt zentral im Runner. +- `ActivityDetails::EVENT_TYPES` wandert in die Moduldefinition (`events`). +- `ViewBooking` liest den Aktionsnamen aus `Activity::$action`, wie heute. + +### 7.2 Auslöser + +Es kommen keine neuen hinzu. Die heutigen Stellen rufen weiter `CaseAutomation::advance` auf: nach Eingang, nach `ContributeCaseFacts`, Scheduler `bookings:auto-offers`, `cases:data-requests` und `bookings:expire-holds`. `triggers` in der Definition dokumentiert sie und wird vom Tester zur Ereignissimulation genutzt (`04` §4). + +--- + +## 8. Trennung von Kanaladaptern und Fachprozess (N7) + +### 8.1 Befund + +- `ChannelConnector` kennt nur `fetchOccupations` (iCal). +- Mails laufen über `ProcessPortalMail` → `PortalMailParser` → `PortalIntake::inquiryMail/cancellationMail`. +- Belegungen laufen über `SyncChannel` → `BlockedPeriod` → `PortalIntake::process(BlockedPeriod)`. +- Die fachliche Annahme (`PortalIntake::evaluate/process/adopt`: Duplikat über `caseByReference`/`caseWithSameNights`, `certainty`) ist also schon vom Transport getrennt. Sie ist aber an die **Form** `BlockedPeriod` gebunden. + +### 8.2 Vorschlag: Kanalereignisse + +```php +namespace App\Channels\Events; + +final readonly class Provenance // where an event came from and how far it can be trusted +{ + public function __construct( + public Channel $channel, + public string $transport, // 'ical' | 'email' | 'api' | 'webhook' + public string $trust, // 'announced' | 'stated_by_portal' | 'verified' (= evidence levels, 03 §5) + public ?string $externalReference, + public ?string $evidenceRef, // portal_emails.id, blocked_periods.id, raw payload id + public CarbonImmutable $receivedAt, + ) {} +} + +// One class per business event, all plain data: +IncomingBooking(Provenance, arrival, departure, guests?, guest facts[], amounts?, binding: bool) +IncomingInquiry(Provenance, arrival, departure, guests?, guest facts[], message?) +BookingCancelledByChannel(Provenance, reference, cancelledOn) +BookingChangedByChannel(Provenance, reference, new dates?, new guests?) +PaymentReported(Provenance, reference, amounts[], paidOn) // → RecordPortalAmounts +PayoutReported(Provenance, reference, amount, paidOn) // → RecordPortalAmounts / CaseMoney +OccupationsReported(Provenance, list) // → SyncChannel (today's path) +``` + +- **Ein Eingang:** `ChannelEventHandler::handle(ChannelEvent)` verteilt an die bestehenden Fachfunktionen: `PortalIntake` (umgestellt von `BlockedPeriod` auf `IncomingBooking`/`IncomingInquiry`; die Sperre im Kalender entsteht weiterhin als `BlockedPeriod` mit `source = transport`), `CancelBooking`, `ChangeBooking`-Vorschlag sowie `RecordPortalAmounts`. +- **Prüfungen bleiben im Fachprozess**, unabhängig vom Transport: Herkunft (`Provenance.channel` gehört zur Wohnung des Mandanten), Vertrauensstufe, Duplikate (Referenz, gleiche Nächte) und Verbindlichkeit (`binding` + `trust`). +- **Adapter-Fähigkeiten** als kleine Zusatzschnittstellen am Connector: `ImportsOccupations` (heute `fetchOccupations`), `DeliversEvents` (Abruf, `fetchEvents(Channel, since): list`), `ReceivesWebhooks` (Route `channels/{channel}/hook` → Adapter → Ereignisse), `PushesAvailability` (später). `ChannelRegistry` und `config/channels.php` bleiben das Register. + +**N7-Nachweis:** Ein künftiger `FewoDirektApiConnector` implementiert `DeliversEvents` und liefert `IncomingBooking` mit `transport = 'api'` und `trust = 'stated_by_portal'`. Danach laufen dieselben Schritte wie bei der Mail-Schnellspur: Duplikat zur iCal-Sperre über Referenz/Nächte, dann `TakeOverExternalBooking`, dann das gewählte Modell `a4.portal_booking`. Geändert werden müssen nur der Adapter und sein Registereintrag. **Unverändert** bleiben `PortalIntake`, `TakeOverExternalBooking`, die Modelle und der Konfigurator. diff --git a/docs/Prozessarchitektur/Architektur/03_KANALKONFIGURATOR.md b/docs/Prozessarchitektur/Architektur/03_KANALKONFIGURATOR.md new file mode 100644 index 0000000..02c6317 --- /dev/null +++ b/docs/Prozessarchitektur/Architektur/03_KANALKONFIGURATOR.md @@ -0,0 +1,173 @@ +# 03 – Kanalkonfigurator: Modellauswahl, Konfiguration entlang der Schritte, Vorschau + +Stand: 04.11.2026 · Kennzeichnung: **[Befund]**, **[Vorschlag]**, **[Entscheidung offen]** + +Dieses Dokument **ersetzt** `Vorschläge/KANALKONFIGURATOR.md` als Zielbild. Dessen Inhalte werden übernommen und auf die Fachmodul-Architektur (`02`) gestellt: + +- Die „Schablone“ wird zu Prozessmodell und Variante. +- Die Schritte sind die Module des Modells. +- Die Nachweisregel wird ein Modulparameter. +- Die Vorschau wird Teil des Prozess-Testers. + +Die offenen Punkte D1–D6 des Vorschlags sind in `06` §9 eingeordnet. + +--- + +## 1. Ausgangslage [Befund] + +- `EditChannel`/`ChannelForm` zeigen technische Kanaldaten: Import, Export, Echo, Regeln. Dazu kommt je Eingangsart eine flache Liste von `ProcessSetting`-Feldern, die in `channels.process_overrides[intake]` gespeichert werden. +- `HandlingSettings` (Vermieter) und `PropertyForm` (Wohnung) zeigen dieselben Felder auf ihrer Ebene. `EffectiveSettings` zeigt die wirksamen Werte mit Herkunft. +- Was ein Vorgang dieses Kanals **tut**, ist nirgends sichtbar. Ebenso wenig ist erkennbar, welche Einstellung welchen Schritt betrifft. Das ist die Kritik aus dem Auftrag (§1). + +--- + +## 2. Auswahl nach Kanal und Eingangsart [Vorschlag] + +### 2.1 Aufbau + +Neue Seite **Kanal › Ablauf** (`ChannelProcess`, Unterseite der `ChannelResource` wie heute `ChannelRules`). Ein Reiter je Eingangsart, die der Kanal liefert: + +- Die zulässigen Eingangsarten folgen aus dem Kanal. `booking_model`: `Inquiry` → nur Anfrage, `PortalBooking` → nur Buchung, `Mixed` → beide. Die eigene Webseite (`isWebsite()`) liefert nur Anfrage, bis die Direktbuchung freigegeben ist (D6). +- Je Reiter steht oben eine Frage: **„Wie wird eine Anfrage über FeWo-direkt abgewickelt?“** Darunter stehen die **zulässigen Modelle** als Karten, jeweils mit Kurzbeschreibung, Archetyp-Kennzeichen und den wichtigsten Folgen in einem Satz. + +| Kanal (Beispiel) | Eingangsart | wählbare Modelle (Varianten) | Vorbelegung bei Umstellung | +|---|---|---|---| +| Eigene Webseite | Anfrage | `a1.offer` (standard, loyalty), `a1.information` | aus heutigem `PreReservation` | +| FeWo-direkt (`Mixed`) | Anfrage | `a2.offer`, `a2.information` | aus `PreReservation` des Kanals | +| FeWo-direkt (`Mixed`) | Buchung | `a4.portal_booking`, `a5.portal_booking`, `a3.portal_booking` | aus `Documents`/`Payments` des Kanals | +| Destination Solutions | Buchung | `a3.portal_booking`, `a4.portal_booking` | aus `Documents`/`Payments` | + +Die Zuordnungen in der Tabelle sind Beispiele. Ob ein Modell für einen Kanal zulässig ist, legt das Modell fest (`intakes()`, `channelKinds()`). Darüber hinaus kann ein Connector die Auswahl einschränken (`ChannelConnector::allowedModels()`, optional). Beispiel: Destination Solutions zahlt nie aus, also ist dort kein A4 möglich. **[Entscheidung offen E2]** Diese Einschränkungen je Portal müssen anhand `docs/PORTALE.md` und `Szenarien/R08`/`R09` verbindlich festgelegt werden. + +### 2.2 Keine unzulässigen Kombinationen + +- Angeboten werden nur Modelle, deren `intakes()` die Eingangsart und deren `channelKinds()` die Kanalart enthält. +- Parameter, die einem Modell widersprechen, gibt es nicht. Ein Beispiel ist „Dokumente: Portal“ in `a3`: Die Verantwortungen sind im Modell festgelegt (E1). +- Speichern läuft über die Action `ConfigureChannelProcess`. Sie validiert gegen `ProcessCatalogue::validate($model, $variant, $config)`. Die Filament-Seite ändert nichts selbst; das entspricht der Projektregel, dass Geschäftsoperationen in `app/Actions` liegen. + +--- + +## 3. Konfiguration entlang des Ablaufs [Vorschlag] + +### 3.1 Schrittliste + +Nach der Modellwahl zeigt die Seite die Schritte **in der Reihenfolge des Modells**, gruppiert nach P01–P05 („Eingang und Daten“, „Angebot und Verbindlichkeit“, „Abwicklung“, „Aufenthalt“, „Abschluss“). Jeder Schritt ist eine aufklappbare Karte: + +``` +┌ 3 Fehlende Angaben beim Gast anfragen [ optional ● an ] +│ Was: Fragt fehlende Pflichtangaben per Link beim Gast an und erinnert. +│ Wann: Sobald Angaben für das Angebot fehlen – vor dem Angebot. +│ Wer: System · Ausführung: ( ) automatisch (●) nach Freigabe ( ) manuell +│ Fristen: Erinnerung nach 24 h (geerbt: Ihre Standards) · höchstens 2 Erinnerungen (hier gesetzt) +│ Braucht: E-Mail-Adresse des Gastes +│ Nachweis: Anfrage und Antworten im Verlauf (automatisch) +│ Folgen: Ist der Schritt aus, wartet das Angebot, bis Sie die Angaben selbst eintragen. +└ +``` + +| Auftrag §7.2 | Quelle in der Karte | +|---|---| +| Aufgabe | `ModuleDefinition::purpose` | +| Wann | Phase und Position im Modell sowie `triggers` als Klartext | +| verbindlich / bedingt / optional, kann entfallen | `toggle` (Pflicht = Schloss-Symbol, kein Schalter) | +| Wer führt aus | `performer`: System / Vermieter / Gast / Portal (übertragbare Schritte) | +| automatisch / nach Freigabe / manuell | `modes` des Moduls; wirkt nur, wo deklariert | +| Fristen | Parameter mit Zeitbezug (`HoldHours`, `DataRequestReminderHours`, `ArrivalInfoDaysBefore` …) | +| Daten | `needs` (Feldnamen aus `CaseRequirements::label`) | +| Nachweise | `evidence` beziehungsweise Mindest-Nachweisstufe für übertragene Schritte (§5) | +| geerbt oder gesetzt | Herkunft je Wert aus `ProcessSettings::resolve` (`ProcessProfile::sourceLabel`), plus Knopf „auf geerbten Wert zurücksetzen“ | +| Folgen für nachgelagerte Schritte | `consequences` (deklarierter Klartext je Schalterstellung) **und** die Vorschau (§6), die den Ablauf neu rechnet | + +### 3.2 Einfache Ansicht und Expertenansicht + +- **Einfach** (Standard, `AdminMode::Simple`): Modellwahl, Schalter für optionale Schritte, Ausführungsart, die wichtigsten Fristen, Vorschau. +- **Experte**: Hier sind zusätzlich zu sehen: + - alle Parameter; + - Modul- und Modellversion; + - Herkunft je Wert; + - der Vergleich mit dem Vermieterstandard; + - der Link „Wirksame Einstellungen“ (`EffectiveSettings` bleibt als Prüfsicht). +- Technische Schlüssel erscheinen nur im Experten-Tooltip, JSON nie. + +### 3.3 Ausführungsart je Schritt + +Heute gibt es nur `Processing` (global automatisch/manuell) und `DataRequest` (eigener Modus) **[Befund]**. Vorschlag: + +- Module deklarieren ihre zulässigen Arten. Beispiele: `offer.binding`: automatisch / nach Freigabe / manuell; `availability.check`: nur automatisch. +- Gespeichert wird je Modul unter `process_overrides[intake].steps[].mode`. `Processing` bleibt der Standard, wenn nichts gesetzt ist. So bleibt die Vererbung erhalten. +- Diese Lösung beantwortet die frühere Frage des Betreibers: „Datenanfrage automatisch, Rest manuell“. + +--- + +## 4. Optionale Schritte [Vorschlag] + +- Ein Schalter erscheint **nur**, wenn das Modul `Optional` deklariert. Im Startumfang sind das `guest.data_request`, `arrival.details`, `review.request` und in Variante `loyalty` die beiden Loyalty-Module. Hinzu kommt die Zahlungserinnerung als Parameter von `payments.monitor`. +- **Nie abschaltbar**, weil sie im Modell als `Mandatory` stehen und `ConfigureChannelProcess` die Prüfung verweigert: + - `availability.check` + - `channels.block` + - Pflichtangaben vor dem verbindlichen Angebot (`guest.details`) + - `offer.acceptance` + - Verbindlichkeitsprüfung externer Buchungen (`binding.portal`) + - Mail-Schranke (kein Schritt) +- Wird ein optionaler Schritt abgeschaltet, steht er im Plan als `enabled = false` mit Grund „im Kanal abgeschaltet“. Der Vorgang zeigt ihn nicht. Der Prozess-Tester führt ihn als „übersprungen (Konfiguration)“ (N5). + +--- + +## 5. Übertragene Schritte und Nachweis [Vorschlag] + +Übernahme aus dem Vorschlag §5: Für Module mit `toggle = Transferable` gilt Folgendes, wenn das Modell sie dem Portal zuweist (A4: `payments.monitor`; A5: `documents.send`, `arrival.info`): + +- Der Schritt bleibt **im Plan** mit `performer = Portal`. +- Die Mindest-Nachweisstufe ist ein Modulparameter: angekündigt / laut Portal erledigt / nachgewiesen. Vorgaben je Modell gemäß D3. +- Nachweise werden als Verlaufseintrag `CaseLog::record($booking, 'evidence', …, data: {module, level, source, ref})` geführt. Ein Beleg kann eine Portal-Mail, ein Eintrag der Vermieterin oder eine Datei sein. Das Muster entspricht `ChannelTaskProof` (Initiated/Observed/Confirmed) und `RecordPortalAmounts`. +- `Kanalereignisse` (`02` §8) liefern ihre Stufe über `Provenance.trust` und heben den Nachweis automatisch an. +- Ist die Mindeststufe nicht erreicht, bleibt der Schritt offen mit „Nachweis fehlt“ und erscheint beim kaufmännischen Abschluss (`case.settlement`). Ein begründeter Abschluss bleibt möglich. + +--- + +## 6. Vererbung und Wirkung auf laufende Vorgänge [Vorschlag] + +- Die Hierarchie bleibt **Vermieterstandard → Wohnung → Kanal × Eingangsart → Vorgang**. Die bestehende `ProcessSettings::resolve` wird um zwei Schlüssel ergänzt: + - `model` und `variant`: nur auf Kanalebene, mit Vorgabe aus dem Vermieterstandard je Eingangsart; + - `steps..{on, mode, params}`: auf allen Ebenen. +- Leer bedeutet geerbt; ein gesetzter Wert bleibt ein Wert. Auch `false`, `0` und „entfällt“ sind Werte, wie es `ProcessSetting::normalize` heute schon handhabt. +- Die Speicherung erfolgt in den **bestehenden JSON-Spalten**: `tenants.process_defaults`, `properties.process_overrides`, `channels.process_overrides`. Es gibt keine neue Tabelle und keine zweite Konfigurationsdatenbank. +- Laufende Vorgänge sind geschützt: Der Plan wird beim Eingang eingefroren (`CaseRecorder::freeze` → `profile.plan`). Eine Kanaländerung wirkt nur auf neue Vorgänge. + - Beim Speichern zeigt die Seite „Gilt für neue Vorgänge. 4 laufende Vorgänge behalten ihren bisherigen Ablauf.“ + - Eine bewusste Übernahme in einen laufenden Vorgang wird **nicht** angeboten. **[Entscheidung offen E3]** Empfehlung: Sie wird nicht angeboten, weil sonst Angebote und Verträge mit abweichenden Regeln entstehen. +- Jede Speicherung schreibt `configured_at` und einen Eintrag im Aktivitätsprotokoll des Kanals (`ConfigureChannelProcess`). Im eingefrorenen Plan eines Vorgangs ist damit nachvollziehbar, welcher Konfigurationsstand galt. + +--- + +## 7. Vorschau und Übergang zum Prozess-Tester [Vorschlag] + +- **Vorschau** (immer sichtbar, rechte Spalte): der Ablauf eines typischen Vorgangs mit den aktuellen, noch nicht gespeicherten Einstellungen. + - Technisch ist das `ProcessRunner::plan(...)` ohne Fall, also rein aus Definition und Konfiguration. + - Die Liste zeigt je Schritt: aktiv / übersprungen mit Grund; wer, wann, Ausführungsart. + - Es wird nichts geschrieben und nichts ausgeführt. +- **„Ablauf testen“** (Knopf unter der Vorschau) öffnet den Prozess-Tester (`04`) mit derselben, auch ungespeicherten Konfiguration. Dort wird ein synthetischer Vorgang mit den echten Modulen durchgespielt. +- Widersprüche werden sofort angezeigt. Beispiel: Ein Kanal liefert laut Import nur Buchungen, aber nur der Reiter „Anfrage“ ist konfiguriert. Die bekannte Lücke aus `KONFIGURATION_UND_WIRKSAMKEIT.md` §7 wird so geschlossen. + +--- + +## 8. Berechtigungen und Navigation [Vorschlag] + +- Es gilt die bestehende Policy der `ChannelResource`; ändern dürfen Administratoren des Mandanten (D5). Die Seite nutzt `FollowsAdminMode`. +- `HandlingSettings` („So arbeite ich“) nutzt **dieselbe** Schrittansicht ohne Kanalbezug, nämlich als Vermieterstandard je Eingangsart. +- `PropertyForm` zeigt nur die Abweichungen der Wohnung (Expertenansicht). +- Die heutige flache Feldliste am Kanal entfällt als Hauptansicht. + +--- + +## 9. Abnahmekriterien Konfigurator + +| # | Kriterium (prüfbar auf stommer.info) | +|---|---| +| K01 | Je Kanal und Eingangsart ist genau ein Modell wählbar, und zwar nur ein zulässiges. Ein danach eingehender Vorgang erhält Modell, Variante und den erwarteten Archetyp. | +| K02 | Jeder Schritt zeigt Aufgabe, Zeitpunkt, Ausführende, Ausführungsart, Fristen, Daten, Nachweis, Herkunft der Werte und Folgen. Pflichtschritte haben keinen Schalter. | +| K03 | Die Vorschau entspricht der Ablaufliste eines danach eingehenden echten Vorgangs. Das wird automatisch geprüft durch den Vergleich `ProcessRunner::plan` gegen `CaseActivities::for` eines frisch angelegten Falls. | +| K04 | Ein übertragener Schritt ohne Mindestnachweis bleibt offen und erscheint beim kaufmännischen Abschluss. | +| K05 | Eine Konfigurationsänderung verändert keinen laufenden Vorgang. Das zeigen der Plan in `bookings.profile` vorher und nachher sowie ein Test. | +| K06 | `EffectiveSettings` und Konfigurator zeigen dieselben Werte und dieselbe Herkunft. | +| K07 | Pflichtangaben, Verfügbarkeit, Verbindlichkeit externer Buchungen und Mail-Schranke lassen sich durch keine Konfiguration umgehen. Die v0.11-Regressionstests bleiben grün, ergänzt um einen Test, der jede `Mandatory`-Abschaltung abweist. | +| K08 | Die Einrichtung eines Kanals in der einfachen Ansicht kommt ohne technische Schlüssel aus. Geprüft wird das durch Bedienung mit dem Betreiber in der Abnahme. | diff --git a/docs/Prozessarchitektur/Architektur/04_PROZESS_TESTER.md b/docs/Prozessarchitektur/Architektur/04_PROZESS_TESTER.md new file mode 100644 index 0000000..9b2bf7c --- /dev/null +++ b/docs/Prozessarchitektur/Architektur/04_PROZESS_TESTER.md @@ -0,0 +1,206 @@ +# 04 – Prozess-Tester „Ablauf testen“: gleiche Logik, technische Isolation, Ereignissimulation, Bericht + +Stand: 04.11.2026 · Kennzeichnung: **[Befund]**, **[Vorschlag]**, **[Entscheidung offen]** + +--- + +## 1. Zweck und Grenzen [Vorschlag] + +Der Vermieter spielt mit der gerade bearbeiteten Kanalkonfiguration einen **synthetischen Vorgang** durch. Die Konfiguration darf auch ungespeichert sein. Er sieht Schritt für Schritt: + +- welche Module liefen und mit welchem Ergebnis; +- welche übersprungen wurden und warum; +- was als Nächstes kommt; +- welche Aufgaben offen sind; +- welche Wirkungen **simuliert** wurden: Mails, Sperren, Dokumente, Zahlungen. + +Der Tester ist Teil des Kanalkonfigurators (`03` §7) und gemeinsames Abnahmekriterium. + +Nicht Ziel: Lasttests, Prüfung des echten Portals oder der echten KI-Anbindung. Für die Verbindungsprüfung gibt es die Prüfknöpfe in `AiConnection::check` und `Operations::checkMailbox`. + +--- + +## 2. Dieselbe fachliche Logik [Vorschlag] + +### 2.1 Prinzip + +Der Tester enthält **keine** Fachregeln. Er ist ein Treiber, der drei Dinge tut: + +1. Er legt den Ausgangszustand in einem isolierten Datenspeicher an (§3). +2. Er löst Ereignisse über **dieselben Einstiegspunkte** aus, die im Betrieb Controller, Kommandos und Connectors verwenden. +3. Er liest nach jedem Ereignis den Ablauf über `ProcessRunner::activities` aus, also dieselbe Methode, die `ViewBooking` nutzt. + +| Szenario-Ereignis | Einstiegspunkt im Betrieb (unverändert) | +|---|---| +| Gast sendet Anfrage über die Webseite | `CreateReservation::handle` (wie das Livewire-Buchungsformular) | +| Anfrage per Portal-Mail | `ProcessPortalMail::handle(PortalMail)` mit synthetischer `PortalMail` | +| Portalbuchung über iCal | `SyncChannel::handle` mit `ScriptedConnector` (liefert `ExternalPeriod`s) | +| Portalbuchung über künftige API | `ChannelEventHandler::handle(IncomingBooking)` (`02` §8) | +| Gast ergänzt Angaben per Formular | dieselbe Action wie `GuestDataController` (`ContributeCaseFacts` mit `FactSource::GuestLink`) | +| Gast antwortet per E-Mail | `ReceiveInboundMessage::handle(PortalMail)` → `MessageMatcher` → `ExtractMessageFacts` mit Skript-Antwort der KI | +| Vermieter gibt frei / sendet | Modul-`run` bzw. dieselbe Action wie die Kopfaktion in `ViewBooking` | +| Gast nimmt an / lehnt ab | `AcceptOffer::handle` / `RejectOffer::handle` | +| Zeit vergeht (Frist, Erinnerung, Anreise) | simulierte Uhr (§4) + dieselben Scheduler-Handler: `ExpireReservations::handle`, `SendPendingAutoOffers`, `cases:data-requests`, `SendBookingReminders::handle`, `PrepareStays::handle`, `RequestReviews::handle` | +| Portal meldet Zahlung/Auszahlung | `RecordPortalAmounts::handle` (bzw. `PaymentReported` über den Ereigniseingang) | +| Kommunikation oder Schnittstelle fällt aus | Effekt-Port wirft den echten Fehlertyp: `TransportException`, `AccessRejected`, `ChannelSyncException` | + +### 2.2 Nachweis der Gleichheit + +- Jedes mitgelieferte Szenario (§5) existiert zusätzlich als PHPUnit-Test (`ProcessTesterParityTest`). Der Test führt dasselbe Szenario **ohne** Tester auf der normalen Testdatenbank aus, über dieselben Actions, und vergleicht Ablauf, Status und Effektliste mit dem Testerbericht. Weichen sie ab, schlägt der Test fehl. +- Außerdem wird die Vorschau im Konfigurator (`ProcessRunner::plan`) gegen die Ablaufliste eines danach eingehenden echten Vorgangs geprüft (K03). +- Ein Architekturtest stellt sicher, dass Tester-Klassen keine Fachklassen ersetzen. Unter `app/Process/Tester` dürfen keine Klassen liegen, die `ProcessModule` implementieren oder `PriceCalculator`, `AvailabilityChecker` oder Actions ableiten. + +--- + +## 3. Technische Isolation [Vorschlag] + +### 3.1 Warum nicht Rollback oder `dryRun` + +Ein Transaktions-Rollback schützt nur die Datenbank, und selbst die nur unvollständig. Es bleiben: + +- Mails: Sie gehen beim Senden raus, nicht beim Commit. +- HTTP-Aufrufe an KI und iCal. +- Dateien: Vertrags-PDFs über `RentalContract` auf `Storage::disk`. +- Warteschlangen-Einträge. +- Sitzungs- und Cache-Schreibvorgänge: `SESSION_DRIVER=database` und `CACHE_STORE=database` laufen auf derselben Verbindung. +- Sperren: `lockForUpdate` an 28 Stellen hält echte Vorgänge auf. +- Ein versehentlicher Commit durch verschachtelte `DB::transaction` mit Fehlerbehandlung. + +Ein `dryRun`-Schalter müsste an jeder Effektstelle beachtet werden und versagt beim ersten vergessenen Aufruf. + +Der Tester verwendet daher **mehrere unabhängige Schutzschichten**. Jede einzelne verhindert schon für sich operativen Schaden. + +### 3.2 Schicht 1: getrennter synthetischer Datenspeicher + +- Eigene Verbindung `sandbox` (`config/database.php`): **SQLite-Datei je Testlauf** unter `storage/app/sandbox/.sqlite`, nach dem Lauf gelöscht. Das passt zur Strato-Dateiquote, siehe `BETRIEB.md`. +- **[Befund]** Die gesamte Testsuite (683 Feature-Tests) läuft auf SQLite (`phpunit.xml`). Die Fachlogik ist also auf SQLite lauffähig und geprüft. +- **Vorlage:** Beim Deployment erzeugt `php artisan process:sandbox-template` eine migrierte, leere SQLite-Vorlage im Release. Jeder Lauf kopiert sie. Es gibt keine Migration zur Laufzeit; das dauert unter 100 ms. +- **Befüllung:** Der `SandboxSeeder` liest vor Aktivierung der Schutzschichten **lesend** aus der echten Datenbank und schreibt nur in die Sandbox-Verbindung. Übernommen werden: + - der aktuelle Mandant (Einstellungen, Texte, Bankangaben laut `TenantConfig`); + - die gewählte Wohnung mit Saisons, Sonderangeboten, Extras, Vertragsvorlagen und den Kanälen dieser Wohnung; + - der zu testende Kanal mit der **Entwurfskonfiguration** aus dem Konfigurator; + - optional die Belegung als anonymisierte Sperrzeiten, damit die Verfügbarkeit realistisch ist. + - **Keine** Gäste, keine Buchungen, keine Nachrichten, keine Zugangsdaten. KI-Schlüssel und Postfach-Passwörter werden nicht kopiert. +- Während des Laufs ist `sandbox` die **Standardverbindung**: `config(['database.default' => 'sandbox'])`, `DB::purge`, `DB::setDefaultConnection`. Kein Modell setzt eine eigene `$connection` **[Befund: keine Fundstelle in `app/`]**. Damit landen alle Eloquent- und Query-Builder-Zugriffe in der Sandbox. + +### 3.3 Schicht 2: Schreibwächter auf der echten Verbindung + +- Vor dem Lauf registriert `ProcessSandbox` auf der echten Verbindung (Standardverbindung des Servers, MariaDB) einen `beforeExecuting`-Rückruf. Er bricht **jede** Anweisung mit `SandboxViolation` ab, auch Lesezugriffe, solange der Lauf aktiv ist. Ein Zugriff auf die echte Datenbank ist im Lauf ein Fehler, keine Kleinigkeit. +- Der Wächter wird erst nach dem Lauf entfernt, im `finally`, und erst dann wird die Standardverbindung zurückgesetzt. Sitzung und Cache der Admin-Anfrage schreiben erst nach Ende der Anfrage, also nach dem Lauf. Das deckt der Sicherheitstest in §7 ab. + +### 3.4 Schicht 3: Effekt-Ports auf Simulation + +Jeder Weg nach außen wird für die Dauer des Laufs auf eine aufzeichnende Simulation umgestellt. Die Aufzeichnung (`EffectLedger`) ist zugleich der Bericht der „simulierten Seiteneffekte“. + +| Effekt | Betrieb [Befund] | im Tester | +|---|---|---| +| E-Mail | Laravel-Mailer → `EnforceMailTestMode` → SMTP | Mailer `array` (Framework-Transport, keine Zustellung). Ein Listener auf `MessageSending` zeichnet Empfänger, Betreff und gerenderten Text auf. `EnforceMailTestMode` bleibt zusätzlich aktiv, mit Sandbox-Mandant im Testbetrieb und Testadresse `tester@invalid`. | +| HTTP (KI, iCal-Abruf) | `Http`-Client (`LlmClient`, `ICalConnector`) | `Http::preventStrayRequests()` + `Http::fake` mit Szenario-Antworten. Jeder nicht vorgesehene Aufruf bricht den Lauf ab. | +| IMAP | `MailboxReader` (Webklex) | Container-Bindung auf `SandboxMailboxReader`, das bei Aufruf `SandboxViolation` wirft. Eingehende Mails werden als `PortalMail` direkt eingespielt (§2.1). | +| Connectors | `ChannelRegistry` (`config/channels.php`) | Registry-Bindung auf `ScriptedConnector`/Ereignisquelle des Szenarios | +| Dateien | `Storage::disk('local'/'public')` | `Storage::fake` je Disk auf `storage/app/sandbox//…`. PDFs werden erzeugt und verworfen; die Größe wird im Bericht genannt. | +| Warteschlange | `QUEUE_CONNECTION=database` | Verbindung `sync`, jobs laufen im Lauf, also ebenfalls in der Sandbox | +| Cache, Rate-Limiter | `CACHE_STORE=database` | Store `array` | +| Kanal-Export (iCal-Feed) | `ICalFeed` | wird nicht ausgeliefert. Der Tester berechnet den Feed der Sandbox vorher/nachher und zeigt „würde im Export von FeWo-direkt erscheinen“. | +| Zahlungen | – (keine Zahlungsintegration) [Befund] | nur Datensätze in der Sandbox | +| Zeit | `now()` | simulierte Uhr (§4) | + +### 3.5 Schicht 4: Ausführungsrahmen + +- Es gibt genau **einen** Einstieg: `ProcessSandbox::run(Scenario, ConfigDraft): TestReport`. + - Er aktiviert die Schichten 1 bis 3 in fester Reihenfolge, prüft sie und führt erst dann aus. + - Schlägt eine Prüfung fehl, bricht er vor dem ersten Ereignis ab. Beispiel: Die Standardverbindung ist nicht `sandbox`, oder der Mailer ist nicht `array`. +- Eine Sperre pro Mandant (`Cache::lock` auf dem echten Store, **vor** Aktivierung) verhindert parallele Läufe derselben Person. Eine Laufzeitgrenze (z. B. 20 s) und eine Ereignisgrenze (z. B. 60) verhindern Endlosschleifen. +- Der Lauf findet **innerhalb der Admin-Anfrage** statt, ohne Hintergrundprozess. Strato startet keine Arbeiterprozesse dauerhaft. Der Scheduler über n8n bleibt unberührt; seine Läufe sehen die Sandbox nie, weil sie in einem anderen PHP-Prozess mit der echten Standardverbindung laufen. +- Den Bericht speichert erst **nach** dem Lauf der Tester selbst, in der echten Datenbank (§6). Kein Modul kann das beeinflussen. + +### 3.6 Ausweichlösung [Entscheidung offen E4] + +Falls `pdo_sqlite` auf Strato nicht verfügbar ist (Voraussetzung V1, mit `php -m` zu prüfen), wird statt der SQLite-Datei eine **eigene MariaDB-Datenbank** des Strato-Tarifs als Sandbox genutzt. Sie wird je Lauf geleert, mit Vorlage per `schema:dump`. Alle anderen Schichten bleiben gleich. Das ist eine Datenhaltung für synthetische Testfälle, **keine** zweite Konfigurationsdatenbank. + +### 3.7 Grenzen der Gleichheit + +SQLite und MariaDB unterscheiden sich in wenigen Punkten: Datumsfunktionen in rohem SQL (28 `DB::raw`/`whereRaw`/`selectRaw`-Fundstellen), Sortierung und Sperrsemantik. Die Fachlogik ist auf SQLite getestet. Die Stellen mit rohem SQL werden in Paket U-D einmal gesichtet und notfalls datenbankneutral gefasst. Die Testsuite deckt beides bereits ab. + +--- + +## 4. Ereignis- und Zeitsimulation [Vorschlag] + +- **Simulierte Uhr:** `Date::setTestNow()` (Carbon), gesetzt durch den Treiber und im `finally` zurückgesetzt. Startzeit ist „jetzt“ oder vom Szenario vorgegeben, etwa „Anfrage am Freitag 18 Uhr“ für Klärungsfristen am Wochenende. +- **Zeitsprung** (`advance(hours: 25)`) führt die zeitgesteuerten Handler in der Reihenfolge von `routes/console.php` aus. Ausgeführt werden nur die für Vorgänge relevanten (§2.1), nicht `channels:sync` oder `channels:fetch-mail`. +- **Ereignisse** sind kleine Treiberklassen, eine je Zeile in §2.1. Szenarien sind Listen solcher Ereignisse mit Daten. Der Vermieter wählt vorbereitete Szenarien und kann einige Daten ändern: Zeitraum, Personen, fehlende Felder, „Gast ist Stammgast“, „KI nicht erreichbar“. Eigene Ablauflogik kann er nicht schreiben. +- **Interaktiv:** Ereignisse sind schrittweise auslösbar („Weiter: Gast antwortet per Mail“). Jeder Schritt startet einen neuen Lauf aus Ausgangszustand und Ereignisliste bis zu diesem Punkt; die Läufe sind deterministisch. So wird nichts zwischen Anfragen im Speicher gehalten, was auf Shared Hosting ohnehin nicht trägt. + +--- + +## 5. Szenarienkatalog (Startumfang) + +| # | Szenario | Prüft | +|---|---|---| +| S01 | Vollständige Anfrage (A1/A2) | Klärungsreservierung, Angebot, Annahme, Bestätigung | +| S02 | Fehlende Gastdaten | `guest.data_request`, Warten des Angebots, Erinnerung nach Fristsprung | +| S03 | Gast antwortet über Formular | Fakten mit Quelle `GuestLink`, Angebot wird frei | +| S04 | Gast antwortet per E-Mail | Zuordnung, Skript-KI liefert Anschrift, Übernahme bzw. Vorschlag | +| S05 | Frist läuft ab | `ExpireReservations`, Status, Kalender wieder frei | +| S06 | Angebot wird angenommen | `AcceptOffer` → `ConfirmBooking`, Sperraufgaben für Kanäle | +| S07 | Portalbuchung wird übernommen (A3/A4/A5) | Duplikaterkennung iCal + Mail, `binding.portal` | +| S08 | Portal übernimmt Zahlung und Dokumente (A4/A5) | übertragene Schritte, Nachweisstufe, Abschlussprüfung | +| S09 | Loyalty-Status wird festgestellt | `guest.loyalty_status` mit synthetischen Vorgängen in der Sandbox | +| S10 | Rabatt wird angewendet | `Discount`-Zeile im Angebot, Grundlage im Verlauf | +| S11 | Optionaler Schritt deaktiviert | „übersprungen (Konfiguration)“, Ablauf bleibt gültig | +| S12 | Kommunikation oder Schnittstelle fällt aus | Mail-Port wirft `TransportException`, KI liefert 401 → `AccessRejected`, iCal-Abruf liefert Fehler. Danach definierte Zustände: Aufgabe, Postfach-Hinweis, kein Absturz. | + +--- + +## 6. Testbericht [Vorschlag] + +Inhalt nach Auftrag §8: + +1. **Kopf:** + - Prozessmodell und Version, Variante, Modulversionen; + - Kanal und Eingangsart; + - Release (`deploy//`): Die Release-Kennung legt `scripts/deploy.sh` als Datei im Release ab, neu in U-D. Heute gibt es dafür keine Anzeige in der Anwendung. + - Startzeit (simuliert), Szenario und Eingaben. +2. **Wirksame Konfiguration:** jeder Wert mit Herkunft (Vermieter, Wohnung, Kanal, Entwurf). „Entwurf“ markiert ungespeicherte Änderungen. +3. **Zeitleiste:** je Ereignis + - ausgeführte Module mit Ergebnis (`StepResult`: erledigt / wartet / Problem + Klartext); + - übersprungene Module mit Grund (`applies = false`, abgeschaltet, nicht zuständig); + - fachliche Prüfungen (`blockers`) mit Ergebnis; + - Statuswechsel; + - entstandene Aufgaben. +4. **Simulierte Seiteneffekte** aus dem `EffectLedger`: Mails mit Vorschau, Kalenderhalt, Sperraufgaben je Kanal, Dokumente, KI-Aufrufe (nur „simuliert, Antwort laut Szenario“), Exportänderungen. +5. **Ergebnis:** Endzustand, offene Punkte, nächster Schritt (`CaseActivities::next`-Äquivalent) und Hinweise. Beispiel: „Ohne E-Mail-Adresse kann das Angebot nicht automatisch gehen.“ + +**Speicherung:** neue Tabelle `process_test_runs` (Mandant, Kanal, Benutzer, Szenario, Konfigurationsschnappschuss, Modellversionen, Release, Bericht als JSON, Ergebnis). Die Löschfrist richtet sich nach der Mandanteneinstellung für Protokolle, Vorgabe 90 Tage. + +**Reproduzierbarkeit:** +- „Erneut ausführen“ startet mit dem gespeicherten Schnappschuss. +- Ist das Release neuer, zeigt der Bericht die Unterschiede zum vorigen Lauf. Das dient auch als Regressionshinweis nach Updates. +- Die Wohnungsdaten des Schnappschusses (Preise, Saisons) werden mit gespeichert. So ist ein Lauf auch nach Preisänderungen gleich wiederholbar. + +--- + +## 7. Sicherheitstests (Pflicht, Teil der Suite) + +| Test | Prüft | +|---|---| +| `ProcessSandboxIsolationTest` | Für jedes Szenario S01–S12 vergleicht der Test die Zeilenzahlen und Prüfsummen aller Tabellen der echten Verbindung vor und nach dem Lauf; sie sind identisch. Ausnahme ist `process_test_runs` (+1). | +| `ProcessSandboxViolationTest` | Ein Testmodul greift absichtlich auf die echte Verbindung zu und startet echte HTTP- bzw. IMAP-Aufrufe. Erwartet werden `SandboxViolation`, abgebrochener Lauf, Bericht „Lauf abgebrochen“ und keine Änderung. | +| `ProcessSandboxMailTest` | Kein Aufruf des echten Transports. Geprüft wird das mit einem Spionage-Transport auf dem Standard-Mailer. `MailTestModeGateTest` bleibt grün. | +| `ProcessSandboxRestoreTest` | Nach dem Lauf, auch nach einer Ausnahme, sind Standardverbindung, Mailer, Disks, Queue, Cache, Uhr und Bindungen wiederhergestellt. Eine anschließende normale Aktion schreibt wieder in die echte Datenbank. | +| `ProcessSandboxTenantTest` | Der Lauf sieht nur Daten des eigenen Mandanten. Ein zweiter Mandant bleibt unberührt (`TenantIsolationTest`-Muster). | +| `ProcessTesterParityTest` | Gleichheit Tester ↔ echter Ablauf (§2.2) | +| `ModuleContractTest` | Jedes Modul erzeugt im Sandkasten nur die Effekte, die es deklariert hat (`02` §3.2) | + +--- + +## 8. Abnahmekriterien Tester (N6) + +| # | Kriterium (auf stommer.info) | +|---|---| +| T01 | Aus dem Kanalkonfigurator lässt sich mit der aktuellen, auch ungespeicherten Konfiguration jedes Szenario S01–S12 starten und schrittweise weiterführen. | +| T02 | Der Bericht enthält Modell und Version, Kanal und Eingangsart, wirksame Konfiguration, ausgeführte und übersprungene Module mit Gründen, Prüfungen, simulierte Effekte, Ergebnis und offene Punkte, in verständlicher Sprache. | +| T03 | Nach einer Testreihe sind in der echten Datenbank keine Buchungen, Gäste, Aufgaben, Kanalaufgaben, Sperren oder Nachrichten hinzugekommen oder verändert; einzige Ausnahme sind die Testberichte. Geprüft wird das per Zählabfrage vorher/nachher im Abnahmeprotokoll. | +| T04 | Im Testpostfach und beim Mail-Anbieter ist keine Mail aus Testläufen angekommen. Der Export-Feed der Kanäle ist byte-gleich vor und nach der Testreihe. | +| T05 | Ein Lauf mit gleichem Schnappschuss liefert denselben Bericht. | +| T06 | Ein Ausfall von Mail, KI oder iCal im Szenario führt zu dem definierten Zustand, den auch der echte Vorgang zeigt. Das wird durch S12 und den Paritätstest belegt. | diff --git a/docs/Prozessarchitektur/Architektur/05_AENDERUNGSANALYSE_UND_TESTS.md b/docs/Prozessarchitektur/Architektur/05_AENDERUNGSANALYSE_UND_TESTS.md new file mode 100644 index 0000000..38ee41b --- /dev/null +++ b/docs/Prozessarchitektur/Architektur/05_AENDERUNGSANALYSE_UND_TESTS.md @@ -0,0 +1,119 @@ +# 05 – Änderungsanalyse und Teststrategie + +Stand: 04.11.2026 · Kennzeichnung: **[Befund]**, **[Vorschlag]**, **[Entscheidung offen]** + +--- + +## 1. Ausgangslage [Befund] + +- Es gibt 683 Feature-Testmethoden, gruppiert nach Fachthema, etwa `OfferWorkflowTest`, `PortalBookingTest`, `CaseCoreTest`, `GuidedCaseHandlingTest`, `ClarificationHoldTest`, `DataRequestTest`, `EndToEndAcceptanceTest` (15 Ende-zu-Ende-Fälle) und `TenantIsolationTest`. +- Eine Zuordnung „welcher Test sichert welchen Schritt eines welchen Ablaufs“ gibt es nicht. Wer heute einen Schritt ändert, sucht die Fundstellen per Volltextsuche; vgl. die Streuung in `01` §2.2. + +--- + +## 2. Abhängigkeitsmodell [Vorschlag] + +### 2.1 Die Quelle ist der Code + +Alle Angaben stehen bereits in den Definitionen aus `02`. Sie werden **nicht** zusätzlich gepflegt: + +| Frage (Auftrag §9) | Quelle | +|---|---| +| 1. In welchen Modellen wird ein Modul verwendet? | `ProcessModel::steps()` und `variants()` aller registrierten Modelle | +| 2. An welchen Erweiterungspunkten? | `Step::point` / `Variant::insert` | +| 3. Wer braucht seine Ergebnisse? | `produces` des Moduls ∩ `needs`/`requires` anderer Module | +| 4. Welche Konfiguration beeinflusst es? | `parameters` + `toggle` + `modes`, dazu Kanäle/Wohnungen, die diese Modelle gewählt haben (Abfrage auf `channels.process_overrides`) | +| 5. Welche Tests decken es ab? | PHPUnit-Gruppen `#[Group('module:')]` und `#[Group('model:')]`. Das ist ein vorhandenes PHPUnit-Merkmal, keine neue Abhängigkeit. | +| 6. Auswirkung auf andere Archetypen? | `caseTypes()` der Modelle, die das Modul enthalten. Dazu kommen die genutzten Querschnittsdienste (`uses`), z. B. `pricing`. | + +### 2.2 Werkzeuge + +- **`php artisan process:impact `** liest die Definitionen und gibt aus: + - Modelle und Varianten mit Archetyp; + - Erweiterungspunkte; + - abhängige Module; + - Parameter; + - die Zahl der Kanäle je Mandant mit diesem Modell (nur Zahl, keine Daten); + - die Testgruppen samt fertigem Aufruf `php artisan test --group=module:`. +- **`php artisan process:check`** prüft den Katalog: + - Jedes Modul ist registriert und hat eine vollständige Definition. + - Pflichtmodule sind nicht abschaltbar. + - Erweiterungspunkte sind zulässig. + - `requires` ist in jeder Modellreihenfolge erfüllt. + - Jedes Modul und jedes Modell hat mindestens eine Testgruppe. + - Alte Versionen ohne offene Vorgänge werden gemeldet. + - Der Befehl läuft in der CI vor den Tests. +- **Modulmatrix** `docs/Prozessarchitektur/Architektur/MODULMATRIX.md`: Sie wird von `process:check --matrix` erzeugt und in der CI auf Aktualität geprüft. Sie ist die lesbare Übersicht Modell × Modul × Parameter × Testgruppe. + +### 2.3 Beispiel `pricing.loyalty_discount` + +``` +$ php artisan process:impact pricing.loyalty_discount +Modul pricing.loyalty_discount v1 (Preis und Angebot, optional) +Modelle a1.offer:loyalty (A1) +Punkt BeforePriceFixing +Benötigt guest.loyalty_status (Ergebnis loyalty_status) +Benötigt von – (Ergebnis: Preiszeile; gelesen von offer.binding über CasePricing) +Dienste pricing (CasePricing → PriceCalculator unverändert) +Parameter loyalty_discount_percent, loyalty_discount_max, loyalty_combinable +Kanäle 1 Kanal (Mandant 1) +Archetypen nur A1 betroffen; A2–A6 enthalten das Modul nicht +Tests --group=module:pricing.loyalty_discount (LoyaltyDiscountTest, ProcessTesterParityTest S10) + --group=service:pricing (PriceCalculatorTest, SpecialOfferPricingTest, OfferWorkflowTest …) +``` + +--- + +## 3. Testebenen [Vorschlag] + +| Ebene | Inhalt | Gruppe | Wann | +|---|---|---|---| +| **Modultest** | Ein Modul isoliert: `applies`/`activity`/`blockers`/`run` für seine Zustände, Fehlerfälle, Idempotenz | `module:` | bei jeder Änderung des Moduls | +| **Vertragstest** (generisch) | `ModuleContractTest` mit Datenquelle „alle registrierten Module“: Definition vollständig, Lesemethoden ohne Schreibzugriff, nur deklarierte Effekte (im Sandkasten gemessen), zweiter `run` wirkungslos | `contract` | immer (schnell) | +| **Modelltest** | Je Modell/Variante: Schrittfolge, zulässige Kombinationen, Abschaltung optionaler Schritte (N5), Plan einfrieren und lesen | `model:` | bei Änderung des Modells oder seiner Module | +| **Szenario-/Paritätstest** | S01–S12 als Ende-zu-Ende über Actions, gleich mit Tester-Bericht (`04` §2.2) | `scenario` | immer | +| **Sicherheitstests Tester** | `04` §7 | `sandbox` | immer | +| **Übergreifende Regression** | bestehende Suite, unverändert; siehe §5 | – | immer, vollständig vor jedem Deployment | + +Gezielte Läufe beschleunigen die Entwicklung, ersetzen aber **nicht** den vollständigen Lauf vor dem Deployment. Die Modularität verringert die Unsicherheit, sie ersetzt keine Sicherheitsprüfung (Auftrag §9). + +--- + +## 4. Absicherung des Umbaus: Golden Master [Vorschlag] + +Der Umbau von `CaseActivities`/`CaseAutomation` auf `ProcessRunner` (`06`, U-A) ist die riskanteste Änderung. Absicherung: + +1. **Vor dem Umbau** wird die heutige Ausgabe festgehalten: + - Gesammelt werden `CaseActivities::for`, `next` und `situation` sowie das Ergebnis von `CaseAutomation::advance`. + - Grundlage ist eine **Fallmatrix**: A1–A6 × Status × Verbindlichkeit × Verantwortungen × Datenlage × Vorgangsende. Das sind etwa 150 Konstellationen, erzeugt über die vorhandenen Factories. + - Die Ausgabe wird als Fixture-Datei unter `tests/Fixtures/process/golden.json` gespeichert. +2. **Nach dem Umbau** prüft `ProcessRunnerGoldenMasterTest`, dass der neue Runner für jede Konstellation ein **identisches** Ergebnis liefert. Verglichen werden Schlüssel, Titel, Zustand, Detail und Aktion. +3. Abweichungen sind nur zulässig, wenn sie in der Fixture-Datei begründet sind (Feld `intended`). Ein Beispiel: `ActivityDetails::EVENT_TYPES` wird ins Modul übernommen. Jede begründete Abweichung wird im Umsetzungsbericht aufgeführt. +4. Die bestehenden Tests (`CaseCoreTest`, `GuidedCaseHandlingTest`, `AutoOfferTest` …) laufen unverändert weiter. + +--- + +## 5. Übergreifende Regressionen (bleiben Pflicht) + +| Bereich | bestehende Tests [Befund] | Ergänzung [Vorschlag] | +|---|---|---| +| Verbindlichkeit | `PortalBookingTest`, `BookingAcceptanceTest`, `OfferWorkflowTest` | kein Modell oder Parameter umgeht `offer.acceptance`/`binding.portal` (K07) | +| Preise | `PriceCalculatorTest`, `SpecialOfferPricingTest`, `MinimumStayRulesTest` | `CasePricing` ohne Beiträge = `PriceCalculator` (Gleichheitstest); keine Beiträge für verbindliche Fälle | +| Mandantentrennung | `TenantIsolationTest`, `TenantSeparationTest` | Konfigurator und Tester je Mandant | +| Reservierungen/Halte | `ReservationWorkflowTest`, `ClarificationHoldTest` | – | +| Externe Portale | `ChannelSyncTest`, `PortalMailTest`, `GenericChannelIntegrationTest` | Kanalereignisse: gleiche Entscheidung für iCal-, Mail- und API-Ereignis desselben Inhalts | +| Mail-Schranke | `MailTestModeGateTest` | Tester-Mailer wird mit geprüft | + +--- + +## 6. Konkrete Nachweisfälle N1–N7 + +| # | Betroffene Komponenten | Schnittstellen | Änderungen | Abnahmekriterien | +|---|---|---|---|---| +| **N1** A1-Bestand: Anfrage → Klärungsreservierung → Datenbeschaffung → Angebot → Annahme | Modell `a1.offer`; Module `intake.record`, `guest.details`, `guest.data_request`, `hold`, `availability.check`, `offer.binding`, `offer.acceptance` | `ProcessModule`, `ProcessRunner`, bestehende Actions `CreateReservation`, `RequestHold`, `RequestCaseData`, `SendOffer`, `AcceptOffer`, `ConfirmBooking` | Schritte aus `CaseActivities` in Module überführt; **keine** Änderung der Actions | Golden Master identisch; `EndToEndAcceptanceTest` grün; Szenarien S01–S03, S05, S06 im Tester mit gleichem Ergebnis wie auf stommer.info von Hand | +| **N2** A4-Bestand: Portalbuchung → Gastdatenanreicherung → Dokumente → Portalzahlung → Auszahlungskontrolle | Modell `a4.portal_booking`; Module `binding.portal`, `guest.details`, `documents.send`, `payments.monitor` (performer Portal), `portal.payout` | wie N1 + `PortalIntake`, `TakeOverExternalBooking`, `RecordPortalAmounts`, `CaseMoney` | wie N1; Nachweisstufe je übertragenem Schritt neu (Verlaufseintrag `evidence`) | Golden Master identisch; S07/S08; fehlender Auszahlungsnachweis erscheint beim kaufmännischen Abschluss (K04) | +| **N3** A1 mit Loyalty | `a1.offer:loyalty`; neue Module `guest.loyalty_status`, `pricing.loyalty_discount`; Dienst `CasePricing` | `ContributesToPrice`, `PriceContribution`, `QuoteLineType::Discount` | siehe `02` §6.2; A2–A6 unverändert | `process:impact` zeigt nur A1; S09/S10; Rabattzeile im Angebot und Vertrag, Grundlage im Verlauf; Status `Unknown` → Angebot ohne Rabatt + Hinweis; verbindliche Buchung ändert sich bei `ChangeBooking` nicht; **Diff des Umsetzungs-PR berührt keine Datei von A2–A6** | +| **N4** Gemischter Kanal | Kanal mit `booking_model = Mixed`; Reiter Anfrage (`a2.offer`) und Buchung (`a4.portal_booking`) | `ConfigureChannelProcess`, `ProcessSettings::resolve` (Schlüssel `model` je Eingangsart) | keine über U-C hinaus | eingehende Anfrage-Mail → A2-Plan, iCal-Buchung → A4-Plan; beide im selben Kanal; Tester S01 und S07 mit demselben Kanal | +| **N5** Optionales Modul aus | z. B. `review.request` oder `guest.data_request` | `toggle = Optional`, `steps..on = false` | keine | Plan zeigt Schritt nicht; Tester: „übersprungen (Konfiguration)“; `RequestReviews` sendet für den Fall keine Bitte; Versuch, `availability.check` abzuschalten, wird abgewiesen (K07) | +| **N6** Prozess-Tester | `ProcessSandbox`, `EffectLedger`, Szenarien | §3–§7 in `04` | neu | T01–T06 | +| **N7** Neue Portal-API | hypothetischer `ExampleApiConnector`; `ChannelEventHandler`; `PortalIntake` | `DeliversEvents::fetchEvents`, `IncomingBooking`, `Provenance` | nur Adapter + Registereintrag | **Testadapter** in der Suite (`tests/Support/FakeApiConnector`) liefert `IncomingBooking`. Erwartet wird dieselbe Entscheidung wie für Mail/iCal desselben Inhalts: Duplikat zur bestehenden iCal-Sperre erkannt, gleicher Plan `a4`. `PortalIntake` und Modelle werden durch den Adapter-PR nicht geändert. | diff --git a/docs/Prozessarchitektur/Architektur/06_MIGRATIONS_UND_UMSETZUNGSPLAN.md b/docs/Prozessarchitektur/Architektur/06_MIGRATIONS_UND_UMSETZUNGSPLAN.md new file mode 100644 index 0000000..770d67d --- /dev/null +++ b/docs/Prozessarchitektur/Architektur/06_MIGRATIONS_UND_UMSETZUNGSPLAN.md @@ -0,0 +1,220 @@ +# 06 – Migrations- und Umsetzungsplan + +Stand: 04.11.2026 · Kennzeichnung: **[Befund]**, **[Vorschlag]**, **[Entscheidung offen]** + +Grundsatz: **v0.11 bleibt erhalten.** Die Actions, die Preisberechnung, die Faktenaufnahme, die Nachrichtenverarbeitung, die Connectors und die Testsuite bleiben unverändert. Umgebaut wird die Ablaufsteuerung. Neu hinzu kommen Konfigurator, Tester, Kanalereignisse und ein Preis-Erweiterungspunkt. + +--- + +## 1. Notwendige Codeänderungen (Überblick) + +| Bereich | neu | geändert | unverändert | +|---|---|---|---| +| Ablauf | `app/Process/Modules/*` (20 + 2), `ProcessModule`, `ModuleDefinition`, `CaseContext`, `StepResult`, `app/Process/Models/*` (8 Modelle), `ProcessModel`, `Variant`, `Step`, `Point`, `ProcessPlan`, `ProcessRunner`, `ProcessCatalogue`, `config/process.php` | `CaseActivities` (wird Fassade), `CaseAutomation` (Fassade), `ActivityDetails` (Ereignistypen aus Modul), `CaseRecorder::freeze` (Plan mit einfrieren), `ProcessSettings::resolve` (Schlüssel `model`/`variant`/`steps`) | `Activity`, `ActivityState`, `CaseRequirements`, `CaseLog`, `WorkList`, `CaseClosure`, alle Actions | +| Preis | `CasePricing`, `ContributesToPrice`, `PriceContribution` | Aufrufer: `SendOffer::quoteFor`, `SendInformation`, `DecideBookingWish`, `CreateReservation` (Richtpreis), `ChangeBooking` (nicht verbindlich) | `PriceCalculator`, `PriceQuote`, `QuoteLine`, `QuoteLineType` | +| Konfigurator | Seite `ChannelProcess`, Action `ConfigureChannelProcess`, Blade-Komponente Schrittkarte | `HandlingSettings` (dieselbe Schrittansicht), `ChannelForm` (Prozessfelder entfallen), `EffectiveSettings` (liest Plan) | `ChannelRules`, Export, Regeln | +| Tester | `app/Process/Tester/*`: `ProcessSandbox`, `SandboxSeeder`, `EffectLedger`, `ScriptedConnector`, `SandboxMailboxReader`, Ereignistreiber, Szenarien; Seite/Modal „Ablauf testen“; Modell `ProcessTestRun`; Kommando `process:sandbox-template` | `config/database.php` (Verbindung `sandbox`), `scripts/deploy.sh` (Vorlage erzeugen, Release-Kennung ablegen) | `EnforceMailTestMode` (bleibt Schicht im Tester) | +| Kanäle | `app/Channels/Events/*` (Ereignisse, `Provenance`), `ChannelEventHandler`, Fähigkeits-Interfaces `ImportsOccupations`/`DeliversEvents`/`ReceivesWebhooks` | `PortalIntake` (nimmt Ereignis statt `BlockedPeriod`; interne Prüfungen gleich), `SyncChannel` und `ProcessPortalMail` (erzeugen Ereignisse) | `ICalParser`, `PortalMailParser`, `ICalFeed`, `ChannelRegistry` | +| Analyse | `process:impact`, `process:check` (+ `--matrix`) | CI-Workflow `.gitea/workflows/deploy.yml` (ruft `process:check`) | – | +| Loyalty (Nachweis) | `LoyaltyStatusCheck`, `LoyaltyDiscount`, Variante `a1.offer:loyalty`, `FactSource::System` | – | alles andere (`02` §6.2) | + +Neue Abhängigkeiten: **keine.** Verwendet werden nur Framework-Mittel: SQLite-PDO, `Http::fake`, `Storage::fake`, Mailer `array`, `Date::setTestNow` und PHPUnit-Gruppen. + +--- + +## 2. Datenmodelländerungen + +| Änderung | Art | Migration | +|---|---|---| +| Eingefrorener Plan im Vorgang | neuer Schlüssel `plan` in `bookings.profile` (JSON) | **keine** | +| Modellwahl, Schritte, Ausführungsart, Parameter | neue Schlüssel in `channels.process_overrides[intake]`, `properties.process_overrides`, `tenants.process_defaults` (JSON) | **keine** | +| Nachweise übertragener Schritte | Verlaufseintrag `booking_events.type = 'evidence'`; Datei auf dem privaten Disk, Pfad im Ereignis | **keine** | +| Faktquelle `System` | neuer Wert im Enum `FactSource`; Spalte `case_facts.source` ist `string(30)` [Befund] | **keine** | +| Testberichte | neue Tabelle `process_test_runs` (`tenant_id`, `channel_id`, `user_id`, `scenario`, `snapshot` JSON, `report` JSON, `outcome`, `release`, Zeitstempel; Index `tenant_id, created_at`) | **1 Migration** | +| Sandbox | Verbindung `sandbox` (SQLite-Datei je Lauf), Vorlage im Release | keine Migration der echten DB | + +Es gibt **eine** neue Tabelle und keine Änderung bestehender Spalten. + +--- + +## 3. Arbeitspakete + +Die Pakete sind technische Einheiten mit eigenem Nutzen und eigener Testabdeckung. Die **Betreiberfreigabe** erfolgt gemeinsam nach U-F; Teilfreigaben gibt es nicht (Auftrag §14). Bis dahin liegen alle Pakete auf einem Integrationszweig und werden erst nach der Abnahme nach `develop` zusammengeführt. + +### U-A Ablaufkern und Modulkatalog (Grundlage) + +- Modulvertrag, Registry und `config/process.php`. +- Überführung **aller** Schritte aus `CaseActivities::for`, `internal()`, `closing()` und `tasks()` sowie aus `CaseAutomation::step` in 20 Module. +- Die Modelle `a1.*`, `a2.*`, `a3`–`a5`, `a6` jeweils in Version 1. +- `ProcessPlan` mit Einfrieren und Legacy-Abbildung (§4). +- `ProcessRunner`. +- Die Fassaden `CaseActivities` und `CaseAutomation` behalten ihre öffentlichen Methoden. +- `process:check`/`process:impact`, PHPUnit-Gruppen an den bestehenden Tests, Golden Master (`05` §4). +- **Abnahme (technisch):** + - Golden Master identisch. + - Volle Suite grün. + - `process:check` ohne Befund. + - N1, N2 und N5 in Modelltests. + +### U-B Erweiterungspunkte, Preisfassade und Loyalty-Nachweis + +- Erweiterungspunkte im Runner. +- `CasePricing` mit Gleichheitstest gegen `PriceCalculator` (ohne Beiträge). +- `LoyaltyStatusCheck`, `LoyaltyDiscount` und Variante `a1.offer:loyalty`, je nach E7 wählbar oder nur Test. +- **Abnahme (technisch):** N3 inklusive des Nachweises, dass A2–A6 nicht verändert wurden: Der Diff berührt keine Modelldatei außer `A1OfferModel`. + +### U-C Kanalkonfigurator + +- `ChannelProcess` mit Reitern je Eingangsart, Modellwahl, Schrittkarten, Ausführungsart je Schritt, optionalen Schritten, Nachweisstufen, Herkunft, Vorschau. +- `ConfigureChannelProcess` mit Validierung. +- `HandlingSettings` auf dieselbe Ansicht umgestellt; Prozessfelder in `ChannelForm` entfernt. +- `EffectiveSettings` liest den Plan. +- Prüfung „Nachweis fehlt“ beim kaufmännischen Abschluss. +- **Abnahme (technisch):** K01–K07 automatisiert, N4. + +### U-D Prozess-Tester + +- Sandbox-Verbindung und Vorlage, Schutzschichten 1–4, `EffectLedger`, Ereignistreiber, Szenarien S01–S12, Bericht und `process_test_runs`. +- „Ablauf testen“ im Konfigurator. +- Sicherheitstests (`04` §7), Paritätstest. +- Sichtung der 28 Rohabfragen auf SQLite/MariaDB-Gleichheit. +- Release-Kennung im Deployment. +- **Abnahme (technisch):** alle Sandbox-Tests grün; T01–T06 lokal. + +### U-E Kanalereignisse + +- Ereignisklassen und `Provenance`, `ChannelEventHandler`. +- `PortalIntake` auf Ereignisse umgestellt; `SyncChannel` und `ProcessPortalMail` liefern Ereignisse. +- Vertrauensstufe → Nachweisstufe (U-C). +- Testadapter für N7. +- **Abnahme (technisch):** `ChannelSyncTest`, `PortalMailTest`, `PortalBookingTest` und `GenericChannelIntegrationTest` unverändert grün; N7-Test. + +### U-F Gesamtabnahme auf stommer.info + +- Deployment des Integrationszweigs auf das Testsystem; dort Zählabfrage vorher/nachher. +- Abnahmeprotokoll `Abnahme/ARCHITEKTUR_MODULAR_ABNAHME.md`: + - N1–N7, K01–K08, T01–T06; + - Konfiguration aller vorhandenen Kanäle des Testmandanten durch den Betreiber in der einfachen Ansicht; + - je Kanal und Eingangsart ein Testerlauf und ein echter Testvorgang zum Vergleich (K03). +- Aktualisierung von `docs/STATUS.md`, `KONFIGURATION_UND_WIRKSAMKEIT.md`, `MODULMATRIX.md`. +- **Abnahme (fachlich):** Freigabe durch den Betreiber; erst danach Merge nach `develop` und `main`. + +### 3.1 Abhängigkeiten + +``` +U-A ──┬── U-B + ├── U-C ──┐ + ├── U-E ──┼── U-F + └── U-D ──┘ (U-D nutzt den Konfigurationsentwurf aus U-C und die Ereignisse aus U-E für S07/S08) +``` + +U-B, U-C und U-E können nach U-A parallel laufen. U-D beginnt nach U-A mit Sandbox und Schutzschichten; Szenarien S07/S08 folgen nach U-E. + +### 3.2 Aufwand (Schätzung) + +| Paket | Entwicklertage | +|---|---| +| U-A | 8–10 | +| U-B | 3–4 | +| U-C | 6–8 | +| U-D | 8–10 | +| U-E | 4–5 | +| U-F (inkl. Fehlerbehebung aus der Abnahme) | 3–4 | +| **Summe** | **32–41** | + +Die Werte enthalten Tests und Dokumentation. Hinzu kommen etwa 1–2 Tage Betreiberzeit für Entscheidungen und die Abnahme. Größter Unsicherheitsfaktor ist U-A: Wie viele unbeabsichtigte Unterschiede zeigt der Golden Master? + +--- + +## 4. Migrationsstrategie für bestehende Vorgänge und Kanäle + +**Keine Datenänderung an bestehenden Buchungen oder Kanälen** – weder bei der Umsetzung noch beim Deployment. + +1. **Vorgänge ohne `profile.plan`** (alle bestehenden): `ProcessPlan::of($booking)` bildet beim Lesen aus dem eingefrorenen Profil ab: + - `intake = Internal` → `a6.internal@1`; + - `Inquiry` → `a1|a2` (nach `caseType`) `.offer@1` bei `preReservation()`, sonst `.information@1`; + - `Booking` → `a3|a4|a5.portal_booking@1` nach `caseType`. + - Variante `standard`. + - Optionale Schritte so, wie sie heute wirken: `review.request` an, wenn `guestMessages() = Landlord`; `guest.data_request` nach `dataRequestMode()`. + - Version 1 jedes Modells reproduziert das heutige Verhalten exakt (Golden Master). + - Das Profil wird nicht neu geschrieben. `origin = 'migration'` bleibt beachtet: `CaseAutomation` fasst solche Vorgänge heute nicht automatisch an, und das gilt weiter. +2. **Neue Vorgänge** erhalten beim Eingang den vollständigen Plan (`CaseRecorder::freeze`). +3. **Kanäle ohne `model`:** `ProcessSettings::resolve` leitet das Modell zur Laufzeit wie in Punkt 1 aus den bisherigen Werten ab. + - Der Konfigurator zeigt es als „aus Ihren bisherigen Einstellungen abgeleitet“. + - Gespeichert wird erst, wenn der Vermieter speichert. + - Damit verhält sich jeder Kanal nach dem Deployment genau wie vorher. +4. **Wegfallende Einzelwerte** (`Documents`/`Payments` am Kanal für Eingangsart Buchung, falls E1 wie empfohlen) bleiben lesbar und dienen der Ableitung. Sie werden im Konfigurator nicht mehr einzeln angeboten. Ein späteres Aufräumen ist optional und nicht Teil dieser Umsetzung. +5. **Rückweg:** Es werden keine Daten umgeschrieben, und `profile.plan` wird von der alten Version ignoriert. Ein Rollback per `scripts/deploy.sh rollback` ist deshalb ohne Datenkorrektur möglich. Ausnahme ist die neue Tabelle `process_test_runs`; sie bleibt ungenutzt stehen. + +--- + +## 5. Risiken + +| Risiko | Eintritt | Wirkung | Maßnahme | +|---|---|---|---| +| Verhaltensabweichung durch Umbau | mittel | falsche Schritte/Automatik | Golden Master, Fallmatrix, unveränderte Bestandstests, gemeinsame Abnahme | +| `pdo_sqlite` fehlt auf Strato | unbekannt | Tester ohne SQLite | V1 vor Beginn prüfen; Ausweichlösung eigene MariaDB-Datenbank (E4) | +| Sandbox-Leck durch neuen Effektweg (z. B. künftige direkte Netzverbindung) | gering | Schaden durch Tester | Schreibwächter + `preventStrayRequests` + `ModuleContractTest`; Regel: neue Effektwege nur über Framework-Fassaden (wie `MailTestModeGateTest` für Mail) | +| Laufzeit des Testers auf Shared Hosting | mittel | Zeitüberschreitung | Vorlage statt Migration, Ereignisgrenze, Laufzeitgrenze, schrittweise Läufe | +| SQLite/MariaDB-Abweichung in Rohabfragen | gering | Tester ≠ Betrieb in Randfällen | Sichtung in U-D, Paritätstest auf MariaDB in der CI (optional) | +| Konfigurator zu umfangreich | mittel | schlechte Bedienbarkeit | einfache Ansicht mit wenigen Feldern; Betreibertest in U-F (K08) | +| Parallele Arbeiten am selben Repo | mittel | Konflikte in `CaseActivities`/`ViewBooking` | Integrationszweig, `ZUSAMMENARBEIT.md`, U-A zuerst und zügig | + +--- + +## 6. Voraussetzungen + +| # | Voraussetzung | +|---|---| +| V1 | `pdo_sqlite` auf Strato (Test- und Produktivpaket) verfügbar – Prüfung mit `scripts/deploy.sh staging artisan` bzw. `php -m` auf dem Server | +| V2 | Entscheidungen E1–E9 (§9) getroffen | +| V3 | v0.11 auf stommer.info abgenommen ([Befund]: Release `7e4e208` ist auf dem Testsystem live; der Branch `feature/aufenthalt` liegt 112 Commits vor `main`, zuletzt lokal `ef2783e`) | +| V4 | Zusammenführungsstand der laufenden Feature-Zweige geklärt, damit U-A auf aktuellem Stand beginnt | +| V5 | Zuständigkeiten je Portal (welche Modelle zulässig) aus `docs/PORTALE.md` bestätigt (E2) | + +--- + +## 7. Gemeinsame Abnahmekriterien der Umsetzung + +1. N1–N7 erfüllt, wie in `05` §6 beschrieben. +2. K01–K08 (Konfigurator) und T01–T06 (Tester) auf stommer.info erfüllt. +3. Der Golden Master ist identisch. Die volle Suite und `process:check` sind ohne Befund. +4. Kein bestehender Vorgang und kein bestehender Kanal wurde durch das Deployment verändert. Das wird per Prüfsumme der Spalten `bookings.profile` und `channels.process_overrides` vorher und nachher festgestellt. +5. Betreiberfreigabe auf Grundlage des Abnahmeprotokolls. Der Konfigurator ist **betriebsfähig**, und der Tester ist **schadensfrei**; beides wird gemeinsam freigegeben. + +--- + +## 8. Was ausdrücklich nicht umgesetzt wird + +- Grafischer Designer, frei kombinierbare Bedingungen, Modellpflege in der Datenbank. +- Dynamisch geladene Fremdmodule, zweite Engine, neue Pakete. +- Konkrete Portal-API-Anbindungen. Es gibt nur Schnittstellen und einen Testadapter. +- Ein vollständiges Loyalty-Programm (Punkte, Stufen, Gastkonto). Es gibt nur die beiden Nachweismodule. +- Direktbuchung auf der Webseite (D6): Die Modellstelle `a1.direct_booking` ist vorgesehen, aber nicht wählbar. + +--- + +## 9. Offene Entscheidungen (vor der Implementierung) + +| # | Frage | Empfehlung | +|---|---|---| +| **E1** | Legt bei Buchungen (A3–A5) das gewählte Modell die Verantwortungen fest, oder bleiben die Einzelwerte `Documents`/`Payments` maßgeblich? | **Das Modell legt sie fest**: unzulässige Kombinationen sind dann ausgeschlossen. | +| **E2** | Welche Modelle sind je Portal zulässig (FeWo-direkt, Destination Solutions, weitere)? | Aus `PORTALE.md`/`R08`/`R09` ableiten und vom Betreiber bestätigen lassen. Vorschlag: FeWo-direkt Anfrage A2, Buchung A4 oder A5; Destination Solutions Buchung A3. | +| **E3** | Darf eine Kanaländerung in einen laufenden Vorgang übernommen werden? | **Nein.** Gilt nur für neue Vorgänge. | +| **E4** | Sandbox-Speicher: SQLite-Datei oder eigene MariaDB-Datenbank? | SQLite, wenn V1 erfüllt ist; sonst MariaDB. | +| **E5** | Loyalty bei Änderung einer verbindlichen Buchung? | Rabattzeile unverändert übernehmen, keine Neuberechnung; dazu ein Hinweis für eine manuelle Anpassung. | +| **E6** | Loyalty mit Sonderangeboten kombinierbar? | Vorgabe **nein**, der höhere Nachlass gilt; als Parameter einstellbar. | +| **E7** | Loyalty produktiv wählbar oder nur als Architekturnachweis? | Beide Module bauen. Variante wählbar, Vorgabe **aus**. Der Rabattsatz ist Pflichtangabe beim Einschalten. | +| **E8** | Wer darf den Tester nutzen, wie lange werden Berichte aufbewahrt? | Administratoren des Mandanten; 90 Tage. | +| **E9** | Wie viel darf der Vermieter an Szenarien verändern? | Nur vorgegebene Eingaben (Zeitraum, Personen, fehlende Felder, Stammgast ja/nein, Ausfallart); keine eigenen Ereignisfolgen. | + +### Einordnung der Punkte D1–D6 aus dem Vorschlag Kanalkonfigurator + +| # | Stand | +|---|---| +| D1 Preisanfrage als Eingangsart | bleibt: **keine** eigene Eingangsart; Modell `a1.information` / `a2.information` | +| D2 Schablone nach Anpassung | entfällt als Frage: Das Modell bleibt gewählt, abweichende Parameter tragen die Herkunft „hier gesetzt“. Die Kennzeichnung „angepasst“ zeigt der Konfigurator, wenn Werte von den Modellvorgaben abweichen. | +| D3 Mindestnachweis je Modell | **offen** (Vorgaben wie im Vorschlag empfohlen) | +| D4 akzeptierte Angaben je Kanal | **offen**; wird Parameter von `guest.details` je Kanal (nicht ausgewählte Felder → Vorschlag statt Übernahme) | +| D5 Berechtigung | bestätigt: Administratoren des Mandanten | +| D6 Direktbuchung Webseite | bleibt eigene Entscheidung nach Rechtsprüfung | diff --git a/docs/Prozessarchitektur/README.md b/docs/Prozessarchitektur/README.md index 4a71612..57c63e3 100644 --- a/docs/Prozessarchitektur/README.md +++ b/docs/Prozessarchitektur/README.md @@ -49,6 +49,7 @@ ## Geltung, Dokumente und Archiv - Die Dateien unter `Referenzen/` sind **Quellen- und Belegmaterial**, keine eigenständigen neuen Normen. Ihr historisches Versionsdatum bleibt unverändert. - Die **vollständige Original-v0.10 mit Originaldokumenten, Audit, damaligen Umsetzungs-/Abnahmeprotokollen, Screenshots und Vault-Dateien** liegt unverändert als [Historie/Prozessarchitektur_v0.10_ORIGINAL.zip](Historie/Prozessarchitektur_v0.10_ORIGINAL.zip) bei. Sie ist **nicht** parallel gültig. Ihre technischen und rechtlichen Prüfstände belegen nur v0.10. - Die Beschlussquelle für den neuen Bereich liegt in [Historie/CH_Entscheidungsstand_2026-11-03_v4.md](Historie/CH_Entscheidungsstand_2026-11-03_v4.md). Die normative aktuelle Regel ist die CH-Querschnittsdatei. +- Unter [Architektur/](Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md) liegt der **Architektur- und Umsetzungsplan** für die modulare Prozessarchitektur (Fachmodule, Prozessmodelle, Kanalkonfigurator, Prozess-Tester). Er ist eine Planung und noch nicht normativ; er löst `Vorschläge/KANALKONFIGURATOR.md` als Zielbild ab. - Die [Konsolidierungsprüfung](KONSOLIDIERUNGSBERICHT_v0.11.md) erklärt Herkunft, Änderungen und technische Freigabevorbehalte. **Es wurde kein aktueller Repository-Code geprüft.** ## Offene Nachweise vor produktivem Go-live diff --git a/docs/Prozessarchitektur/Vorschläge/KANALKONFIGURATOR.md b/docs/Prozessarchitektur/Vorschläge/KANALKONFIGURATOR.md index 67d3143..21cc4d1 100644 --- a/docs/Prozessarchitektur/Vorschläge/KANALKONFIGURATOR.md +++ b/docs/Prozessarchitektur/Vorschläge/KANALKONFIGURATOR.md @@ -1,5 +1,7 @@ # Ergänzungsvorschlag: Kanalkonfigurator (Schablonen, Schritte, Nachweise, Vorschau) +> **Abgelöst als Zielbild** durch [Architektur/03_KANALKONFIGURATOR.md](../Architektur/03_KANALKONFIGURATOR.md) (Schablonen → Prozessmodelle; D1–D6 eingeordnet in [Architektur/06](../Architektur/06_MIGRATIONS_UND_UMSETZUNGSPLAN.md) §9). Dieser Text bleibt als Herleitung erhalten. + **Stand:** 04.11.2026 · **Status:** Vorschlag zur Ergänzung der Spezifikation v0.11, **nicht normativ**. Normativ wird er erst, wenn der Betreiber die offenen Entscheidungen (§9) trifft und der Inhalt in die betroffenen Kapitel übernommen ist (02 Abwicklungsprofile, Konfiguration und Wirksamkeit, Gates und Nachweise, Archetypen). Anlass: Abstimmung mit dem Betreiber am 03./04.11.2026. Heute gibt es am Kanal eine flache Liste von Einstellungen, deren Wirkung auf den Ablauf nicht erkennbar ist. Die Spezifikation fordert dagegen: „die konkreten Wirkungen und Herkunftswerte müssen sichtbar bleiben“ (02). Neue Portale verhalten sich unterschiedlich; künftig soll auch eine Direktbuchung auf der eigenen Webseite möglich sein. diff --git a/docs/STATUS.md b/docs/STATUS.md index 9c79757..51d1f28 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -24,6 +24,7 @@ ## Aktueller Stand (03.11.2026) - [Umsetzungsergebnis v0.11](Prozessarchitektur/Implementierungsstände/UMSETZUNGSERGEBNIS_V011.md) (Rückverfolgung, Entscheidungen, Einschränkungen, Go-live-Bedingungen); - [Abnahme auf dem Testsystem](Prozessarchitektur/Abnahme/V011_ABNAHME_TESTSYSTEM.md) (Dienste, Konfiguration, Drehbuch); - Planung: [Soll-Ist](Prozessarchitektur/Implementierungsstände/V011_SOLL_IST_ANALYSE.md), [Zielarchitektur](Prozessarchitektur/Implementierungsstände/V011_TECHNISCHE_ZIELARCHITEKTUR.md), [Umsetzungsplan](Prozessarchitektur/Implementierungsstände/V011_UMSETZUNGSPLAN.md). +- Nachfolgeplanung (04.11.2026, noch nicht umgesetzt): [Kontrolliert modulare Prozessarchitektur, Kanalkonfigurator und Prozess-Tester](Prozessarchitektur/Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md) – Entscheidungen E1–E9 offen. **Nächste Schritte:** 1. Abstimmung mit dem Betreiber: Auslieferung von `feature/aufenthalt` über `develop` auf das Testsystem (vier neue Migrationen), eigenes IMAP-Postfach, KI-Zugang des Mandanten unter „System › KI-Anbindung“ (Dienst vorher im Betreiberbereich einschalten). From 750c1ed1d958a5c1f0b981015639d8f72994b635 Mon Sep 17 00:00:00 2001 From: Lars Date: Wed, 4 Nov 2026 13:37:45 +0100 Subject: [PATCH 3/9] Architekturplan Review V2: Runner, Modulgrenzen, Versionierung, Kanalereignisse, Sandbox-Anfrage (Planung) Korrekturen K1-K10 in die Dokumente 00-06 eingearbeitet: abhaengigkeitsbasierter ProcessRunner mit Nachweisszenario, Kriterien fuer Modulgrenzen, vier Versionierungsebenen mit Bestandsfall-Tests, Stufen M1-M4 und Ereignisvertraege, Prozess-Tester in eigener Sandbox-Anfrage mit Negativtests, Verantwortungsmatrix A1-A6, Deploymentweg ueber develop/stommer.info, Loyalty nur im Tester, Verhaltensvergleich in acht Dimensionen, Kanalereignisse als Ergaenzung. E1-E9 als entschieden gekennzeichnet; offen nur O1-O5. Co-Authored-By: Claude Opus 5.5 --- .../00_MANAGEMENT_ZUSAMMENFASSUNG.md | 118 ++-- .../Architektur/01_ARCHITEKTURBEWERTUNG.md | 243 +++++--- .../Architektur/02_FACHMODUL_ARCHITEKTUR.md | 559 ++++++++++++------ .../Architektur/03_KANALKONFIGURATOR.md | 288 ++++++--- .../Architektur/04_PROZESS_TESTER.md | 345 +++++++---- .../05_AENDERUNGSANALYSE_UND_TESTS.md | 200 ++++--- .../06_MIGRATIONS_UND_UMSETZUNGSPLAN.md | 316 +++++----- docs/Prozessarchitektur/README.md | 2 +- docs/STATUS.md | 2 +- 9 files changed, 1333 insertions(+), 740 deletions(-) diff --git a/docs/Prozessarchitektur/Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md b/docs/Prozessarchitektur/Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md index c0fa5f5..6f5b863 100644 --- a/docs/Prozessarchitektur/Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md +++ b/docs/Prozessarchitektur/Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md @@ -1,79 +1,93 @@ # Management-Zusammenfassung: Kontrolliert modulare Prozessarchitektur -Stand: 04.11.2026 · Analyse- und Planungsergebnis. Es wurden kein Code, keine Migration und keine Buchung oder Kanalkonfiguration geändert. +Stand: 04.11.2026, **Review V2** · Planungsergebnis, nach den Korrekturen K1–K10 implementierungsreif. Es wurden kein Code, keine Migration und keine Buchung oder Kanalkonfiguration geändert. Dokumente: -1. [01 Architekturbewertung](01_ARCHITEKTURBEWERTUNG.md) -2. [02 Fachmodul-Architektur](02_FACHMODUL_ARCHITEKTUR.md) -3. [03 Kanalkonfigurator](03_KANALKONFIGURATOR.md) -4. [04 Prozess-Tester](04_PROZESS_TESTER.md) -5. [05 Änderungsanalyse und Tests](05_AENDERUNGSANALYSE_UND_TESTS.md) -6. [06 Migrations- und Umsetzungsplan](06_MIGRATIONS_UND_UMSETZUNGSPLAN.md) +1. [01 Architekturbewertung](01_ARCHITEKTURBEWERTUNG.md) – Soll-Ist, korrigierte Aussagen, Architekturcheck +2. [02 Fachmodul-Architektur](02_FACHMODUL_ARCHITEKTUR.md) – Modulgrenzen, Vertrag, Versionierung, Runner, Kanalereignisse +3. [03 Kanalkonfigurator](03_KANALKONFIGURATOR.md) – Modellwahl, Verantwortungsmatrix, Konfiguration am Schritt +4. [04 Prozess-Tester](04_PROZESS_TESTER.md) – Sandbox-Anfrage, Sicherheits- und Negativtests +5. [05 Änderungsanalyse und Tests](05_AENDERUNGSANALYSE_UND_TESTS.md) – Verhaltensvergleich, Bestandsfälle, N1–N7 +6. [06 Migrations- und Umsetzungsplan](06_MIGRATIONS_UND_UMSETZUNGSPLAN.md) – Pakete, Deploymentweg, Entscheidungsmatrix -Kennzeichnung: **[Befund]** (im Code nachgewiesen), **[Vorschlag]**, **[Entscheidung offen]**. +Kennzeichnung: **[Befund]**, **[Vorschlag]**, **[Entschieden]**, **[Entscheidung offen]**. --- -## Empfohlener Ansatz [Vorschlag] +## Architektur V2 (angenommen) -Empfohlen wird ein **Modulkatalog mit Prozessmodellen im Code**. Es gibt keine Workflow-Engine und keine Modellpflege in der Datenbank. +- **Fachmodule mit Vertrag:** Sie rufen die bestehenden Actions auf. + - Der Katalog ist ein Startumfang. Ob etwas Parameter, Modulerweiterung oder neues Modul wird, entscheiden Kriterien, keine Sollzahl. + - Jedes Vertragsfeld nennt, womit es geprüft wird. +- **Prozessmodelle** (`a1.offer`, `a4.portal_booking` …): zentral im Code, versioniert, mit festen Erweiterungspunkten und den **bestimmenden** Verantwortungen des Archetyps. +- **Kanalkonfigurator:** Das Modell wählt der Vermieter je Kanal × Eingangsart. Alles Weitere stellt er **am Schritt** ein: an/aus, Ausführende im zulässigen Rahmen, Ausführungsart, Fristen, Nachweis. Dazu gibt es eine Vorschau. +- **Ein Ablaufkern** (`ProcessRunner`) ersetzt die verdrahteten Inhalte von `CaseActivities` und `CaseAutomation`. + - Ein Schritt läuft, wenn seine fachlichen Voraussetzungen erfüllt sind. Ein wartender Schritt hält nur die Schritte auf, die von ihm abhängen. + - Der Zustand bleibt aus den Falldaten abgeleitet; es gibt keine zweite Wahrheit. +- **Prozess-Tester** in einer **eigenen Sandbox-Anfrage**: Dort ist nur ein Speicher je Lauf konfiguriert, alle Außenwege sind gesperrt oder simuliert. +- **Kanalereignisse** als zusätzlicher Eingang für künftige APIs, abgebildet auf den vorhandenen Eingang. iCal und Mail bleiben unverändert. -- Rund **20 Fachmodule** entlang P01–P05. Jedes Modul hat einen Vertrag: Aufgabe, Daten, Ergebnisse, Voraussetzungen, Seiteneffekte, Parameter, Abschaltbarkeit und Tests. Die Module rufen die **bestehenden Actions** auf. -- **Versionierte Prozessmodelle** (`a1.offer`, `a2.information`, `a4.portal_booking` …) mit festen **Erweiterungspunkten**. Varianten entstehen durch Einfügen vorhandener Module. Die Archetypen A1–A6 bleiben reine Klassifikation. -- **Kanalkonfigurator:** Je Kanal und Eingangsart wählt der Vermieter ein zulässiges Modell. Er stellt die Schritte direkt am Schritt ein und sieht sofort eine Vorschau. Gespeichert wird in den **bestehenden JSON-Spalten**. Laufende Vorgänge behalten ihren eingefrorenen Plan. -- **Prozess-Tester „Ablauf testen“:** Er nutzt dieselben Module und Actions. Isoliert wird durch einen eigenen synthetischen Datenspeicher (SQLite-Datei je Lauf), einen Schreibwächter auf der echten Datenbank, simulierte Mail/HTTP/Dateien/Connectors und eine simulierte Uhr. Ein Rollback allein reicht nicht. -- **Kanalereignisse** (`IncomingBooking`, `PaymentReported` …) trennen iCal, Mail und künftige APIs vom Fachprozess. +## Was die Überarbeitung korrigiert hat -Einfachere Ansätze wurden geprüft und verworfen, siehe `01` §3. Zusätzliche Einstellungen allein oder eine Beschreibungsschicht über unverändertem Code erfüllen Konfigurator und Tester nicht. Konfigurator und Vorschau würden dann einen anderen Ablauf zeigen als den ausgeführten. +| | Korrektur | +|---|---| +| K1 | Runner nach fachlichen Abhängigkeiten statt „erster offener Schritt“. Belegt am Szenario fehlende Anschrift → Klärungsreservierung → Rückfrage → Fristablauf → spätere Antwort → Angebot (`02` §7.6). Auslöser bleiben die vorhandenen; die heute verteilten Direktaufrufe laufen über den Runner. | +| K2 | Vier Stufen: Parameter / Modulerweiterung / neues Modul / neuer Erweiterungspunkt. Prüffälle Loyalty und Adressprüfung ohne Eingriff in andere Archetypen. | +| K3 | Vier Ebenen: Vertragsdaten, Prozessdefinition, Implementierung, Fehlerkorrektur. Regeln R1–R6; Bestandsfall-Tests mit eingefrorenen v0.11-Fällen prüfen bei jedem Release Preise, Stornokosten, Fälligkeiten, Vertragstext und Ablauf. | +| K4 | Meldung → zugeordnete Portalinformation → bestätigte Erledigung → zulässige Vertragsänderung (M1–M4). Die Vertrauensstufe einer Quelle ist kein Nachweis. Ereignisverträge für Buchung, Storno, Änderung, Zahlung, Auszahlung. | +| K5 | Das Umschalten in der Admin-Anfrage ist nicht ausreichend sicher und wird ersetzt durch die eigene Sandbox-Anfrage („standardmäßig gesperrt“). 15 Negativtests. Die Grenze native PHP-Aufrufe ist benannt und durch einen statischen Test abgedeckt. | +| K6 | Verantwortungsmatrix A1–A6. Archetypbestimmend sind Vertragsabschluss, Inkasso und Vertragsdokumentation. Variabel am Schritt sind Kommunikation, ergänzende Unterlagen, Anreiseinformation und lokale Leistungen. | +| K7 | Weg: Entwicklungszweig → Regression → Merge `develop` → Push → automatisches Deployment stommer.info → technische Prüfung → fachliche Abnahme. Kein `main`. | +| K8 | Loyalty nur im Tester; für echte Buchungen technisch nicht aktivierbar. | +| K9 | Verhaltensvergleich in acht Dimensionen. Ein Fehlerregister verhindert, dass bekannte Fehler zur Norm werden. Jede beabsichtigte Abweichung hat eine Begründung und einen Test. | +| K10 | Ereignisse ergänzen, statt den Eingang umzubauen: 2 kleine Änderungen in `PortalIntake`. Die Duplikatregeln bleiben eine Implementierung. | + +Korrigiert wurden auch zu weit gehende Aussagen des ersten Entwurfs (`01` §2.8): + +- „alle Actions unverändert“: tatsächlich ändern sich Aufrufstellen, nicht die Fachlogik; +- „jede Schicht verhindert jeden Schaden“; +- `trust` = Nachweis; +- Merge nach `main`. ## Was erhalten bleibt [Befund] -Unverändert bleiben: +- Fachlogik der Actions, `PriceCalculator`, Faktenaufnahme mit Herkunft, Datenbeschaffung, Nachrichteneingang mit KI; +- Mail-Schranke, Vererbung und Einfrieren der Einstellungen; +- iCal- und Mail-Eingang samt E-019-Regeln; +- Datenmodelle (neue Angaben in vorhandenen JSON-Spalten); +- die Testsuite. -- alle 56 Actions; -- `PriceCalculator` und `PriceQuote`; -- die Faktenaufnahme mit Herkunft (`ContributeCaseFacts`); -- Datenbeschaffung, Nachrichteneingang und KI-Auswertung (BYOK); -- die Mail-Schranke (`EnforceMailTestMode`); -- die Vererbung der Einstellungen samt Herkunft und Einfrieren (`ProcessSettings`, `ProcessProfile`); -- Connectors und Parser; -- die Datenmodelle; -- die gesamte Testsuite (683 Feature-Tests) als Regressionsnetz. - -## Was sich tatsächlich ändert [Vorschlag] - -1. `CaseActivities::for` und `CaseAutomation::step` sind heute fest verdrahtet [Befund]. Sie werden zu **einem Ablaufkern über Module**. Die öffentlichen Methoden bleiben, damit Oberfläche und Kommandos stabil bleiben. Abgesichert wird das per Golden-Master-Vergleich über etwa 150 Fallkonstellationen. -2. Ein **Preis-Erweiterungspunkt** (`CasePricing`) vor der Preisfestlegung. Er ist die einzige Änderung im Preisweg. -3. `PortalIntake` nimmt **Ereignisse** statt `BlockedPeriod` an. -4. Neu hinzu kommen der Konfigurator, der Tester und die Analysebefehle `process:impact` und `process:check`. -5. Datenmodell: **eine** neue Tabelle für Testberichte. Alles andere passt in bestehende JSON-Spalten. - -**Loyalty-Nachweis:** Nötig sind zwei neue Module, eine Variante von `a1.offer`, ein Registereintrag und Tests. A2–A6, `PriceCalculator`, `SendOffer`, Dokumente, Konfigurator und Tester bleiben unverändert (`02` §6.2). +Neu ist eine Tabelle für Testberichte. Eine Spalte für deren Aufbewahrungsfrist kommt hinzu, falls die Frist wie die übrigen am Mandanten geführt wird. ## Aufwand (Schätzung) -Geschätzt sind **32–41 Entwicklertage** einschließlich Tests und Abnahme. Hinzu kommen 1–2 Tage Betreiberzeit. Die größte Unsicherheit liegt im Umbau des Ablaufkerns (U-A). +**34–45 Entwicklertage** (vorher 32–41) zuzüglich 1–2 Tage Betreiberzeit. -Es gibt eine **gemeinsame Betreiberfreigabe** nach der Ende-zu-Ende-Abnahme auf stommer.info. Konfigurator und schadensfreier Tester werden zusammen abgenommen. +- Mehraufwand: Bestandsaufnahme U-0, abhängigkeitsbasierter Runner, Verantwortungsmatrix, Sandbox-Anfrage, Negativtests. +- Minderaufwand: kein Umbau des Kanaleingangs. +- Größte Unsicherheit: der Umfang des Fehlerregisters aus dem Verhaltensvergleich. -## Wichtigste technische Risiken +## Verbleibende Risiken -1. **Unbemerkte Verhaltensänderung beim Umbau.** Gegenmaßnahmen: Golden Master, unveränderte Bestandstests, Abnahme je Kanal. -2. **`pdo_sqlite` auf Strato ungeklärt.** Das ist vor Beginn zu prüfen. Andernfalls dient eine eigene MariaDB-Datenbank als Sandbox. -3. **Leck im Tester durch einen künftigen neuen Effektweg.** Gegenmaßnahmen: Schreibwächter, Sperre fremder HTTP-Aufrufe, generischer Modul-Vertragstest. -4. **Laufzeit des Testers auf Shared Hosting.** Gegenmaßnahmen: vorbereitete Sandbox-Vorlage, Laufzeitgrenzen, schrittweise Läufe. +1. **Verhaltensabweichung im Umbau**, besonders bei Mails, die einander ersetzen (Rückfrage statt Eingangsbestätigung). Gegenmaßnahme: Verhaltensvergleich mit Kommunikationsdimension. +2. **Gemeinsame Actions und Bestandsfälle.** Gegen Fehler in Code, der Vertragsdaten *schreibt*, schützt nur die Testabdeckung. Gegenmaßnahme: Bestandsfall-Tests, `readsContractData`. +3. **Server-Voraussetzungen:** `pdo_sqlite` (V1) oder ein getrennter DB-Benutzer (V6). Ist beides nicht gegeben, ist der Tester auf diesem Server nicht verfügbar. +4. **Native PHP-Aufrufe** am Framework vorbei sind zur Laufzeit nicht abfangbar. Sie werden nur über den statischen Test ausgeschlossen. +5. **Parallele Feature-Zweige:** Konflikte in `CaseActivities`/`ViewBooking` (Klärung in U-0). -## Vor der Implementierung zu entscheiden [Entscheidung offen] +## Entscheidungen + +Entschieden sind E1–E9 sowie D4 und D6 (als Regel). D3 ist aus den Geschäftsregeln abgeleitet. Die Matrix mit Begründung, Komponenten, Auswirkung und Testnachweis steht in `06` §9.1. + +**Tatsächlich noch offen** (`06` §9.2): | # | Frage | Empfehlung | |---|---|---| -| E1 | Legt das gewählte Modell die Verantwortungen (Dokumente/Zahlungen) fest? | ja | -| E2 | Zulässige Modelle je Portal | FeWo-direkt: Anfrage A2, Buchung A4/A5; Destination Solutions: A3 – bitte bestätigen | -| E3 | Kanaländerung in laufende Vorgänge übernehmen? | nein | -| E4 | Sandbox: SQLite oder eigene MariaDB-Datenbank | SQLite, falls verfügbar | -| E5–E7 | Loyalty: Verhalten bei Änderung, Kombination mit Sonderangeboten, produktiv wählbar? | übernehmen statt neu rechnen; nicht kombinierbar; wählbar, Vorgabe aus | -| E8–E9 | Testerberechtigung, Aufbewahrung, Szenario-Freiheit | Administratoren, 90 Tage, nur vorgegebene Eingaben | -| D3, D4, D6 | Mindestnachweise, akzeptierte Angaben je Kanal, Direktbuchung | aus dem Vorschlag Kanalkonfigurator übernommen, weiter offen | +| O1 | Bleibt die Vertragsdokumentation archetypbestimmend (`Documents = Portal` ⇒ A5)? | ja | +| O2 | FeWo-direkt zusätzlich A5 oder A3? | zunächst nur A4 | +| O3 | Aufbewahrungsfrist der Testberichte im Löschkonzept | kurz, z. B. 30 Tage | +| O4 | Gemeldete Portal-Stornierung/-Änderung setzt automatische Außenwirkungen aus? | ja | +| O5 | Abschluss A4/A5 ohne erfassten Auszahlungseingang? | nur begründet, mit Protokoll | -Weitere Voraussetzungen: v0.11 ist auf stommer.info abgenommen, und die offenen Feature-Zweige sind zusammengeführt. Erst dann beginnt U-A. +Vor Beginn (U-0): tatsächlichen Repository- und Testsystemstand prüfen, V1/V6 auf dem Server prüfen, Referenz-Snapshots erzeugen. diff --git a/docs/Prozessarchitektur/Architektur/01_ARCHITEKTURBEWERTUNG.md b/docs/Prozessarchitektur/Architektur/01_ARCHITEKTURBEWERTUNG.md index 421091e..cc6a0fb 100644 --- a/docs/Prozessarchitektur/Architektur/01_ARCHITEKTURBEWERTUNG.md +++ b/docs/Prozessarchitektur/Architektur/01_ARCHITEKTURBEWERTUNG.md @@ -1,13 +1,31 @@ # 01 – Architekturbewertung: kontrolliert modulare Prozessarchitektur -Stand: 04.11.2026 · Grundlage: Branch `feature/aufenthalt` (Commit `ef2783e`), Prozessarchitektur v0.11, Vorschlag `Vorschläge/KANALKONFIGURATOR.md` -Status: **Analyse und Planung** – keine Codeänderung, keine Migration, keine Änderung an Buchungen oder Kanälen. +Stand: 04.11.2026, **Review V2** · Grundlage: Branch `feature/aufenthalt` (`86f2d0a`; Anwendungscode = `develop` `7e4e208`), Prozessarchitektur v0.11, Vorschlag `Vorschläge/KANALKONFIGURATOR.md` +Status: **Planung, nach Review V2 implementierungsreif** – keine Codeänderung, keine Migration, keine Änderung an Buchungen oder Kanälen. + +**Review V2:** Die Variante V2 ist vom Betreiber angenommen. Die Korrekturen K1–K10 sind eingearbeitet: + +| Korrektur | Ort | +|---|---| +| K1 Runner mit unabhängigen und wartenden Schritten | `02` §7 | +| K2 Kriterien für Modulgrenzen | `02` §2 | +| K3 vier Versionierungsebenen, Bestandsfall-Tests | `02` §5.3–5.4, `05` §4.5 | +| K4 Meldung ≠ Geschäftshandlung, Ereignisverträge | `02` §8.2–8.3 | +| K5 eigene Sandbox-Anfrage, standardmäßig gesperrt | `04` §3 | +| K6 Verantwortungsmatrix | `03` §2.3 | +| K7 Deploymentweg | `06` §3 (U-0, U-F) | +| K8 Loyalty nur im Tester | `02` §6 | +| K9 Verhaltensvergleich in acht Dimensionen | `05` §4 | +| K10 Ereignisse als Ergänzung | `02` §8.4 | + +Aussagen des ersten Entwurfs, die nicht trugen, sind in §2.8 benannt. Kennzeichnung in allen Dokumenten dieser Reihe: - **[Befund]** – im Code oder in Tests nachgewiesen (mit Klasse/Methode) - **[Vorschlag]** – begründete Architekturempfehlung -- **[Entscheidung offen]** – vor der Umsetzung vom Betreiber zu treffen (gesammelt in `06`, Abschnitt 9) +- **[Entschieden]** – vom Betreiber festgelegt (gesammelt in `06` §9.1) +- **[Entscheidung offen]** – vor dem genannten Paket zu treffen (`06` §9.2, O1–O5) --- @@ -16,119 +34,152 @@ ## 1. Bestand in Zahlen [Befund] | Bereich | Umfang | |---|---| | Actions (`app/Actions`) | 56 Klassen, 35 davon mit `DB::transaction` | -| Ablaufsteuerung (`app/Process`) | 13 Klassen. Davon `CaseActivities` 459 Zeilen, `CaseAutomation` 75, `ProcessSettings` 120, `ProcessProfile` 213 Zeilen | +| Ablaufsteuerung (`app/Process`) | 13 Klassen. Davon `CaseActivities` 459 Zeilen, `CaseAutomation` 75, `ProcessSettings` 120, `ProcessProfile` 213 | | Einstellungen | `ProcessSetting`: 16 Werte (8 seit v0.10, 8 seit v0.11) | | Kanalanbindung | `ChannelConnector` (nur iCal-Import), `PortalIntake` (489 Zeilen), `ProcessPortalMail`, `MailboxReader` | -| Tests | 683 Feature-Testmethoden; die PHPUnit-Suite läuft vollständig auf **SQLite in-memory** (`phpunit.xml`: `DB_CONNECTION=sqlite`) | -| Zeitgesteuert | 15 Scheduler-Einträge (`routes/console.php`), angestoßen von n8n jede Minute | +| Tests | 683 Feature-Testmethoden; die PHPUnit-Suite läuft vollständig auf **SQLite in-memory** (`phpunit.xml`) | +| Zeitgesteuert | 15 Scheduler-Einträge (`routes/console.php`), angestoßen von n8n jede Minute über HTTP (`ChannelController`, `Artisan::call('schedule:run')`) | --- -## 2. Verpflichtender Soll-Ist-Abgleich +## 2. Soll-Ist-Abgleich ### 2.1 Bereits sauber gekapselte Fähigkeiten [Befund] -Die einzelnen Geschäftsoperationen sind gut gekapselt: Jede Action prüft ihre Voraussetzungen selbst, arbeitet transaktional und protokolliert über `CaseLog::record`. +Jede Action prüft ihre Voraussetzungen selbst, arbeitet transaktional und protokolliert über `CaseLog::record`. | Fähigkeit | Kapselung | Bewertung | |---|---|---| -| Preis berechnen | `PriceCalculator::calculate(Property, StayRequest)` → unveränderliches `PriceQuote` mit `QuoteLine`s (Typen u. a. `Discount`, `Adjustment`) | sehr gut; seiteneffektfrei, stark getestet (`PriceCalculatorTest`, `SpecialOfferPricingTest`, `MinimumStayRulesTest`) | -| Verfügbarkeit | `AvailabilityChecker::isAvailable`, `CalendarClearance::reasons/refresh` | gut; die einzige Stelle für Kalenderwahrheit | -| Verbindliches Angebot | `SendOffer::handle` (versioniert, `quoteFor` mit `Adjustment`-Zeile), `deliver` (Mail getrennt) | gut; Preisfestlegung an einer Stelle | +| Preis berechnen | `PriceCalculator::calculate(Property, StayRequest)` → unveränderliches `PriceQuote` mit `QuoteLine`s | sehr gut; seiteneffektfrei, stark getestet | +| Verfügbarkeit | `AvailabilityChecker::isAvailable`, `CalendarClearance::reasons/refresh` | gut; einzige Stelle für Kalenderwahrheit | +| Verbindliches Angebot | `SendOffer::handle` (versioniert, `quoteFor`), `deliver` | gut; Preisfestlegung an einer Stelle | | Annahme / Ablehnung | `AcceptOffer`, `RejectOffer` (Versionsprüfung) | gut | | Verbindlichkeit | `ConfirmBooking`, `TakeOverExternalBooking` | gut | -| Fakten und Herkunft | `ContributeCaseFacts` → `case_facts` (Quelle, Beleg, Sicherheit, Konflikt) | sehr gut; einheitlicher Eingang für alle Quellen (`FactSource`) | +| Fakten und Herkunft | `ContributeCaseFacts` → `case_facts` (Quelle, Beleg, Sicherheit, Konflikt) | sehr gut; ein Eingang für alle Quellen | | Datenbeschaffung | `RequestCaseData` + `data_requests` + `GuestDataController` | gut | | Halten | `RequestHold` (Zweck offer/clarification), `ExpireReservations`, `ReleaseReservation` | gut | -| Dokumente | `DocumentComposer` → `DocumentComposition::toConfirm`, `SendBookingDocuments`, `RentalContract` | gut | +| Dokumente | `DocumentComposer`, `SendBookingDocuments`, `RentalContract` | gut | | Portalbeträge | `RecordPortalAmounts`, `CaseMoney` | gut | -| Nachrichteneingang | `ReceiveInboundMessage`, `MessageMatcher`, `ExtractMessageFacts`, `LlmClient` (BYOK) | gut; KI liefert nur Vorschläge in `ContributeCaseFacts` | -| Mail-Schranke | `EnforceMailTestMode` (MessageSending, jeder Mailer); `MailTestModeGateTest` verhindert Umgehungen | sehr gut; ein zentraler Effektpunkt | -| Nachweis | `CaseLog`, `CaseRecorder` (Observer-gestützt), `BookingEvent` | gut | +| Nachrichteneingang | `ReceiveInboundMessage`, `MessageMatcher`, `ExtractMessageFacts`, `LlmClient` (BYOK) | gut; KI liefert nur Vorschläge | +| Mail-Schranke | `EnforceMailTestMode`; `MailTestModeGateTest` | sehr gut; zentraler Effektpunkt | +| Nachweis | `CaseLog`, `CaseRecorder`, `BookingEvent` | gut | -**Folgerung:** Die Fachmodule existieren inhaltlich schon. Es fehlt nicht die Logik, sondern eine **Beschreibung und Komposition** dieser Logik. +**Folgerung:** Die Fachmodule existieren inhaltlich schon. Es fehlt eine **Beschreibung und Komposition** dieser Logik. ### 2.2 Über mehrere Komponenten verteilte Geschäftsregeln [Befund] | Regel | Fundstellen | |---|---| -| „Wer liefert die Dokumente?“ (`documents() ===`) | `CaseActivities`, `CaseAutomation`, `ViewBooking`, `BookingInfolist`, `DocumentKind` | -| „Wer kassiert?“ (`payments() ===`) | `CaseActivities`, `CancelBooking`, `DocumentComposer`, `PaymentsRelationManager`, `Booking::needsPaymentMonitoring` (Z. 472) | -| „Wer schreibt dem Gast?“ (`guestMessages() ===`) | `CaseActivities`, `RequestReviews`, `SendBookingReminders` | -| Anfrage oder Buchung (`IntakeKind::Booking`) | 14 Dateien, u. a. `PortalIntake`, `RequestCaseData`, `ProvideGuestContact`, `DocumentComposer` | -| Vorreservierung ja/nein (`preReservation()`) | 15 Dateien, u. a. `AutoOffer`, `RequestCaseData`, `DocumentComposer`, `SendPendingAutoOffers` | +| „Wer liefert die Dokumente?“ | `CaseActivities`, `CaseAutomation`, `ViewBooking`, `BookingInfolist`, `DocumentKind` | +| „Wer kassiert?“ | `CaseActivities`, `CancelBooking`, `DocumentComposer`, `PaymentsRelationManager`, `Booking::needsPaymentMonitoring` | +| „Wer schreibt dem Gast?“ | `CaseActivities`, `RequestReviews`, `SendBookingReminders` | +| Anfrage oder Buchung (`IntakeKind::Booking`) | 14 Dateien | +| Vorreservierung ja/nein (`preReservation()`) | 15 Dateien | | Interne Belegung (`isInternal()`) | 11 Dateien | -| Pflichtangaben je Schritt | `CaseRequirements` (zentral) – aber das Warten auf diese Angaben ist in `CaseActivities` (Kontakt-, Angebots- und Wunschschritt), `AutoOffer::blockers` und `RequestCaseData` jeweils eigens ausgewertet | - -Diese Regeln sind **korrekt**, aber nur implizit ein „Prozess“. Ein neuer Schritt (z. B. Loyalty) müsste heute an mehreren dieser Stellen bedacht werden. +| Pflichtangaben je Schritt | `CaseRequirements` (zentral), ausgewertet in `CaseActivities`, `AutoOffer::blockers`, `RequestCaseData` | ### 2.3 Fest verdrahtete Prozesse und Archetypen [Befund] -1. **Ablaufliste:** `CaseActivities::for()` baut die Schritte als eine lange Folge von `if`-Blöcken. Sie verzweigt nach `$inquiry`, `$binding`, `preReservation()`, `documents()`, `payments()` und `isInternal()`; Letzteres führt nach `internal()`. Reihenfolge, Bedingung, Zustand und Aktion jedes Schritts stehen inline. Die Schlüssel sind Zeichenketten: `intake`, `contact`, `information`, `wish`, `wish_check`, `offer`, `acceptance`, `binding`, `price`, `documents`, `channel_block`, `payment`, `payout`, `deposit`, `balance`, `change_proposed`, `arrival_details`, `arrival_info`, `data_request`, `stay`, `review`, `closure`, `settlement`, `task_*`. -2. **Automatik:** `CaseAutomation::step()` kennt genau zwei Fälle (Angebot/Auskunft einer Anfrage, Unterlagen einer verbindlichen Buchung). Beide sind als eigene Bedingungen codiert und laufen nicht entlang der Ablaufliste. -3. **Archetyp:** `ProcessProfile::caseTypeFor()` leitet A1–A6 aus Eingangsart, „über Kanal“ und Verantwortungen ab. **Der Archetyp steuert nichts** (`CaseType::A` kommt nur in `ProcessProfile` vor). Er ist eine reine Klassifikation – genau das, was der Auftrag für Archetypen vorsieht. -4. **Schrittdetails:** `ActivityDetails::EVENT_TYPES` ordnet Verlaufsereignisse über die Schritt-Zeichenketten zu. Das ist eine zweite, parallel gepflegte Liste. -5. **Aktionen der Oberfläche:** `ViewBooking` bildet Aktionsnamen (`provideContact`, `approveDataRequest`, `portalPrice` …) auf Schritte ab. +1. **Ablaufliste:** `CaseActivities::for()` baut die Schritte als Folge von `if`-Blöcken. Reihenfolge, Bedingung, Zustand und Aktion stehen inline. Die Schlüssel sind Zeichenketten (`intake`, `contact`, `information`, `wish`, `offer`, `acceptance`, `binding`, `documents`, `payment`, `payout`, `arrival_info`, `stay`, `review`, `closure`, `settlement`, `task_*` …). +2. **Automatik:** `CaseAutomation::step()` kennt genau zwei Fälle, nämlich Angebot/Auskunft und Unterlagen. +3. **Archetyp:** `ProcessProfile::caseTypeFor()` leitet A1–A6 aus Eingangsart, „über Kanal“ und zwei Verantwortungen ab: `Documents = Portal` → A5, `Payments = Portal` → A4, sonst A3. **Der Archetyp steuert nichts.** +4. **Schrittdetails:** `ActivityDetails::EVENT_TYPES` ist eine zweite, parallel gepflegte Liste. +5. **Aktionen der Oberfläche:** `ViewBooking` bildet Aktionsnamen auf Schritte ab. -### 2.4 Tatsächlich vorhandene Konfiguration [Befund] +### 2.4 Vorhandene Konfiguration [Befund] -- Hierarchie `ProcessSettings::resolve`: System (`ProcessSetting::default`) → Vermieter (`tenants.process_defaults`) → Wohnung (`properties.process_overrides`, Vertragsvorlage) → Kanal × Eingangsart (`channels.process_overrides[intake]`) beziehungsweise Webseite (`forWebsite`). -- Nicht gesetzte Werte erben; ein bewusst gesetztes `0`/„nein“/„manuell“ bleibt erhalten (`ProcessSetting::normalize`). Jeder Wert trägt seine Herkunft (`ProcessProfile::source`, `sourceLabel`). -- Die Einstellungen werden beim Eingang eingefroren (`CaseRecorder::freeze` → `bookings.profile`). Ausnahme: `ProcessProfile::LIVE = [ContractTemplate]`. -- Kanalebene: `ProcessSetting::channelIntakes()` begrenzt, welche Einstellung je Eingangsart überhaupt am Kanal gilt. -- Oberflächen: `HandlingSettings` (Vermieter), `PropertyForm` (Wohnung), `ChannelForm`/`EditChannel` (Kanal), `EffectiveSettings` (Wirksamkeit). +- Die Hierarchie in `ProcessSettings::resolve` lautet: System → Vermieter → Wohnung → Kanal × Eingangsart bzw. Webseite. +- Nicht gesetzte Werte erben; ein bewusst gesetztes `0`/„nein“/„manuell“ bleibt erhalten. Jeder Wert trägt seine Herkunft. +- Eingefroren wird beim Eingang (`CaseRecorder::freeze` → `bookings.profile`). Ausnahme: `ProcessProfile::LIVE = [ContractTemplate]`; die tatsächliche Vorlagenversion friert `offer_terms` beim Angebot ein. +- Oberflächen: `HandlingSettings`, `PropertyForm`, `ChannelForm`/`EditChannel`, `EffectiveSettings`. -**Damit ist Ebene C (Kanalkonfiguration) zur Hälfte vorhanden:** Vererbung, Herkunft und Einfrieren sind gelöst. Es fehlen die Auswahl eines Ablaufs und die Darstellung entlang der Schritte. +Ebene C ist damit zur Hälfte vorhanden. Es fehlen die Wahl eines Ablaufs und die Darstellung entlang der Schritte. -### 2.5 Spezifizierte, aber nicht umgesetzte Freiheitsgrade [Befund] +### 2.5 Spezifizierte, nicht umgesetzte Freiheitsgrade [Befund] -| Freiheitsgrad (v0.10/v0.11, Vorschlag Kanalkonfigurator) | Stand | +| Freiheitsgrad | Stand | |---|---| -| Ablaufmodell je Kanal × Eingangsart wählen | fehlt; ergibt sich implizit aus `booking_model` und Verantwortungen | -| Optionale Schritte an-/abschalten (Bewertungsbitte, Erinnerungen, Adressprüfung) | nur teilweise über Einzelwerte (`GuestMessages`, `FormRequiresAddress`); Bewertungsbitte hängt an `guestMessages()` | -| Schrittweise Automatik (automatisch / nach Freigabe / manuell je Schritt) | nur global `Processing` sowie `DataRequest` (eigener Modus) | -| Nachweisstufe für ans Portal übertragene Schritte | fehlt (Vorschlag §5: angekündigt / laut Portal erledigt / nachgewiesen) | -| Vorschau „was passiert bei diesem Kanal“ | fehlt (`EffectiveSettings` zeigt Werte, keinen Ablauf) | -| Erweiterungspunkte (z. B. vor Preisfestlegung) | fehlen; Preis kommt direkt aus `PriceCalculator` in `CreateReservation`, `SendOffer::quoteFor`, `ChangeBooking` | -| Prozess durchspielen ohne Auswirkungen | fehlt; einzig die Testsuite (Entwickler) und der Mail-Testbetrieb (keine Datenisolation) | +| Ablaufmodell je Kanal × Eingangsart | fehlt; implizit aus `booking_model` und Verantwortungen | +| Optionale Schritte | nur über Einzelwerte; Bewertungsbitte hängt an `guestMessages()` | +| Ausführungsart je Schritt | nur global `Processing` sowie `DataRequest` | +| Ausführende je Schritt im Rahmen des Archetyps | nur über `GuestMessages`, `Documents`, `Payments` als Kanalwerte, ohne Schrittbezug | +| Nachweisstufe für übertragene Schritte | fehlt (Muster vorhanden: `ChannelTaskProof`) | +| Vorschau | fehlt | +| Erweiterungspunkte | fehlen | +| Prozess durchspielen ohne Auswirkungen | fehlt | -### 2.6 Ohne grundlegenden Umbau weiterverwendbar [Befund → Vorschlag] +### 2.6 Weiterverwendbar [Befund → Vorschlag] -Alle Actions aus 2.1, `PriceCalculator`, `CaseRequirements`, `ContributeCaseFacts`, `CaseLog`/`CaseRecorder`, `ProcessSettings` samt Vererbung, `ProcessProfile` samt Einfrieren, `EnforceMailTestMode`, `PortalIntake` (fachliche Annahme), die Connectors und Parser, die Datenmodelle (`bookings.profile`, `channels.process_overrides` sind JSON-Spalten und nehmen die neuen Angaben **ohne Migration** auf) sowie die gesamte Testsuite als Regressionsnetz. +In ihrer **Fachlogik** bleiben erhalten: -### 2.7 Wirklich notwendige Architekturänderungen [Vorschlag] +- die Actions aus 2.1, `PriceCalculator`, `CaseRequirements`, `ContributeCaseFacts`; +- `CaseLog`/`CaseRecorder`, `ProcessSettings`, `ProcessProfile`; +- `EnforceMailTestMode`; +- `PortalIntake` (Entscheidungsregeln), `SyncChannel`, `ProcessPortalMail`, Connectors und Parser; +- die JSON-Spalten `bookings.profile` und `channels.process_overrides` (ohne Migration); +- die Testsuite. -1. **`CaseActivities` und `CaseAutomation` werden zu einer Ablaufsteuerung über Module.** Jeder heutige `if`-Block wird zu einem Schritt eines Fachmoduls mit eigenem Vertrag. Die Reihenfolge kommt aus einem versionierten Prozessmodell, nicht mehr aus der Methode. Das ist der Kern und keine bloße Abstraktionsschicht: Die alte Methode verschwindet. -2. **Ein Erweiterungspunkt im Preisweg:** `SendOffer::quoteFor` (und die anderen Aufrufer für verbindliche Preise) holen den Preis über eine kleine Fassade `CasePricing`. Sie ruft `PriceCalculator` unverändert und ergänzt Preisbeiträge aktiver Module als `QuoteLine`s. -3. **Kanalereignisse statt `BlockedPeriod`-zentrierter Annahme:** `PortalIntake` nimmt künftig ein normalisiertes Ereignis an (`IncomingBooking` …). iCal, Mail und spätere APIs liefern dieses Ereignis. -4. **Isolierte Ausführungsumgebung für den Prozess-Tester** (getrennte Datenverbindung + Effekt-Ports + simulierte Zeit). -5. **Kanalkonfigurator als Oberfläche über dem Prozessmodell**, gespeichert in den bestehenden JSON-Spalten. +**Nicht unverändert** bleiben die **Aufrufstellen**, über die Ablauf und Preis gesteuert werden. Sie sind vollständig in `06` §1 aufgeführt. -Alles andere bleibt. +### 2.7 Notwendige Architekturänderungen [Vorschlag] + +1. **`CaseActivities` und `CaseAutomation` werden zu einer Ablaufsteuerung über Module.** + - Was laufen darf, folgt aus fachlichen Abhängigkeiten, nicht aus der Position (`02` §7). + - Die verteilten direkten Automatik-Aufrufe gehen über `ProcessRunner::advance`. +2. **Ein Erweiterungspunkt im Preisweg:** Die Fassade `CasePricing` ruft `PriceCalculator` unverändert und ergänzt Preisbeiträge aktiver Module. Ihre Aufrufer werden umgestellt. +3. **Kanalereignisse als zusätzlicher Eingang** für künftige Adapter. Sie werden auf den vorhandenen Eingang abgebildet; iCal und Mail bleiben (`02` §8.4). +4. **Prozess-Tester in einer eigenen Sandbox-Anfrage**, in der nur Sandbox-Speicher und simulierte Effekte konfiguriert sind (`04` §3). +5. **Kanalkonfigurator am Schritt** mit Verantwortungsmatrix, gespeichert in den bestehenden JSON-Spalten (`03`). + +### 2.8 Ergänzende Befunde (Review V2) und korrigierte Aussagen + +**Neue Befunde:** + +| Thema | Befund | Folge | +|---|---|---| +| Automatik ist verteilt | `CaseAutomation::advance` wird von 5 Stellen gerufen, kennt aber nur 2 Fälle. `CreateReservation`, `SubmitBookingWish` und `TakeOverExternalBooking` rufen `AutoOffer`/`RequestCaseData::forNextStep` direkt. Zeitgesteuert laufen `bookings:auto-offers`, `cases:data-requests` und `bookings:expire-holds` (ohne `advance`). | Runner übernimmt diese Auslöser ohne neuen Scheduler (`02` §7.4) | +| Klärungsreservierung | Gesetzt wird sie von `RequestHold::for` im Eingang unter Kalendersperre. `ExpireReservations` lässt Klärungsfälle offen. `AutoOffer` akzeptiert eine abgelaufene Klärungsreservierung und prüft nur den freien Zeitraum. | Szenario K1 ist fachlich heute schon angelegt; der Runner darf es nicht verhindern | +| Eingefrorene Vertragsdaten | Eingefroren sind `quote`, `total`, `offer_terms` (inkl. Stornoregel), `acceptance.terms_sha256`, Fälligkeiten und `contract_path`. **Ausgewertet** werden sie durch veränderlichen Code: `CancellationCost` (zählt `Discount`-Zeilen zur Stornogrundlage), `CancellationPolicy::tierFor`, `ContractPlaceholders`. | Regel R1 und Bestandsfall-Tests (`02` §5.3–5.4) | +| Portalmeldungen | `PortalIntake` storniert, ändert oder gibt nie frei (E-019). Stornomails heben nur die Mail-Sperre auf. Portalzahlungen sind `GuestViaPortal`. Die Mail-Zuordnung erfolgt nur über die Absenderdomain, also ohne Authentifizierung. | Stufen M1–M4 und Ereignisverträge (`02` §8) | +| Seiteneffektwege | Datenbank (Eloquent/Query Builder; `getPdo` nur in `BackupDatabase`), Mail (53 Dateien), `Http` (KI, iCal, n8n-Webhook in `CreateChannelTasks`), IMAP (`MailboxReader`), `Storage` (5), Cache (10, u. a. `Cache::lock`, `rememberForever`), Sessions (database), `encrypted`-Casts, signierte Links (16), statische Zwischenspeicher, 18 `rescue()`. Keine Queue-Jobs, kein `exec`, kein Octane. | Tester „standardmäßig gesperrt“ (`04` §3) | +| Deployment | Push auf `develop` → automatisches Deployment `staging` (stommer.info); `main` → `production`. Ein freizugebendes Produktivsystem gibt es derzeit nicht. | Umsetzungsweg K7 (`06` U-F) | + +**Korrigierte Aussagen des ersten Entwurfs:** + +| Erster Entwurf | Korrektur | +|---|---| +| „Alle 56 Actions unverändert“ | Fachlogik unverändert; Aufrufstellen in mehreren Actions werden geändert (`06` §1) | +| Runner führt „den ersten offenen automatischen Schritt“ aus | abhängigkeitsbasierte Bereitschaft; unabhängige Schritte laufen (`02` §7) | +| Eingefrorener Plan schützt laufende Vorgänge | Er schützt die Definition. Vertragsdaten und ihre Auswertung brauchen R1–R6 und eigene Tests. | +| `Provenance.trust` = Nachweisstufe | verworfen: Quelle ≠ Nachweis (`02` §8.2) | +| Jede Schutzschicht verhindert für sich jeden Schaden | zurückgenommen; eigene Sandbox-Anfrage, benannte Grenze für native PHP-Aufrufe (`04` §3.5) | +| `PortalIntake` auf Ereignisse umbauen | nicht nötig; Ergänzung reicht (`02` §8.4) | +| 22 Module als Ergebnis | Startkatalog, Zahl folgt aus Kriterien (`02` §2) | +| Loyalty produktiv wählbar | nur im Tester (E7) | +| Merge nach `develop` und `main` nach der Abnahme | Merge nach `develop` → Deployment auf stommer.info → Abnahme; kein `main` (`06` U-F) | +| Aufbewahrung Testberichte 90 Tage | über das Löschkonzept, Wert offen (O3) | --- ## 3. Vergleich realistischer Architekturvarianten -| | V0 Status quo + mehr Einzeleinstellungen | V1 Beschreibungsschicht über bestehender Logik | **V2 Modulkatalog + Prozessmodelle im Code (empfohlen)** | V3 Workflow-Engine / Zustandsmaschinen-Paket | +| | V0 Status quo + mehr Einzeleinstellungen | V1 Beschreibungsschicht über bestehender Logik | **V2 Modulkatalog + Prozessmodelle im Code (angenommen)** | V3 Workflow-Engine / Zustandsmaschinen-Paket | |---|---|---|---|---| -| Idee | weitere `ProcessSetting`s, `CaseActivities` erweitern | Schrittbeschreibungen für Konfigurator und Vorschau; `CaseActivities` bleibt verdrahtet | Fachmodule mit Vertrag; Modelle als versionierte PHP-Definitionen; `CaseActivities`/`CaseAutomation` iterieren das eingefrorene Modell | z. B. `symfony/workflow` oder eigene Engine mit Zuständen/Übergängen in DB | -| Loyalty-Nachweis (N3) | `if` in `CaseActivities`, `SendOffer`, `AutoOffer`; Einstellungswildwuchs | Beschreibung **und** Code an mehreren Stellen – Doppelpflege | 2 Module + 1 Variante + Test; Kern unverändert | Modell in Engine + Adapter auf Actions | -| Konfigurator | Feldsammlung (heutiges Problem) | möglich, aber Beschreibung kann von Wirklichkeit abweichen | Oberfläche liest dieselbe Definition, nach der ausgeführt wird | möglich | -| Tester mit gleicher Logik | nicht möglich | nur Vorschau, kein Durchlauf | Durchlauf über dieselben Module und Actions | möglich, aber zweite Steuerlogik neben Actions | -| Neue Abhängigkeit | nein | nein | nein | ja (Auftrag: nicht erwünscht) | -| Risiko für laufende Vorgänge | gering | gering | mittel, beherrschbar durch Referenzvergleich (Golden Master, `05` §4) | hoch (zweite Engine, Datenmigration) | -| Aufwand | klein, wächst je Änderung | klein–mittel | mittel (einmalig) | hoch | -| Erfüllt Auftrag | nein (§2, §11) | nein („bloße Abstraktionsschicht genügt nicht“, §6) | ja | nein (§6 „keine zweite Engine“, §11) | - -**Empfehlung: V2.** V1 ist als Rückfallebene ungeeignet: Der Konfigurator würde einen Ablauf zeigen, der nicht der ausgeführte ist. Für den Tester gilt dasselbe. +| Idee | weitere `ProcessSetting`s, `CaseActivities` erweitern | Schrittbeschreibungen für Konfigurator und Vorschau; Logik bleibt verdrahtet | Fachmodule mit Vertrag, Modelle als versionierte PHP-Definitionen, Runner über eingefrorenen Plan | z. B. `symfony/workflow` oder eigene Engine mit Zuständen in der DB | +| Loyalty-Nachweis (N3) | `if` an mehreren Stellen | Beschreibung **und** Code an mehreren Stellen | 2 Module + 1 Variante + Tests (nach einmaliger Preisfassade) | Modell in Engine + Adapter | +| Konfigurator | Feldsammlung | Beschreibung kann von Wirklichkeit abweichen | liest dieselbe Definition, nach der ausgeführt wird | möglich | +| Tester mit gleicher Logik | nein | nur Vorschau | Durchlauf über dieselben Module und Actions | zweite Steuerlogik | +| Neue Abhängigkeit | nein | nein | nein | ja | +| Risiko für laufende Vorgänge | gering | gering | mittel; beherrschbar durch Verhaltensvergleich und Bestandsfall-Tests | hoch | +| Erfüllt Auftrag | nein | nein | ja | nein | ### Was V2 bewusst nicht ist -- Kein Vermieter-Designer; Modelle und Varianten entstehen nur im Code (Pull Request, Tests). -- Keine Bedingungen durch Endanwender – nur deklarierte Parameter und deklarierte optionale Schritte. -- Keine Speicherung von Modellen in der Datenbank; dort liegen nur **Auswahl und Parameter** (bestehende JSON-Spalten). -- Kein dynamisches Laden: Module sind in einem festen Katalog (`config/process.php`) registriert, wie heute die Connectors in `config/channels.php`. +- Kein Vermieter-Designer; Modelle und Varianten entstehen nur im Code. +- Keine Bedingungen durch Endanwender – nur deklarierte Parameter, Ausführende und optionale Schritte. +- Keine Modelle in der Datenbank; dort liegen nur Auswahl und Parameter. +- Kein dynamisches Laden (fester Katalog `config/process.php`). +- Keine BPMN- oder Workflow-Engine: Der Runner berechnet Bereitschaft aus abgeleiteten Zuständen und Abhängigkeiten und speichert keinen Schrittzustand. --- @@ -136,24 +187,42 @@ ## 4. Risiken | Risiko | Wirkung | Gegenmaßnahme | |---|---|---| -| Umbau von `CaseActivities` ändert Verhalten unbemerkt | falsche nächste Schritte, falsche Automatik | Golden-Master-Vergleich alt/neu über alle Testfälle und eine Fallmatrix (`05` §4); Umstellung erst, wenn identisch | -| Laufende Vorgänge ohne Modellangabe | Ablauf ändert sich mitten im Vorgang | Abbildung `legacy` → Modell v1 aus `caseType`+`intake`+Profilwerten; v1 reproduziert heutige Liste exakt (`06` §4) | -| Tester greift doch auf echte Daten zu | Schaden an Buchungen, Mails, Portalen | mehrschichtige Isolation, Schreibwächter auf der echten Verbindung, Sicherheitstests (`04` §3) | -| SQLite auf Strato nicht verfügbar | Tester ohne getrennte Datenhaltung | Voraussetzung vorab prüfen (`php -m`); Ausweichlösung eigene MariaDB-Datenbank des Tarifs (`04` §3.6) | -| Modulvertrag wird zu formal | Mehraufwand ohne Nutzen | Vertrag als PHP-Definition mit wenigen Pflichtfeldern; Prüfung automatisch im Vertragstest | -| Zu feine Module | Konfigurator unübersichtlich | ca. 20 Module entlang der Prozesslandkarte, nicht je Methode (`02` §2) | +| Umbau von Ablauf und Auslösern ändert Verhalten unbemerkt | falsche Schritte, Automatik oder Mails | Verhaltensvergleich in acht Dimensionen, Fehlerregister (`05` §4) | +| Gemeinsame Action ändert laufende Vorgänge | andere Stornokosten, Fristen, Preise | R1–R6, `OngoingCaseRegressionTest` (`02` §5.3–5.4) | +| Laufende Vorgänge ohne Modellangabe | Ablauf ändert sich mitten im Vorgang | Legacy-Abbildung auf Modell v1 (`06` §4) | +| Tester greift auf echte Daten oder Dienste zu | Schaden an Buchungen, Mails, Portalen | Sandbox-Anfrage ohne echte Konfiguration, Aufzeichnung vor Abbruch, Negativtests (`04` §3, §7) | +| SQLite auf dem Server nicht verfügbar | Tester ohne getrennte Datenhaltung | U-0 prüft V1; MariaDB nur mit getrenntem Benutzer (V6), sonst kein Tester auf diesem Server | +| Modulvertrag verspricht mehr als geprüft | Scheinsicherheit | jedes Feld mit Prüfung oder als „beschreibend“ gekennzeichnet (`02` §3.2) | +| Zu feine oder zu grobe Module | Konfigurator unübersichtlich bzw. starr | Kriterien statt Sollzahl (`02` §2) | --- -## 5. Abschließende kritische Prüfung (Auftrag §15) +## 5. Abschließender Architekturcheck (Review V2) -1. **Sinnvoll gekapselt oder umbenannt?** Die Actions bleiben, wie sie sind – das ist gewollt, sie sind gut. Neu ist, was heute fehlt: Jeder Schritt erhält Bedingung, Zustand, Automatik, Parameter, Seiteneffekte und Nachweis an einer Stelle (Modul) statt verteilt über `CaseActivities`, `CaseAutomation`, `ActivityDetails::EVENT_TYPES` und `ViewBooking`. Die Verteilung aus 2.2 wird beseitigt, nicht umbenannt. -2. **Varianten ohne Sonderprogrammierung?** Ja, solange die Variante nur vorhandene Module kombiniert oder an Erweiterungspunkten ergänzt (N3). Ein neues Fachmodul braucht weiterhin Code und Tests – so verlangt. -3. **Modellauswahl praktisch nutzbar?** Die Auswahl ist je Kanal × Eingangsart auf die zulässigen Modelle eingeschränkt, meist 1–2 Optionen. Ein Standard wird aus dem heutigen Verhalten vorbelegt (`03` §2). -4. **Schritte verständlich, Einstellungen am Schritt?** Ja: Der Konfigurator rendert die Schrittliste aus dem Modell; Parameter hängen am Modul (`03` §3). -5. **Loyalty ohne Eingriff in andere Archetypen?** Ja; nachgewiesen in `02` §6 mit vollständiger Liste geänderter und unveränderter Komponenten. Einmalig nötig ist der generische Preis-Erweiterungspunkt; er ist kein Loyalty-Code. -6. **Änderungen nachvollziehbar?** Ja über den Katalog: Modell × Modul × Parameter × Testgruppe (`05` §2); `php artisan process:impact ` liest dieselben Definitionen. -7. **Tester mit derselben Logik?** Ja: Er führt dieselben Actions und dieselbe Ablaufsteuerung aus, nur mit getrennter Datenverbindung und ausgetauschten Effekt-Ports (`04` §2). -8. **Seiteneffekte technisch ausgeschlossen?** Mehrschichtig: andere Datenverbindung (physisch andere Datei), Schreibwächter auf der echten Verbindung, Mail/HTTP/Dateien/Warteschlange auf Fakes, keine Connector-Netzzugriffe, Abbruch bei jeder unerwarteten Effektart. Ein Rollback allein wird nicht verwendet. -9. **Neue Portal-APIs?** Ja über Kanalereignisse; ein API-Adapter liefert `IncomingBooking` wie heute iCal/Mail (N7, `02` §8). -10. **Komplexität gerechtfertigt?** Ja, weil drei Ziele (Konfigurator, Tester, Erweiterbarkeit) dieselbe Grundlage brauchen, die Actions erhalten bleiben und keine neue Abhängigkeit, keine Engine und keine Datenbankmigration für Modelle entsteht. Einfachere Varianten (V0/V1) erfüllen Konfigurator **und** Tester nicht. Bewusst weggelassen: frei kombinierbare Bedingungen, grafische Modelle, Modellpflege in der Datenbank, eine eigene Ereignis-/Zustandsmaschine. +1. **Ist die Modularität echt oder nur eine neue Beschreibungsschicht?** Echt, mit einer benannten Grenze. + - Konfigurator, Vorschau, Tester und Vorgang lesen dieselbe Definition, nach der der Runner ausführt. Die verdrahtete Methode `CaseActivities::for` verschwindet. + - Die Grenze: Actions bleiben gemeinsame Bausteine. Ein Modul kapselt ihre Komposition, nicht ihren Code. Deshalb sichern R1–R6 die gemeinsamen Actions zusätzlich. +2. **Ist die Steuerung bei Wartezuständen und unabhängigen Aktivitäten korrekt?** Ja. + - Bereitschaft folgt aus `requires`, Zustände bleiben abgeleitet, es gibt keine zweite Wahrheit. + - Das Szenario K1 ist Schritt für Schritt belegt (`02` §7.6) und als Test vorgesehen. + - Grenze: Unabhängigkeit heißt fachliche, nicht technische Parallelität. Bereite Schritte laufen nacheinander in einer Bewertungsrunde; das genügt für diese Vorgänge. +3. **Bleibt die Konfiguration flexibel genug?** Ja. + - Das Modell legt nur die bestimmenden Verantwortungen fest. + - Ausführende, Ausführungsart, Fristen, Schalter und Nachweis werden am Schritt eingestellt (`03` §2.3, §3). + - Offen ist nur O1. +4. **Können neue Fachmodule ohne Eingriff in unabhängige Modelle ergänzt werden?** Ja, wenn ein vorhandener Erweiterungspunkt passt. Belegt ist das mit zwei Prüffällen (Loyalty, Adressprüfung). Ein neuer Punkt ist eine bewusste Architekturänderung (Stufe 4). +5. **Sind bestehende Buchungen, Preise und Verpflichtungen geschützt?** Ja, über vier Ebenen: + - eingefrorene Vertragsdaten; + - stabile Auswertung (R1); + - eingefrorene Prozessdefinition (E3); + - Bestandsfall-Tests in jeder CI. + + Kanalereignisse ändern verbindliche Vorgänge nie selbst (M4). Grenze: Gegen Fehler in einer Action, die Vertragsdaten **schreibt**, schützt nur die Testabdeckung. +6. **Ist der Prozess-Tester auch bei Fehlern sicher?** Für alle Wege über Laravel-Fassaden ja: Die Sandbox-Anfrage kennt Betriebsdatenbank und echte Dienste nicht, Verstöße werden vor dem Abbruch aufgezeichnet, und es gibt keinen Zustand wiederherzustellen. Native PHP-Aufrufe sind nicht zur Laufzeit abfangbar, sondern durch einen statischen Test ausgeschlossen (`04` §3.5). Diese Grenze ist dokumentiert. +7. **Sind neue Portal-APIs mit begrenztem Aufwand möglich?** Ja. Ein Adapter liefert Ereignisse, die auf den vorhandenen Eingang abgebildet werden; Duplikat- und Sicherheitsregeln bleiben eine Implementierung (`02` §8). +8. **Ist die zusätzliche Komplexität gerechtfertigt?** Ja, aus drei Gründen: + - Konfigurator, Tester und Erweiterbarkeit brauchen dieselbe Grundlage. + - Gegenüber dem ersten Entwurf wurde Komplexität **entfernt**: kein Umbau des Kanaleingangs, keine produktive Loyalty, kein Umschalten in der Admin-Anfrage. + - Hinzugekommen ist nur, was die Sicherheit trägt: Bestandsfall-Tests, Negativtests, Sandbox-Anfrage. + + Aufwand: 34–45 statt 32–41 Entwicklertage. diff --git a/docs/Prozessarchitektur/Architektur/02_FACHMODUL_ARCHITEKTUR.md b/docs/Prozessarchitektur/Architektur/02_FACHMODUL_ARCHITEKTUR.md index 660d0df..e7ee7fd 100644 --- a/docs/Prozessarchitektur/Architektur/02_FACHMODUL_ARCHITEKTUR.md +++ b/docs/Prozessarchitektur/Architektur/02_FACHMODUL_ARCHITEKTUR.md @@ -1,6 +1,6 @@ # 02 – Fachmodul-Architektur: Module, Prozessmodelle, Erweiterungspunkte, Ausführung -Stand: 04.11.2026 · Kennzeichnung: **[Befund]**, **[Vorschlag]**, **[Entscheidung offen]** (siehe `01`) +Stand: 04.11.2026, **Review V2** (Korrekturen K1–K4, K8, K10 eingearbeitet) · Kennzeichnung: **[Befund]**, **[Vorschlag]**, **[Entschieden]**, **[Entscheidung offen]** (siehe `01`) --- @@ -8,24 +8,47 @@ ## 1. Begriffe und Ebenen [Vorschlag] | Begriff | Bedeutung | Ort im Code | |---|---|---| -| **Archetyp** (A1–A6) | Geschäftsklassifikation aus Herkunft, Verbindlichkeit und Verantwortung. Er **steuert nichts**, sondern dient nur der Klassifikation und Plausibilisierung. | `CaseType`, `ProcessProfile::caseTypeFor` (unverändert) | -| **Fachmodul** | Wiederverwendbare fachliche Fähigkeit mit Vertrag. Es bietet einen oder mehrere **Schritte** an. | `app/Process/Modules/*` (neu); nutzt die bestehenden Actions | -| **Prozessmodell** | Zentral definierte, versionierte, geordnete Folge von Schritten mit Erweiterungspunkten. Es ist für bestimmte Archetypen und Eingangsarten zulässig. | `app/Process/Models/*` (neu, PHP) | -| **Prozessvariante** | Zulässige Ausprägung eines Modells: zusätzliche Module an Erweiterungspunkten und/oder andere Vorgaben. Sie hat **denselben Archetyp**. | im Modell deklariert | -| **Kanalkonfiguration** | Auswahl Modell/Variante je Kanal × Eingangsart, dazu Parameter und optionale Schritte | `channels.process_overrides[intake]` (bestehende JSON-Spalte) | -| **Vorgangsinstanz** | Ein Fall mit eingefrorenem **Prozessplan** (Modell@Version, Variante, Modul-Versionen, aktive Schritte, Parameter mit Herkunft) | `bookings.profile` (bestehende JSON-Spalte, Schlüssel `plan`) | +| **Archetyp** (A1–A6) | Geschäftsklassifikation aus Herkunft, Verbindlichkeit und den **archetypbestimmenden** Verantwortungen (`03` §2.3). Er wird abgeleitet und plausibilisiert, er steuert keinen Schritt. | `CaseType`, `ProcessProfile::caseTypeFor` (unverändert) | +| **Fachmodul** | Wiederverwendbare fachliche Fähigkeit mit Vertrag. Es bietet einen oder mehrere **Schritte** an. | `app/Process/Modules/*` (neu); ruft die bestehenden Actions auf | +| **Prozessmodell** | Zentral definierte, versionierte Menge von Schritten mit fachlichen Abhängigkeiten und Erweiterungspunkten. Es legt den verbindlichen Rahmen fest, darunter die festen Verantwortungen. | `app/Process/Models/*` (neu, PHP) | +| **Prozessvariante** | Zulässige Ausprägung eines Modells: zusätzliche Module an Erweiterungspunkten. Sie hat **denselben Archetyp**. | im Modell deklariert | +| **Kanalkonfiguration** | Modell und Variante je Kanal × Eingangsart, dazu je Schritt: an/aus (nur optionale), Ausführungsart, Ausführende (nur innerhalb der zulässigen Menge), Parameter, Mindestnachweis | `channels.process_overrides[intake]` (bestehende JSON-Spalte) | +| **Prozessplan** | Beim Eingang eingefrorene Definition eines Vorgangs: Modell@Version, Variante, Modulversionen, Schrittschalter, Ausführende, Parameter mit Herkunft | `bookings.profile.plan` (bestehende JSON-Spalte) | Ebene A = Module, B = Modelle/Varianten, C = Kanalkonfiguration, D = Ausführung (`ProcessRunner`) und Tester (`04`). --- -## 2. Granularität [Vorschlag] +## 2. Modulgrenzen: Kriterien statt Sollzahl [Vorschlag, K2] -**Regel:** Ein Modul entspricht einer fachlichen Verantwortung, die im Vorgang als eigener Schritt sichtbar ist. Es kann eigenständig aktiv oder inaktiv sein, oder es hat eigene Parameter. Was nur gemeinsam sinnvoll ist, bleibt ein Modul, auch wenn es mehrere Actions nutzt (Beispiel `offer.binding`: Angebot erstellen und versenden). „Anschrift prüfen“, „Gast identifizieren“ und „Gastdaten validieren“ werden **Parameter** von `guest.details`, keine eigenen Module. Sie teilen dieselben Daten (`case_facts`), dieselbe Pflichtfeldlogik (`CaseRequirements`) und denselben Eingang (`ContributeCaseFacts`). Eine Trennung würde nur Übergaben erzeugen. +Der Katalog in §4 ist ein **Startkatalog**. Die Zahl der Module ergibt sich aus den fachlichen Verantwortungen und darf wachsen oder schrumpfen. Für jede neue Fähigkeit gilt die folgende Prüfreihenfolge. Die erste zutreffende Stufe entscheidet. -Querschnittsdienste wie Preisberechnung, Mail-Schranke, Verlauf, Mandant und Nachrichtenzuordnung sind **keine Schritte**. Module nutzen sie, und im Konfigurator erscheinen sie nicht als Schritt. +| Stufe | Wann | Folge | Beispiel | +|---|---|---|---| +| **1 Parameter** eines bestehenden Moduls | Die Funktion nutzt dieselben Daten, dieselbe Pflichtfeldlogik und denselben Eingang wie das Modul. Sie hat kein eigenes Ergebnis mit eigener Bedeutung, keinen eigenen Wartezustand, keinen eigenen Effekt und keine eigene Fehlerbehandlung. | Neuer Parameter in `ModuleDefinition::parameters`. Die Modulversion steigt nur, wenn sich das Verhalten bei unverändertem Parameterwert ändert. | „Postleitzahl ist Pflicht“, „Anschrift erst vor dem Angebot“ → `guest.details` (`FormRequiresAddress`, `CaseRequirements`) | +| **2 Erweiterung** eines bestehenden Moduls | Die Funktion gehört zur Verantwortung des Moduls. Sie ändert dessen Ergebnis oder Zustände, bleibt aber ohne eigenen Effekt nach außen und ohne eigenes Warten. | Neue Modulversion (§5.3). Bestehende Pläne behalten die alte, falls die Änderung nicht als kompatibel deklariert ist. | weitere Plausibilitätsprüfung im Fakteneingang | +| **3 Neues Modul** | Mindestens **zwei** der folgenden Merkmale treffen zu: (a) eigenes fachliches Ergebnis, das andere Schritte lesen; (b) eigener Effekt nach außen (Netz, Mail, Dokument, Kalender); (c) eigener Warte- oder Fehlerzustand mit eigener Folge, etwa manueller Klärung; (d) eigener Nachweis; (e) soll je Kanal unabhängig an- oder abschaltbar sein. | Neue Klasse, Registereintrag, Modultest, Platz an einem Erweiterungspunkt oder in einem Modell | `guest.loyalty_status` (a, d, e); `guest.address_verification` (a, b, c, d, e) | +| **4 Neuer Erweiterungspunkt** | Ein neues Modul muss an einer Stelle wirken, an der **kein** vorhandener Punkt garantiert, was es braucht: Datenlage, Phase vor oder nach einer Verbindlichkeitsgrenze. | Änderung **aller** Modelle, die den Punkt anbieten sollen, mit Modelltests. Das ist eine Architekturänderung; sie wird im PR begründet. | — (Loyalty und Adressprüfung kommen mit den vorhandenen Punkten aus) | -Ergebnis: **22 Module** (20 aus dem Bestand, 2 neu für Loyalty) und **5 Querschnittsdienste**, entlang P01–P05. +Querschnittsdienste (Preisberechnung, Mail-Schranke, Verlauf, Mandant, Nachrichtenzuordnung) sind **keine Schritte**. Module nutzen sie, und im Konfigurator erscheinen sie nicht. + +### 2.1 Prüffall Adressprüfung (nicht Teil der Umsetzung) + +`guest.address_verification` erfüllt Stufe 3: + +- **Ergebnis:** `verified`, `corrected`, `rejected` oder `unknown` als Fakt mit Herkunft. +- **Effekt:** HTTP-Aufruf eines Prüfdienstes über die `Http`-Fassade. +- **Wartezustand:** `Waiting` (Dienst nicht erreichbar, nächster Versuch), daraus eine Aufgabe „Anschrift klären“. +- **Nachweis:** Antwort des Dienstes im Verlauf. +- **Schaltbarkeit:** je Kanal an oder aus. + +Einbau ohne Umbau anderer Archetypen: + +1. Platz am vorhandenen Punkt `AfterGuestIdentified`. Das Modul hat `requires: guest.details` (Anschrift vorhanden) und `blocksDependents: false`. Ein `unknown` hält damit **nicht** das Angebot auf; ob ein `rejected` das Angebot aufhält, ist ein Modulparameter. +2. Varianten mit dem Modul **nur** in den Modellen, die es nutzen sollen (z. B. `a1.offer:address_check`). A2–A6 bleiben unberührt. Für Portalbuchungen (A3–A5) bliebe die Verbindlichkeit unberührt: Das Modul darf dort nur prüfen und Aufgaben erzeugen, nie den Vorgang anhalten (Wächter `respectsExternalBinding`, §3.2). +3. Der Tester simuliert den Dienst über `Http::fake` (`04` §3). + +Dasselbe Muster gilt für `guest.loyalty_status` (§6). Beide Prüffälle brauchen **keinen** neuen Erweiterungspunkt. --- @@ -50,7 +73,7 @@ ### 3.1 Technische Form /** Whether the step belongs to this case at all (condition), from case data and plan parameters. */ public function applies(CaseContext $case): bool; - /** Where the step stands – today's inline match blocks in CaseActivities. */ + /** Where the step stands, derived from case data; includes what it waits for and until when (§7.2). */ public function activity(CaseContext $case): Activity; /** What keeps the step from being carried out now (plain words, empty = may run). */ @@ -59,122 +82,115 @@ ### 3.1 Technische Form /** Carry the step out by calling the existing Action(s); only for steps with an automatic mode. */ public function run(CaseContext $case): StepResult; } -``` -Zusätzlich gibt es einen optionalen Untervertrag für Preisbeiträge: - -```php interface ContributesToPrice { - /** Lines added before the price is fixed; never touches a binding case (enforced by CasePricing). */ + /** Lines added before the price is fixed; CasePricing never calls this for a binding case. */ public function priceLines(CaseContext $case, PriceQuote $quote): PriceContribution; // lines + basis + outcome } ``` -`CaseContext` bündelt den `Booking`, den eingefrorenen `ProcessPlan`, die Parameter dieses Moduls und die aktuelle Zeit (aus `now()`; im Tester simuliert). Module halten **keinen** eigenen Zustand. Der Zustand steht weiter in `bookings`, `case_facts`, `booking_tasks`, `data_requests` und `booking_events`, genau wie heute. +`CaseContext` bündelt den `Booking`, den eingefrorenen `ProcessPlan`, die Parameter dieses Moduls und die aktuelle Zeit (`now()`; im Tester simuliert). Module halten **keinen** eigenen Zustand. Der Zustand steht weiter in `bookings`, `case_facts`, `booking_tasks`, `data_requests` und `booking_events`. -### 3.2 Pflichtangaben in `ModuleDefinition` +### 3.2 Pflichtangaben in `ModuleDefinition` und wie sie geprüft werden -| Vertragsfeld (Auftrag §4) | Feld | Beispiel `offer.binding` | +Ein Vertragsfeld verspricht nur, was ein Test technisch prüfen kann. Die Spalte „Prüfung“ sagt, womit. Felder ohne automatische Prüfung sind ausdrücklich **beschreibend**; sie werden im Review geprüft und begründen keine Sicherheitszusage. + +| Feld | Inhalt (Beispiel `offer.binding`) | Prüfung | |---|---|---| -| Kennung und Version | `key()`, `version()` | `offer.binding` / 1 | -| Fachliche Aufgabe | `purpose` (Klartext für Konfigurator) | „Verbindliches Angebot mit Vertragsentwurf erstellen und dem Gast senden“ | -| Benötigte Eingabedaten | `needs`: Felder aus `CaseRequirements` / Fallattribute | `CaseRequirements::OFFER`, Zeitraum, Gästezahl, E-Mail | -| Produzierte Ergebnisse | `produces` | `offer_version`, `offer_terms`, `total`, Status `OfferSent`, signierter Link | -| Voraussetzungen | `requires`: Module, die vorher `Done` sein müssen | `availability.check`, `guest.details` | -| Zulässige Phasen | `phases` (P01–P05) | P02 | -| Erlaubte Seiteneffekte | `effects`: Aufzählung `Effect` | `CaseWrite`, `GuestMail`, `Document`, `CalendarHold` | -| Fehler- und Wartezustände | `states`: erlaubte `ActivityState`s + Bedeutung | `Later` = „wartet auf Angaben“, `Problem` = Zeitraum belegt | -| Auslösende Ereignisse | `triggers` | `facts.complete`, `hold.started`, Hand: `sendOffer` | -| Idempotenz/Wiederholung | `idempotency` | `expected_version`; erneuter Lauf ohne Wirkung (heute in `SendOffer` per Versionsprüfung) | -| Abhängigkeiten | `uses`: Dienste/Module | `pricing` (Dienst), `documents` (Dienst) | -| Konfigurierbare Parameter | `parameters`: `ProcessSetting`s oder `ModuleParameter`s mit Frage, Typ, Grenzen | `Processing`, `HoldHours` | -| Aktivierung | `toggle`: `Mandatory` / `Optional(defaultOn)` / `Conditional` / `Transferable` | `Mandatory` | -| Sicherheits-/Vertragsgrenzen | `guards` (Klartext + Test) | nie ohne Verfügbarkeit; nie ohne freigegebene Mietbedingungen im Livebetrieb (`AutoOffer::contractTextsReleased`) | -| Vertragstests | `#[Group('module:offer.binding')]` + generischer `ModuleContractTest` | siehe `05` §3 | +| `key`, `version` | `offer.binding` / 1 | `process:check`: eindeutig, im Register | +| `purpose` | „Verbindliches Angebot mit Vertragsentwurf erstellen und senden“ | beschreibend | +| `needs` | `CaseRequirements::OFFER`, Zeitraum, Gästezahl, E-Mail | Modultest: fehlt eine Angabe, ist `blockers` nicht leer | +| `produces` | `offer_version`, `quote`, `offer_terms`, Status `OfferSent` | Modultest nach `run` | +| `requires` | Schritte, die `Done` sein müssen, bevor dieser bereit ist: `guest.details`, `availability.check` | `process:check` (jedes Modell erfüllbar), Runner-Test (§7) | +| `blocksDependents` | ob ein Warten oder Problem dieses Schritts abhängige Schritte aufhält (Vorgabe ja) | Runner-Test | +| `phases` | P02 | `process:check` | +| `points` | erlaubte Erweiterungspunkte | `process:check` | +| `effects` | `CaseWrite`, `GuestMail`, `Document`, `CalendarHold` | `ModuleContractTest` im Tester: Effekt-Ledger enthält nur deklarierte Arten. **Grenze:** Das prüft nur die in den Testfällen durchlaufenen Pfade. | +| `waits` | worauf der Schritt warten kann (Gast, Portal, Vermieter, Zeit) und welche Daten die Frist tragen | Modultest je Wartezustand | +| `triggers` | Ereignisse, nach denen der Runner neu bewertet (`facts.applied`, `offer.accepted`, Zeit) | `process:check` gegen die Liste der Auslöser (§7.4) | +| `idempotency` | `expected_version`; erneuter Lauf ohne Wirkung | `ModuleContractTest`: zweiter `run` erzeugt keinen Effekt | +| `parameters` | `Processing`, `HoldHours` | `process:check`: gültige `ProcessSetting`/`ModuleParameter`, Grenzen | +| `toggle` | `Mandatory` / `Optional(defaultOn)` / `Conditional` / `EventDriven` | `ConfigureChannelProcess`-Test: `Mandatory` lässt sich nicht abschalten | +| `performers` | zulässige Ausführende und welche davon das Modell festlegt (`03` §2.3) | `process:check` gegen die Verantwortungsmatrix | +| `modes` | automatisch / nach Freigabe / manuell | Konfigurator-Test | +| `guards` | z. B. „nie ohne Verfügbarkeit“, `respectsExternalBinding` | je Wächter ein benannter Test; ohne Test kein Wächter | +| `availability` | `Production` oder `TesterOnly` (§6.3) | `ConfigureChannelProcess` und `ProcessPlan::freeze` weisen `TesterOnly` außerhalb des Testers ab (Test) | -Der **generische Vertragstest** prüft für jedes registrierte Modul automatisch: +Der generische `ModuleContractTest` prüft für jedes registrierte Modul: -- Die Definition ist vollständig, und die Parameter sind gültige `ProcessSetting`s. -- `applies`/`activity`/`blockers` schreiben nichts. -- `run` erzeugt nur die deklarierten `effects`. Gemessen wird das im Tester-Sandkasten über die Effekt-Ports (`04` §3). -- Ein zweiter `run` ist wirkungslos (Idempotenz). +- Die Definition ist vollständig. +- `applies`, `activity` und `blockers` schreiben nichts (Abfrageprotokoll ohne Schreibanweisung). +- `run` erzeugt nur die deklarierten Effektarten. +- Ein zweiter `run` ist wirkungslos. -So wird der Vertrag nicht zu Papier: Ein Verstoß bricht die Suite. +Er ersetzt **nicht** die Modultests; er fängt vergessene Deklarationen. --- -## 4. Fachmodulkatalog +## 4. Fachmodulkatalog (Startumfang) -Spalte „heute“ = **[Befund]**, Rest = **[Vorschlag]**. Schlüssel in Klammern = heutige Schrittschlüssel in `CaseActivities`. +Spalte „heute“ = **[Befund]**, Rest = **[Vorschlag]**. Schlüssel in Klammern = heutige Schrittschlüssel in `CaseActivities`. Spalte „requires“ ist die fachliche Abhängigkeit für die Bereitschaft (§7). ### P01 Eingang und Daten -| Modul | Aufgabe | heute | Aktivierung | Parameter | +| Modul | Aufgabe | heute | requires | Aktivierung | |---|---|---|---|---| -| `intake.record` (`intake`) | Eingang festhalten, Plan einfrieren | `CreateReservation`, `TakeOverPortalInquiry`, `TakeOverExternalBooking`, `CaseRecorder::freeze` | Pflicht | – | -| `guest.details` (`contact`) | Gast identifizieren, Angaben zusammenführen und prüfen (inkl. Anschrift) | `ContributeCaseFacts`, `ProvideGuestContact`, `CaseRequirements`, `AssignOccupationGuest` | Pflicht, wenn wir mit dem Gast korrespondieren (heute `$needsContact`) | `FormRequiresAddress`, Pflichtfelder je Folgeschritt (fest) | -| `guest.data_request` (`data_request`) | Fehlende Angaben beim Gast anfragen | `RequestCaseData`, `DataRequest`, `GuestDataController` | Optional (Modus „aus“ = entfällt) | `DataRequest`, `DataRequestRemindersMax`, `DataRequestFollowupsMax`, `DataRequestReminderHours`, `GuestLinkValidDays` | -| `guest.loyalty_status` (neu) | Stammgaststatus ermitteln | – | Optional (nur Variante „Stammgast“) | Mindestaufenthalte, Rückblick in Jahren | +| `intake.record` (`intake`) | Eingang festhalten, Plan einfrieren; setzt **unter der Kalendersperre** die Reservierung des Eingangs (`RequestHold::for`) | `CreateReservation`, `TakeOverPortalInquiry`, `TakeOverExternalBooking`, `CaseRecorder::freeze` | – | Pflicht | +| `guest.details` (`contact`) | Gast identifizieren, Angaben zusammenführen und prüfen | `ContributeCaseFacts`, `ProvideGuestContact`, `CaseRequirements`, `AssignOccupationGuest` | `intake.record` | Pflicht, wenn wir mit dem Gast korrespondieren | +| `guest.data_request` (`data_request`) | Fehlende Angaben beim Gast anfragen, erinnern, übergeben | `RequestCaseData` (`forNextStep`, `remindDue`, `handOver`) | `intake.record`; läuft nur, solange `guest.details` fehlt | Optional | +| `guest.loyalty_status` (neu) | Stammgaststatus ermitteln | – | `guest.details` (E-Mail) | Optional, `TesterOnly` (§6) | ### P01/P02 Belegung und Verbindlichkeit -| Modul | Aufgabe | heute | Aktivierung | Parameter | +| Modul | Aufgabe | heute | requires | Aktivierung | |---|---|---|---|---| -| `availability.check` | Zeitraum frei, Kanäle aktuell | `AvailabilityChecker`, `CalendarClearance` | **Pflicht, nicht abschaltbar** | – | -| `hold` | Klärungs- bzw. Angebotsvorreservierung | `RequestHold`, `ExpireReservations`, `ReleaseReservation` | Bedingt (Anfrage) | `PreReservation`, `HoldHours`, `ClarificationHoldAutoMinutes`, `ClarificationHoldManualMinutes` | -| `binding.portal` (`binding`, `price`) | Verbindlichkeit beim Portal feststellen, Portalpreis | `TakeOverExternalBooking`, `PortalIntake`, `RecordPortalAmounts` | Pflicht bei Eingangsart Buchung | Nachweisstufe | -| `channels.block` (`channel_block`) | Andere Kanäle sperren/freigeben | `CreateChannelTasks`, Observer, `RemindChannelTasks`, `ICalFeed` | **Pflicht** (nicht abschaltbar, wirkt je Kanal mit `requires_manual_blocking`) | – | +| `availability.check` | Zeitraum frei, Kanäle aktuell | `AvailabilityChecker`, `CalendarClearance` | – | Pflicht | +| `hold` | Klärungs- bzw. Angebotsreservierung **überwachen**: Frist, Ablauf, Freigabe. Gesetzt wird sie von `intake.record` und `SendOffer`. | `RequestHold`, `ExpireReservations`, `ReleaseReservation` | `intake.record` (**nicht** `guest.details`) | Bedingt (Anfrage mit Vorreservierung) | +| `binding.portal` (`binding`, `price`) | Verbindlichkeit beim Portal feststellen, Portalpreis | `TakeOverExternalBooking`, `PortalIntake`, `RecordPortalAmounts` | `intake.record` | Pflicht bei Eingangsart Buchung | +| `channels.block` (`channel_block`) | Andere Kanäle sperren/freigeben | `CreateChannelTasks`, Observer, `RemindChannelTasks` | belegungswirksamer Status | Pflicht | ### P02 Preis, Angebot und Annahme -| Modul | Aufgabe | heute | Aktivierung | Parameter | +| Modul | Aufgabe | heute | requires | Aktivierung | |---|---|---|---|---| -| `pricing.loyalty_discount` (neu) | Stammgastrabatt als Preiszeile | – | Optional (Variante) | Prozent, Höchstbetrag, mit Sonderangeboten kombinierbar | -| `offer.information` (`information`, `wish`, `wish_check`) | Unverbindliche Auskunft → Buchungswunsch → verbindlich bestätigen | `SendInformation`, `SubmitBookingWish`, `DecideBookingWish` | Alternative zu `offer.binding` (Modellwahl) | `Processing` | -| `offer.binding` (`offer`) | Verbindliches Angebot erstellen und senden | `SendOffer`, `OfferTerms`, `DocumentComposer` | Alternative zu `offer.information` | `Processing`, `ContractTemplate` | -| `offer.acceptance` (`acceptance`) | Annahme/Ablehnung, dann Bestätigung | `AcceptOffer`, `RejectOffer`, `ConfirmBooking` | Pflicht nach `offer.binding` | – | +| `pricing.loyalty_discount` (neu) | Stammgastrabatt als Preiszeile | – | `guest.loyalty_status` | Optional, `TesterOnly` | +| `offer.information` (`information`, `wish`, `wish_check`) | Auskunft → Buchungswunsch → verbindlich bestätigen | `SendInformation`, `SubmitBookingWish`, `DecideBookingWish` | `guest.details` (E-Mail), `availability.check` | Alternative zu `offer.binding` | +| `offer.binding` (`offer`) | Verbindliches Angebot erstellen und senden | `SendOffer`, `OfferTerms`, `DocumentComposer`, `AutoOffer::blockers` | `guest.details` (alle Angebotsangaben), `availability.check` | Alternative zu `offer.information` | +| `offer.acceptance` (`acceptance`) | Annahme/Ablehnung, dann Bestätigung | `AcceptOffer`, `RejectOffer`, `ConfirmBooking` | `offer.binding` | Pflicht nach `offer.binding` | ### P03 Abwicklung und Geld -| Modul | Aufgabe | heute | Aktivierung | Parameter | +| Modul | Aufgabe | heute | requires | Aktivierung | |---|---|---|---|---| -| `documents.send` (`documents`) | Buchungsunterlagen an den Gast | `SendBookingDocuments`, `RentalContract`, `CaseAutomation::documentBlockers` | Übertragbar (Portal) | `Documents`, Nachweisstufe | -| `payments.monitor` (`payment`, `deposit`, `balance`) | Zahlungen überwachen, erinnern | `RecordPayment`, `SendBookingReminders`, `SendPaymentReminder` | Übertragbar (Portal) | `Payments`, Erinnerungen an/aus (heute in `GuestMessages`) | -| `portal.payout` (`payout`) | Auszahlung des Portals prüfen | `RecordPortalAmounts`, `CaseMoney` | Bedingt (`Payments = Portal`) | – | -| `change.proposal` (`change_proposed`) | Änderungsvorschlag beim Gast | `ChangeBooking` | Ereignisgetrieben (kein Planplatz, s. 4.1) | – | +| `documents.send` (`documents`) | Buchungsunterlagen an den Gast | `SendBookingDocuments`, `RentalContract`, `CaseAutomation::documentBlockers` | Verbindlichkeit, `guest.details` (E-Mail), Gesamtpreis | Ausführende laut Modell (`03` §2.3) | +| `payments.monitor` (`payment`, `deposit`, `balance`) | Zahlungen überwachen, erinnern | `RecordPayment`, `SendBookingReminders`, `SendPaymentReminder` | Verbindlichkeit | Ausführende laut Modell | +| `portal.payout` (`payout`) | Auszahlung des Portals prüfen | `RecordPortalAmounts`, `CaseMoney` | Verbindlichkeit | Bedingt (`Payments = Portal`) | +| `change.proposal` (`change_proposed`) | Änderungsvorschlag beim Gast | `ChangeBooking` | – | Ereignisgetrieben (§4.1) | -### P04 Aufenthalt +### P04 Aufenthalt und P05 Abschluss -| Modul | Aufgabe | heute | Aktivierung | Parameter | +| Modul | Aufgabe | heute | requires | Aktivierung | |---|---|---|---|---| -| `arrival.details` (`arrival_details`) | Anreisedaten, Dienstleister | `PrepareStays` (Aufgaben, `services`) | Optional | – | -| `arrival.info` (`arrival_info`) | Anreise-Informationen | `PrepareStays` | Übertragbar | `GuestMessages`, `ArrivalInfoDaysBefore` | -| `stay` (`stay`) | Aufenthalt | `CloseStay` | Pflicht | – | - -### P05 Abschluss - -| Modul | Aufgabe | heute | Aktivierung | Parameter | -|---|---|---|---|---| -| `review.request` (`review`) | Bitte um Bewertung | `RequestReviews` | **Optional** | an/aus (heute an `GuestMessages` gekoppelt) | -| `case.closure` (`closure`) | Aufenthalt abschließen | `CaseClosure` | Pflicht | – | -| `case.settlement` (`settlement`) | Kaufmännisch abschließen | `CaseClosure` | Pflicht | – | +| `arrival.details` (`arrival_details`) | Anreisedaten, Dienstleister | `PrepareStays` | Verbindlichkeit | Optional | +| `arrival.info` (`arrival_info`) | Anreise-Informationen | `PrepareStays`, `SendBookingReminders` | Verbindlichkeit, E-Mail | Ausführende variabel | +| `stay` (`stay`) | Aufenthalt | `CloseStay` | Verbindlichkeit | Pflicht | +| `review.request` (`review`) | Bitte um Bewertung | `RequestReviews` | `stay` | Optional | +| `case.closure` (`closure`) | Aufenthalt abschließen | `CaseClosure` | `stay` | Pflicht | +| `case.settlement` (`settlement`) | Kaufmännisch abschließen, Nachweise prüfen | `CaseClosure` | `case.closure` | Pflicht | ### 4.1 Ereignisgetriebene Sonderprozesse [Vorschlag] -Stornierung (`CancelBooking`, `CancelBookingByGuest`, `RecordCancellation`), Änderung (`ChangeBooking`) und Ablauf (`ExpireReservations`) laufen **quer** zum Plan. Sie bleiben Actions und erscheinen als Module ohne festen Planplatz (`toggle = EventDriven`). Der Plan zeigt sie, wenn ihr Ereignis vorliegt. Ihr Code bleibt unverändert. +Stornierung (`CancelBooking`, `CancelBookingByGuest`, `RecordCancellation`), Änderung (`ChangeBooking`), Portalmeldungen (Aufgaben `PortalCancellationReported`, `PortalChangeReported`) und Ablauf (`ExpireReservations`) laufen **quer** zum Plan. Sie sind Module mit `toggle = EventDriven` ohne festen Platz. Ihre Actions bleiben. Wie sie mit dem Runner zusammenwirken, beschreibt §7.3. -### 4.2 Querschnittsdienste (keine Schritte) +### 4.2 Querschnittsdienste und interne Belegungen -`pricing` (`PriceCalculator` + neue Fassade `CasePricing`), `messages` (`ReceiveInboundMessage`, `MessageMatcher`, `ExtractMessageFacts`), `mail` (Laravel-Mailer + `EnforceMailTestMode`), `log` (`CaseLog`, `CaseRecorder`), `tenancy` (`TenantContext`, `TenantConfig`). - -### 4.3 Interne Belegungen (A6) - -`CaseActivities::internal()` wird zum Modell `a6.internal` (Module `intake.record`, `channels.block`, `documents.send` optional, `payments.monitor` ohne Erinnerungen, `stay`, `case.closure`). Ein Kanal kommt hier nicht vor, also gibt es keine Kanalkonfiguration. +- **Querschnittsdienste:** `pricing` (`PriceCalculator` + neue Fassade `CasePricing`), `messages` (`ReceiveInboundMessage`, `MessageMatcher`, `ExtractMessageFacts`), `mail` (Laravel-Mailer + `EnforceMailTestMode`), `log` (`CaseLog`, `CaseRecorder`), `tenancy` (`TenantContext`, `TenantConfig`). +- **Interne Belegungen:** `CaseActivities::internal()` wird zum Modell `a6.internal` (`intake.record`, `channels.block`, `documents.send` optional, `payments.monitor` ohne Erinnerungen, `stay`, `case.closure`). Es gibt keine Kanalkonfiguration. --- -## 5. Prozessmodelle, Varianten, Erweiterungspunkte [Vorschlag] +## 5. Prozessmodelle, Varianten, Erweiterungspunkte, Versionierung [Vorschlag] ### 5.1 Definition im Code @@ -187,6 +203,13 @@ ### 5.1 Definition im Code public static function intakes(): array { return [IntakeKind::Inquiry]; } public static function channelKinds(): array { return [Channel::KIND_WEBSITE, 'direct']; } + /** Responsibilities fixed by the model, and the ones the channel may choose within the frame (03 §2.3). */ + public static function responsibilities(): Responsibilities + { + return Responsibilities::fixed(contract: Landlord, collection: Landlord, contractDocuments: Landlord) + ->variable(guestMessages: [Landlord], arrivalInfo: [Landlord, ServiceProvider], localServices: [Landlord, ServiceProvider]); + } + public function steps(): array { return [ @@ -217,7 +240,8 @@ ### 5.1 Definition im Code { return [ Variant::make('standard', 'Angebot mit Vorreservierung'), - Variant::make('loyalty', 'Angebot mit Stammgastrabatt') + Variant::make('loyalty', 'Angebot mit Stammgastrabatt (Architekturnachweis)') + ->testerOnly() ->insert(Point::AfterGuestIdentified, 'guest.loyalty_status') ->insert(Point::BeforePriceFixing, 'pricing.loyalty_discount'), ]; @@ -225,146 +249,335 @@ ### 5.1 Definition im Code } ``` -**Erweiterungspunkte** (fest, Auftrag §5): `AfterGuestIdentified`, `BeforePriceFixing`, `BeforeBindingOffer`, `AfterBinding`, `BeforeStay`, `BeforeSettlement`. Jedes Modul deklariert, an welchen Punkten es stehen darf. `ProcessCatalogue::validate()` prüft das beim Booten im Test sowie in `php artisan process:check`. +Die Reihenfolge der Schritte ist die **Anzeige- und Lesereihenfolge**. Was wann laufen darf, bestimmen die `requires` der Module (§7). Die **Erweiterungspunkte** sind fest: `AfterGuestIdentified`, `BeforePriceFixing`, `BeforeBindingOffer`, `AfterBinding`, `BeforeStay`, `BeforeSettlement`. `BeforePriceFixing` garantiert, dass der Fall nicht verbindlich ist; `AfterBinding` garantiert das Gegenteil. `ProcessCatalogue::validate()` prüft Punkte, Abhängigkeiten und Verantwortungen in `process:check` und im Test. ### 5.2 Modellkatalog (Startumfang) | Modell | Archetyp | Eingang | Ersetzt heutigen Zweig | |---|---|---|---| -| `a1.offer` (Varianten `standard`, `loyalty`) | A1 | Anfrage, direkt/Webseite | `preReservation() = true` | -| `a1.information` | A1 | Anfrage, direkt/Webseite | `preReservation() = false` (Auskunft → Wunsch) | -| `a2.offer`, `a2.information` | A2 | Anfrage über Portal | wie A1, mit `intake` über `TakeOverPortalInquiry` | -| `a3.portal_booking` | A3 | Buchung | `documents = Landlord`, `payments = Landlord` | -| `a4.portal_booking` | A4 | Buchung | `payments = Portal` | -| `a5.portal_booking` | A5 | Buchung | `documents = Portal` | +| `a1.offer` (Varianten `standard`, `loyalty` = nur Tester) | A1 | Anfrage, direkt/Webseite | `preReservation() = true` | +| `a1.information` | A1 | Anfrage, direkt/Webseite | `preReservation() = false` | +| `a2.offer`, `a2.information` | A2 | Anfrage über Portal | wie A1, Eingang über `TakeOverPortalInquiry` | +| `a3.portal_booking` | A3 | Buchung | Verträge, Inkasso und Dokumente beim Vermieter | +| `a4.portal_booking` | A4 | Buchung | Inkasso beim Portal, Vertragsdokumentation beim Vermieter | +| `a5.portal_booking` | A5 | Buchung | Inkasso und Vertragsdokumentation beim Portal | | `a6.internal` | A6 | intern | `CaseActivities::internal()` | -A2 nutzt dieselben Module wie A1. Die Modelle sind getrennt, weil Eingang und Kanalbezug fachlich verschieden sind (A2 bleibt A2). Gemeinsame Schrittfolgen werden als PHP-Methode der Basisklasse geteilt, nicht kopiert. +A2 nutzt dieselben Module wie A1; gemeinsame Schrittfolgen teilt die Basisklasse. **[Entschieden E1]** Das gewählte Modell legt die Grundverantwortungen fest; innerhalb des Modells bleiben die ausdrücklich zugelassenen Varianten von Kommunikation, Dokumenten und lokalen Dienstleistungen konfigurierbar (`03` §2.3). `caseTypeFor` bleibt als Plausibilitätsprüfung. -**[Entscheidung offen E1]** Für A3–A5 gibt es zwei Möglichkeiten: Entweder steuern die Verantwortungs-Einstellungen `Documents`/`Payments` weiter, welches Modell gilt (Modell wird abgeleitet), oder der Vermieter wählt das Modell, und dieses legt die Verantwortungen fest. Empfehlung: **Modell wählen, Verantwortungen folgen aus dem Modell.** Das entspricht dem Auftrag (§7.1) und verhindert unzulässige Kombinationen. `caseTypeFor` bleibt als Plausibilitätsprüfung erhalten. +### 5.3 Versionierung und Schutz laufender Vorgänge (K3) -### 5.3 Versionierung +Ein eingefrorener Plan schützt die **Definition**, nicht das Codeverhalten. Deshalb werden vier Ebenen unterschieden: -- Modell und Modul tragen je eine ganze Zahl als Version. Erhöht wird bei jeder fachlich wirksamen Änderung der Schrittfolge oder des Modulverhaltens. Reine Textänderungen erhöhen nicht. -- Beim Eingang wird ein **Prozessplan** eingefroren: `profile.plan = {model: 'a1.offer@1', variant: 'loyalty', modules: {'guest.loyalty_status': {v: 1, on: true, params: {...}, source: {...}}}, configured_at}`. Das erweitert den bestehenden `CaseRecorder::freeze` und braucht keine Migration. -- Die Klassen alter Modellversionen bleiben im Code, solange offene Vorgänge sie nutzen. `php artisan process:check` meldet Versionen ohne offene Vorgänge, und erst dann wird entfernt. -- Modulversionen ändern das Verhalten laufender Vorgänge **nur**, wenn das Modul eine abwärtskompatible Korrektur deklariert (`compatibleWith: [1]`). Sonst bleibt die alte Klasse aktiv (z. B. `LoyaltyDiscountV1`). Das ist selten: Die meisten Module rufen Actions auf, und deren Fehlerkorrekturen gelten wie heute für alle Vorgänge. +| Ebene | Inhalt | Wo eingefroren | Darf ein neues Release sie ändern? | +|---|---|---|---| +| **E-V Vertragliche Daten und Zusagen** | Preiszeilen (`quote`), Gesamtpreis (`total`), Bedingungen und Vorlagenversion (`offer_terms`: Texte, Stornoregel, Anzahlungsfrist), Annahmeprotokoll mit `terms_sha256` (`acceptance`), Fälligkeiten (`deposit_due_on`, `balance_due_on`), Portalbeträge „laut Portal“ (`booking_amounts`), erzeugte Vertrags-PDFs (`contract_path`) [Befund] | Spalten der Buchung, beim Angebot bzw. bei der Bestätigung | **Nie.** Nur eine fachliche Action mit Protokoll (`ChangeBooking`, `Adjustment`-Zeile, `RecordPortalAmounts` mit Quelle) | +| **E-P Prozessdefinition und Parameter** | Modell@Version, Variante, Modulversionen, Schalter, Ausführende, Parameterwerte, Fristen in Stunden/Minuten | `profile` und `profile.plan` beim Eingang | **Nein** für laufende Vorgänge [Entschieden E3]. Ausnahme: Ebene E-K. | +| **E-I Technische Implementierung** | Code der Actions, Module, Dienste, Ansichten, Mail-Texte | nicht eingefroren | **Ja**, solange sie Ebene E-V nicht anders auswertet (Kompatibilitätsregel R1) | +| **E-K Fehlerkorrektur** | Korrektur nachweislich falschen Verhaltens, das bestehende Vorgänge betrifft | – | **Ja**, aber nur als deklarierte Korrektur mit Wirkungsprüfung (R4) | -### 5.4 Eine Variante täuscht keine Geschäftsart vor +**Kompatibilitätsregeln** -Das Modell deklariert `caseTypes()`. Beim Einfrieren prüft `ProcessPlan::freeze`, ob `caseTypeFor(...)` darin liegt. Bei Abweichung gibt es einen klaren Fehler und **kein** stilles Umdeuten. Der Archetyp bleibt immer die abgeleitete Klassifikation. +- **R1 – Auswertung eingefrorener Vertragsdaten ist Vertragsbestandteil.** Code, der E-V-Daten auswertet, muss für vorhandene Vorgänge dasselbe Ergebnis liefern wie zuvor. Beispiele: + - `CancellationCost::calculate` (Stornostaffel aus `offer_terms`, Grundlage aus `quote`-Zeilen); + - `CancellationPolicy::tierFor`; + - Anzahlungs- und Restbetrag; + - `ContractPlaceholders` (Vertragstext aus `offer_terms`). + + Eine Änderung, die das Ergebnis ändern würde, wird **versioniert**: Die neue Logik gilt ab einem Merkmal im eingefrorenen Datensatz, etwa `offer_terms.rules_version`. Alte Datensätze ohne Merkmal werden mit der bisherigen Logik ausgewertet. +- **R2 – Modulversionen.** Ein Modul mit fachlich wirksamer Änderung bekommt eine neue Version. Pläne mit der alten Version führen die alte Klasse weiter (z. B. `LoyaltyDiscountV1`), außer das neue Modul deklariert `compatibleWith: [1]` und besteht den Bestandsfall-Test (§5.4) für Version 1. +- **R3 – Actions bleiben gemeinsam.** Es gibt keine Kopie alter Actions je Release. Eine Action-Änderung darf das Verhalten laufender Vorgänge ändern, wenn sie (a) E-V-Daten nicht anders auswertet (R1), (b) keine bereits getroffene Statusentscheidung zurücknimmt und (c) die Bestandsfall-Tests unverändert bestehen. +- **R4 – Fehlerkorrektur mit Wirkung auf Bestandsfälle** ist zulässig, wenn + - der Fehler im Fehlerregister steht (`05` §4.3), + - der PR die betroffenen Bestandsfälle zählt (Abfrage, keine Datenänderung), + - die geänderte Erwartung im Bestandsfall-Test begründet ist. + + Geld- und Fristwirkungen auf bereits **verbindliche** Vorgänge werden nicht durch Code korrigiert, sondern als Aufgabe für den Vermieter ausgewiesen. +- **R5 – Kein Neuberechnen.** Kein Release berechnet Preise, Rabatte, Fristen oder Status bestehender Vorgänge neu, außer eine fachliche Action wird ausdrücklich ausgelöst. +- **R6 – Aufbewahrung alter Versionen.** Alte Modell- und Modulklassen bleiben, solange offene Vorgänge sie im Plan tragen. `process:check` meldet Versionen ohne offene Vorgänge; erst dann wird entfernt. + +Es wird **nicht** verlangt, frühere Anwendungsversionen vollständig zu betreiben. Ältere Vorgänge werden sicher weitergeführt, weil + +1. ihre Vertragsdaten eingefroren sind, +2. deren Auswertung nach R1 stabil bleibt, +3. ihre Prozessdefinition eingefroren ist, +4. die Bestandsfall-Tests das bei jedem Release prüfen. + +### 5.4 Bestandsfall-Tests (Regression für laufende Vorgänge) + +`OngoingCaseRegressionTest` arbeitet mit **eingefrorenen Bestandsfällen**, nicht mit Factories des aktuellen Codes: + +- **Fixtures:** Etwa 40 Buchungsdatensätze als JSON-Fixtures (`tests/Fixtures/ongoing/*.json`). Sie wurden einmalig mit dem v0.11-Stand erzeugt und enthalten die Zeilen von `bookings`, `case_facts`, `data_requests`, `booking_amounts`, `payments` und `booking_tasks`. Es sind synthetische Daten, keine Kundendaten. +- **Abdeckung:** jeder Archetyp × die Status `Reserved` (Klärungs- und Angebotsreservierung), `OfferSent`, `Confirmed` mit offener Anzahlung, `Confirmed` nach Anreise, `Cancelled` mit Stornoregel, A4 mit Portalraten, `origin = migration`. +- **Prüfungen je Fixture**, bei fester Uhr: + - unverändert: `total`, `quote`-Zeilen, `offer_terms`, `acceptance`; + - gleich wie die gespeicherte Erwartung: `CancellationCost::calculate` an drei Stichtagen, Anzahlungs- und Restbetrag, Fälligkeiten, Hash des gerenderten Vertragstexts (`RentalContract::render`, Entwurf); + - gleich wie die gespeicherte Erwartung: `ProcessRunner::activities` und die Entscheidung von `advance` (läuft/läuft nicht, Blocker); + - nach `advance` keine Änderung an E-V-Spalten. +- **Ausführung:** Der Test läuft in jeder CI. Eine Abweichung ist nur mit Eintrag `intended` und Verweis auf R1–R4 zulässig. + +### 5.5 Eine Variante täuscht keine Geschäftsart vor + +Das Modell deklariert `caseTypes()`. Beim Einfrieren prüft `ProcessPlan::freeze`, ob `caseTypeFor(...)` darin liegt. Bei Abweichung gibt es einen klaren Fehler und **kein** stilles Umdeuten. --- -## 6. Architektur-Nachweis Loyalty (N3) +## 6. Architektur-Nachweis Loyalty (N3, K8) -### 6.1 Ablauf in der Variante `a1.offer:loyalty` +### 6.1 Status -1. `guest.details` identifiziert den Gast (E-Mail, wie heute über `CreateReservation`/`Guest`). -2. **`guest.loyalty_status`** (Punkt `AfterGuestIdentified`) zählt abgeschlossene Aufenthalte desselben Gastes beim selben Mandanten. Gezählt werden `BookingStatus::Completed`, nicht storniert, im Rückblickzeitraum. Das Ergebnis wird als Fakt `loyalty_status` über `ContributeCaseFacts` gespeichert (neue `FactSource::System`), mit Beleg „3 Aufenthalte: 2024-0012, 2025-0031, 2026-0007“. - - Ergebnisse: `Qualified` / `NotQualified` / `Unknown`. `Unknown` gilt bei fehlender E-Mail, mehrdeutiger Zuordnung oder technischem Fehler. -3. **`pricing.loyalty_discount`** (Punkt `BeforePriceFixing`, `ContributesToPrice`). Bei `Qualified` entsteht eine `QuoteLine(QuoteLineType::Discount, 'Stammgastrabatt (3 frühere Aufenthalte)', …)`, berechnet auf `PriceQuote::rent()` mit Höchstbetrag. - - Bei `NotQualified` gibt es keine Zeile. Bei `Unknown` auch keine Zeile; zusätzlich erscheint die Schrittanzeige „Status nicht feststellbar – kein Rabatt“ sowie eine optionale Aufgabe „Stammgast prüfen“. - - **Der Angebotsversand wird nie blockiert.** Das ist das definierte fachliche Ergebnis eines Fehlers. -4. `offer.binding` ruft `SendOffer` auf. `SendOffer::quoteFor` holt den Preis nun über `CasePricing::quote($booking, $stay)`. Die Rabattzeile steht damit im versionierten Angebot (`offer_terms`), im Vertragsentwurf und im Verlauf (`CaseLog::record($booking, 'price', …, data: ['basis' => …])`). -5. Ab `offer.acceptance`/`ConfirmBooking` ist der Preis fest. `CasePricing` ruft für verbindliche Vorgänge (`$booking->isBinding()`) **keine** Beiträge mehr auf. Bei `ChangeBooking` wird die gespeicherte Rabattzeile übernommen, nicht neu berechnet. **[Entscheidung offen E5]**: Soll bei einer Verlängerung der Rabatt auf die neuen Nächte ausgedehnt werden? Empfehlung: nein, stattdessen ein Hinweis für eine manuelle `Adjustment`-Zeile. +**[Entschieden E5–E7]** Loyalty ist ein **Erweiterbarkeitsnachweis**, kein freigegebenes Rabattprogramm: -### 6.2 Was geändert wird und was unverändert bleibt +- Die Variante `a1.offer:loyalty` und beide Module tragen `availability = TesterOnly`. Für echte Buchungen sind sie nicht aktivierbar. +- Berechtigung, Gastidentifikation, Staffel, Kombination mit Sonderangeboten und Umbuchung sind **nicht** als Geschäftsregel freigegeben. +- Die Tests arbeiten mit ausdrücklich vorgegebenem Verhalten, das als Testannahme gekennzeichnet ist. +- Für eine spätere produktive Freigabe braucht es eigene fachliche Regeln, Tests und eine Entscheidung. Technisch genügt dann der Wechsel auf `Production` (neue Modulversion). + +### 6.2 Ablauf in der Variante (Testannahmen) + +1. `guest.details` identifiziert den Gast (E-Mail). +2. **`guest.loyalty_status`** (Punkt `AfterGuestIdentified`) zählt abgeschlossene, nicht stornierte Aufenthalte desselben Gastes beim selben Mandanten. + - Ergebnis `Qualified`, `NotQualified` oder `Unknown` als Fakt `loyalty_status` über `ContributeCaseFacts` (neue `FactSource::System`), mit Beleg (Referenzen der Aufenthalte). + - `blocksDependents = false`: Ein `Unknown` hält den Angebotsschritt nicht auf. +3. **`pricing.loyalty_discount`** (Punkt `BeforePriceFixing`, `ContributesToPrice`) liefert bei `Qualified` eine `QuoteLine(QuoteLineType::Discount, …)`. + - Testannahme E6: Bei Sonderangebot keine Zeile. + - Bei `NotQualified`/`Unknown` keine Zeile; bei `Unknown` ein Hinweis im Schritt. + - **Der Angebotsversand wird nie blockiert.** +4. `offer.binding` → `SendOffer`; `SendOffer::quoteFor` holt den Preis über `CasePricing::quote($booking, $stay)`. Die Zeile steht damit in `quote`, im Vertragsentwurf und im Verlauf. +5. Ab Verbindlichkeit ist der Preis fest. `CasePricing` ruft für verbindliche Fälle **keine** Beiträge auf (Test). Bei `ChangeBooking` bleibt die gespeicherte Rabattzeile eingefroren (E5); die spätere Regel ist offen. +6. **Hinweis R1:** `CancellationCost::rent` zählt `Discount`-Zeilen zur Stornogrundlage [Befund]. Eine Rabattzeile senkt also auch die Stornogebühr. Für den Nachweis ist das Testannahme; vor einer Freigabe ist es fachlich zu entscheiden. + +### 6.3 Nicht aktivierbar für echte Buchungen – technische Umsetzung + +| Stelle | Prüfung | Test | +|---|---|---| +| `ConfigureChannelProcess` | weist Speichern einer `TesterOnly`-Variante oder eines `TesterOnly`-Moduls ab | `LoyaltyNotActivatableTest::configurator_rejects` | +| `ProcessPlan::freeze` | weist `TesterOnly` ab, außer im Sandbox-Kontext (`04` §3.3) | `LoyaltyNotActivatableTest::freeze_rejects_outside_sandbox` | +| Konfigurator | zeigt Variante und Schritte mit Kennzeichen „nur im Prozess-Tester“; im Entwurf schaltbar, Speichern gesperrt | Livewire-Test | +| Tester | spielt `standard` und `loyalty` durch (S09, S10) | Paritätstest | + +### 6.4 Was geändert wird und was unverändert bleibt | Komponente | Änderung | |---|---| -| `app/Process/Modules/Guest/LoyaltyStatusCheck.php` | **neu** | -| `app/Process/Modules/Pricing/LoyaltyDiscount.php` | **neu** | -| `A1OfferModel::variants()` | **+1 Variante** (3 Zeilen) | -| `config/process.php` (Modulregister) | **+2 Einträge** | -| `FactSource` | **+1 Fall** `System`, falls bis dahin nicht vorhanden; wird auch von anderen Systemfeststellungen genutzt | -| Tests `LoyaltyStatusCheckTest`, `LoyaltyDiscountTest`, Tester-Szenario „Stammgast“ | **neu** | -| `PriceCalculator`, `PriceQuote`, `QuoteLine`, `QuoteLineType` | unverändert | -| `SendOffer`, `AcceptOffer`, `ConfirmBooking`, `DocumentComposer`, `RentalContract` | unverändert. Die Rabattzeile ist eine normale `Discount`-Zeile und wird schon heute gedruckt. | -| `CaseActivities`/`ProcessRunner`, `CaseAutomation` | unverändert. Beide iterieren den Plan. | +| `LoyaltyStatusCheck`, `LoyaltyDiscount` | **neu** | +| `A1OfferModel::variants()` | **+1 Variante** | +| `config/process.php` | **+2 Einträge** | +| `FactSource` | **+1 Fall** `System` | +| Tests `LoyaltyStatusCheckTest`, `LoyaltyDiscountTest`, `LoyaltyNotActivatableTest`, Szenarien S09/S10 | **neu** | +| `PriceCalculator`, `PriceQuote`, `QuoteLine`, `QuoteLineType`, `CancellationCost` | unverändert | +| `SendOffer`, `AcceptOffer`, `ConfirmBooking`, `DocumentComposer`, `RentalContract` | durch Loyalty unverändert (die Umstellung von `SendOffer::quoteFor` auf `CasePricing` geschieht vorher in U-B, siehe unten) | +| `ProcessRunner`, Konfigurator, Tester | unverändert; sie lesen Variante und Parameter aus der Definition | | Modelle `a1.information`, `a2.*`, `a3`–`a6` | unverändert | -| Kanalkonfigurator | unverändert. Er rendert Variante und Parameter aus der Definition. | -| Prozess-Tester | unverändert. Nur ein Szenario wird ergänzt. | -**Einmalige Voraussetzung (kein Loyalty-Code):** die Fassade `CasePricing` mit dem Erweiterungspunkt `BeforePriceFixing`. Ihre Aufrufer sind `SendOffer::quoteFor`, der Preis der Auskunft in `SendInformation` und `DecideBookingWish`. `CreateReservation` (Richtpreis der Anfrage) und `ChangeBooking` für nicht verbindliche Fälle kommen hinzu. Sie wird mit Paket U-B gebaut (`06`) und dort mit einem Testmodul geprüft, das eine Preiszeile ergänzt. +**Einmalige Voraussetzung (kein Loyalty-Code), Paket U-B:** die Fassade `CasePricing` mit dem Punkt `BeforePriceFixing`. Ihre Aufrufer werden **geändert**: -**[Entscheidung offen E6]** Ist ein Stammgastrabatt mit Sonderangeboten kombinierbar? `PriceCalculator::bestOffers` wählt das beste Angebot je Nacht; Loyalty steht außerhalb. Empfehlung: Der Parameter „mit Sonderangeboten kombinierbar“ steht per Vorgabe auf **nein**, dann gilt der höhere Nachlass. +- `SendOffer::quoteFor`; +- `SendInformation`; +- `DecideBookingWish`; +- `CreateReservation` (Richtpreis); +- `ChangeBooking` (nur nicht verbindliche Fälle). + +Ohne Beiträge liefert `CasePricing` genau `PriceCalculator::calculate` (Gleichheitstest). --- -## 7. Ausführungslogik [Vorschlag] +## 7. Ausführungslogik (K1) [Vorschlag] -### 7.1 Ein Ablaufkern statt zwei verdrahteter Klassen +### 7.1 Grundsatz: eine Wahrheit, abgeleitete Bereitschaft -`ProcessRunner` ersetzt die Inhalte von `CaseActivities::for` und `CaseAutomation::step`. Die öffentlichen Methoden bleiben als dünne Fassaden erhalten: `CaseActivities::for/next/situation` und `CaseAutomation::advance/documentBlockers`. So bleiben `ViewBooking`, `BookingInfolist`, `WorkList`, `ActivityDetails`, Kommandos und Tests stabil. +- **Zustand** jedes Schritts wird wie heute aus den Falldaten **abgeleitet**: Status, Versionen, Zeitstempel, `data_requests`, `case_facts`, `booking_tasks`. Der Runner speichert **keinen** Schrittzustand. Es gibt also keine zweite Wahrheit. +- **Bereitschaft** wird bei jeder Bewertung neu berechnet: Ein Schritt ist *bereit*, wenn + - er im Plan aktiv ist und `applies` gilt, + - sein Zustand `Open` ist, + - alle `requires` `Done` sind (oder `NotApplicable`, wo das Modul das zulässt), + - `blockers` leer ist. +- **Unabhängigkeit:** Ein wartender Schritt hält nur Schritte auf, die ihn in `requires` führen und für die er `blocksDependents = true` hat. Alle anderen bereiten Schritte laufen. +- Die Reihenfolge im Modell bestimmt nur die **Ausführungsreihenfolge innerhalb einer Bewertungsrunde** und die Anzeige. + +### 7.2 Zustandsarten + +| Art | Darstellung (`ActivityState`) | Bedeutung für den Runner | Beispiel | +|---|---|---|---| +| sequenziell | `Later` bis die Voraussetzung `Done` ist | nicht bereit | Angebot vor vollständigen Angaben | +| bedingt | nicht in der Liste (`applies = false`) oder `NotApplicable` | übersprungen mit Grund | Auszahlung nur bei Portal-Inkasso | +| unabhängig | eigene `requires` | läuft, auch wenn anderes wartet | Klärungsreservierung überwacht ihre Frist, während die Rückfrage wartet | +| Warten auf Gast/Portal/Vermieter | `Waiting` + `waitsFor` + `until` | nicht bereit; bewertet neu bei Ereignis oder Frist | Rückfrage offen bis `next_reminder_at` | +| Frist | `Waiting` mit `until`; nach Ablauf führt die Zeit-Action die Wirkung aus | nur die zuständige Action schreibt (z. B. `ExpireReservations`) | Angebotsreservierung abgelaufen | +| manuelle Freigabe | `Open` mit Aktion (`approve…`) bei Modus „nach Freigabe“ | der Runner führt **nicht** aus; die Freigabe ruft dasselbe `run` und danach `advance` | Rückfrage-Entwurf freigeben | +| Problem | `Problem` | nicht bereit; Aufgabe für den Vermieter | Zeitraum inzwischen belegt | + +### 7.3 Ablauf von `advance` ``` -ProcessRunner::activities(Booking): list - plan = ProcessPlan::of(booking) // frozen plan or legacy mapping (06 §4) - for step in plan.steps (in order): - module = registry.module(step) // exact frozen version - if not step.enabled or not module.applies(ctx): continue (recorded as skipped + reason) - activity = module.activity(ctx) - apply the over/closed rule (today's $later closure in CaseActivities::for) centrally - + event-driven modules with an open event, + open BookingTasks (today's tasks()) - -ProcessRunner::advance(Booking): list // today's CaseAutomation::advance - only when processing() is automatic (or the step's own mode is automatic, see 03 §3.3) - first step with state Open whose mode is automatic: - blockers = module.blockers(ctx); if blockers: return blockers (shown as task, as today) - result = module.run(ctx) inside CaseLog::context(actor: system) - repeat for the next step until nothing runs (bounded loop, max = number of steps) +ProcessRunner::advance(Booking): AdvanceResult + lock case (Cache::lock "case-advance:{id}", short; actions keep their own guards) + repeat at most |steps| rounds: + activities = derive all steps (same derivation as activities()) + if an open urgent event task suspends automation (§7.5): stop, report it + ready = steps in model order whose mode is automatic and that are ready (§7.1) + if ready is empty: stop + for step in ready: + result = module.run(ctx) inside CaseLog::context(actor: system) + record result (ran / blocked / failed); a failed step does not stop independent steps + refresh booking + return ran steps, blockers per waiting/blocked step (shown as tasks, as today) ``` -- Die Zustandsermittlung bleibt **abgeleitet**, wie heute: aus Falldaten, nicht aus einer gespeicherten Zustandsmaschine. Es gibt also keine zweite Wahrheit, die auseinanderlaufen kann. -- Die Regel „nach Vorgangsende ist nichts mehr zu tun“ (`$later` in `CaseActivities::for`) liegt zentral im Runner. -- `ActivityDetails::EVENT_TYPES` wandert in die Moduldefinition (`events`). -- `ViewBooking` liest den Aktionsnamen aus `Activity::$action`, wie heute. +- **Begrenzt:** höchstens so viele Runden wie Schritte. Jeder `run` ist idempotent; ein Schritt, der in einer Runde lief, läuft in derselben Bewertung nicht erneut. +- **Fehler:** Eine Ausnahme in einem Schritt wird gemeldet (`report`). Der Schritt erscheint als „technischer Fehler, bitte von Hand fortsetzen“, wie heute in `CaseAutomation::advance`. Unabhängige Schritte laufen weiter. +- **Nebenläufigkeit:** Die Actions behalten ihre Schutzmechanismen (`expected_version`, `lockForUpdate`). Die Sperre je Vorgang verhindert nur doppelte Bewertung bei gleichzeitigen Auslösern. +- **`origin = migration`:** wie heute keine Automatik. -### 7.2 Auslöser +### 7.4 Auslöser: vorhandene Stellen, keine neue Engine -Es kommen keine neuen hinzu. Die heutigen Stellen rufen weiter `CaseAutomation::advance` auf: nach Eingang, nach `ContributeCaseFacts`, Scheduler `bookings:auto-offers`, `cases:data-requests` und `bookings:expire-holds`. `triggers` in der Definition dokumentiert sie und wird vom Tester zur Ereignissimulation genutzt (`04` §4). +Die Automatik ist heute verteilt **[Befund]**: + +- `CaseAutomation::advance` kennt nur zwei Fälle: Angebot/Auskunft und Unterlagen. +- Aufgerufen wird es von `ContributeCaseFacts`, `RecordPortalAmounts`, `TakeOverExternalBooking`, `TakeOverPortalInquiry` und `ViewBooking`. +- `CreateReservation::sendMails` ruft `AutoOffer` und danach `RequestCaseData::forNextStep` **direkt** auf, ebenso `SubmitBookingWish` und `TakeOverExternalBooking` die Datenanfrage. +- Zeitgesteuert laufen `bookings:auto-offers` (`AutoOffer` direkt), `cases:data-requests` (`RequestCaseData::remindDue`) und `bookings:expire-holds` (`ExpireReservations`, ohne `advance`). + +Umstellung in U-A: + +| Auslöser heute | künftig | +|---|---| +| `CaseAutomation::advance` (5 Aufrufer) | Fassade auf `ProcessRunner::advance`; Aufrufer unverändert | +| direkte Aufrufe `AutoOffer` + `RequestCaseData::forNextStep` in `CreateReservation`, `SubmitBookingWish`, `TakeOverExternalBooking` | ein Aufruf `ProcessRunner::advance`. Die Datenanfrage und das Angebot sind dann zwei Schritte mit eigenen `requires`. Die Mailregel „Rückfrage ersetzt die Eingangsbestätigung“ bleibt in `CreateReservation` und liest das `AdvanceResult`. Gesichert ist das durch einen Golden-Master-Vergleich der Kommunikationsaufträge (`05` §4). | +| `bookings:auto-offers` | gleicher Eintrag und gleiche Fallauswahl; ruft `advance` statt `AutoOffer` | +| `cases:data-requests`, `bookings:expire-holds`, Erinnerungen, Bewertungen | unverändert. Diese Actions schreiben ihre Wirkung selbst. Wo danach etwas Neues bereit werden kann (Übergabe einer stummen Rückfrage, Ablauf einer Angebotsfrist), rufen sie `advance` für den betroffenen Vorgang. | +| Eingang eines Kanalereignisses (`02` §8) | über die bestehenden Actions, die schon `advance` rufen | + +Es entsteht **kein** neuer Scheduler-Eintrag und keine Ereignis-Warteschlange. + +### 7.5 Ereignisgetriebene Sonderprozesse im Runner + +- Storno, Änderung und Portalmeldungen haben keinen Planplatz. Sie erscheinen als Aufgabe (heute `URGENT` in `CaseActivities`) und werden zuerst angezeigt. +- **[Entscheidung offen O4]** Eine offene Meldung „Portal meldet Stornierung/Änderung“ setzt automatische **Außenwirkungen** des Vorgangs aus, bis sie geklärt ist: Unterlagen, Erinnerungen, Anreiseinformation. Die Vorbereitung im System bleibt erlaubt. Das ist eine beabsichtigte Abweichung von v0.11 und braucht einen Test sowie einen Eintrag im Golden Master. Empfehlung: ja. +- Nach der fachlichen Entscheidung über die Meldung (`CancelBooking`, `ChangeBooking` oder Verwerfen) ruft die Action `advance`. + +### 7.6 Nachweis-Szenario K1: fehlende Anschrift, Klärungsreservierung, Rückfrage, Fristablauf, spätere Antwort + +Annahmen: A1, Webseite, `a1.offer@1`, Automatik an, `FormRequiresAddress = vor dem Angebot`, `ClarificationHoldAutoMinutes = 120`, `DataRequestReminderHours = 24`, `DataRequestRemindersMax = 2`, `HoldHours = 72`. + +| Zeit | Ereignis | Wirkung (Action, unverändert) | Schritte danach (abgeleitet) | Runner | +|---|---|---|---|---| +| Fr 18:00 | Anfrage ohne Anschrift (`CreateReservation`) | unter Kalendersperre: Klärungsreservierung bis 20:00 (`RequestHold::for`, qualifiziert: Wohnung, Zeitraum, E-Mail) | `guest.details` Open (fehlt Anschrift); `hold` Waiting bis 20:00; `offer.binding` Later (requires `guest.details`) | bereit: `guest.data_request` → Rückfrage per Link; die Rückfrage ersetzt die Eingangsbestätigung. `offer.binding` nicht bereit. `hold` läuft unabhängig. | +| Fr 18:00 | – | – | `guest.details` Waiting (`waitsFor: guest`, bis Erinnerung Sa 18:00) | nichts mehr bereit | +| Fr 20:00 | Frist der Klärungsreservierung | Kalender ist frei, weil `isHoldActive` false ist. `ExpireReservations` lässt den Vorgang bewusst offen (nur `HOLD_OFFER` läuft ab) [Befund]. | `hold` Done („Klärungsreservierung abgelaufen, Zeitraum nicht mehr reserviert“); Anfrage bleibt Reserved | – | +| Sa 18:00 | `cases:data-requests` | Erinnerung 1 (`remindDue`) | `guest.details` Waiting bis So 18:00 | – | +| So 11:00 | Gast antwortet per Mail mit Anschrift | `ReceiveInboundMessage` → `ExtractMessageFacts` → `ContributeCaseFacts` (Quelle E-Mail, Übernahme nach Regel) → `advance` | `guest.details` Done; Rückfrage wird geschlossen (Listener `ContinueDataRequest`, heute) | bereit: `offer.binding`. `blockers` = `AutoOffer::blockers`: Klärungsreservierung abgelaufen ist zulässig (`$clarified`), der Zeitraum wird geprüft. | +| So 11:00 | a) Zeitraum frei | `SendOffer` mit neuer Angebotsreservierung (72 h, `HOLD_OFFER`) | `offer.binding` Done, `offer.acceptance` Waiting (Gast) | fertig | +| So 11:00 | b) Zeitraum inzwischen belegt | kein Versand | `offer.binding` Problem „Der Zeitraum ist inzwischen belegt.“ → Aufgabe | fertig; der Vermieter entscheidet (Alternativtermin, Absage) | +| So 18:00 (falls keine Antwort) | `cases:data-requests` | Erinnerung 2; nach dem Maximum `handOver` → Aufgabe „Gast antwortet nicht“ | `guest.details` Open (Vermieter trägt ein oder schließt ab) | `advance` nach Übergabe: nichts bereit | +| Mi 11:00 | Angebotsfrist (Fall a) | `ExpireReservations` → Expired | alle offenen Schritte `NotApplicable` (`$later`-Regel) | – | + +Testnachweis: `RunnerIndependentStepsTest` spielt die Tabelle mit fester Uhr durch. Geprüft werden je Zeile die Schrittzustände, die Bereitschaft, die ausgeführten Actions und die Mails. Er läuft zusätzlich als Tester-Szenario S02/S04/S05 (`04` §5). + +### 7.7 Fassaden + +`CaseActivities::for/next/situation` und `CaseAutomation::advance/documentBlockers` bleiben als dünne Fassaden. So bleiben `ViewBooking`, `BookingInfolist`, `WorkList`, `ActivityDetails` und die Kommandos stabil. Der Runner übernimmt zentral: + +- die Regel „nach Vorgangsende ist nichts mehr zu tun“ (`$later`); +- die Ereignistypen aus `ActivityDetails::EVENT_TYPES`, die in die Moduldefinition (`events`) wandern. --- -## 8. Trennung von Kanaladaptern und Fachprozess (N7) +## 8. Kanalereignisse und Vertragsverbindlichkeit (N7, K4, K10) ### 8.1 Befund - `ChannelConnector` kennt nur `fetchOccupations` (iCal). -- Mails laufen über `ProcessPortalMail` → `PortalMailParser` → `PortalIntake::inquiryMail/cancellationMail`. -- Belegungen laufen über `SyncChannel` → `BlockedPeriod` → `PortalIntake::process(BlockedPeriod)`. -- Die fachliche Annahme (`PortalIntake::evaluate/process/adopt`: Duplikat über `caseByReference`/`caseWithSameNights`, `certainty`) ist also schon vom Transport getrennt. Sie ist aber an die **Form** `BlockedPeriod` gebunden. +- Mails laufen über `ProcessPortalMail` → `PortalMailParser` → `PortalIntake::process` (Buchung, über eine Mail-Sperre `source = email`), `cancellationMail` oder `inquiryMail`. +- Belegungen laufen über `SyncChannel` → `BlockedPeriod` (`source = channel`) → `PortalIntake::process` und `afterSync`. +- **Sicherheitsregeln (E-019)** sind schon im Code: + - Meldungen zu bekannten Vorgängen werden zu Aufgabe und Verlaufseintrag; der Vorgang wird **nie** storniert, freigegeben oder geändert. + - Ein neuer Vorgang entsteht nur bei Sicherheit (`certainty`: Buchungsmail mit Nummer, Regel `portal_reservation` als `leading_candidate`, vom Vermieter eingeordnet). + - Stornomails heben nur die **Mail-Sperre** auf, nicht den Vorgang. +- Portalzahlungen werden als `PaymentKind::GuestViaPortal` („laut Portal“) erfasst, angekündigte Auszahlungen als `AmountKind::PayoutAnnounced`. Beides ist kein Eingang auf unserem Konto (`PaymentKind::PortalPayout` erfasst nur der Vermieter). +- Die Zuordnung einer Mail zum Portal geschieht über die Absenderdomain (`ProcessPortalMail::channelFor`). Eine Mail ist also **nicht authentifiziert**. -### 8.2 Vorschlag: Kanalereignisse +### 8.2 Vier Stufen statt einer Vertrauensstufe + +Der frühere Entwurf ordnete `Provenance.trust` den Nachweisstufen zu. **Das wird verworfen**: Die Verlässlichkeit einer Quelle belegt nicht, dass eine Geschäftshandlung erfolgt ist. + +| Stufe | Bedeutung | Wer stellt sie fest | Darf bewirken | +|---|---|---|---| +| **M1 Eingegangene Meldung** | Etwas ist angekommen (Mail, Kalendereintrag, API-Antwort, Webhook) | Transportadapter | Speicherung als Beleg, Duplikatprüfung, **Kalender-Schutzwirkung** (Sperre bei möglicher Buchung) | +| **M2 Authentifizierte, zugeordnete Portalinformation** | Herkunft technisch gesichert und eindeutig einem Kanal der Wohnung und, falls genannt, einem Vorgang zugeordnet | Adapter (Authentizität) + `PortalIntake` (Zuordnung: Nummer, Nächte, keine Mehrdeutigkeit) | neuer Vorgang bei Eingangsart Buchung nach `certainty`; Angaben „laut Portal“ (`RecordPortalAmounts`, `ContributeCaseFacts` mit Quelle); Aufgabe zu bekanntem Vorgang | +| **M3 Fachlich bestätigte Erledigung** | Ein Schritt ist tatsächlich erledigt: Beleg geprüft, Mindestnachweis erreicht | Vermieter oder eine Regel, die einen **Beleg** auswertet (z. B. Bankeingang, vom Vermieter erfasst) | Nachweisstufe eines Schritts erhöhen; `case.settlement` freigeben | +| **M4 Zulässige Änderung des verbindlichen Vorgangs** | Rechtswirksame Änderung des Vertrags (Storno, Umbuchung, Preis) | nur eine fachliche Action mit Entscheidung des Vermieters: `CancelBooking`, `RecordCancellation`, `ChangeBooking`; bei A3–A5 nach Portal-Nachweis | Statuswechsel, Preis- und Fristwirkung | + +`Provenance` beschreibt deshalb nur Herkunft und Authentizität: ```php -namespace App\Channels\Events; - -final readonly class Provenance // where an event came from and how far it can be trusted +final readonly class Provenance { public function __construct( public Channel $channel, - public string $transport, // 'ical' | 'email' | 'api' | 'webhook' - public string $trust, // 'announced' | 'stated_by_portal' | 'verified' (= evidence levels, 03 §5) + public string $transport, // 'ical' | 'email' | 'api' | 'webhook' + public string $authenticity, // 'unauthenticated' (ical, mail sender) | 'authenticated' (signed webhook, API with credentials) public ?string $externalReference, - public ?string $evidenceRef, // portal_emails.id, blocked_periods.id, raw payload id + public string $evidenceRef, // blocked_periods.id, portal_emails.id, stored raw payload public CarbonImmutable $receivedAt, ) {} } - -// One class per business event, all plain data: -IncomingBooking(Provenance, arrival, departure, guests?, guest facts[], amounts?, binding: bool) -IncomingInquiry(Provenance, arrival, departure, guests?, guest facts[], message?) -BookingCancelledByChannel(Provenance, reference, cancelledOn) -BookingChangedByChannel(Provenance, reference, new dates?, new guests?) -PaymentReported(Provenance, reference, amounts[], paidOn) // → RecordPortalAmounts -PayoutReported(Provenance, reference, amount, paidOn) // → RecordPortalAmounts / CaseMoney -OccupationsReported(Provenance, list) // → SyncChannel (today's path) ``` -- **Ein Eingang:** `ChannelEventHandler::handle(ChannelEvent)` verteilt an die bestehenden Fachfunktionen: `PortalIntake` (umgestellt von `BlockedPeriod` auf `IncomingBooking`/`IncomingInquiry`; die Sperre im Kalender entsteht weiterhin als `BlockedPeriod` mit `source = transport`), `CancelBooking`, `ChangeBooking`-Vorschlag sowie `RecordPortalAmounts`. -- **Prüfungen bleiben im Fachprozess**, unabhängig vom Transport: Herkunft (`Provenance.channel` gehört zur Wohnung des Mandanten), Vertrauensstufe, Duplikate (Referenz, gleiche Nächte) und Verbindlichkeit (`binding` + `trust`). -- **Adapter-Fähigkeiten** als kleine Zusatzschnittstellen am Connector: `ImportsOccupations` (heute `fetchOccupations`), `DeliversEvents` (Abruf, `fetchEvents(Channel, since): list`), `ReceivesWebhooks` (Route `channels/{channel}/hook` → Adapter → Ereignisse), `PushesAvailability` (später). `ChannelRegistry` und `config/channels.php` bleiben das Register. +Eine Zuordnung zur Nachweisstufe gibt es nicht. `authenticity` beeinflusst nur, ob die Stufe M2 ohne zusätzliche Bestätigung erreicht wird (§8.3). Eine Meldung erreicht M3 oder M4 **nie** allein durch ihren Eingang. -**N7-Nachweis:** Ein künftiger `FewoDirektApiConnector` implementiert `DeliversEvents` und liefert `IncomingBooking` mit `transport = 'api'` und `trust = 'stated_by_portal'`. Danach laufen dieselben Schritte wie bei der Mail-Schnellspur: Duplikat zur iCal-Sperre über Referenz/Nächte, dann `TakeOverExternalBooking`, dann das gewählte Modell `a4.portal_booking`. Geändert werden müssen nur der Adapter und sein Registereintrag. **Unverändert** bleiben `PortalIntake`, `TakeOverExternalBooking`, die Modelle und der Konfigurator. +### 8.3 Ereignisverträge + +Jedes Ereignis ist ein reines Datenobjekt. Der Handler ruft nur bestehende Fachfunktionen auf. + +| Ereignis | Pflichtdaten | Sicherheitsprüfungen | Erlaubte Wirkung | Nie | +|---|---|---|---|---| +| **`IncomingBooking`** (neue verbindliche Portalbuchung) | Kanal, Zeitraum, Referenz (bei Mail/API Pflicht), Belegquelle | Kanal gehört zur Wohnung; `booking_model` erlaubt Buchungen; Duplikat über Referenz, gleiche Nächte und Spiegelung (`PortalIntake::evaluate`); Überschneidung → Klärung; `certainty`; Eingangsmodus des Kanals (`case_intake`) | Sperre (`BlockedPeriod`, `source` = Transport); Vorgang über `TakeOverExternalBooking` mit Plan des gewählten Modells; Angaben „laut Portal“ | Vorgang ohne Referenz aus Mail/API; Zusammenführen bei abweichender Referenz; eigene Annahme oder eigener Preis (A3–A5) | +| **`BookingCancelledByChannel`** | Kanal, Referenz oder Zeitraum, Beleg | Zuordnung eindeutig, sonst Klärung | Aufgabe `PortalCancellationReported` + Verlauf; Aufheben einer **Mail-Sperre** desselben Eintrags; Aussetzen automatischer Außenwirkungen (O4) | Stornieren des Vorgangs, Freigabe des Kalenders aus einer Vorgangssperre, Erstattung, Stornogebühr | +| **`BookingChangedByChannel`** | Kanal, Referenz, neue Daten | Zuordnung eindeutig; neue Nächte gegen Verfügbarkeit **geprüft, nicht gesperrt** | Aufgabe `PortalChangeReported` mit Vergleich alt/neu; Vorschlag für `ChangeBooking` | Änderung von Zeitraum, Preis oder Gästen ohne Action des Vermieters | +| **`PaymentReported`** (Gast hat beim Portal gezahlt) | Kanal, Referenz, Betrag, Datum | Zuordnung eindeutig; Betrag plausibel zum Portal-Gesamtpreis | `RecordPortalAmounts` → `PaymentKind::GuestViaPortal` „laut Portal“; idempotent über Betrag + Datum + Quelle [Befund] | Zahlung als Eingang auf unserem Konto (`PaymentKind::Guest` oder `PortalPayout`); Mahnstopp für eigene Forderungen (A3) | +| **`PayoutReported`** (Portal kündigt Auszahlung an oder meldet sie) | Kanal, Referenz, Betrag, Datum, Art (angekündigt/ausgeführt laut Portal) | wie oben | `AmountKind::PayoutAnnounced` bzw. Verlaufseintrag „Auszahlung laut Portal ausgeführt“; Nachweisstufe des Schritts `portal.payout` = „laut Portal“ | Kennzeichnung als eingegangen; `case.settlement` ohne Mindestnachweis (D3) | +| `IncomingInquiry` | Kanal, Zeitraum, Kontakt | wie heute `inquiryMail` | `TakeOverPortalInquiry` | – | +| `OccupationsReported` | Liste `ExternalPeriod` | wie heute `SyncChannel` | heutiger Pfad | – | + +**Erstattungen:** Kein Ereignis kennzeichnet eine Erstattung als ausgeführt. Eine Erstattung (`PaymentKind::Refund`) erfasst nur der Vermieter. Eine Portalmeldung „Erstattung veranlasst“ wird zur Aufgabe mit Beleg. + +**Duplikate zwischen iCal, Mail und API:** Alle Buchungsereignisse werden auf dieselbe `BlockedPeriod`-Form abgebildet und durchlaufen `PortalIntake::evaluate`. Die Duplikatregeln bleiben deshalb **eine** Implementierung: + +1. bereits verknüpft; +2. gleiche Referenz; +3. Spiegelung; +4. gleicher Kanal mit gleichen Nächten; +5. Überschneidung → Klärung. + +Eine Mail-Sperre und eine API-Sperre mit gleicher Referenz werden vom nächsten iCal-Abgleich bestätigt, nicht doppelt angelegt (heutiges Verhalten von `SyncChannel` für `source = email`, erweitert auf `api`). + +### 8.4 Kleinster tragfähiger Ansatz (K10) + +| | **V-E1 Ergänzung (gewählt)** | V-E2 Komplettumbau | +|---|---|---| +| Idee | Ereignisklassen und `ChannelEventHandler` als **neuer** Eingang für künftige Adapter. Der Handler bildet Buchungs-, Storno- und Änderungsereignisse auf die vorhandene Form ab (`BlockedPeriod` + `PortalIntake::process` bzw. `reportToCase`) und Geldereignisse auf `RecordPortalAmounts`. **iCal und Mail bleiben unverändert.** | `PortalIntake` nimmt nur noch Ereignisse an; `SyncChannel` und `ProcessPortalMail` werden auf Ereignisse umgebaut | +| Änderungsumfang | neu: `app/Channels/Events/*`, `ChannelEventHandler`, Fähigkeits-Interfaces. Geändert: `PortalIntake` an zwei Stellen (`source`-Liste um `api`/`webhook`; `cancellationMail` delegiert an ein allgemeines `reportToCase(Channel, reference, kind, evidence)`) | `PortalIntake`, `SyncChannel`, `ProcessPortalMail`, `ReconcileChannelRepresentations`, Tests der Eingänge | +| Testaufwand | neue Ereignistests + unveränderte Bestandstests | alle Eingangstests anpassen | +| Doppelverarbeitung | gering: ein Prüfpfad (`evaluate`) für alle Transporte | gering, aber Umbaufehler im heute funktionierenden Pfad möglich | +| Zukunftsfähigkeit | ausreichend: Ein API-Adapter liefert Ereignisse, die denselben Fachpfad nutzen | gleich | +| Parallele Geschäftslogik? | nein; der Handler enthält keine Entscheidungsregeln | nein | + +**Begründung:** Ein Komplettumbau brächte keinen fachlichen Gewinn, weil `BlockedPeriod` ohnehin die Kalenderwahrheit jeder Buchung ist. Gleichzeitig würde er den funktionierenden Eingang gefährden. V-E2 wird erst nötig, wenn ein Portal Ereignisse liefert, die sich nicht als Belegung, Meldung oder Betrag ausdrücken lassen. Das wird dann neu bewertet. + +**Adapter-Fähigkeiten** als kleine Zusatzschnittstellen am Connector: + +- `ImportsOccupations` (heute `fetchOccupations`); +- `DeliversEvents` (`fetchEvents(Channel, since)`); +- `ReceivesWebhooks` (Route `channels/{channel}/hook`, Signaturprüfung im Adapter → `authenticity = authenticated`); +- `PushesAvailability` (später). + +`ChannelRegistry` und `config/channels.php` bleiben das Register. Jeder Adapter nutzt für Netzzugriffe die `Http`-Fassade; das prüft ein statischer Test (`04` §3.5). + +**N7-Nachweis:** Ein künftiger `FewoDirektApiConnector` implementiert `DeliversEvents` und liefert `IncomingBooking` mit `transport = api`, `authenticity = authenticated`. Danach laufen dieselben Prüfungen wie bei der Mail-Schnellspur: + +1. Duplikat zur iCal-Sperre über Referenz und Nächte; +2. `TakeOverExternalBooking`; +3. das gewählte Modell `a4.portal_booking`. + +Geändert werden nur der Adapter und sein Registereintrag. diff --git a/docs/Prozessarchitektur/Architektur/03_KANALKONFIGURATOR.md b/docs/Prozessarchitektur/Architektur/03_KANALKONFIGURATOR.md index 02c6317..8e44472 100644 --- a/docs/Prozessarchitektur/Architektur/03_KANALKONFIGURATOR.md +++ b/docs/Prozessarchitektur/Architektur/03_KANALKONFIGURATOR.md @@ -1,173 +1,265 @@ -# 03 – Kanalkonfigurator: Modellauswahl, Konfiguration entlang der Schritte, Vorschau +# 03 – Kanalkonfigurator: Modellwahl, Verantwortungen, Konfiguration am Schritt, Vorschau -Stand: 04.11.2026 · Kennzeichnung: **[Befund]**, **[Vorschlag]**, **[Entscheidung offen]** +Stand: 04.11.2026, **Review V2** (K6, E1–E3, D3, D4, D6 eingearbeitet) · Kennzeichnung: **[Befund]**, **[Vorschlag]**, **[Entschieden]**, **[Entscheidung offen]** -Dieses Dokument **ersetzt** `Vorschläge/KANALKONFIGURATOR.md` als Zielbild. Dessen Inhalte werden übernommen und auf die Fachmodul-Architektur (`02`) gestellt: +Dieses Dokument **ersetzt** `Vorschläge/KANALKONFIGURATOR.md` als Zielbild: - Die „Schablone“ wird zu Prozessmodell und Variante. - Die Schritte sind die Module des Modells. -- Die Nachweisregel wird ein Modulparameter. -- Die Vorschau wird Teil des Prozess-Testers. +- Die Nachweisregel wird ein Schrittparameter. +- Die Vorschau führt zum Prozess-Tester. -Die offenen Punkte D1–D6 des Vorschlags sind in `06` §9 eingeordnet. +**Leitsatz:** Das Modell setzt den Rahmen. Die eigentliche Konfiguration geschieht **am Schritt**: Schalter, Ausführungsart, Ausführende, Fristen, Nachweis. Der Konfigurator ist keine Auswahl weniger starrer Abläufe. --- ## 1. Ausgangslage [Befund] -- `EditChannel`/`ChannelForm` zeigen technische Kanaldaten: Import, Export, Echo, Regeln. Dazu kommt je Eingangsart eine flache Liste von `ProcessSetting`-Feldern, die in `channels.process_overrides[intake]` gespeichert werden. -- `HandlingSettings` (Vermieter) und `PropertyForm` (Wohnung) zeigen dieselben Felder auf ihrer Ebene. `EffectiveSettings` zeigt die wirksamen Werte mit Herkunft. -- Was ein Vorgang dieses Kanals **tut**, ist nirgends sichtbar. Ebenso wenig ist erkennbar, welche Einstellung welchen Schritt betrifft. Das ist die Kritik aus dem Auftrag (§1). +- `EditChannel`/`ChannelForm` zeigen technische Kanaldaten (Import, Export, Echo, Regeln). Dazu kommt je Eingangsart eine flache Liste von `ProcessSetting`-Feldern in `channels.process_overrides[intake]`. +- `HandlingSettings` (Vermieter) und `PropertyForm` (Wohnung) zeigen dieselben Felder auf ihrer Ebene; `EffectiveSettings` zeigt die wirksamen Werte mit Herkunft. +- Was ein Vorgang dieses Kanals **tut**, ist nirgends sichtbar. Ebenso wenig ist erkennbar, welche Einstellung welchen Schritt betrifft. +- `ProcessProfile::caseTypeFor` leitet bei Buchungen den Archetyp aus zwei Verantwortungen ab: `Documents = Portal` → A5, sonst `Payments = Portal` → A4, sonst A3. `GuestMessages` geht nicht in den Archetyp ein. --- -## 2. Auswahl nach Kanal und Eingangsart [Vorschlag] +## 2. Modell je Kanal und Eingangsart -### 2.1 Aufbau +### 2.1 Aufbau [Vorschlag] -Neue Seite **Kanal › Ablauf** (`ChannelProcess`, Unterseite der `ChannelResource` wie heute `ChannelRules`). Ein Reiter je Eingangsart, die der Kanal liefert: +Neue Seite **Kanal › Ablauf** (`ChannelProcess`, Unterseite der `ChannelResource` wie `ChannelRules`), mit einem Reiter je Eingangsart, die der Kanal liefert: -- Die zulässigen Eingangsarten folgen aus dem Kanal. `booking_model`: `Inquiry` → nur Anfrage, `PortalBooking` → nur Buchung, `Mixed` → beide. Die eigene Webseite (`isWebsite()`) liefert nur Anfrage, bis die Direktbuchung freigegeben ist (D6). -- Je Reiter steht oben eine Frage: **„Wie wird eine Anfrage über FeWo-direkt abgewickelt?“** Darunter stehen die **zulässigen Modelle** als Karten, jeweils mit Kurzbeschreibung, Archetyp-Kennzeichen und den wichtigsten Folgen in einem Satz. +- Die Eingangsarten folgen aus `booking_model`: `Inquiry` → Anfrage, `PortalBooking` → Buchung, `Mixed` → beide. +- Die eigene Webseite liefert nur Anfragen (D6). -| Kanal (Beispiel) | Eingangsart | wählbare Modelle (Varianten) | Vorbelegung bei Umstellung | -|---|---|---|---| -| Eigene Webseite | Anfrage | `a1.offer` (standard, loyalty), `a1.information` | aus heutigem `PreReservation` | -| FeWo-direkt (`Mixed`) | Anfrage | `a2.offer`, `a2.information` | aus `PreReservation` des Kanals | -| FeWo-direkt (`Mixed`) | Buchung | `a4.portal_booking`, `a5.portal_booking`, `a3.portal_booking` | aus `Documents`/`Payments` des Kanals | -| Destination Solutions | Buchung | `a3.portal_booking`, `a4.portal_booking` | aus `Documents`/`Payments` | +Je Reiter steht oben die Frage „Wie wird eine Buchung über FeWo-direkt abgewickelt?“. Darunter erscheinen die zulässigen Modelle als Karten, darunter die Schrittliste (§3). -Die Zuordnungen in der Tabelle sind Beispiele. Ob ein Modell für einen Kanal zulässig ist, legt das Modell fest (`intakes()`, `channelKinds()`). Darüber hinaus kann ein Connector die Auswahl einschränken (`ChannelConnector::allowedModels()`, optional). Beispiel: Destination Solutions zahlt nie aus, also ist dort kein A4 möglich. **[Entscheidung offen E2]** Diese Einschränkungen je Portal müssen anhand `docs/PORTALE.md` und `Szenarien/R08`/`R09` verbindlich festgelegt werden. +### 2.2 Zulässige Modelle je Kanal (E2) [Entschieden: Ableitungsregel; Vorschlag: Zuordnung] -### 2.2 Keine unzulässigen Kombinationen +**Regel (E2):** Die zulässigen Modelle richten sich nach den tatsächlichen Geschäfts- und Integrationsfähigkeiten des Kanals. Technisch: -- Angeboten werden nur Modelle, deren `intakes()` die Eingangsart und deren `channelKinds()` die Kanalart enthält. -- Parameter, die einem Modell widersprechen, gibt es nicht. Ein Beispiel ist „Dokumente: Portal“ in `a3`: Die Verantwortungen sind im Modell festgelegt (E1). -- Speichern läuft über die Action `ConfigureChannelProcess`. Sie validiert gegen `ProcessCatalogue::validate($model, $variant, $config)`. Die Filament-Seite ändert nichts selbst; das entspricht der Projektregel, dass Geschäftsoperationen in `app/Actions` liegen. +- `ProcessModel::intakes()` und `channelKinds()` filtern nach Eingangsart und Kanalart. +- Ein Connector kann zusätzlich einschränken (`ChannelConnector::allowedModels()`). +- Für Portale ohne eigenen Connector steht die Einschränkung als Kanaleigenschaft im Register (`config/channels.php`, Profil des Portals). + +Zuordnung, abgeleitet aus `PORTALE.md`, `R08`, `R09` und `01_Buchungsarchetypen.md`: + +| Kanal | Eingang | zulässig | Vorbelegung | Grundlage | +|---|---|---|---|---| +| Eigene Webseite | Anfrage | `a1.offer`, `a1.information` | aus `PreReservation` | A1; Direktbuchung D6 später | +| FeWo-direkt | Anfrage | `a2.offer`, `a2.information` | aus `PreReservation` | PORTALE §2: „Anfrage oder Sofortbuchung“ | +| FeWo-direkt | Buchung | `a4.portal_booking` | A4 | R09: Portal verwaltet Anzahlung und Restzahlung; Vermieter versendet eigene Vertragsdokumentation | +| Destination Solutions | Buchung | `a3.portal_booking` | A3 | R08: Portal bestätigt verbindlich; Vermieter verantwortet Vertrag, Zahlungsforderung und Überwachung | +| Destination Solutions | Anfrage | keine | – | R08 kennt nur verbindliche Buchungen | +| ferienundwohnen.de, Ostseeklar | Anfrage | `a2.offer`, `a2.information` | aus `PreReservation` | PORTALE §2: Anfragen gehen per Mail an den Vermieter; keine Buchung über das Portal | +| Booking.com, Traum-Ferienwohnungen | – | nicht vorkonfiguriert | – | nicht angebunden (PORTALE §2 „Typische weitere“); Zuordnung bei Anbindung | + +**Widersprüche und offene Punkte:** + +- **[Entscheidung offen O2]** Soll FeWo-direkt neben A4 auch **A5** zulassen, also Portal-Unterlagen ohne eigene Vertragsdokumentation? + - R09 beschreibt eigene Vertragsdokumente. Zugleich ist der eigene Vertrag „nicht im Portal hinterlegt“, und das Konto kann „anders konfiguriert sein“. + - Empfehlung: zunächst nur A4. A5 erst zulassen, wenn FW-01 bis FW-07 geklärt sind. +- **[Entscheidung offen O2]** Soll FeWo-direkt auch **A3** zulassen, also Inkasso durch den Vermieter? + - Nach R09-Praxis ist das nicht vorgesehen. + - Empfehlung: nicht zulassen. + +### 2.3 Verantwortungen: bestimmend, variabel, Variante, optional (K6) [Vorschlag; E1 entschieden] + +Jedes Modell erklärt seine **Verantwortungsfelder** (`ProcessModel::responsibilities()`). Für jedes Feld gibt es vier mögliche Arten: + +| Art | Bedeutung | Im Konfigurator | +|---|---|---| +| **bestimmend** | legt den Archetyp fest; Änderung = anderes Modell | nicht als Feld, sondern als Modellwahl | +| **variabel** | im Rahmen des Modells wählbare Ausführende oder Ausführungsart | Auswahl **am Schritt**, nur zugelassene Werte | +| **Variante** | zusätzlicher Schritt aus demselben Archetyp (Erweiterungspunkt) | Variantenwahl am Modell, Schritt erscheint in der Liste | +| **optional / entfällt** | Schritt kann abgeschaltet werden | Schalter am Schritt | + +Verantwortungsmatrix für den Startumfang. „wir“ = Vermieter; „DL“ = Dienstleister des Vermieters (Reinigung, Schlüssel, Gastbetreuung). + +| Verantwortung | A1 | A2 | A3 | A4 | A5 | A6 | +|---|---|---|---|---|---|---| +| Vertragsabschluss / Verbindlichkeit | **wir** (bestimmend) | **wir** (bestimmend) | **Portal** (bestimmend) | **Portal** (bestimmend) | **Portal** (bestimmend) | – | +| Inkasso (wer fordert und empfängt das Geld des Gastes) | **wir** | **wir** | **wir** (bestimmend) | **Portal** (bestimmend) | **Portal** (bestimmend) | wir (variabel: keins) | +| Vertragsdokumentation (verbindliche Bedingungen gegenüber dem Gast) | **wir** | **wir** | **wir** | **wir** (bestimmend, siehe O1) | **Portal** (bestimmend) | – | +| Ergänzende Gastunterlagen (Hausordnung, Anlagen, Rechnung) | wir | wir | wir | variabel: wir / keine | variabel: wir / keine | optional | +| Gastkommunikation (Rückfragen, Erinnerungen) | wir | variabel: wir / über Portal-Postfach | wir | variabel: wir / Portal / beide | variabel: Portal / beide | – | +| Zahlungserinnerungen | wir (optional) | wir (optional) | wir (optional) | entfällt (Portal) | entfällt (Portal) | entfällt | +| Auszahlungskontrolle | – | – | – | wir (Pflicht) | wir (Pflicht) | – | +| Anreiseinformation | variabel: wir / DL | variabel: wir / DL | variabel: wir / DL | variabel: wir / Portal / DL | variabel: Portal / wir / DL | – | +| Lokale Leistungen (Reinigung, Schlüssel, Wäsche) | variabel: wir / DL | variabel: wir / DL | variabel: wir / DL | variabel: wir / DL | variabel: wir / DL | variabel | +| Bewertungsbitte | optional | optional | optional | optional (Portal fragt selbst) | optional | – | +| Andere Kanäle sperren | Pflicht | Pflicht | Pflicht | Pflicht | Pflicht | Pflicht | + +Ableitung: + +- **Archetyp bestimmend** sind Vertragsabschluss, Inkasso und Vertragsdokumentation. Das entspricht `caseTypeFor` [Befund] und E-025 („Dokumente steuern den Ablauf“). +- **Variabel** sind Kommunikation, ergänzende Unterlagen, Anreiseinformation und lokale Leistungen. Beispiel A4 (K6): Die Zahlung bleibt beim Portal. Ob die Anreiseinformation von uns, vom Portal (R09: Gästeinformation etwa 72 h vor Anreise) oder vom Dienstleister kommt, ist eine Einstellung am Schritt `arrival.info`, **kein** Modellwechsel. Dasselbe gilt für ergänzende Unterlagen und das Kommunikationsmittel. +- **Andere Variante oder anderes Modell** braucht es, wenn ein bestimmendes Feld anders liegt, etwa wenn der Vermieter bei A4 keine eigene Vertragsdokumentation mehr sendet (→ A5). Das gilt auch, wenn ein zusätzlicher fachlicher Schritt hinzukommt (Variante, z. B. Loyalty). + +**[Entscheidung offen O1]** Bleibt die Vertragsdokumentation **archetypbestimmend**, so wie heute codiert: `Documents = Portal` ⇒ A5? + +- Empfehlung: ja. Ein A4-Vorgang ohne eigene Vertragsdokumentation ist fachlich A5. Ihn als A4 zu führen, würde die Nachweis- und Abschlussregeln verfälschen. +- Variabel bleiben die **ergänzenden** Unterlagen. + +**Widerspruchsfreiheit (technisch):** + +- `ConfigureChannelProcess` lässt für ein variables Feld nur die Werte zu, die das Modell dafür erklärt. +- Bestimmende Felder sind nicht speicherbar. +- `ProcessPlan::freeze` prüft `caseTypeFor` gegen `caseTypes()` (`02` §5.5). +- So kann eine Einstellung keinen widersprüchlichen Archetyp erzeugen. Test: `ResponsibilityMatrixTest` mit allen Modell × Feld × Wert-Kombinationen. --- -## 3. Konfiguration entlang des Ablaufs [Vorschlag] +## 3. Konfiguration am Schritt [Vorschlag] ### 3.1 Schrittliste -Nach der Modellwahl zeigt die Seite die Schritte **in der Reihenfolge des Modells**, gruppiert nach P01–P05 („Eingang und Daten“, „Angebot und Verbindlichkeit“, „Abwicklung“, „Aufenthalt“, „Abschluss“). Jeder Schritt ist eine aufklappbare Karte: +Nach der Modellwahl zeigt die Seite die Schritte in Modellreihenfolge, gruppiert nach P01–P05. Jeder Schritt ist eine aufklappbare Karte: ``` -┌ 3 Fehlende Angaben beim Gast anfragen [ optional ● an ] -│ Was: Fragt fehlende Pflichtangaben per Link beim Gast an und erinnert. -│ Wann: Sobald Angaben für das Angebot fehlen – vor dem Angebot. -│ Wer: System · Ausführung: ( ) automatisch (●) nach Freigabe ( ) manuell -│ Fristen: Erinnerung nach 24 h (geerbt: Ihre Standards) · höchstens 2 Erinnerungen (hier gesetzt) -│ Braucht: E-Mail-Adresse des Gastes -│ Nachweis: Anfrage und Antworten im Verlauf (automatisch) -│ Folgen: Ist der Schritt aus, wartet das Angebot, bis Sie die Angaben selbst eintragen. +┌ 9 Anreise-Informationen [ an ] +│ Was: Wegbeschreibung, Schlüssel, Kontakt vor Ort. +│ Wann: 3 Tage vor Anreise (geerbt: Ihre Standards). +│ Wer: ( ) wir (●) Portal (FeWo-direkt sendet ~72 h vorher) ( ) Dienstleister +│ Nachweis: Mindestens „laut Portal erledigt“ (Vorgabe für Portal-Schritte) +│ Folgen: Wir senden keine eigene Anreise-Mail; bleibt der Nachweis aus, erscheint +│ beim kaufmännischen Abschluss „Nachweis fehlt“. └ ``` -| Auftrag §7.2 | Quelle in der Karte | +| Angabe | Quelle | |---|---| | Aufgabe | `ModuleDefinition::purpose` | -| Wann | Phase und Position im Modell sowie `triggers` als Klartext | -| verbindlich / bedingt / optional, kann entfallen | `toggle` (Pflicht = Schloss-Symbol, kein Schalter) | -| Wer führt aus | `performer`: System / Vermieter / Gast / Portal (übertragbare Schritte) | -| automatisch / nach Freigabe / manuell | `modes` des Moduls; wirkt nur, wo deklariert | +| Wann | Phase, `requires` als Klartext, Fristparameter | +| Pflicht / bedingt / optional | `toggle` (Pflicht = Schloss-Symbol, kein Schalter) | +| Wer | `performers` **gefiltert** durch `ProcessModel::responsibilities()` (§2.3) | +| automatisch / nach Freigabe / manuell | `modes` | | Fristen | Parameter mit Zeitbezug (`HoldHours`, `DataRequestReminderHours`, `ArrivalInfoDaysBefore` …) | | Daten | `needs` (Feldnamen aus `CaseRequirements::label`) | -| Nachweise | `evidence` beziehungsweise Mindest-Nachweisstufe für übertragene Schritte (§5) | -| geerbt oder gesetzt | Herkunft je Wert aus `ProcessSettings::resolve` (`ProcessProfile::sourceLabel`), plus Knopf „auf geerbten Wert zurücksetzen“ | -| Folgen für nachgelagerte Schritte | `consequences` (deklarierter Klartext je Schalterstellung) **und** die Vorschau (§6), die den Ablauf neu rechnet | +| Nachweis | Mindestnachweis für Schritte, die nicht wir ausführen (§5) | +| Herkunft | `ProcessSettings::resolve` mit `ProcessProfile::sourceLabel`, Knopf „auf geerbten Wert zurücksetzen“ | +| Folgen | deklarierter Klartext je Stellung **und** die Vorschau (§7) | +| Kennzeichen | „nur im Prozess-Tester“ für `TesterOnly` (Loyalty) | ### 3.2 Einfache Ansicht und Expertenansicht -- **Einfach** (Standard, `AdminMode::Simple`): Modellwahl, Schalter für optionale Schritte, Ausführungsart, die wichtigsten Fristen, Vorschau. -- **Experte**: Hier sind zusätzlich zu sehen: - - alle Parameter; - - Modul- und Modellversion; - - Herkunft je Wert; - - der Vergleich mit dem Vermieterstandard; - - der Link „Wirksame Einstellungen“ (`EffectiveSettings` bleibt als Prüfsicht). +- **Einfach** (Standard, `AdminMode::Simple`): Modellwahl, Schalter, Ausführende, Ausführungsart, wichtigste Fristen, Vorschau. +- **Experte**: zusätzlich alle Parameter, Modul- und Modellversion, Herkunft je Wert, Vergleich mit dem Vermieterstandard und der Link „Wirksame Einstellungen“. - Technische Schlüssel erscheinen nur im Experten-Tooltip, JSON nie. ### 3.3 Ausführungsart je Schritt -Heute gibt es nur `Processing` (global automatisch/manuell) und `DataRequest` (eigener Modus) **[Befund]**. Vorschlag: - -- Module deklarieren ihre zulässigen Arten. Beispiele: `offer.binding`: automatisch / nach Freigabe / manuell; `availability.check`: nur automatisch. -- Gespeichert wird je Modul unter `process_overrides[intake].steps[].mode`. `Processing` bleibt der Standard, wenn nichts gesetzt ist. So bleibt die Vererbung erhalten. -- Diese Lösung beantwortet die frühere Frage des Betreibers: „Datenanfrage automatisch, Rest manuell“. +- Module deklarieren ihre zulässigen Arten. Beispiele: `offer.binding` automatisch / nach Freigabe / manuell; `availability.check` nur automatisch. +- Gespeichert wird unter `process_overrides[intake].steps[].mode`. Ohne Eintrag gilt `Processing`. So bleibt die Vererbung erhalten. +- Damit ist „Datenanfrage automatisch, Rest manuell“ möglich. --- ## 4. Optionale Schritte [Vorschlag] -- Ein Schalter erscheint **nur**, wenn das Modul `Optional` deklariert. Im Startumfang sind das `guest.data_request`, `arrival.details`, `review.request` und in Variante `loyalty` die beiden Loyalty-Module. Hinzu kommt die Zahlungserinnerung als Parameter von `payments.monitor`. -- **Nie abschaltbar**, weil sie im Modell als `Mandatory` stehen und `ConfigureChannelProcess` die Prüfung verweigert: - - `availability.check` - - `channels.block` - - Pflichtangaben vor dem verbindlichen Angebot (`guest.details`) - - `offer.acceptance` - - Verbindlichkeitsprüfung externer Buchungen (`binding.portal`) - - Mail-Schranke (kein Schritt) -- Wird ein optionaler Schritt abgeschaltet, steht er im Plan als `enabled = false` mit Grund „im Kanal abgeschaltet“. Der Vorgang zeigt ihn nicht. Der Prozess-Tester führt ihn als „übersprungen (Konfiguration)“ (N5). +- Ein Schalter erscheint nur bei `toggle = Optional`. Im Startumfang sind das: + - `guest.data_request`; + - `arrival.details`; + - `review.request`; + - die Zahlungserinnerung (Parameter von `payments.monitor`); + - die ergänzenden Unterlagen (A4/A5); + - in der Variante `loyalty` die beiden Loyalty-Module (nur im Entwurf und im Tester). +- **Nie abschaltbar:** + - `availability.check`; + - `channels.block`; + - Pflichtangaben vor dem verbindlichen Angebot (`guest.details`); + - `offer.acceptance`; + - `binding.portal`; + - `portal.payout` bei Portal-Inkasso; + - Mail-Schranke (kein Schritt). +- Ein abgeschalteter Schritt steht im Plan als `enabled = false` mit Grund „im Kanal abgeschaltet“. Im Tester erscheint er als „übersprungen (Konfiguration)“ (N5). --- -## 5. Übertragene Schritte und Nachweis [Vorschlag] +## 5. Schritte, die nicht wir ausführen, und Nachweise (D3) [Vorschlag] -Übernahme aus dem Vorschlag §5: Für Module mit `toggle = Transferable` gilt Folgendes, wenn das Modell sie dem Portal zuweist (A4: `payments.monitor`; A5: `documents.send`, `arrival.info`): +- Der Schritt bleibt im Plan, mit `performer = Portal` bzw. `ServiceProvider`. +- **Nachweisstufen** (Muster `ChannelTaskProof` Initiated/Observed/Confirmed [Befund]): + - **angekündigt:** Das Portal sagt, es werde tun. + - **laut Portal erledigt:** Eine Portalmeldung der Stufe M2 liegt vor (`02` §8.2). + - **nachgewiesen:** M3, also ein geprüfter Beleg, etwa ein vom Vermieter erfasster Bankeingang, ein Dokument oder eine Bestätigung des Dienstleisters. +- Nachweise werden als Verlaufseintrag geführt: `CaseLog::record($booking, 'evidence', …, data: {module, level, source, ref})`. +- Eine Portalmeldung hebt die Stufe **höchstens** auf „laut Portal erledigt“, nie auf „nachgewiesen“. +- Ist die Mindeststufe nicht erreicht, bleibt der Schritt offen mit „Nachweis fehlt“ und erscheint beim kaufmännischen Abschluss (`case.settlement`). Ein begründeter Abschluss durch den Vermieter bleibt möglich und wird protokolliert. -- Der Schritt bleibt **im Plan** mit `performer = Portal`. -- Die Mindest-Nachweisstufe ist ein Modulparameter: angekündigt / laut Portal erledigt / nachgewiesen. Vorgaben je Modell gemäß D3. -- Nachweise werden als Verlaufseintrag `CaseLog::record($booking, 'evidence', …, data: {module, level, source, ref})` geführt. Ein Beleg kann eine Portal-Mail, ein Eintrag der Vermieterin oder eine Datei sein. Das Muster entspricht `ChannelTaskProof` (Initiated/Observed/Confirmed) und `RecordPortalAmounts`. -- `Kanalereignisse` (`02` §8) liefern ihre Stufe über `Provenance.trust` und heben den Nachweis automatisch an. -- Ist die Mindeststufe nicht erreicht, bleibt der Schritt offen mit „Nachweis fehlt“ und erscheint beim kaufmännischen Abschluss (`case.settlement`). Ein begründeter Abschluss bleibt möglich. +**Mindestnachweise, abgeleitet aus den Geschäftsregeln (D3):** + +| Schritt | Ausführende | Mindestnachweis | Grundlage | +|---|---|---|---| +| Inkasso Gastzahlung | Portal (A4/A5) | laut Portal erledigt | R09: Portal verwaltet Raten; Werte „laut Portal“ (`GuestViaPortal`) | +| Auszahlung an uns | Portal → wir (A4/A5) | **nachgewiesen** (Bankeingang vom Vermieter erfasst, `PortalPayout`) | R09: „Nachweis des tatsächlichen Bankeingangs … nicht belegt“ durch Portalansicht | +| Vertragsdokumentation | Portal (A5) | laut Portal erledigt | A5-Definition | +| Ergänzende Unterlagen, Anreiseinformation | Portal | angekündigt | geringe Vertragsrelevanz | +| Anreiseinformation, lokale Leistungen | Dienstleister | angekündigt; „nachgewiesen“ wählbar | Vermieter bleibt verantwortlich | +| Erstattung nach Storno | Portal | **nachgewiesen** | E-019: Erstattung nie allein aus Meldung | + +**[Entscheidung offen O5]** Darf der kaufmännische Abschluss einer A4/A5-Buchung **ohne** erfassten Auszahlungseingang erfolgen, wenn das Portal die Auszahlung als ausgeführt meldet? + +- Empfehlung: nein, nur als begründeter Abschluss mit Protokoll. +- Das ist der einzige verbleibende Teil von D3. --- -## 6. Vererbung und Wirkung auf laufende Vorgänge [Vorschlag] +## 6. Akzeptierte Angaben je Kanal (D4) [Entschieden: Regel] -- Die Hierarchie bleibt **Vermieterstandard → Wohnung → Kanal × Eingangsart → Vorgang**. Die bestehende `ProcessSettings::resolve` wird um zwei Schlüssel ergänzt: - - `model` und `variant`: nur auf Kanalebene, mit Vorgabe aus dem Vermieterstandard je Eingangsart; - - `steps..{on, mode, params}`: auf allen Ebenen. -- Leer bedeutet geerbt; ein gesetzter Wert bleibt ein Wert. Auch `false`, `0` und „entfällt“ sind Werte, wie es `ProcessSetting::normalize` heute schon handhabt. -- Die Speicherung erfolgt in den **bestehenden JSON-Spalten**: `tenants.process_defaults`, `properties.process_overrides`, `channels.process_overrides`. Es gibt keine neue Tabelle und keine zweite Konfigurationsdatenbank. -- Laufende Vorgänge sind geschützt: Der Plan wird beim Eingang eingefroren (`CaseRecorder::freeze` → `profile.plan`). Eine Kanaländerung wirkt nur auf neue Vorgänge. +- Je Kanal und Eingangsart legt ein Parameter von `guest.details` fest, **welche Felder** aus diesem Kanal ohne Rückfrage **übernommen werden dürfen** (Zulässigkeit der Datenübernahme). +- Nicht ausgewählte Felder werden nicht übernommen, sondern zur Bestätigung vorgelegt (Ergebnis wie heute bei Änderungen in verbindlichen Fällen, `CaseFact::CHANGE_REQUEST`; ob ein eigener Ergebniswert nötig ist, klärt U-C). +- Die Regel ersetzt **keine** Prüfung. Herkunft, Plausibilität (`CaseRequirements::isValid`) und Konfliktprüfung (`ContributeCaseFacts::outcome`) laufen immer. +- Ein Konflikt mit einem vorhandenen Wert bleibt ein Konflikt, auch bei „akzeptiert“. +- Test: `AcceptedFieldsTest` (akzeptiertes Feld mit Konflikt → Konflikt; ungültiger Wert → abgewiesen). + +--- + +## 7. Vererbung und laufende Vorgänge [Vorschlag; E3 entschieden] + +- **Hierarchie:** Vermieterstandard → Wohnung → Kanal × Eingangsart → Vorgang. `ProcessSettings::resolve` wird um zwei Schlüssel ergänzt: + - `model`/`variant`: Kanalebene, mit Vorgabe des Vermieters je Eingangsart; + - `steps..{on, mode, performer, params, evidence}`: auf allen Ebenen. +- **Werte:** Leer heißt geerbt. Ein gesetzter Wert bleibt ein Wert, auch `false`, `0` und „entfällt“ (`ProcessSetting::normalize`). +- **Speicherung** nur in den bestehenden JSON-Spalten (`tenants.process_defaults`, `properties.process_overrides`, `channels.process_overrides`). +- **[Entschieden E3]** Änderungen gelten nur für **neu angelegte** Vorgänge. Der Plan wird beim Eingang eingefroren (`CaseRecorder::freeze` → `profile.plan`). - Beim Speichern zeigt die Seite „Gilt für neue Vorgänge. 4 laufende Vorgänge behalten ihren bisherigen Ablauf.“ - - Eine bewusste Übernahme in einen laufenden Vorgang wird **nicht** angeboten. **[Entscheidung offen E3]** Empfehlung: Sie wird nicht angeboten, weil sonst Angebote und Verträge mit abweichenden Regeln entstehen. -- Jede Speicherung schreibt `configured_at` und einen Eintrag im Aktivitätsprotokoll des Kanals (`ConfigureChannelProcess`). Im eingefrorenen Plan eines Vorgangs ist damit nachvollziehbar, welcher Konfigurationsstand galt. + - Eine Übernahme in laufende Vorgänge wird nicht angeboten. +- Jede Speicherung schreibt `configured_at` und einen Eintrag im Aktivitätsprotokoll des Kanals (`ConfigureChannelProcess`, eine Action in `app/Actions`). --- -## 7. Vorschau und Übergang zum Prozess-Tester [Vorschlag] +## 8. Vorschau und Übergang zum Prozess-Tester [Vorschlag] -- **Vorschau** (immer sichtbar, rechte Spalte): der Ablauf eines typischen Vorgangs mit den aktuellen, noch nicht gespeicherten Einstellungen. - - Technisch ist das `ProcessRunner::plan(...)` ohne Fall, also rein aus Definition und Konfiguration. - - Die Liste zeigt je Schritt: aktiv / übersprungen mit Grund; wer, wann, Ausführungsart. +- **Vorschau** (rechte Spalte): der Ablauf eines typischen Vorgangs mit den aktuellen, noch nicht gespeicherten Einstellungen. + - Technisch ist das `ProcessRunner::plan(...)` ohne Fall, rein aus Definition und Konfiguration. - Es wird nichts geschrieben und nichts ausgeführt. -- **„Ablauf testen“** (Knopf unter der Vorschau) öffnet den Prozess-Tester (`04`) mit derselben, auch ungespeicherten Konfiguration. Dort wird ein synthetischer Vorgang mit den echten Modulen durchgespielt. -- Widersprüche werden sofort angezeigt. Beispiel: Ein Kanal liefert laut Import nur Buchungen, aber nur der Reiter „Anfrage“ ist konfiguriert. Die bekannte Lücke aus `KONFIGURATION_UND_WIRKSAMKEIT.md` §7 wird so geschlossen. +- **„Ablauf testen“** öffnet den Prozess-Tester (`04`) mit derselben, auch ungespeicherten Konfiguration. +- Widersprüche werden sofort angezeigt. Beispiel: Der Kanal liefert laut Import Buchungen, aber nur „Anfrage“ ist konfiguriert (Lücke aus `KONFIGURATION_UND_WIRKSAMKEIT.md` §7). --- -## 8. Berechtigungen und Navigation [Vorschlag] +## 9. Berechtigungen und Navigation [Vorschlag] - Es gilt die bestehende Policy der `ChannelResource`; ändern dürfen Administratoren des Mandanten (D5). Die Seite nutzt `FollowsAdminMode`. -- `HandlingSettings` („So arbeite ich“) nutzt **dieselbe** Schrittansicht ohne Kanalbezug, nämlich als Vermieterstandard je Eingangsart. -- `PropertyForm` zeigt nur die Abweichungen der Wohnung (Expertenansicht). -- Die heutige flache Feldliste am Kanal entfällt als Hauptansicht. +- `HandlingSettings` nutzt **dieselbe** Schrittansicht ohne Kanalbezug, als Vermieterstandard je Eingangsart. +- `PropertyForm` zeigt nur Abweichungen der Wohnung (Expertenansicht). +- Die flache Feldliste am Kanal entfällt als Hauptansicht. --- -## 9. Abnahmekriterien Konfigurator +## 10. Abnahmekriterien Konfigurator + +K01–K10 sind Abnahmekriterien; sie sind nicht mit den Review-Korrekturen K1–K10 zu verwechseln. | # | Kriterium (prüfbar auf stommer.info) | |---|---| -| K01 | Je Kanal und Eingangsart ist genau ein Modell wählbar, und zwar nur ein zulässiges. Ein danach eingehender Vorgang erhält Modell, Variante und den erwarteten Archetyp. | -| K02 | Jeder Schritt zeigt Aufgabe, Zeitpunkt, Ausführende, Ausführungsart, Fristen, Daten, Nachweis, Herkunft der Werte und Folgen. Pflichtschritte haben keinen Schalter. | -| K03 | Die Vorschau entspricht der Ablaufliste eines danach eingehenden echten Vorgangs. Das wird automatisch geprüft durch den Vergleich `ProcessRunner::plan` gegen `CaseActivities::for` eines frisch angelegten Falls. | -| K04 | Ein übertragener Schritt ohne Mindestnachweis bleibt offen und erscheint beim kaufmännischen Abschluss. | -| K05 | Eine Konfigurationsänderung verändert keinen laufenden Vorgang. Das zeigen der Plan in `bookings.profile` vorher und nachher sowie ein Test. | +| K01 | Je Kanal und Eingangsart ist genau ein Modell wählbar, und nur ein zulässiges (§2.2). Ein danach eingehender Vorgang erhält Modell, Variante und den erwarteten Archetyp. | +| K02 | Jeder Schritt zeigt Aufgabe, Zeitpunkt, Ausführende, Ausführungsart, Fristen, Daten, Nachweis, Herkunft und Folgen. Pflichtschritte haben keinen Schalter. | +| K03 | Die Vorschau entspricht der Ablaufliste eines danach eingehenden echten Vorgangs (automatischer Vergleich `ProcessRunner::plan` ↔ `CaseActivities::for`). | +| K04 | Ein Schritt eines Portals oder Dienstleisters ohne Mindestnachweis bleibt offen und erscheint beim kaufmännischen Abschluss. | +| K05 | Eine Konfigurationsänderung verändert keinen laufenden Vorgang (Plan in `bookings.profile` vorher/nachher; Test). | | K06 | `EffectiveSettings` und Konfigurator zeigen dieselben Werte und dieselbe Herkunft. | -| K07 | Pflichtangaben, Verfügbarkeit, Verbindlichkeit externer Buchungen und Mail-Schranke lassen sich durch keine Konfiguration umgehen. Die v0.11-Regressionstests bleiben grün, ergänzt um einen Test, der jede `Mandatory`-Abschaltung abweist. | -| K08 | Die Einrichtung eines Kanals in der einfachen Ansicht kommt ohne technische Schlüssel aus. Geprüft wird das durch Bedienung mit dem Betreiber in der Abnahme. | +| K07 | Pflichtangaben, Verfügbarkeit, Verbindlichkeit externer Buchungen und Mail-Schranke lassen sich durch keine Konfiguration umgehen. Jede `Mandatory`-Abschaltung und jeder unzulässige Ausführende werden abgewiesen. | +| K08 | Ein variables Verantwortungsfeld (z. B. Anreiseinformation bei A4: wir → Portal) lässt sich ohne Modellwechsel umstellen. Ein bestimmendes Feld ist nicht umstellbar. Test `ResponsibilityMatrixTest` plus Bedienung in der Abnahme. | +| K09 | Loyalty ist im Entwurf schaltbar und im Tester ausführbar, aber nicht speicherbar (`02` §6.3). | +| K10 | Die Einrichtung eines Kanals in der einfachen Ansicht kommt ohne technische Schlüssel aus (Bedienung mit dem Betreiber). | diff --git a/docs/Prozessarchitektur/Architektur/04_PROZESS_TESTER.md b/docs/Prozessarchitektur/Architektur/04_PROZESS_TESTER.md index 9b2bf7c..dde35f7 100644 --- a/docs/Prozessarchitektur/Architektur/04_PROZESS_TESTER.md +++ b/docs/Prozessarchitektur/Architektur/04_PROZESS_TESTER.md @@ -1,22 +1,27 @@ -# 04 – Prozess-Tester „Ablauf testen“: gleiche Logik, technische Isolation, Ereignissimulation, Bericht +# 04 – Prozess-Tester „Ablauf testen“: gleiche Logik, standardmäßig gesperrt, nachweisbare Isolation -Stand: 04.11.2026 · Kennzeichnung: **[Befund]**, **[Vorschlag]**, **[Entscheidung offen]** +Stand: 04.11.2026, **Review V2** (K5, E4, E8, E9 eingearbeitet) · Kennzeichnung: **[Befund]**, **[Vorschlag]**, **[Entschieden]**, **[Entscheidung offen]** --- -## 1. Zweck und Grenzen [Vorschlag] +## 1. Zweck und Abgrenzung [Vorschlag] -Der Vermieter spielt mit der gerade bearbeiteten Kanalkonfiguration einen **synthetischen Vorgang** durch. Die Konfiguration darf auch ungespeichert sein. Er sieht Schritt für Schritt: +Der Vermieter spielt mit der gerade bearbeiteten Kanalkonfiguration einen **synthetischen Vorgang** durch. Die Konfiguration darf ungespeichert sein. Er sieht Schritt für Schritt: - welche Module liefen und mit welchem Ergebnis; -- welche übersprungen wurden und warum; +- was übersprungen wurde und warum; - was als Nächstes kommt; - welche Aufgaben offen sind; -- welche Wirkungen **simuliert** wurden: Mails, Sperren, Dokumente, Zahlungen. +- welche Wirkungen **simuliert** wurden. -Der Tester ist Teil des Kanalkonfigurators (`03` §7) und gemeinsames Abnahmekriterium. - -Nicht Ziel: Lasttests, Prüfung des echten Portals oder der echten KI-Anbindung. Für die Verbindungsprüfung gibt es die Prüfknöpfe in `AiConnection::check` und `Operations::checkMailbox`. +| | Prozess-Tester | Integrationstest | +|---|---|---| +| Frage | Verhält sich **mein** Ablauf mit **meiner** Konfiguration so, wie ich will? | Funktioniert die Verbindung zu Portal, Postfach, KI, Mailserver wirklich? | +| Fachlogik | echt: dieselben Module, Actions, Preisberechnung | echt | +| Daten | synthetisch, eigener Speicher je Lauf | echt (Testsystem) oder Testkonto beim Anbieter | +| Außenverbindungen | **alle simuliert**, Antworten laut Szenario | echt | +| Wer, wo | Vermieter, im Konfigurator, auch auf dem Produktivsystem | Entwickler/Betreiber: PHPUnit, Prüfknöpfe (`AiConnection::check`, `Operations::checkMailbox`), Abnahme auf stommer.info | +| Aussage zur Schadensfreiheit | ja, das ist sein Zweck (§3) | nein; er wirkt absichtlich nach außen | --- @@ -24,112 +29,170 @@ ## 2. Dieselbe fachliche Logik [Vorschlag] ### 2.1 Prinzip -Der Tester enthält **keine** Fachregeln. Er ist ein Treiber, der drei Dinge tut: +Der Tester enthält **keine** Fachregeln. Er ist ein Treiber mit drei Aufgaben: -1. Er legt den Ausgangszustand in einem isolierten Datenspeicher an (§3). -2. Er löst Ereignisse über **dieselben Einstiegspunkte** aus, die im Betrieb Controller, Kommandos und Connectors verwenden. -3. Er liest nach jedem Ereignis den Ablauf über `ProcessRunner::activities` aus, also dieselbe Methode, die `ViewBooking` nutzt. +1. Er legt den Ausgangszustand im isolierten Speicher an (§3). +2. Er löst Ereignisse über **dieselben Einstiegspunkte** aus wie Controller, Kommandos und Connectors. +3. Er liest danach den Ablauf über `ProcessRunner::activities`, also dieselbe Methode wie `ViewBooking`. -| Szenario-Ereignis | Einstiegspunkt im Betrieb (unverändert) | +| Szenario-Ereignis | Einstiegspunkt im Betrieb | |---|---| -| Gast sendet Anfrage über die Webseite | `CreateReservation::handle` (wie das Livewire-Buchungsformular) | -| Anfrage per Portal-Mail | `ProcessPortalMail::handle(PortalMail)` mit synthetischer `PortalMail` | -| Portalbuchung über iCal | `SyncChannel::handle` mit `ScriptedConnector` (liefert `ExternalPeriod`s) | +| Anfrage über die Webseite | `CreateReservation::handle` | +| Anfrage oder Buchung per Portal-Mail | `ProcessPortalMail::handle(PortalMail)` mit synthetischer `PortalMail` | +| Portalbuchung über iCal | `SyncChannel::handle` mit `ScriptedConnector` | | Portalbuchung über künftige API | `ChannelEventHandler::handle(IncomingBooking)` (`02` §8) | -| Gast ergänzt Angaben per Formular | dieselbe Action wie `GuestDataController` (`ContributeCaseFacts` mit `FactSource::GuestLink`) | -| Gast antwortet per E-Mail | `ReceiveInboundMessage::handle(PortalMail)` → `MessageMatcher` → `ExtractMessageFacts` mit Skript-Antwort der KI | +| Gast ergänzt Angaben per Formular | dieselbe Action wie `GuestDataController` (`ContributeCaseFacts`, `FactSource::GuestLink`) | +| Gast antwortet per E-Mail | `ReceiveInboundMessage` → `MessageMatcher` → `ExtractMessageFacts` mit Skript-Antwort der KI | | Vermieter gibt frei / sendet | Modul-`run` bzw. dieselbe Action wie die Kopfaktion in `ViewBooking` | -| Gast nimmt an / lehnt ab | `AcceptOffer::handle` / `RejectOffer::handle` | -| Zeit vergeht (Frist, Erinnerung, Anreise) | simulierte Uhr (§4) + dieselben Scheduler-Handler: `ExpireReservations::handle`, `SendPendingAutoOffers`, `cases:data-requests`, `SendBookingReminders::handle`, `PrepareStays::handle`, `RequestReviews::handle` | -| Portal meldet Zahlung/Auszahlung | `RecordPortalAmounts::handle` (bzw. `PaymentReported` über den Ereigniseingang) | -| Kommunikation oder Schnittstelle fällt aus | Effekt-Port wirft den echten Fehlertyp: `TransportException`, `AccessRejected`, `ChannelSyncException` | +| Gast nimmt an / lehnt ab | `AcceptOffer`, `RejectOffer` | +| Zeit vergeht | simulierte Uhr + dieselben Handler: `ExpireReservations`, `bookings:auto-offers`-Logik, `RequestCaseData::remindDue`, `SendBookingReminders`, `PrepareStays`, `RequestReviews` | +| Portal meldet Zahlung/Auszahlung | `RecordPortalAmounts` bzw. `PaymentReported`/`PayoutReported` | +| Ausfall | Effekt-Port wirft den echten Fehlertyp (`TransportException`, `AccessRejected`, `ChannelSyncException`) | ### 2.2 Nachweis der Gleichheit -- Jedes mitgelieferte Szenario (§5) existiert zusätzlich als PHPUnit-Test (`ProcessTesterParityTest`). Der Test führt dasselbe Szenario **ohne** Tester auf der normalen Testdatenbank aus, über dieselben Actions, und vergleicht Ablauf, Status und Effektliste mit dem Testerbericht. Weichen sie ab, schlägt der Test fehl. -- Außerdem wird die Vorschau im Konfigurator (`ProcessRunner::plan`) gegen die Ablaufliste eines danach eingehenden echten Vorgangs geprüft (K03). -- Ein Architekturtest stellt sicher, dass Tester-Klassen keine Fachklassen ersetzen. Unter `app/Process/Tester` dürfen keine Klassen liegen, die `ProcessModule` implementieren oder `PriceCalculator`, `AvailabilityChecker` oder Actions ableiten. +- **`ProcessTesterParityTest`:** Jedes Szenario läuft zusätzlich ohne Tester auf der normalen Testdatenbank, über dieselben Actions. Verglichen werden Ablauf, Status und Effektliste; jede Abweichung lässt den Test fehlschlagen. +- **Vorschau gegen Wirklichkeit:** Die Vorschau (`ProcessRunner::plan`) wird gegen die Ablaufliste eines danach eingehenden echten Vorgangs geprüft (K03). +- **Architekturtest:** Unter `app/Process/Tester` liegt keine Klasse, die `ProcessModule` implementiert oder Actions, `PriceCalculator` oder `AvailabilityChecker` ableitet. --- -## 3. Technische Isolation [Vorschlag] +## 3. Technische Isolation (K5) -### 3.1 Warum nicht Rollback oder `dryRun` +### 3.1 Bewertung des bisherigen Entwurfs -Ein Transaktions-Rollback schützt nur die Datenbank, und selbst die nur unvollständig. Es bleiben: +Der bisherige Entwurf schaltete **innerhalb der Admin-Anfrage** die Standardverbindung auf `sandbox` um und stellte sie im `finally` zurück. Die Behauptung, jede Schicht verhindere für sich jeden Schaden, wird **zurückgenommen**. Das Umschalten innerhalb einer normalen Anfrage ist nicht ausreichend sicher: -- Mails: Sie gehen beim Senden raus, nicht beim Commit. -- HTTP-Aufrufe an KI und iCal. -- Dateien: Vertrags-PDFs über `RentalContract` auf `Storage::disk`. -- Warteschlangen-Einträge. -- Sitzungs- und Cache-Schreibvorgänge: `SESSION_DRIVER=database` und `CACHE_STORE=database` laufen auf derselben Verbindung. -- Sperren: `lockForUpdate` an 28 Stellen hält echte Vorgänge auf. -- Ein versehentlicher Commit durch verschachtelte `DB::transaction` mit Fehlerbehandlung. +| Schwachstelle | Warum sie in der Admin-Anfrage besteht [Befund] | +|---|---| +| Bereits aufgelöste Dienste und Zwischenspeicher | Der Container hält Singletons mit echten Daten: `TenantContext`, `Settings`, `SystemSettings` (Cache `rememberForever`), statisch `DocumentCompositionFields::$compositions`. Im Lauf würden sie echte Werte liefern, danach Sandbox-Werte weitertragen. | +| Wiederverwendete Verbindungen | Objekte, die vor dem Umschalten eine `Connection` erhalten haben (Query Builder, Relationen geladener Modelle), schreiben weiter auf die echte Verbindung. | +| Sitzung, Authentifizierung, Livewire | `SESSION_DRIVER=database`, `CACHE_STORE=database`. Die Middleware schreibt am Anfragenende über die Standardverbindung. Livewire hydriert Komponenten mit Modellen der echten Verbindung. | +| Ausnahmen und Verschachtelung | Ein Fehler im `finally` selbst, eine offene Transaktion der Admin-Anfrage oder ein `rescue()` innerhalb einer Action, das den Wächter-Fehler verschluckt (`rescue` ist mehrfach im Einsatz, z. B. `TakeOverExternalBooking`, `SyncChannel`) | +| Gleichzeitige Läufe | Mehrere Läufe eines Mandanten in parallelen Anfragen teilen eine Sandbox-Datei, wenn nicht je Lauf getrennt. Ein gemeinsames Zurücksetzen wäre unsicher. | +| Signierte Links | `SendOffer` erzeugt `temporarySignedRoute('offers.show', …)` mit dem echten `APP_KEY`. Eine Sandbox-Buchung `id = 17` erzeugt einen Link, der in der echten Anwendung die echte Buchung `17` öffnet, sobald er aus dem Bericht kopiert wird. | +| Verschlüsselte Felder | `encrypted`-Casts (`CaseFact::value`, `BlockedPeriod::ical_raw`, `Mailbox::password`). Mit dem echten Schlüssel könnte der Lauf echte Geheimnisse entschlüsseln, falls sie in die Sandbox gelangen. | -Ein `dryRun`-Schalter müsste an jeder Effektstelle beachtet werden und versagt beim ersten vergessenen Aufruf. +**Korrektur:** Der Lauf findet in einer **eigenen Sandbox-Anfrage** statt. Diese wird von Anfang an im Sandbox-Modus gestartet. Die echte Datenbank ist in ihr **nicht konfiguriert**, und es gibt nichts wiederherzustellen, weil der PHP-Prozess der Anfrage endet. Laravel Octane oder ein anderer langlebiger Prozess wird nicht eingesetzt [Befund: `composer.json`]; jede Anfrage beginnt mit frischem Anwendungszustand. -Der Tester verwendet daher **mehrere unabhängige Schutzschichten**. Jede einzelne verhindert schon für sich operativen Schaden. +### 3.2 Ablauf eines Testschritts -### 3.2 Schicht 1: getrennter synthetischer Datenspeicher +``` +Admin-Anfrage (normal, angemeldet) Sandbox-Anfrage (eigener Bootvorgang) +─────────────────────────────────── ───────────────────────────────────────── +1 Berechtigung prüfen (Policy) +2 Schnappschuss LESEN: Mandant, Wohnung, + Saisons, Angebote, Extras, Vorlagen, + Kanal + Entwurfskonfiguration, anonymi- + sierte Sperrzeiten – als Klartext-JSON + (keine Gäste, Buchungen, Nachrichten, + Zugangsdaten, Schlüssel) +3 Laufverzeichnis anlegen: + storage/app/sandbox//input.json +4 Token ausgeben: HMAC(run, tenant, user, + input-hash, Ablauf 5 min) – zustandslos +5 Browser ruft POST /_sandbox/run/ ──▶ 6 SandboxBootstrapper (afterBootstrapping + LoadConfiguration): Pfad + Token prüfen + OHNE Datenbank; sonst 404 + 7 Konfiguration ersetzen (§3.3) – bevor ein + Provider bootet oder eine Verbindung entsteht + 8 Token als verbraucht markieren (Datei) + 9 Vorlage kopieren → /db.sqlite, + input.json einspielen (Eloquent, Sandbox-Schlüssel) + 10 Szenario bis zum gewählten Schritt ausführen + 11 report.json schreiben; Antwort = Bericht +12 report.json lesen, in process_test_runs ◀── + speichern (echte DB, normaler Kontext) +13 Laufverzeichnis löschen +``` -- Eigene Verbindung `sandbox` (`config/database.php`): **SQLite-Datei je Testlauf** unter `storage/app/sandbox/.sqlite`, nach dem Lauf gelöscht. Das passt zur Strato-Dateiquote, siehe `BETRIEB.md`. -- **[Befund]** Die gesamte Testsuite (683 Feature-Tests) läuft auf SQLite (`phpunit.xml`). Die Fachlogik ist also auf SQLite lauffähig und geprüft. -- **Vorlage:** Beim Deployment erzeugt `php artisan process:sandbox-template` eine migrierte, leere SQLite-Vorlage im Release. Jeder Lauf kopiert sie. Es gibt keine Migration zur Laufzeit; das dauert unter 100 ms. -- **Befüllung:** Der `SandboxSeeder` liest vor Aktivierung der Schutzschichten **lesend** aus der echten Datenbank und schreibt nur in die Sandbox-Verbindung. Übernommen werden: - - der aktuelle Mandant (Einstellungen, Texte, Bankangaben laut `TenantConfig`); - - die gewählte Wohnung mit Saisons, Sonderangeboten, Extras, Vertragsvorlagen und den Kanälen dieser Wohnung; - - der zu testende Kanal mit der **Entwurfskonfiguration** aus dem Konfigurator; - - optional die Belegung als anonymisierte Sperrzeiten, damit die Verfügbarkeit realistisch ist. - - **Keine** Gäste, keine Buchungen, keine Nachrichten, keine Zugangsdaten. KI-Schlüssel und Postfach-Passwörter werden nicht kopiert. -- Während des Laufs ist `sandbox` die **Standardverbindung**: `config(['database.default' => 'sandbox'])`, `DB::purge`, `DB::setDefaultConnection`. Kein Modell setzt eine eigene `$connection` **[Befund: keine Fundstelle in `app/`]**. Damit landen alle Eloquent- und Query-Builder-Zugriffe in der Sandbox. +- **Interaktiv** (E9): Jeder Klick „Weiter“ startet eine **neue** Sandbox-Anfrage mit demselben Schnappschuss und der Ereignisliste bis zu diesem Punkt. Die Läufe sind deterministisch (feste Uhr, Skript-Antworten). Zwischen Anfragen wird kein Zustand gehalten. +- Die Sandbox-Anfrage hat **keinen** Zugang zur echten Datenbank. Den Schnappschuss liest die Admin-Anfrage **lesend**; den Bericht speichert die Admin-Anfrage. Kein Modul hat darauf Einfluss. -### 3.3 Schicht 2: Schreibwächter auf der echten Verbindung +### 3.3 Standardmäßig gesperrt: Konfiguration der Sandbox-Anfrage -- Vor dem Lauf registriert `ProcessSandbox` auf der echten Verbindung (Standardverbindung des Servers, MariaDB) einen `beforeExecuting`-Rückruf. Er bricht **jede** Anweisung mit `SandboxViolation` ab, auch Lesezugriffe, solange der Lauf aktiv ist. Ein Zugriff auf die echte Datenbank ist im Lauf ein Fehler, keine Kleinigkeit. -- Der Wächter wird erst nach dem Lauf entfernt, im `finally`, und erst dann wird die Standardverbindung zurückgesetzt. Sitzung und Cache der Admin-Anfrage schreiben erst nach Ende der Anfrage, also nach dem Lauf. Das deckt der Sicherheitstest in §7 ab. +Der `SandboxBootstrapper` ersetzt die Konfiguration vollständig, nicht teilweise. Was nicht ausdrücklich erlaubt ist, existiert in der Anfrage nicht. -### 3.4 Schicht 3: Effekt-Ports auf Simulation - -Jeder Weg nach außen wird für die Dauer des Laufs auf eine aufzeichnende Simulation umgestellt. Die Aufzeichnung (`EffectLedger`) ist zugleich der Bericht der „simulierten Seiteneffekte“. - -| Effekt | Betrieb [Befund] | im Tester | +| Bereich | Einstellung in der Sandbox-Anfrage | Folge eines unerlaubten Zugriffs | |---|---|---| -| E-Mail | Laravel-Mailer → `EnforceMailTestMode` → SMTP | Mailer `array` (Framework-Transport, keine Zustellung). Ein Listener auf `MessageSending` zeichnet Empfänger, Betreff und gerenderten Text auf. `EnforceMailTestMode` bleibt zusätzlich aktiv, mit Sandbox-Mandant im Testbetrieb und Testadresse `tester@invalid`. | -| HTTP (KI, iCal-Abruf) | `Http`-Client (`LlmClient`, `ICalConnector`) | `Http::preventStrayRequests()` + `Http::fake` mit Szenario-Antworten. Jeder nicht vorgesehene Aufruf bricht den Lauf ab. | -| IMAP | `MailboxReader` (Webklex) | Container-Bindung auf `SandboxMailboxReader`, das bei Aufruf `SandboxViolation` wirft. Eingehende Mails werden als `PortalMail` direkt eingespielt (§2.1). | -| Connectors | `ChannelRegistry` (`config/channels.php`) | Registry-Bindung auf `ScriptedConnector`/Ereignisquelle des Szenarios | -| Dateien | `Storage::disk('local'/'public')` | `Storage::fake` je Disk auf `storage/app/sandbox//…`. PDFs werden erzeugt und verworfen; die Größe wird im Bericht genannt. | -| Warteschlange | `QUEUE_CONNECTION=database` | Verbindung `sync`, jobs laufen im Lauf, also ebenfalls in der Sandbox | -| Cache, Rate-Limiter | `CACHE_STORE=database` | Store `array` | -| Kanal-Export (iCal-Feed) | `ICalFeed` | wird nicht ausgeliefert. Der Tester berechnet den Feed der Sandbox vorher/nachher und zeigt „würde im Export von FeWo-direkt erscheinen“. | -| Zahlungen | – (keine Zahlungsintegration) [Befund] | nur Datensätze in der Sandbox | -| Zeit | `now()` | simulierte Uhr (§4) | +| Datenbank | `database.connections` = **nur** `sandbox` (SQLite, Pfad `/db.sqlite`); `database.default = sandbox`; Redis-Konfiguration leer | `DB::connection('mysql')` → `InvalidArgumentException: Database connection [mysql] not configured` → Abbruch | +| Zusätzlich | `beforeExecuting` auf `sandbox` prüft, dass der PDO-Dateipfad gleich `/db.sqlite` ist | `SandboxViolation` | +| Mail | `mail.mailers` = nur `array`; `mail.default = array`; `EnforceMailTestMode` bleibt aktiv (Sandbox-Mandant im Testbetrieb, Testadresse `tester@invalid`) | anderer Mailer → „not defined“ → Abbruch | +| HTTP | `Http::preventStrayRequests()`; `Http::fake` nur mit Szenario-Antworten (KI, iCal, künftige API, n8n-Webhook von `CreateChannelTasks`) | `StrayRequestException` → Abbruch | +| IMAP | `MailboxReader` an `SandboxMailboxReader` gebunden (wirft); `config('fewo.mailbox')` leer | `SandboxViolation` | +| Connectors | `ChannelRegistry` an Szenario-Connectors gebunden | unbekannter Connector → Abbruch | +| Dateien | alle Disks (`local`, `public`, `private`) mit Wurzel `/files/` | Schreiben bleibt im Laufverzeichnis | +| Cache, Rate-Limiter, Sperren | `cache.default = array`, nur Store `array` | anderer Store → „not defined“ | +| Sitzung | `session.driver = array`; die Sandbox-Route nutzt keine Session-, Auth- oder Livewire-Middleware | – | +| Warteschlange | `queue.default = sync`, nur `sync` [Befund: keine `ShouldQueue`-Klassen in `app/`] | – | +| Scheduler | Die Sandbox-Anfrage ruft nie `schedule:run`. Zeitsprünge rufen die Handler direkt auf (§4). Die Route `ChannelController` mit `Artisan::call('schedule:run')` ist im Sandbox-Modus nicht registriert. | Route 404 | +| Logging | `logging.default` = Datei `/log.txt` (kommt in den Bericht, dann gelöscht) | – | +| App-Schlüssel | `app.key` = zufälliger Schlüssel je Lauf | Signierte Links und verschlüsselte Werte aus der Sandbox sind in der echten Anwendung ungültig | +| Geheimnisse | KI-Schlüssel, Postfach-Passwörter, Webhook-Geheimnisse, SMTP-Zugang: Konfigurationswerte leer, nicht im Schnappschuss | – | +| Routen | Nur die Sandbox-Route ist im Sandbox-Modus erreichbar. Gast-Links (`offers.show`, Datenlink) werden im Bericht als Text ohne Verweis gezeigt. | – | +| iCal-Export | Der echte Feed liest die echte Datenbank und ist unberührt. Der Tester berechnet den Feed der Sandbox vorher/nachher („würde im Export von FeWo-direkt erscheinen“). | – | +| Künftige APIs/Webhooks | Ausgehend nur über `Http` (Regel und statischer Test, §3.5); eingehende Webhook-Routen sind im Sandbox-Modus nicht registriert | `StrayRequestException` bzw. 404 | +| Zeit | `Date::setTestNow()` auf die Szenariozeit | – | -### 3.5 Schicht 4: Ausführungsrahmen +**Verhalten bei Fehlern:** Jede Ausnahme des Laufs wird im Treiber gefangen und als „Lauf abgebrochen: , “ in den Bericht geschrieben. -- Es gibt genau **einen** Einstieg: `ProcessSandbox::run(Scenario, ConfigDraft): TestReport`. - - Er aktiviert die Schichten 1 bis 3 in fester Reihenfolge, prüft sie und führt erst dann aus. - - Schlägt eine Prüfung fehl, bricht er vor dem ersten Ereignis ab. Beispiel: Die Standardverbindung ist nicht `sandbox`, oder der Mailer ist nicht `array`. -- Eine Sperre pro Mandant (`Cache::lock` auf dem echten Store, **vor** Aktivierung) verhindert parallele Läufe derselben Person. Eine Laufzeitgrenze (z. B. 20 s) und eine Ereignisgrenze (z. B. 60) verhindern Endlosschleifen. -- Der Lauf findet **innerhalb der Admin-Anfrage** statt, ohne Hintergrundprozess. Strato startet keine Arbeiterprozesse dauerhaft. Der Scheduler über n8n bleibt unberührt; seine Läufe sehen die Sandbox nie, weil sie in einem anderen PHP-Prozess mit der echten Standardverbindung laufen. -- Den Bericht speichert erst **nach** dem Lauf der Tester selbst, in der echten Datenbank (§6). Kein Modul kann das beeinflussen. +Actions fangen Fehler teilweise selbst ab [Befund]: 18 `rescue()`-Aufrufe, `catch (Throwable)` in `CaseAutomation::advance` und `SendPendingAutoOffers`. Ein Verstoß könnte so verschluckt werden. Deshalb **zeichnet die Sperre den Verstoß auf, bevor sie wirft**: -### 3.6 Ausweichlösung [Entscheidung offen E4] +- Im Sandbox-Modus sind `DatabaseManager`, `MailManager`, `CacheManager` und `FilesystemManager` durch Unterklassen ersetzt. Deren Auflösung eines nicht erlaubten Namens schreibt zuerst einen Eintrag `violation` in das `EffectLedger` und wirft dann. +- `Http` erhält als letzte Fake-Regel einen Rückruf, der aufzeichnet und dann wirft. +- `SandboxMailboxReader` und der `beforeExecuting`-Wächter zeichnen ebenso auf. -Falls `pdo_sqlite` auf Strato nicht verfügbar ist (Voraussetzung V1, mit `php -m` zu prüfen), wird statt der SQLite-Datei eine **eigene MariaDB-Datenbank** des Strato-Tarifs als Sandbox genutzt. Sie wird je Lauf geleert, mit Vorlage per `schema:dump`. Alle anderen Schichten bleiben gleich. Das ist eine Datenhaltung für synthetische Testfälle, **keine** zweite Konfigurationsdatenbank. +Ein Lauf mit mindestens einem `violation`-Eintrag gilt **immer** als abgebrochen, auch wenn die Action danach weiterlief. -### 3.7 Grenzen der Gleichheit +### 3.4 Gleichzeitige Läufe, Ressourcen, Aufräumen -SQLite und MariaDB unterscheiden sich in wenigen Punkten: Datumsfunktionen in rohem SQL (28 `DB::raw`/`whereRaw`/`selectRaw`-Fundstellen), Sortierung und Sperrsemantik. Die Fachlogik ist auf SQLite getestet. Die Stellen mit rohem SQL werden in Paket U-D einmal gesichtet und notfalls datenbankneutral gefasst. Die Testsuite deckt beides bereits ab. +| Anforderung | Umsetzung | Prüfbar durch | +|---|---|---| +| Isolation je Lauf | eigenes Verzeichnis `` mit eigener SQLite-Datei; kein gemeinsamer Sandbox-Speicher | Test: zwei Läufe parallel, keine gegenseitige Sicht | +| Gleichzeitige Läufe | Plätze als Dateisperren (`flock`) unter `storage/app/sandbox/slots/`: höchstens 1 Lauf je Mandant, 3 je Server; sonst „Tester ist gerade belegt“ | Test mit gehaltener Sperre | +| Berechtigung | Admin-Anfrage: Policy (Administratoren des Mandanten, E8). Sandbox-Anfrage: Token gebunden an Lauf, Mandant, Benutzer und Eingabe-Hash, 5 min gültig, einmal verwendbar (Marker-Datei) | Tests: fremder Mandant, abgelaufen, wiederverwendet, veränderte Eingabe → abgewiesen | +| Ressourcen | Laufzeit 20 s (eigene Prüfung im Treiber, unter `max_execution_time`), höchstens 60 Ereignisse, SQLite-Datei höchstens 20 MB, Laufverzeichnis höchstens 30 MB | Test je Grenze | +| Aufräumen | Die Admin-Anfrage löscht nach dem Speichern des Berichts. Bei jedem neuen Lauf werden Verzeichnisse älter als 1 h gelöscht (kein neuer Scheduler-Eintrag). Der Deploy legt das Verzeichnis außerhalb der Releases an (Strato-Dateiquote, `BETRIEB.md`). | Test: abgebrochener Lauf hinterlässt Verzeichnis, nächster Lauf räumt es | +| Wiederherstellung | entfällt, weil die Sandbox-Anfrage endet. Die Admin-Anfrage wechselt nie in den Sandbox-Modus. | Test: Admin-Anfrage hat nach dem Lauf unveränderte Konfiguration und Container-Bindungen | + +### 3.5 Grenzen und wie sie abgedeckt werden + +Nicht zur Laufzeit abfangbar sind **native PHP-Aufrufe**, die am Framework vorbeigehen: + +- `new PDO(...)` mit fest codierten Zugangsdaten; +- `fsockopen`, `curl_*`, `mail()`, `stream_socket_client`; +- `file_put_contents` auf absolute Pfade. + +`disable_functions` lässt sich auf Shared Hosting nicht je Anfrage setzen. + +Abdeckung: + +- **Statischer Test `SideEffectPathsTest`** (Muster `MailTestModeGateTest`): In `app/` sind diese Funktionen verboten, außer in einer Positivliste [Befund: heute nur `BackupDatabase` (`getPdo`, `unlink`) und `ListGuests` (`php://output`); beide sind in der Sandbox-Anfrage nicht erreichbar]. Neue Außenwege müssen Framework-Fassaden nutzen. +- **Zugangsdaten:** Die Sandbox-Anfrage enthält keine Zugangsdaten der echten Datenbank in der Konfiguration. Die `.env` liegt zwar im Release, ihre DB-Werte werden aber nicht übernommen. Ein nativer Zugriff bräuchte also Code, der die `.env` selbst liest. Das verbietet der statische Test (`env()` nur in `config/`, Larastan-/Grep-Regel). + +**Ehrliche Aussage:** Der Tester ist schadensfrei für alle Effektwege über Laravel-Fassaden und für jeden nicht konfigurierten Dienst. Native Aufrufe sind durch Code-Regel und statischen Test ausgeschlossen, nicht durch die Laufzeit. Diese Grenze steht im Bericht und in `BETRIEB.md`. + +### 3.6 Sandbox-Datenbank (E4) [Entschieden: SQLite bevorzugt] + +- **SQLite:** Voraussetzung ist `pdo_sqlite` auf dem Server (V1). + - **[Befund]** Die gesamte Testsuite (683 Feature-Tests) läuft auf SQLite; die Fachlogik ist dort lauffähig. + - Die Vorlage (migriert, leer) erzeugt `process:sandbox-template` beim Deployment. +- **MariaDB-Ausweichlösung** nur bei nachgewiesener technischer Trennung: + 1. eigene Strato-Datenbank(en) für den Tester mit **eigenem Datenbankbenutzer**, der auf die Betriebsdatenbank **keine** Rechte hat (Strato vergibt je Datenbank einen eigenen Benutzer; vor der Umsetzung zu prüfen, V6); + 2. die Sandbox-Anfrage kennt nur diese Zugangsdaten; + 3. ein Pool von N Datenbanken mit exklusiver Belegung je Lauf (`flock`-Platz = Datenbank); Leeren nur der belegten Datenbank mit dem Sandbox-Benutzer; + 4. Negativtest auf dem Server: Der Sandbox-Benutzer kann die Betriebsdatenbank weder lesen noch schreiben. + + Ist (1) oder (4) nicht erfüllbar, ist der Tester auf diesem Server **nicht verfügbar**. Eine ungeschützte gemeinsame Sandbox gibt es nicht. +- **Rohabfragen [Befund]:** 8 Fundstellen mit Roh-SQL. 4 liegen in `BackupDatabase` (im Tester nicht erreichbar). Übrig sind `orderByRaw('due_on is null')` (zweimal, darunter `CaseActivities`), eine `CASE WHEN`-Sortierung im Posteingang und `whereRaw('lower(domain) = ?')`; alle sind auf SQLite und MariaDB gültig. Die Datumsfilter laufen über `whereDate`, das das Framework je Datenbank übersetzt. Paket U-D bestätigt das mit dem Paritätstest auf beiden Datenbanken. --- -## 4. Ereignis- und Zeitsimulation [Vorschlag] +## 4. Ereignis- und Zeitsimulation [Vorschlag; E9 entschieden] -- **Simulierte Uhr:** `Date::setTestNow()` (Carbon), gesetzt durch den Treiber und im `finally` zurückgesetzt. Startzeit ist „jetzt“ oder vom Szenario vorgegeben, etwa „Anfrage am Freitag 18 Uhr“ für Klärungsfristen am Wochenende. -- **Zeitsprung** (`advance(hours: 25)`) führt die zeitgesteuerten Handler in der Reihenfolge von `routes/console.php` aus. Ausgeführt werden nur die für Vorgänge relevanten (§2.1), nicht `channels:sync` oder `channels:fetch-mail`. -- **Ereignisse** sind kleine Treiberklassen, eine je Zeile in §2.1. Szenarien sind Listen solcher Ereignisse mit Daten. Der Vermieter wählt vorbereitete Szenarien und kann einige Daten ändern: Zeitraum, Personen, fehlende Felder, „Gast ist Stammgast“, „KI nicht erreichbar“. Eigene Ablauflogik kann er nicht schreiben. -- **Interaktiv:** Ereignisse sind schrittweise auslösbar („Weiter: Gast antwortet per Mail“). Jeder Schritt startet einen neuen Lauf aus Ausgangszustand und Ereignisliste bis zu diesem Punkt; die Läufe sind deterministisch. So wird nichts zwischen Anfragen im Speicher gehalten, was auf Shared Hosting ohnehin nicht trägt. +- **Simulierte Uhr:** `Date::setTestNow()`. Start ist „jetzt“ oder die Szenariozeit, etwa „Freitag 18 Uhr“ für Klärungsfristen am Wochenende. +- **Zeitsprung** (`advance(hours: 25)`): führt die vorgangsrelevanten Handler in der Reihenfolge von `routes/console.php` aus, nicht `channels:sync` oder `channels:fetch-mail`. +- **[Entschieden E9]** Vordefinierte Szenarien mit veränderbaren Eingaben: Zeitraum, Personen, fehlende Felder, „Gast ist Stammgast“, Ausfallart, Antwortzeitpunkt. Schrittweise Ausführung. **Keine** frei programmierbaren Ereignisfolgen. --- @@ -137,60 +200,91 @@ ## 5. Szenarienkatalog (Startumfang) | # | Szenario | Prüft | |---|---|---| -| S01 | Vollständige Anfrage (A1/A2) | Klärungsreservierung, Angebot, Annahme, Bestätigung | -| S02 | Fehlende Gastdaten | `guest.data_request`, Warten des Angebots, Erinnerung nach Fristsprung | -| S03 | Gast antwortet über Formular | Fakten mit Quelle `GuestLink`, Angebot wird frei | -| S04 | Gast antwortet per E-Mail | Zuordnung, Skript-KI liefert Anschrift, Übernahme bzw. Vorschlag | -| S05 | Frist läuft ab | `ExpireReservations`, Status, Kalender wieder frei | -| S06 | Angebot wird angenommen | `AcceptOffer` → `ConfirmBooking`, Sperraufgaben für Kanäle | -| S07 | Portalbuchung wird übernommen (A3/A4/A5) | Duplikaterkennung iCal + Mail, `binding.portal` | -| S08 | Portal übernimmt Zahlung und Dokumente (A4/A5) | übertragene Schritte, Nachweisstufe, Abschlussprüfung | -| S09 | Loyalty-Status wird festgestellt | `guest.loyalty_status` mit synthetischen Vorgängen in der Sandbox | -| S10 | Rabatt wird angewendet | `Discount`-Zeile im Angebot, Grundlage im Verlauf | -| S11 | Optionaler Schritt deaktiviert | „übersprungen (Konfiguration)“, Ablauf bleibt gültig | -| S12 | Kommunikation oder Schnittstelle fällt aus | Mail-Port wirft `TransportException`, KI liefert 401 → `AccessRejected`, iCal-Abruf liefert Fehler. Danach definierte Zustände: Aufgabe, Postfach-Hinweis, kein Absturz. | +| S01 | Vollständige Anfrage (A1/A2) | Angebotsreservierung, Angebot, Annahme, Bestätigung | +| S02 | Fehlende Anschrift (`02` §7.6) | Klärungsreservierung **und** Rückfrage unabhängig; Angebot wartet | +| S03 | Gast antwortet über Formular | `GuestLink`-Fakten, Angebot wird bereit | +| S04 | Gast antwortet per E-Mail nach Ablauf der Klärungsreservierung | Zuordnung, Skript-KI, Angebot bei freiem bzw. belegtem Zeitraum | +| S05 | Frist läuft ab | Klärung: Anfrage bleibt offen; Angebot: `Expired`, Kalender frei | +| S06 | Angebot wird angenommen | `AcceptOffer` → `ConfirmBooking`, Sperraufgaben | +| S07 | Portalbuchung über iCal und Mail (A3/A4) | Duplikaterkennung, `binding.portal` | +| S08 | A4: Portal-Inkasso, Anreiseinformation durch Portal | variable Verantwortung, Nachweisstufen, Abschlussprüfung | +| S09 | Loyalty-Status (nur Tester) | `guest.loyalty_status` mit synthetischen Vorgängen | +| S10 | Loyalty-Rabatt (nur Tester) | `Discount`-Zeile vor Preisfestlegung, keine nach Verbindlichkeit | +| S11 | Optionaler Schritt aus | „übersprungen (Konfiguration)“ | +| S12 | Ausfall von Mail, KI oder iCal | definierte Zustände: Aufgabe, Hinweis, kein Absturz | +| S13 | Portal meldet Stornierung | Aufgabe, keine Stornierung, Mail-Sperre aufgehoben, Außenwirkungen ausgesetzt (O4) | --- -## 6. Testbericht [Vorschlag] +## 6. Testbericht [Vorschlag; E8 entschieden] -Inhalt nach Auftrag §8: +Inhalt: 1. **Kopf:** - - Prozessmodell und Version, Variante, Modulversionen; + - Modell und Version, Variante, Modulversionen; - Kanal und Eingangsart; - - Release (`deploy//`): Die Release-Kennung legt `scripts/deploy.sh` als Datei im Release ab, neu in U-D. Heute gibt es dafür keine Anzeige in der Anwendung. + - Release-Kennung (Datei, die `scripts/deploy.sh` im Release ablegt, neu in U-D); - Startzeit (simuliert), Szenario und Eingaben. -2. **Wirksame Konfiguration:** jeder Wert mit Herkunft (Vermieter, Wohnung, Kanal, Entwurf). „Entwurf“ markiert ungespeicherte Änderungen. -3. **Zeitleiste:** je Ereignis - - ausgeführte Module mit Ergebnis (`StepResult`: erledigt / wartet / Problem + Klartext); - - übersprungene Module mit Grund (`applies = false`, abgeschaltet, nicht zuständig); - - fachliche Prüfungen (`blockers`) mit Ergebnis; - - Statuswechsel; - - entstandene Aufgaben. -4. **Simulierte Seiteneffekte** aus dem `EffectLedger`: Mails mit Vorschau, Kalenderhalt, Sperraufgaben je Kanal, Dokumente, KI-Aufrufe (nur „simuliert, Antwort laut Szenario“), Exportänderungen. -5. **Ergebnis:** Endzustand, offene Punkte, nächster Schritt (`CaseActivities::next`-Äquivalent) und Hinweise. Beispiel: „Ohne E-Mail-Adresse kann das Angebot nicht automatisch gehen.“ +2. **Wirksame Konfiguration** mit Herkunft (Vermieter, Wohnung, Kanal, Entwurf). +3. **Zeitleiste** je Ereignis: + - ausgeführte Schritte mit Ergebnis; + - übersprungene mit Grund; + - wartende Schritte mit „wartet auf … bis …“; + - Prüfungen, Statuswechsel, Aufgaben. +4. **Simulierte Seiteneffekte** aus dem `EffectLedger`: Mails mit Vorschau, Kalenderhalt, Sperraufgaben, Dokumente, KI-Aufrufe, Exportänderungen. Links erscheinen nur als Text. +5. **Ergebnis:** Endzustand, offene Punkte, nächster Schritt, Hinweise, gegebenenfalls „Lauf abgebrochen“ mit Grund. -**Speicherung:** neue Tabelle `process_test_runs` (Mandant, Kanal, Benutzer, Szenario, Konfigurationsschnappschuss, Modellversionen, Release, Bericht als JSON, Ergebnis). Die Löschfrist richtet sich nach der Mandanteneinstellung für Protokolle, Vorgabe 90 Tage. +**Speicherung:** -**Reproduzierbarkeit:** -- „Erneut ausführen“ startet mit dem gespeicherten Schnappschuss. -- Ist das Release neuer, zeigt der Bericht die Unterschiede zum vorigen Lauf. Das dient auch als Regressionshinweis nach Updates. -- Die Wohnungsdaten des Schnappschusses (Preise, Saisons) werden mit gespeichert. So ist ein Lauf auch nach Preisänderungen gleich wiederholbar. +- Tabelle `process_test_runs`: Mandant, Kanal, Benutzer, Szenario, Konfigurationsschnappschuss, Modellversionen, Release, Bericht (JSON), Ergebnis. Das ist die einzige Migration. +- Berichte enthalten nur synthetische Gastdaten, aber Konfiguration und Benutzerkennung. +- **[Entschieden E8]** Die Aufbewahrung wird in das Löschkonzept eingebunden: + - neuer Schlüssel `fewo.retention.process_test_run_days` mit Eintrag in `docs/LOESCHKONZEPT.md`, `SystemSettings`, `TenantConfig`; + - Löschung durch das bestehende `AnonymizeGuests`; + - nach Projektregel nur gegenüber der `.env`-Grundlinie verkürzbar. + - **Der Wert ist nicht festgelegt** (O3). + +**Reproduzierbarkeit:** „Erneut ausführen“ startet mit dem gespeicherten Schnappschuss. Bei neuerem Release zeigt der Bericht die Unterschiede zum vorigen Lauf. --- -## 7. Sicherheitstests (Pflicht, Teil der Suite) +## 7. Sicherheitstests (Pflicht, Gruppe `sandbox`) + +In PHPUnit stellt eine **eigene SQLite-Datei** die echte Betriebsdatenbank dar. Ihr Datei-Hash vor und nach dem Lauf ist der stärkste verfügbare Nachweis. + +### 7.1 Positivtests | Test | Prüft | |---|---| -| `ProcessSandboxIsolationTest` | Für jedes Szenario S01–S12 vergleicht der Test die Zeilenzahlen und Prüfsummen aller Tabellen der echten Verbindung vor und nach dem Lauf; sie sind identisch. Ausnahme ist `process_test_runs` (+1). | -| `ProcessSandboxViolationTest` | Ein Testmodul greift absichtlich auf die echte Verbindung zu und startet echte HTTP- bzw. IMAP-Aufrufe. Erwartet werden `SandboxViolation`, abgebrochener Lauf, Bericht „Lauf abgebrochen“ und keine Änderung. | -| `ProcessSandboxMailTest` | Kein Aufruf des echten Transports. Geprüft wird das mit einem Spionage-Transport auf dem Standard-Mailer. `MailTestModeGateTest` bleibt grün. | -| `ProcessSandboxRestoreTest` | Nach dem Lauf, auch nach einer Ausnahme, sind Standardverbindung, Mailer, Disks, Queue, Cache, Uhr und Bindungen wiederhergestellt. Eine anschließende normale Aktion schreibt wieder in die echte Datenbank. | -| `ProcessSandboxTenantTest` | Der Lauf sieht nur Daten des eigenen Mandanten. Ein zweiter Mandant bleibt unberührt (`TenantIsolationTest`-Muster). | +| `SandboxIsolationTest` | Für S01–S13: Hash der Betriebs-Datei vor/nach identisch; nur die Admin-Anfrage schreibt `process_test_runs` (+1) | +| `SandboxRequestConfigTest` | Konfiguration der Sandbox-Anfrage enthält nur die erlaubten Verbindungen, Mailer, Stores und Disks (§3.3) | | `ProcessTesterParityTest` | Gleichheit Tester ↔ echter Ablauf (§2.2) | -| `ModuleContractTest` | Jedes Modul erzeugt im Sandkasten nur die Effekte, die es deklariert hat (`02` §3.2) | +| `ModuleContractTest` | Jedes Modul erzeugt nur deklarierte Effekte (`02` §3.2) | +| `SandboxTenantTest` | Schnappschuss enthält nur Daten des eigenen Mandanten | + +### 7.2 Negativtests (absichtlich unzulässige Zugriffe) + +Ein Testmodul `HostileModule` wird nur im Test registriert. Jeder Fall erwartet: Lauf abgebrochen, Bericht nennt den Grund, Hash der Betriebs-Datei unverändert, kein Mail-Transport aufgerufen, keine Datei außerhalb ``. + +| Fall | Unzulässiger Zugriff | +|---|---| +| N-DB1 | `DB::connection('mysql')` / Name der Betriebsverbindung | +| N-DB2 | `DB::connection()->getPdo()` und Abfrage auf eine Tabelle, die nur in der Betriebsdatenbank existiert | +| N-DB3 | Verbindung zur Laufzeit über `config([...])` neu anlegen mit Pfad der Betriebs-Datei → Wächter `beforeExecuting` | +| N-DB4 | Fehler innerhalb `rescue()` verschluckt → Lauf trotzdem abgebrochen (Ledger) | +| N-NET1 | `Http::get('https://example.org')` ohne Szenario-Antwort | +| N-NET2 | Aufruf des n8n-Webhooks über `CreateChannelTasks` mit gesetzter URL | +| N-IMAP | `MailboxReader::fetch` | +| N-MAIL | `Mail::mailer('smtp')->send(...)` | +| N-FILE | `Storage::disk('local')->put` → liegt unter `/files`; `Storage::build(['root' => base_path()])` → durch statischen Test verboten, zur Laufzeit erkannt über Ledger-Prüfung der Dateiliste außerhalb `` (Vergleich `storage/` vor/nach) | +| N-CACHE | `Cache::store('database')` | +| N-SIGN | im Lauf erzeugter `offers.show`-Link ist in der normalen Anwendung ungültig (403) | +| N-TOKEN | Token wiederverwendet, abgelaufen, anderer Mandant, veränderte Eingabe → 404/403, kein Lauf | +| N-PAR | zwei Läufe gleichzeitig: zweiter wartet oder wird abgewiesen; keine gemeinsame Datei | +| N-ABORT | Abbruch durch Laufzeitgrenze → Verzeichnis wird beim nächsten Lauf geräumt | +| N-STATIC | `SideEffectPathsTest`: neue native Netz-, Mail-, PDO- oder Dateifunktion in `app/` außerhalb der Positivliste → Test rot | + +Ein bestandener Happy-Path-Test gilt **nicht** als Nachweis der Schadensfreiheit. Freigabekriterium sind die Negativtests. --- @@ -198,9 +292,10 @@ ## 8. Abnahmekriterien Tester (N6) | # | Kriterium (auf stommer.info) | |---|---| -| T01 | Aus dem Kanalkonfigurator lässt sich mit der aktuellen, auch ungespeicherten Konfiguration jedes Szenario S01–S12 starten und schrittweise weiterführen. | -| T02 | Der Bericht enthält Modell und Version, Kanal und Eingangsart, wirksame Konfiguration, ausgeführte und übersprungene Module mit Gründen, Prüfungen, simulierte Effekte, Ergebnis und offene Punkte, in verständlicher Sprache. | -| T03 | Nach einer Testreihe sind in der echten Datenbank keine Buchungen, Gäste, Aufgaben, Kanalaufgaben, Sperren oder Nachrichten hinzugekommen oder verändert; einzige Ausnahme sind die Testberichte. Geprüft wird das per Zählabfrage vorher/nachher im Abnahmeprotokoll. | -| T04 | Im Testpostfach und beim Mail-Anbieter ist keine Mail aus Testläufen angekommen. Der Export-Feed der Kanäle ist byte-gleich vor und nach der Testreihe. | +| T01 | Aus dem Konfigurator lässt sich mit der aktuellen, auch ungespeicherten Konfiguration jedes Szenario starten und schrittweise weiterführen. | +| T02 | Der Bericht enthält Modell, Version, Kanal, Eingangsart, wirksame Konfiguration, ausgeführte, wartende und übersprungene Schritte mit Gründen, simulierte Effekte, Ergebnis und offene Punkte. | +| T03 | Nach einer Testreihe hat sich die Betriebsdatenbank nicht verändert, außer `process_test_runs`. Prüfung per `CHECKSUM TABLE` aller fachlichen Tabellen vorher/nachher im Abnahmeprotokoll; `sessions`, `cache` und `cache_locks` werden getrennt betrachtet, weil sie durch die Bedienung selbst wechseln. | +| T04 | Weder im Testpostfach noch beim Mail-Anbieter ist eine Mail aus Testläufen angekommen. Der Export-Feed jedes Kanals ist byte-gleich vor und nach der Testreihe. | | T05 | Ein Lauf mit gleichem Schnappschuss liefert denselben Bericht. | -| T06 | Ein Ausfall von Mail, KI oder iCal im Szenario führt zu dem definierten Zustand, den auch der echte Vorgang zeigt. Das wird durch S12 und den Paritätstest belegt. | +| T06 | Ausfall von Mail, KI oder iCal führt zum selben definierten Zustand wie im echten Vorgang (S12, Paritätstest). | +| T07 | Die Negativtests N-DB1 bis N-STATIC sind in der CI grün; N-DB1, N-NET1 und N-TOKEN werden zusätzlich auf stommer.info über einen nur im Testbetrieb registrierten Prüflauf ausgelöst (Ergebnis: abgebrochen, T03 unverändert). | diff --git a/docs/Prozessarchitektur/Architektur/05_AENDERUNGSANALYSE_UND_TESTS.md b/docs/Prozessarchitektur/Architektur/05_AENDERUNGSANALYSE_UND_TESTS.md index 38ee41b..5c58d86 100644 --- a/docs/Prozessarchitektur/Architektur/05_AENDERUNGSANALYSE_UND_TESTS.md +++ b/docs/Prozessarchitektur/Architektur/05_AENDERUNGSANALYSE_UND_TESTS.md @@ -1,13 +1,17 @@ # 05 – Änderungsanalyse und Teststrategie -Stand: 04.11.2026 · Kennzeichnung: **[Befund]**, **[Vorschlag]**, **[Entscheidung offen]** +Stand: 04.11.2026, **Review V2** (K3, K9 eingearbeitet; Tests zu K1, K4, K5, K8) · Kennzeichnung: **[Befund]**, **[Vorschlag]**, **[Entschieden]**, **[Entscheidung offen]** --- ## 1. Ausgangslage [Befund] -- Es gibt 683 Feature-Testmethoden, gruppiert nach Fachthema, etwa `OfferWorkflowTest`, `PortalBookingTest`, `CaseCoreTest`, `GuidedCaseHandlingTest`, `ClarificationHoldTest`, `DataRequestTest`, `EndToEndAcceptanceTest` (15 Ende-zu-Ende-Fälle) und `TenantIsolationTest`. -- Eine Zuordnung „welcher Test sichert welchen Schritt eines welchen Ablaufs“ gibt es nicht. Wer heute einen Schritt ändert, sucht die Fundstellen per Volltextsuche; vgl. die Streuung in `01` §2.2. +- Es gibt 683 Feature-Testmethoden, gruppiert nach Fachthema, z. B.: + - `OfferWorkflowTest`, `PortalBookingTest`, `CaseCoreTest`, `GuidedCaseHandlingTest`; + - `ClarificationHoldTest`, `DataRequestTest`; + - `EndToEndAcceptanceTest` (15 Ende-zu-Ende-Fälle); + - `TenantIsolationTest`, `MailTestModeGateTest`. +- Eine Zuordnung „welcher Test sichert welchen Schritt welchen Ablaufs“ gibt es nicht. --- @@ -15,81 +19,122 @@ ## 2. Abhängigkeitsmodell [Vorschlag] ### 2.1 Die Quelle ist der Code -Alle Angaben stehen bereits in den Definitionen aus `02`. Sie werden **nicht** zusätzlich gepflegt: +Alle Angaben stehen in den Definitionen aus `02` und werden **nicht** zusätzlich gepflegt. -| Frage (Auftrag §9) | Quelle | +| Frage | Quelle | |---|---| -| 1. In welchen Modellen wird ein Modul verwendet? | `ProcessModel::steps()` und `variants()` aller registrierten Modelle | -| 2. An welchen Erweiterungspunkten? | `Step::point` / `Variant::insert` | -| 3. Wer braucht seine Ergebnisse? | `produces` des Moduls ∩ `needs`/`requires` anderer Module | -| 4. Welche Konfiguration beeinflusst es? | `parameters` + `toggle` + `modes`, dazu Kanäle/Wohnungen, die diese Modelle gewählt haben (Abfrage auf `channels.process_overrides`) | -| 5. Welche Tests decken es ab? | PHPUnit-Gruppen `#[Group('module:')]` und `#[Group('model:')]`. Das ist ein vorhandenes PHPUnit-Merkmal, keine neue Abhängigkeit. | -| 6. Auswirkung auf andere Archetypen? | `caseTypes()` der Modelle, die das Modul enthalten. Dazu kommen die genutzten Querschnittsdienste (`uses`), z. B. `pricing`. | +| In welchen Modellen wird ein Modul verwendet? | `ProcessModel::steps()` und `variants()` | +| An welchen Erweiterungspunkten? | `Step::point`, `Variant::insert` | +| Wer braucht seine Ergebnisse? | `requires` und `needs` anderer Module gegen `produces` | +| Welche Konfiguration beeinflusst es? | `parameters`, `toggle`, `modes`, `performers` + Kanäle mit diesen Modellen (Zählabfrage auf `channels.process_overrides`) | +| Welche Tests decken es ab? | PHPUnit-Gruppen `#[Group('module:')]`, `#[Group('model:')]`, `#[Group('service:')]` | +| Auswirkung auf andere Archetypen? | `caseTypes()` der Modelle mit dem Modul + genutzte Dienste (`uses`) | +| Wertet es eingefrorene Vertragsdaten aus? | Kennzeichen `readsContractData` → Pflicht-Bestandsfall-Test (§4.2) | ### 2.2 Werkzeuge -- **`php artisan process:impact `** liest die Definitionen und gibt aus: - - Modelle und Varianten mit Archetyp; - - Erweiterungspunkte; - - abhängige Module; - - Parameter; - - die Zahl der Kanäle je Mandant mit diesem Modell (nur Zahl, keine Daten); - - die Testgruppen samt fertigem Aufruf `php artisan test --group=module:`. -- **`php artisan process:check`** prüft den Katalog: - - Jedes Modul ist registriert und hat eine vollständige Definition. - - Pflichtmodule sind nicht abschaltbar. +- **`php artisan process:impact `**: Modelle, Varianten, Archetypen, Erweiterungspunkte, abhängige Module, Parameter, Zahl der betroffenen Kanäle (nur Zahl), Testgruppen mit fertigem Aufruf. Für eine **Action** listet es die Module, die sie aufrufen. So sind Änderungen an gemeinsamen Actions sichtbar. +- **`php artisan process:check`** prüft: + - Register und Definitionen sind vollständig. + - `Mandatory` ist nicht abschaltbar. - Erweiterungspunkte sind zulässig. - - `requires` ist in jeder Modellreihenfolge erfüllt. - - Jedes Modul und jedes Modell hat mindestens eine Testgruppe. + - `requires` ist in jedem Modell erfüllbar und zyklenfrei. + - Die Verantwortungsmatrix ist widerspruchsfrei (`03` §2.3). + - `TesterOnly` steht in keiner gespeicherten Konfiguration. + - Jedes Modul und Modell hat Testgruppen. - Alte Versionen ohne offene Vorgänge werden gemeldet. - - Der Befehl läuft in der CI vor den Tests. -- **Modulmatrix** `docs/Prozessarchitektur/Architektur/MODULMATRIX.md`: Sie wird von `process:check --matrix` erzeugt und in der CI auf Aktualität geprüft. Sie ist die lesbare Übersicht Modell × Modul × Parameter × Testgruppe. -### 2.3 Beispiel `pricing.loyalty_discount` + Der Befehl läuft in der CI vor den Tests. +- **Modulmatrix** `MODULMATRIX.md`: erzeugt von `process:check --matrix`, in der CI auf Aktualität geprüft. + +### 2.3 Beispiel ``` $ php artisan process:impact pricing.loyalty_discount -Modul pricing.loyalty_discount v1 (Preis und Angebot, optional) +Modul pricing.loyalty_discount v1 (Preis und Angebot, optional, nur Tester) Modelle a1.offer:loyalty (A1) Punkt BeforePriceFixing -Benötigt guest.loyalty_status (Ergebnis loyalty_status) -Benötigt von – (Ergebnis: Preiszeile; gelesen von offer.binding über CasePricing) +Benötigt guest.loyalty_status Dienste pricing (CasePricing → PriceCalculator unverändert) -Parameter loyalty_discount_percent, loyalty_discount_max, loyalty_combinable -Kanäle 1 Kanal (Mandant 1) -Archetypen nur A1 betroffen; A2–A6 enthalten das Modul nicht -Tests --group=module:pricing.loyalty_discount (LoyaltyDiscountTest, ProcessTesterParityTest S10) - --group=service:pricing (PriceCalculatorTest, SpecialOfferPricingTest, OfferWorkflowTest …) +Vertragsdaten ja: Discount-Zeile in quote; CancellationCost::rent zählt sie (R1) +Kanäle 0 (nicht speicherbar) +Archetypen nur A1; A2–A6 enthalten das Modul nicht +Tests --group=module:pricing.loyalty_discount --group=service:pricing --group=ongoing ``` --- -## 3. Testebenen [Vorschlag] +## 3. Testebenen [Vorschlag] (alle verbindlich) | Ebene | Inhalt | Gruppe | Wann | |---|---|---|---| -| **Modultest** | Ein Modul isoliert: `applies`/`activity`/`blockers`/`run` für seine Zustände, Fehlerfälle, Idempotenz | `module:` | bei jeder Änderung des Moduls | -| **Vertragstest** (generisch) | `ModuleContractTest` mit Datenquelle „alle registrierten Module“: Definition vollständig, Lesemethoden ohne Schreibzugriff, nur deklarierte Effekte (im Sandkasten gemessen), zweiter `run` wirkungslos | `contract` | immer (schnell) | -| **Modelltest** | Je Modell/Variante: Schrittfolge, zulässige Kombinationen, Abschaltung optionaler Schritte (N5), Plan einfrieren und lesen | `model:` | bei Änderung des Modells oder seiner Module | -| **Szenario-/Paritätstest** | S01–S12 als Ende-zu-Ende über Actions, gleich mit Tester-Bericht (`04` §2.2) | `scenario` | immer | -| **Sicherheitstests Tester** | `04` §7 | `sandbox` | immer | -| **Übergreifende Regression** | bestehende Suite, unverändert; siehe §5 | – | immer, vollständig vor jedem Deployment | +| **Modultest** | Ein Modul isoliert: Zustände, Wartezustände, Fehler, Idempotenz | `module:` | bei jeder Moduländerung | +| **Vertragstest** | `ModuleContractTest` für alle Module (`02` §3.2) | `contract` | immer | +| **Modelltest** | Schrittfolge, `requires`, Abschaltung optionaler Schritte, Verantwortungsmatrix, Plan einfrieren/lesen | `model:` | bei Änderung des Modells oder seiner Module | +| **Runner-Test** | Bereitschaft, unabhängige Schritte, Warten, Fristen, Freigaben, Ereignisse (`02` §7) | `runner` | immer | +| **Bestandsfall-Test** | eingefrorene v0.11-Fälle (`02` §5.4) | `ongoing` | immer | +| **Verhaltensvergleich** (Golden Master) | §4 | `golden` | immer während U-A bis U-F | +| **Ereignistest** | Ereignisverträge und Duplikate (`02` §8.3) | `channel-events` | immer | +| **Szenario/Parität** | S01–S13 (`04` §2.2) | `scenario` | immer | +| **Sicherheitstest Tester** | Positiv- und Negativtests (`04` §7) | `sandbox` | immer | +| **Regression** | bestehende Suite, unverändert | – | vollständig vor jedem Merge nach `develop` | -Gezielte Läufe beschleunigen die Entwicklung, ersetzen aber **nicht** den vollständigen Lauf vor dem Deployment. Die Modularität verringert die Unsicherheit, sie ersetzt keine Sicherheitsprüfung (Auftrag §9). +Gezielte Läufe beschleunigen die Entwicklung, ersetzen aber **nicht** den vollständigen Lauf. --- -## 4. Absicherung des Umbaus: Golden Master [Vorschlag] +## 4. Verhaltensvergleich alt/neu (K9) [Vorschlag] -Der Umbau von `CaseActivities`/`CaseAutomation` auf `ProcessRunner` (`06`, U-A) ist die riskanteste Änderung. Absicherung: +### 4.1 Was verglichen wird -1. **Vor dem Umbau** wird die heutige Ausgabe festgehalten: - - Gesammelt werden `CaseActivities::for`, `next` und `situation` sowie das Ergebnis von `CaseAutomation::advance`. - - Grundlage ist eine **Fallmatrix**: A1–A6 × Status × Verbindlichkeit × Verantwortungen × Datenlage × Vorgangsende. Das sind etwa 150 Konstellationen, erzeugt über die vorhandenen Factories. - - Die Ausgabe wird als Fixture-Datei unter `tests/Fixtures/process/golden.json` gespeichert. -2. **Nach dem Umbau** prüft `ProcessRunnerGoldenMasterTest`, dass der neue Runner für jede Konstellation ein **identisches** Ergebnis liefert. Verglichen werden Schlüssel, Titel, Zustand, Detail und Aktion. -3. Abweichungen sind nur zulässig, wenn sie in der Fixture-Datei begründet sind (Feld `intended`). Ein Beispiel: `ActivityDetails::EVENT_TYPES` wird ins Modul übernommen. Jede begründete Abweichung wird im Umsetzungsbericht aufgeführt. -4. Die bestehenden Tests (`CaseCoreTest`, `GuidedCaseHandlingTest`, `AutoOfferTest` …) laufen unverändert weiter. +Der frühere Entwurf verglich nur die sichtbare Ablaufliste. Das reicht nicht. `BehaviourSnapshot` hält je Konstellation **und je Ereignis** fest: + +| Dimension | Inhalt | +|---|---| +| Ablauf | `CaseActivities::for/next/situation`: Schlüssel, Titel, Zustand, Detail, Aktion | +| Zustandsübergänge | `status`, `hold_purpose`, `hold_expires_at`, Versionen (`offer_version`, `information_version`), Zeitstempel (`confirmed_at`, `offer_sent_at` …) | +| Automatik | ausgelöste und **unterdrückte** automatische Schritte mit Blockern (`CaseAutomation::advance`, `AutoOffer::blockers`, `RequestCaseData::forNextStep`) | +| Reservierung und Fristen | Kalenderwirkung (`Booking::occupying`, `isHoldActive`), Ablauf durch `ExpireReservations` | +| Preis | `quote`-Zeilen, `total`, Fälligkeiten | +| Dokumente und Kommunikation | erzeugte Dokumentarten (`DocumentKind`), versendete Mailklassen mit Empfängerrolle, **nicht** versendete Mails (z. B. Eingangsbestätigung ersetzt durch Rückfrage) | +| Aufgaben und Nachweise | `booking_tasks` (Art, offen/erledigt), `ChannelTask`s, Verlaufseinträge (`booking_events.type`) | +| Wiederholung und Dubletten | dasselbe Ereignis zweimal (zweiter `advance`, zweite Portal-Mail, iCal nach Mail): keine zusätzlichen Effekte | + +### 4.2 Grundlage und Durchführung + +1. **Fallmatrix:** A1–A6 × Status × Verantwortungen × Datenlage × Automatik × Vorgangsende, rund 150 Ausgangslagen. Dazu eine **Ereignisfolge** je Ausgangslage (Antwort, Frist, Annahme, Portalmeldung, Wiederholung). +2. **Referenz v0.11:** Die Snapshots werden **vor** U-A mit dem Stand `develop` erzeugt, auf dem U-A beginnt. Sie liegen in `tests/Fixtures/process/behaviour/*.json`. +3. **Prüfung:** `BehaviourComparisonTest` verlangt nach jedem Umbauschritt Gleichheit in allen Dimensionen. + +### 4.3 Bekannte Fehler werden nicht zur Norm + +- Vor dem Festschreiben wird jede Referenz gegen die beschlossenen Anforderungen gelesen (v0.11-Spezifikation, `Entscheidungen.md`, Abnahmeprotokolle). +- Widerspricht eine Referenz einer Anforderung, wird sie **nicht** als Erwartung übernommen. Stattdessen erhält sie einen Eintrag im **Fehlerregister** (`tests/Fixtures/process/defects.md`): Fundstelle, Anforderung, Ist, Soll. +- Ein solcher Eintrag braucht vor dem Abschluss von U-F eine Entscheidung: + - **behoben:** mit Test auf das Soll; + - **zurückgestellt:** mit Begründung; die Erwartung im Snapshot ist dann als `known_defect` markiert und **kein** Gleichheitskriterium. +- Ein Snapshot-Eintrag ohne Anforderungsbezug bleibt Referenz für Gleichheit, aber nicht für „richtig“. + +### 4.4 Beabsichtigte Abweichungen + +Jede Abweichung braucht einen Eintrag `intended` mit fachlicher Begründung, Verweis (z. B. O4, K1) und einem eigenen Test auf das neue Verhalten. Bekannt sind: + +| Abweichung | Begründung | Test | +|---|---|---| +| Ereignistypen aus `ActivityDetails::EVENT_TYPES` kommen aus der Moduldefinition | Einheitliche Quelle | `ActivityDetailsTest` unverändert grün | +| Offene Portal-Storno-/Änderungsmeldung setzt automatische Außenwirkungen aus (nur bei Entscheidung O4 = ja) | K4: kein Fortschreiten aufgrund unklarer Vertragslage | `PortalReportSuspendsAutomationTest` | +| Zeit-Actions rufen nach ihrer Wirkung `advance` für den Vorgang | K1: Wiederaufnahme ohne neuen Auslöser | `RunnerResumesAfterDeadlineTest` | + +### 4.5 Bestandsfall-Tests (K3) + +`OngoingCaseRegressionTest` (`02` §5.4) ist **dauerhaft** Teil der Suite, nicht nur während des Umbaus. Er sichert die Kompatibilitätsregeln R1–R5 bei jedem Release: + +- Vertragsdaten unverändert. +- Stornokosten, Fälligkeiten und Vertragstext-Hash unverändert. +- Ablauf und Automatik-Entscheidung unverändert. +- Keine Neuberechnung. + +Eine Änderung an einer Action mit `readsContractData` ohne passenden Bestandsfall-Test bricht `process:check`. --- @@ -97,23 +142,44 @@ ## 5. Übergreifende Regressionen (bleiben Pflicht) | Bereich | bestehende Tests [Befund] | Ergänzung [Vorschlag] | |---|---|---| -| Verbindlichkeit | `PortalBookingTest`, `BookingAcceptanceTest`, `OfferWorkflowTest` | kein Modell oder Parameter umgeht `offer.acceptance`/`binding.portal` (K07) | -| Preise | `PriceCalculatorTest`, `SpecialOfferPricingTest`, `MinimumStayRulesTest` | `CasePricing` ohne Beiträge = `PriceCalculator` (Gleichheitstest); keine Beiträge für verbindliche Fälle | -| Mandantentrennung | `TenantIsolationTest`, `TenantSeparationTest` | Konfigurator und Tester je Mandant | -| Reservierungen/Halte | `ReservationWorkflowTest`, `ClarificationHoldTest` | – | -| Externe Portale | `ChannelSyncTest`, `PortalMailTest`, `GenericChannelIntegrationTest` | Kanalereignisse: gleiche Entscheidung für iCal-, Mail- und API-Ereignis desselben Inhalts | -| Mail-Schranke | `MailTestModeGateTest` | Tester-Mailer wird mit geprüft | +| Verbindlichkeit | `PortalBookingTest`, `BookingAcceptanceTest`, `OfferWorkflowTest` | kein Modell, Parameter oder Ereignis umgeht `offer.acceptance`/`binding.portal` (K07) | +| Preise | `PriceCalculatorTest`, `SpecialOfferPricingTest`, `MinimumStayRulesTest` | `CasePricing` ohne Beiträge = `PriceCalculator`; keine Beiträge für verbindliche Fälle | +| Laufende Vorgänge | – | `OngoingCaseRegressionTest` (§4.5) | +| Mandantentrennung | `TenantIsolationTest`, `TenantSeparationTest` | Konfigurator, Schnappschuss und Tester je Mandant | +| Reservierungen | `ReservationWorkflowTest`, `ClarificationHoldTest` | `RunnerIndependentStepsTest` (`02` §7.6) | +| Externe Portale | `ChannelSyncTest`, `PortalMailTest`, `GenericChannelIntegrationTest` | §6 | +| Mail-Schranke | `MailTestModeGateTest` | `SideEffectPathsTest` (`04` §3.5) | --- -## 6. Konkrete Nachweisfälle N1–N7 +## 6. Tests der Ereignisverträge (K4) -| # | Betroffene Komponenten | Schnittstellen | Änderungen | Abnahmekriterien | -|---|---|---|---|---| -| **N1** A1-Bestand: Anfrage → Klärungsreservierung → Datenbeschaffung → Angebot → Annahme | Modell `a1.offer`; Module `intake.record`, `guest.details`, `guest.data_request`, `hold`, `availability.check`, `offer.binding`, `offer.acceptance` | `ProcessModule`, `ProcessRunner`, bestehende Actions `CreateReservation`, `RequestHold`, `RequestCaseData`, `SendOffer`, `AcceptOffer`, `ConfirmBooking` | Schritte aus `CaseActivities` in Module überführt; **keine** Änderung der Actions | Golden Master identisch; `EndToEndAcceptanceTest` grün; Szenarien S01–S03, S05, S06 im Tester mit gleichem Ergebnis wie auf stommer.info von Hand | -| **N2** A4-Bestand: Portalbuchung → Gastdatenanreicherung → Dokumente → Portalzahlung → Auszahlungskontrolle | Modell `a4.portal_booking`; Module `binding.portal`, `guest.details`, `documents.send`, `payments.monitor` (performer Portal), `portal.payout` | wie N1 + `PortalIntake`, `TakeOverExternalBooking`, `RecordPortalAmounts`, `CaseMoney` | wie N1; Nachweisstufe je übertragenem Schritt neu (Verlaufseintrag `evidence`) | Golden Master identisch; S07/S08; fehlender Auszahlungsnachweis erscheint beim kaufmännischen Abschluss (K04) | -| **N3** A1 mit Loyalty | `a1.offer:loyalty`; neue Module `guest.loyalty_status`, `pricing.loyalty_discount`; Dienst `CasePricing` | `ContributesToPrice`, `PriceContribution`, `QuoteLineType::Discount` | siehe `02` §6.2; A2–A6 unverändert | `process:impact` zeigt nur A1; S09/S10; Rabattzeile im Angebot und Vertrag, Grundlage im Verlauf; Status `Unknown` → Angebot ohne Rabatt + Hinweis; verbindliche Buchung ändert sich bei `ChangeBooking` nicht; **Diff des Umsetzungs-PR berührt keine Datei von A2–A6** | -| **N4** Gemischter Kanal | Kanal mit `booking_model = Mixed`; Reiter Anfrage (`a2.offer`) und Buchung (`a4.portal_booking`) | `ConfigureChannelProcess`, `ProcessSettings::resolve` (Schlüssel `model` je Eingangsart) | keine über U-C hinaus | eingehende Anfrage-Mail → A2-Plan, iCal-Buchung → A4-Plan; beide im selben Kanal; Tester S01 und S07 mit demselben Kanal | -| **N5** Optionales Modul aus | z. B. `review.request` oder `guest.data_request` | `toggle = Optional`, `steps..on = false` | keine | Plan zeigt Schritt nicht; Tester: „übersprungen (Konfiguration)“; `RequestReviews` sendet für den Fall keine Bitte; Versuch, `availability.check` abzuschalten, wird abgewiesen (K07) | -| **N6** Prozess-Tester | `ProcessSandbox`, `EffectLedger`, Szenarien | §3–§7 in `04` | neu | T01–T06 | -| **N7** Neue Portal-API | hypothetischer `ExampleApiConnector`; `ChannelEventHandler`; `PortalIntake` | `DeliversEvents::fetchEvents`, `IncomingBooking`, `Provenance` | nur Adapter + Registereintrag | **Testadapter** in der Suite (`tests/Support/FakeApiConnector`) liefert `IncomingBooking`. Erwartet wird dieselbe Entscheidung wie für Mail/iCal desselben Inhalts: Duplikat zur bestehenden iCal-Sperre erkannt, gleicher Plan `a4`. `PortalIntake` und Modelle werden durch den Adapter-PR nicht geändert. | +`ChannelEventContractTest`: je Ereignis aus `02` §8.3 mindestens ein Erlaubt-Fall und je „Nie“-Spalte ein Negativfall. + +| Fall | Erwartung | +|---|---| +| `BookingCancelledByChannel` zu verbindlichem Vorgang, `authenticity = authenticated` | Aufgabe + Verlauf; Status unverändert; keine Erstattung; Vorgangssperre bleibt | +| dasselbe per Mail, danach Eintrag verschwindet aus iCal | **eine** Aufgabe (Fingerabdruck), Mail-Sperre aufgehoben, Vorgang unverändert | +| `PaymentReported` 390,61 € | `GuestViaPortal` „laut Portal“; zweite Meldung gleich → kein zweiter Eintrag; kein `PortalPayout`, kein `Guest` | +| `PayoutReported` ausgeführt laut Portal | Nachweisstufe „laut Portal“; `case.settlement` meldet „Nachweis fehlt“ (D3/O5) | +| `BookingChangedByChannel` neue Nächte frei | Aufgabe mit Vergleich; `arrival`/`departure` unverändert | +| `IncomingBooking` per API mit Referenz einer vorhandenen Mail-Sperre | Verknüpfung, kein zweiter Vorgang | +| `IncomingBooking` per API, gleiche Nächte, andere Referenz | Klärung, kein Vorgang | +| `IncomingBooking` ohne Referenz per API | Klärung (`certainty`) | +| Ereignis für Kanal eines anderen Mandanten | abgewiesen | + +Parität der Transporte: dieselbe Buchung als iCal-Eintrag, Mail und API-Ereignis in jeder Reihenfolge → **ein** Vorgang, gleiche Entscheidung (`TransportParityTest`). + +--- + +## 7. Konkrete Nachweisfälle N1–N7 + +| # | Komponenten | Änderungen | Abnahmekriterien | +|---|---|---|---| +| **N1** A1: Anfrage → Klärungsreservierung → Datenbeschaffung → Angebot → Annahme | `a1.offer`; `intake.record`, `guest.details`, `guest.data_request`, `hold`, `availability.check`, `offer.binding`, `offer.acceptance` | Schritte aus `CaseActivities` in Module; **Aufrufstellen** in `CreateReservation`, `SubmitBookingWish`, `TakeOverExternalBooking` rufen `advance` statt `AutoOffer`/`RequestCaseData` direkt (`02` §7.4) | Verhaltensvergleich gleich; `RunnerIndependentStepsTest`; `EndToEndAcceptanceTest` grün; S01–S06 | +| **N2** A4: Portalbuchung → Gastdaten → Dokumente → Portal-Inkasso → Auszahlungskontrolle | `a4.portal_booking`; `binding.portal`, `guest.details`, `documents.send`, `payments.monitor` (Portal), `portal.payout`, `arrival.info` (variabel) | wie N1; Nachweisstufen neu | Verhaltensvergleich gleich; S07/S08; fehlender Auszahlungsnachweis beim Abschluss (K04); Umstellung Anreiseinformation ohne Modellwechsel (K08) | +| **N3** A1 mit Loyalty (nur Tester) | `a1.offer:loyalty`, 2 neue Module, `CasePricing` | `02` §6.4 | `process:impact` zeigt nur A1; S09/S10; Rabattzeile nur vor Verbindlichkeit; `LoyaltyNotActivatableTest`; **Diff des Loyalty-PR berührt keine Datei von A2–A6 und keine Action** | +| **N4** Gemischter Kanal | Kanal `Mixed`, Reiter Anfrage (`a2.offer`) und Buchung (`a4.portal_booking`) | keine über U-C hinaus | Anfrage-Mail → A2-Plan, iCal-Buchung → A4-Plan im selben Kanal; S01 und S07 | +| **N5** Optionaler Schritt aus | `review.request` oder `guest.data_request` | keine | Plan ohne Schritt; Tester „übersprungen (Konfiguration)“; `availability.check` abschalten wird abgewiesen | +| **N6** Prozess-Tester | `04` | neu | T01–T07; alle Negativtests grün | +| **N7** Neue Portal-API | Testadapter `FakeApiConnector`, `ChannelEventHandler` | nur Adapter + Registereintrag | `TransportParityTest`, `ChannelEventContractTest`; `PortalIntake` und Modelle werden durch den Adapter-PR nicht geändert | diff --git a/docs/Prozessarchitektur/Architektur/06_MIGRATIONS_UND_UMSETZUNGSPLAN.md b/docs/Prozessarchitektur/Architektur/06_MIGRATIONS_UND_UMSETZUNGSPLAN.md index 770d67d..4c8ceaa 100644 --- a/docs/Prozessarchitektur/Architektur/06_MIGRATIONS_UND_UMSETZUNGSPLAN.md +++ b/docs/Prozessarchitektur/Architektur/06_MIGRATIONS_UND_UMSETZUNGSPLAN.md @@ -1,24 +1,24 @@ # 06 – Migrations- und Umsetzungsplan -Stand: 04.11.2026 · Kennzeichnung: **[Befund]**, **[Vorschlag]**, **[Entscheidung offen]** +Stand: 04.11.2026, **Review V2** (K7, Entscheidungen E1–E9, D3/D4/D6 eingearbeitet) · Kennzeichnung: **[Befund]**, **[Vorschlag]**, **[Entschieden]**, **[Entscheidung offen]** -Grundsatz: **v0.11 bleibt erhalten.** Die Actions, die Preisberechnung, die Faktenaufnahme, die Nachrichtenverarbeitung, die Connectors und die Testsuite bleiben unverändert. Umgebaut wird die Ablaufsteuerung. Neu hinzu kommen Konfigurator, Tester, Kanalereignisse und ein Preis-Erweiterungspunkt. +Grundsatz: **v0.11 bleibt die fachliche Referenz.** Die Fachlogik der Actions, die Preisberechnung, die Faktenaufnahme, die Nachrichtenverarbeitung und der iCal-/Mail-Eingang bleiben in ihrer Wirkung erhalten. Geändert werden **Aufrufstellen** (Ablaufsteuerung, Preisfassade, zwei Stellen in `PortalIntake`), nicht die Geschäftsregeln. Jede Änderung ist in §1 genannt. --- -## 1. Notwendige Codeänderungen (Überblick) +## 1. Codeänderungen (Überblick) -| Bereich | neu | geändert | unverändert | +| Bereich | neu | geändert (mit Grund) | in der Wirkung unverändert | |---|---|---|---| -| Ablauf | `app/Process/Modules/*` (20 + 2), `ProcessModule`, `ModuleDefinition`, `CaseContext`, `StepResult`, `app/Process/Models/*` (8 Modelle), `ProcessModel`, `Variant`, `Step`, `Point`, `ProcessPlan`, `ProcessRunner`, `ProcessCatalogue`, `config/process.php` | `CaseActivities` (wird Fassade), `CaseAutomation` (Fassade), `ActivityDetails` (Ereignistypen aus Modul), `CaseRecorder::freeze` (Plan mit einfrieren), `ProcessSettings::resolve` (Schlüssel `model`/`variant`/`steps`) | `Activity`, `ActivityState`, `CaseRequirements`, `CaseLog`, `WorkList`, `CaseClosure`, alle Actions | -| Preis | `CasePricing`, `ContributesToPrice`, `PriceContribution` | Aufrufer: `SendOffer::quoteFor`, `SendInformation`, `DecideBookingWish`, `CreateReservation` (Richtpreis), `ChangeBooking` (nicht verbindlich) | `PriceCalculator`, `PriceQuote`, `QuoteLine`, `QuoteLineType` | -| Konfigurator | Seite `ChannelProcess`, Action `ConfigureChannelProcess`, Blade-Komponente Schrittkarte | `HandlingSettings` (dieselbe Schrittansicht), `ChannelForm` (Prozessfelder entfallen), `EffectiveSettings` (liest Plan) | `ChannelRules`, Export, Regeln | -| Tester | `app/Process/Tester/*`: `ProcessSandbox`, `SandboxSeeder`, `EffectLedger`, `ScriptedConnector`, `SandboxMailboxReader`, Ereignistreiber, Szenarien; Seite/Modal „Ablauf testen“; Modell `ProcessTestRun`; Kommando `process:sandbox-template` | `config/database.php` (Verbindung `sandbox`), `scripts/deploy.sh` (Vorlage erzeugen, Release-Kennung ablegen) | `EnforceMailTestMode` (bleibt Schicht im Tester) | -| Kanäle | `app/Channels/Events/*` (Ereignisse, `Provenance`), `ChannelEventHandler`, Fähigkeits-Interfaces `ImportsOccupations`/`DeliversEvents`/`ReceivesWebhooks` | `PortalIntake` (nimmt Ereignis statt `BlockedPeriod`; interne Prüfungen gleich), `SyncChannel` und `ProcessPortalMail` (erzeugen Ereignisse) | `ICalParser`, `PortalMailParser`, `ICalFeed`, `ChannelRegistry` | -| Analyse | `process:impact`, `process:check` (+ `--matrix`) | CI-Workflow `.gitea/workflows/deploy.yml` (ruft `process:check`) | – | -| Loyalty (Nachweis) | `LoyaltyStatusCheck`, `LoyaltyDiscount`, Variante `a1.offer:loyalty`, `FactSource::System` | – | alles andere (`02` §6.2) | +| Ablauf | `app/Process/Modules/*` (Startkatalog), `ProcessModule`, `ModuleDefinition`, `CaseContext`, `StepResult`, `app/Process/Models/*`, `ProcessModel`, `Variant`, `Step`, `Point`, `Responsibilities`, `ProcessPlan`, `ProcessRunner`, `ProcessCatalogue`, `config/process.php` | `CaseActivities` (Fassade), `CaseAutomation` (Fassade), `ActivityDetails` (Ereignistypen aus Modul), `CaseRecorder::freeze` (Plan), `ProcessSettings::resolve` (`model`, `variant`, `steps`). **Aufrufstellen:** `CreateReservation::sendMails`, `SubmitBookingWish`, `TakeOverExternalBooking` (statt `AutoOffer`/`RequestCaseData` direkt → `advance`), `SendPendingAutoOffers` (→ `advance`), `ExpireReservations` und `RequestCaseData::handOver` (danach `advance`) | `Activity`, `ActivityState`, `CaseRequirements`, `CaseLog`, `WorkList`, `CaseClosure`, Fachlogik aller Actions | +| Preis | `CasePricing`, `ContributesToPrice`, `PriceContribution` | **Aufrufstellen:** `SendOffer::quoteFor`, `SendInformation`, `DecideBookingWish`, `CreateReservation` (Richtpreis), `ChangeBooking` (nicht verbindlich) | `PriceCalculator`, `PriceQuote`, `QuoteLine`, `QuoteLineType`, `CancellationCost` | +| Konfigurator | `ChannelProcess`, Action `ConfigureChannelProcess`, Schrittkarte | `HandlingSettings`, `ChannelForm` (Prozessfelder entfallen), `EffectiveSettings` (liest Plan), `guest.details` (akzeptierte Felder, D4) | `ChannelRules`, Export, Regeln | +| Tester | `app/Process/Tester/*`: `SandboxBootstrapper`, Sandbox-Manager, `SnapshotBuilder`, `EffectLedger`, `ScriptedConnector`, `SandboxMailboxReader`, Ereignistreiber, Szenarien, Seite „Ablauf testen“, Modell `ProcessTestRun`, `process:sandbox-template` | `bootstrap/app.php` (`afterBootstrapping`-Haken), `config/database.php` (Vorlage für `sandbox`), `scripts/deploy.sh` (Vorlage, Release-Kennung, Sandbox-Verzeichnis außerhalb der Releases), `AnonymizeGuests` + Löschkonzept (Aufbewahrung) | `EnforceMailTestMode` | +| Kanäle | `app/Channels/Events/*`, `Provenance`, `ChannelEventHandler`, Fähigkeits-Interfaces | `PortalIntake`: `source`-Liste um `api`/`webhook`; `cancellationMail` delegiert an `reportToCase` (K10) | `SyncChannel`, `ProcessPortalMail`, `ICalParser`, `PortalMailParser`, `ICalFeed`, `ChannelRegistry` | +| Analyse | `process:impact`, `process:check` (+ `--matrix`), `SideEffectPathsTest` | CI-Workflow ruft `process:check` | – | +| Loyalty (nur Tester) | `LoyaltyStatusCheck`, `LoyaltyDiscount`, Variante `a1.offer:loyalty`, `FactSource::System` | – | alles andere (`02` §6.4) | -Neue Abhängigkeiten: **keine.** Verwendet werden nur Framework-Mittel: SQLite-PDO, `Http::fake`, `Storage::fake`, Mailer `array`, `Date::setTestNow` und PHPUnit-Gruppen. +Neue Abhängigkeiten: **keine.** Verwendet werden nur Framework-Mittel: SQLite-PDO, `Http::fake`, Mailer `array`, Store `array`, `Date::setTestNow`, PHPUnit-Gruppen. --- @@ -26,125 +26,156 @@ ## 2. Datenmodelländerungen | Änderung | Art | Migration | |---|---|---| -| Eingefrorener Plan im Vorgang | neuer Schlüssel `plan` in `bookings.profile` (JSON) | **keine** | -| Modellwahl, Schritte, Ausführungsart, Parameter | neue Schlüssel in `channels.process_overrides[intake]`, `properties.process_overrides`, `tenants.process_defaults` (JSON) | **keine** | -| Nachweise übertragener Schritte | Verlaufseintrag `booking_events.type = 'evidence'`; Datei auf dem privaten Disk, Pfad im Ereignis | **keine** | -| Faktquelle `System` | neuer Wert im Enum `FactSource`; Spalte `case_facts.source` ist `string(30)` [Befund] | **keine** | -| Testberichte | neue Tabelle `process_test_runs` (`tenant_id`, `channel_id`, `user_id`, `scenario`, `snapshot` JSON, `report` JSON, `outcome`, `release`, Zeitstempel; Index `tenant_id, created_at`) | **1 Migration** | -| Sandbox | Verbindung `sandbox` (SQLite-Datei je Lauf), Vorlage im Release | keine Migration der echten DB | - -Es gibt **eine** neue Tabelle und keine Änderung bestehender Spalten. +| Eingefrorener Plan | Schlüssel `plan` in `bookings.profile` (JSON) | keine | +| Modell, Schritte, Ausführende, Parameter | Schlüssel in `channels.process_overrides`, `properties.process_overrides`, `tenants.process_defaults` | keine | +| Nachweise | Verlaufseintrag `booking_events.type = 'evidence'` | keine | +| Faktquelle `System` | Enum-Wert; `case_facts.source` ist `string(30)` [Befund] | keine | +| Aufbewahrung Testberichte | Spalte am Mandanten nur, falls `TenantConfig` sie wie die anderen Fristen als Spalte führt; sonst Konfigurationsschlüssel | 0–1 (in U-D zu klären) | +| Testberichte | Tabelle `process_test_runs` | **1 Migration** | +| Sandbox | SQLite-Datei je Lauf, Vorlage im Release | keine Migration der Betriebsdatenbank | --- ## 3. Arbeitspakete -Die Pakete sind technische Einheiten mit eigenem Nutzen und eigener Testabdeckung. Die **Betreiberfreigabe** erfolgt gemeinsam nach U-F; Teilfreigaben gibt es nicht (Auftrag §14). Bis dahin liegen alle Pakete auf einem Integrationszweig und werden erst nach der Abnahme nach `develop` zusammengeführt. +### U-0 Bestandsaufnahme vor Beginn (K7) -### U-A Ablaufkern und Modulkatalog (Grundlage) +Vor Beginn wird der tatsächliche Stand geprüft, nicht der aus Statusdokumenten. -- Modulvertrag, Registry und `config/process.php`. -- Überführung **aller** Schritte aus `CaseActivities::for`, `internal()`, `closing()` und `tasks()` sowie aus `CaseAutomation::step` in 20 Module. -- Die Modelle `a1.*`, `a2.*`, `a3`–`a5`, `a6` jeweils in Version 1. +**[Befund 04.11.2026]** + +- `develop` (lokal und `origin`) steht auf `7e4e208`. +- `feature/aufenthalt` liegt 2 Commits davor; beides sind Planungsdokumente (`ef2783e`, `86f2d0a`). +- Weitere Feature-Zweige existieren lokal und auf `origin`. +- Ein Push auf `develop` deployt laut `.gitea/workflows/deploy.yml` automatisch auf `staging` (stommer.info); `main` → `production`. +- Ein freizugebendes Produktivsystem gibt es derzeit nicht. + +Aufgaben von U-0: + +- Stand von `develop`, offene Feature-Zweige und ihre Zusammenführung klären (V4). +- Live-Release auf stommer.info abgleichen (`scripts/deploy.sh staging releases`). +- V1 (`pdo_sqlite`) und V6 (getrennter DB-Benutzer, nur für die Ausweichlösung) auf dem Server prüfen (`scripts/deploy.sh staging artisan`, `php -m`). +- Verhaltens-Snapshots (`05` §4) und Bestandsfall-Fixtures (`02` §5.4) auf dem Ausgangsstand erzeugen; Fehlerregister anlegen. + +**Abnahme:** Protokoll des Ausgangsstands im Umsetzungszweig. + +### U-A Ablaufkern und Modulkatalog + +- Modulvertrag, Register, `config/process.php`. +- Überführung aller Schritte aus `CaseActivities::for`, `internal()`, `closing()`, `tasks()` und aus `CaseAutomation::step` in Module. +- Die Modelle `a1.*`, `a2.*`, `a3`–`a5`, `a6` jeweils in Version 1 mit Verantwortungsfeldern. - `ProcessPlan` mit Einfrieren und Legacy-Abbildung (§4). -- `ProcessRunner`. -- Die Fassaden `CaseActivities` und `CaseAutomation` behalten ihre öffentlichen Methoden. -- `process:check`/`process:impact`, PHPUnit-Gruppen an den bestehenden Tests, Golden Master (`05` §4). +- `ProcessRunner` mit abhängigkeitsbasierter Bereitschaft (`02` §7). +- Umstellung der Auslöser (`02` §7.4), Fassaden. +- `process:check`/`process:impact`, Testgruppen. - **Abnahme (technisch):** - - Golden Master identisch. - - Volle Suite grün. - - `process:check` ohne Befund. - - N1, N2 und N5 in Modelltests. + - Verhaltensvergleich in allen Dimensionen gleich, außer beabsichtigten Abweichungen. + - `RunnerIndependentStepsTest`. + - Bestandsfall-Tests. + - volle Suite grün. + - N1, N2, N5 in Modelltests. -### U-B Erweiterungspunkte, Preisfassade und Loyalty-Nachweis +### U-B Preisfassade und Loyalty-Nachweis -- Erweiterungspunkte im Runner. -- `CasePricing` mit Gleichheitstest gegen `PriceCalculator` (ohne Beiträge). -- `LoyaltyStatusCheck`, `LoyaltyDiscount` und Variante `a1.offer:loyalty`, je nach E7 wählbar oder nur Test. -- **Abnahme (technisch):** N3 inklusive des Nachweises, dass A2–A6 nicht verändert wurden: Der Diff berührt keine Modelldatei außer `A1OfferModel`. +- `CasePricing` mit Gleichheitstest. +- `LoyaltyStatusCheck`, `LoyaltyDiscount`, Variante `a1.offer:loyalty` als `TesterOnly`. +- **Abnahme:** N3 einschließlich `LoyaltyNotActivatableTest` und dem Nachweis, dass der Loyalty-PR keine Datei von A2–A6 und keine Action berührt. ### U-C Kanalkonfigurator -- `ChannelProcess` mit Reitern je Eingangsart, Modellwahl, Schrittkarten, Ausführungsart je Schritt, optionalen Schritten, Nachweisstufen, Herkunft, Vorschau. +- `ChannelProcess` mit Reitern, Modellwahl, Schrittkarten, Ausführenden laut Verantwortungsmatrix, Ausführungsart, Schaltern, Nachweisstufen, Herkunft, Vorschau. - `ConfigureChannelProcess` mit Validierung. -- `HandlingSettings` auf dieselbe Ansicht umgestellt; Prozessfelder in `ChannelForm` entfernt. -- `EffectiveSettings` liest den Plan. -- Prüfung „Nachweis fehlt“ beim kaufmännischen Abschluss. -- **Abnahme (technisch):** K01–K07 automatisiert, N4. +- `HandlingSettings` auf die Schrittansicht umgestellt; `EffectiveSettings` liest den Plan. +- Akzeptierte Angaben je Kanal (D4). +- „Nachweis fehlt“ beim Abschluss. +- **Abnahme:** K01–K09 automatisiert, N4, `ResponsibilityMatrixTest`. ### U-D Prozess-Tester -- Sandbox-Verbindung und Vorlage, Schutzschichten 1–4, `EffectLedger`, Ereignistreiber, Szenarien S01–S12, Bericht und `process_test_runs`. -- „Ablauf testen“ im Konfigurator. -- Sicherheitstests (`04` §7), Paritätstest. -- Sichtung der 28 Rohabfragen auf SQLite/MariaDB-Gleichheit. -- Release-Kennung im Deployment. -- **Abnahme (technisch):** alle Sandbox-Tests grün; T01–T06 lokal. +- Sandbox-Anfrage (`SandboxBootstrapper`), Konfiguration „standardmäßig gesperrt“, Sandbox-Manager mit Aufzeichnung. +- Schnappschuss, Vorlage, Plätze und Grenzen, Aufräumen. +- `EffectLedger`, Ereignistreiber, S01–S13, Bericht, `process_test_runs`, Aufbewahrung im Löschkonzept. +- Positiv- und Negativtests (`04` §7), `SideEffectPathsTest`, Paritätstest. +- Release-Kennung. +- **Abnahme:** alle `sandbox`-Tests grün; T01–T06 lokal. -### U-E Kanalereignisse +### U-E Kanalereignisse (kleiner Ansatz, K10) -- Ereignisklassen und `Provenance`, `ChannelEventHandler`. -- `PortalIntake` auf Ereignisse umgestellt; `SyncChannel` und `ProcessPortalMail` liefern Ereignisse. -- Vertrauensstufe → Nachweisstufe (U-C). -- Testadapter für N7. -- **Abnahme (technisch):** `ChannelSyncTest`, `PortalMailTest`, `PortalBookingTest` und `GenericChannelIntegrationTest` unverändert grün; N7-Test. +- Ereignisklassen, `Provenance`, `ChannelEventHandler` mit Abbildung auf den vorhandenen Eingang. +- Zwei Änderungen in `PortalIntake`. +- Testadapter. +- **Abnahme:** + - `ChannelSyncTest`, `PortalMailTest`, `PortalBookingTest`, `GenericChannelIntegrationTest` **unverändert** grün; + - `ChannelEventContractTest`, `TransportParityTest`, N7. -### U-F Gesamtabnahme auf stommer.info +### U-F Integration, Testsystem, fachliche Abnahme (K7) -- Deployment des Integrationszweigs auf das Testsystem; dort Zählabfrage vorher/nachher. -- Abnahmeprotokoll `Abnahme/ARCHITEKTUR_MODULAR_ABNAHME.md`: - - N1–N7, K01–K08, T01–T06; - - Konfiguration aller vorhandenen Kanäle des Testmandanten durch den Betreiber in der einfachen Ansicht; - - je Kanal und Eingangsart ein Testerlauf und ein echter Testvorgang zum Vergleich (K03). -- Aktualisierung von `docs/STATUS.md`, `KONFIGURATION_UND_WIRKSAMKEIT.md`, `MODULMATRIX.md`. -- **Abnahme (fachlich):** Freigabe durch den Betreiber; erst danach Merge nach `develop` und `main`. +Verbindliche Reihenfolge: + +1. Implementierung und lokale Tests auf dem Entwicklungszweig, je Paket. +2. Vollständige technische Integration und Regression auf dem Entwicklungszweig: + - volle Suite, `process:check`, Verhaltensvergleich, Bestandsfälle, Sandbox-Tests; + - `npm run build`, `vendor/bin/pint`. +3. **Kontrollierter Merge nach `develop`**, erst nach Schritt 2 und nach Abstimmung mit parallelen Sitzungen (`ZUSAMMENARBEIT.md`). +4. **Push von `develop` nach Gitea.** +5. **Automatisches Deployment auf stommer.info** (Workflow `deploy.yml`, `staging`). +6. **Technische Prüfung der bereitgestellten Version:** + - Release-Kennung; + - `process:check` auf dem Server; + - Prüfsumme `bookings.profile` und `channels.process_overrides` vor/nach dem Deployment; + - T03/T04/T07; + - Rückweg geprüft (`scripts/deploy.sh staging rollback` auf einem Probe-Release). +7. **Fachliche Ende-zu-Ende-Abnahme durch den Betreiber:** + - N1–N7, K01–K10, T01–T07; + - Konfiguration aller Kanäle des Testmandanten in der einfachen Ansicht; + - je Kanal und Eingangsart ein Testerlauf und ein echter Testvorgang zum Vergleich (K03); + - Protokoll `Abnahme/ARCHITEKTUR_MODULAR_ABNAHME.md`. + +**Ein Merge nach `main` gehört nicht zu diesem Vorhaben.** Das Testsystem-Deployment ist kein Produktivdeployment. Es gibt eine gemeinsame Freigabe: betriebsfähiger Konfigurator und schadensfreier Tester zusammen. + +Aktualisiert werden `docs/STATUS.md`, `KONFIGURATION_UND_WIRKSAMKEIT.md`, `MODULMATRIX.md`, `BETRIEB.md` (Tester, Grenzen §3.5) und `LOESCHKONZEPT.md`. ### 3.1 Abhängigkeiten ``` -U-A ──┬── U-B - ├── U-C ──┐ - ├── U-E ──┼── U-F - └── U-D ──┘ (U-D nutzt den Konfigurationsentwurf aus U-C und die Ereignisse aus U-E für S07/S08) +U-0 ── U-A ──┬── U-B + ├── U-C ──┐ + ├── U-E ──┼── U-F + └── U-D ──┘ (U-D: S07/S08/S13 nach U-E, Entwurfskonfiguration aus U-C) ``` -U-B, U-C und U-E können nach U-A parallel laufen. U-D beginnt nach U-A mit Sandbox und Schutzschichten; Szenarien S07/S08 folgen nach U-E. +### 3.2 Aufwand (Schätzung, nach Review V2) -### 3.2 Aufwand (Schätzung) +| Paket | Entwicklertage | Änderung ggü. V1 | +|---|---|---| +| U-0 | 1–2 | neu (Bestandsaufnahme, Snapshots, Fixtures) | +| U-A | 9–11 | +1: abhängigkeitsbasierter Runner, Umstellung der Auslöser | +| U-B | 3–4 | – | +| U-C | 7–9 | +1: Verantwortungsmatrix, akzeptierte Angaben | +| U-D | 9–12 | +1–2: Sandbox-Anfrage, Negativtests | +| U-E | 2–3 | −2: Ergänzung statt Umbau | +| U-F | 3–4 | – | +| **Summe** | **34–45** | V1: 32–41 | -| Paket | Entwicklertage | -|---|---| -| U-A | 8–10 | -| U-B | 3–4 | -| U-C | 6–8 | -| U-D | 8–10 | -| U-E | 4–5 | -| U-F (inkl. Fehlerbehebung aus der Abnahme) | 3–4 | -| **Summe** | **32–41** | - -Die Werte enthalten Tests und Dokumentation. Hinzu kommen etwa 1–2 Tage Betreiberzeit für Entscheidungen und die Abnahme. Größter Unsicherheitsfaktor ist U-A: Wie viele unbeabsichtigte Unterschiede zeigt der Golden Master? +Hinzu kommen 1–2 Tage Betreiberzeit (O1–O5, Abnahme). Größte Unsicherheit: wie viele Einträge das Fehlerregister in U-0 bekommt und wie viele davon vor U-F zu beheben sind. --- ## 4. Migrationsstrategie für bestehende Vorgänge und Kanäle -**Keine Datenänderung an bestehenden Buchungen oder Kanälen** – weder bei der Umsetzung noch beim Deployment. +**Keine Datenänderung an bestehenden Buchungen oder Kanälen**, weder bei der Umsetzung noch beim Deployment. -1. **Vorgänge ohne `profile.plan`** (alle bestehenden): `ProcessPlan::of($booking)` bildet beim Lesen aus dem eingefrorenen Profil ab: - - `intake = Internal` → `a6.internal@1`; +1. **Vorgänge ohne `profile.plan`:** `ProcessPlan::of($booking)` bildet beim Lesen aus dem eingefrorenen Profil ab: + - `Internal` → `a6.internal@1`; - `Inquiry` → `a1|a2` (nach `caseType`) `.offer@1` bei `preReservation()`, sonst `.information@1`; - `Booking` → `a3|a4|a5.portal_booking@1` nach `caseType`. - Variante `standard`. - - Optionale Schritte so, wie sie heute wirken: `review.request` an, wenn `guestMessages() = Landlord`; `guest.data_request` nach `dataRequestMode()`. - - Version 1 jedes Modells reproduziert das heutige Verhalten exakt (Golden Master). - - Das Profil wird nicht neu geschrieben. `origin = 'migration'` bleibt beachtet: `CaseAutomation` fasst solche Vorgänge heute nicht automatisch an, und das gilt weiter. -2. **Neue Vorgänge** erhalten beim Eingang den vollständigen Plan (`CaseRecorder::freeze`). -3. **Kanäle ohne `model`:** `ProcessSettings::resolve` leitet das Modell zur Laufzeit wie in Punkt 1 aus den bisherigen Werten ab. - - Der Konfigurator zeigt es als „aus Ihren bisherigen Einstellungen abgeleitet“. - - Gespeichert wird erst, wenn der Vermieter speichert. - - Damit verhält sich jeder Kanal nach dem Deployment genau wie vorher. -4. **Wegfallende Einzelwerte** (`Documents`/`Payments` am Kanal für Eingangsart Buchung, falls E1 wie empfohlen) bleiben lesbar und dienen der Ableitung. Sie werden im Konfigurator nicht mehr einzeln angeboten. Ein späteres Aufräumen ist optional und nicht Teil dieser Umsetzung. -5. **Rückweg:** Es werden keine Daten umgeschrieben, und `profile.plan` wird von der alten Version ignoriert. Ein Rollback per `scripts/deploy.sh rollback` ist deshalb ohne Datenkorrektur möglich. Ausnahme ist die neue Tabelle `process_test_runs`; sie bleibt ungenutzt stehen. + - Schalter und Ausführende so, wie die Profilwerte heute wirken (`review.request` nach `guestMessages()`, `guest.data_request` nach `dataRequestMode()`, Anreiseinformation nach `guestMessages()`). + - Das Profil wird nicht neu geschrieben. `origin = 'migration'` bleibt ohne Automatik. +2. **Neue Vorgänge** erhalten den vollständigen Plan beim Eingang. +3. **Kanäle ohne `model`:** `ProcessSettings::resolve` leitet das Modell zur Laufzeit wie in Punkt 1 ab. Der Konfigurator zeigt „aus Ihren bisherigen Einstellungen abgeleitet“. Gespeichert wird erst durch den Vermieter. +4. **Einzelwerte `Documents`/`Payments`** am Kanal bleiben lesbar und dienen der Ableitung. Im Konfigurator sind sie Modellwahl (bestimmend) bzw. Ausführende am Schritt (variabel). +5. **Rückweg:** Es werden keine Daten umgeschrieben; `profile.plan` ignoriert die alte Version. Ein Rollback per `scripts/deploy.sh rollback` ist ohne Datenkorrektur möglich. `process_test_runs` bleibt ungenutzt stehen. --- @@ -152,13 +183,13 @@ ## 5. Risiken | Risiko | Eintritt | Wirkung | Maßnahme | |---|---|---|---| -| Verhaltensabweichung durch Umbau | mittel | falsche Schritte/Automatik | Golden Master, Fallmatrix, unveränderte Bestandstests, gemeinsame Abnahme | -| `pdo_sqlite` fehlt auf Strato | unbekannt | Tester ohne SQLite | V1 vor Beginn prüfen; Ausweichlösung eigene MariaDB-Datenbank (E4) | -| Sandbox-Leck durch neuen Effektweg (z. B. künftige direkte Netzverbindung) | gering | Schaden durch Tester | Schreibwächter + `preventStrayRequests` + `ModuleContractTest`; Regel: neue Effektwege nur über Framework-Fassaden (wie `MailTestModeGateTest` für Mail) | -| Laufzeit des Testers auf Shared Hosting | mittel | Zeitüberschreitung | Vorlage statt Migration, Ereignisgrenze, Laufzeitgrenze, schrittweise Läufe | -| SQLite/MariaDB-Abweichung in Rohabfragen | gering | Tester ≠ Betrieb in Randfällen | Sichtung in U-D, Paritätstest auf MariaDB in der CI (optional) | -| Konfigurator zu umfangreich | mittel | schlechte Bedienbarkeit | einfache Ansicht mit wenigen Feldern; Betreibertest in U-F (K08) | -| Parallele Arbeiten am selben Repo | mittel | Konflikte in `CaseActivities`/`ViewBooking` | Integrationszweig, `ZUSAMMENARBEIT.md`, U-A zuerst und zügig | +| Verhaltensabweichung durch Umbau | mittel | falsche Schritte, Automatik oder Mails | Verhaltensvergleich in 8 Dimensionen, Fehlerregister, Bestandsfälle | +| Unbeabsichtigte Wirkung gemeinsamer Actions auf laufende Vorgänge | mittel | geänderte Preise, Fristen oder Stornokosten | R1–R6 (`02` §5.3), `OngoingCaseRegressionTest`, `readsContractData` in `process:check` | +| `pdo_sqlite` fehlt und kein getrennter DB-Benutzer möglich | unbekannt | Tester auf dem Server nicht verfügbar | U-0 prüft V1/V6 vor Beginn von U-D | +| Neuer Effektweg am Framework vorbei | gering | Tester nicht mehr schadensfrei | `SideEffectPathsTest`, Sandbox-Manager mit Aufzeichnung, Negativtests | +| Laufzeit auf Shared Hosting | mittel | Abbruch langer Szenarien | Vorlage statt Migration, Grenzen, schrittweise Läufe | +| Konfigurator zu umfangreich | mittel | schlechte Bedienbarkeit | einfache Ansicht; Betreiberprüfung K10 | +| Parallele Arbeiten am Repo | mittel | Konflikte in `CaseActivities`/`ViewBooking` | U-0 klärt Zweige; U-A zuerst und zügig; `ZUSAMMENARBEIT.md` | --- @@ -166,55 +197,68 @@ ## 6. Voraussetzungen | # | Voraussetzung | |---|---| -| V1 | `pdo_sqlite` auf Strato (Test- und Produktivpaket) verfügbar – Prüfung mit `scripts/deploy.sh staging artisan` bzw. `php -m` auf dem Server | -| V2 | Entscheidungen E1–E9 (§9) getroffen | -| V3 | v0.11 auf stommer.info abgenommen ([Befund]: Release `7e4e208` ist auf dem Testsystem live; der Branch `feature/aufenthalt` liegt 112 Commits vor `main`, zuletzt lokal `ef2783e`) | -| V4 | Zusammenführungsstand der laufenden Feature-Zweige geklärt, damit U-A auf aktuellem Stand beginnt | -| V5 | Zuständigkeiten je Portal (welche Modelle zulässig) aus `docs/PORTALE.md` bestätigt (E2) | +| V1 | `pdo_sqlite` auf dem Server (U-0) | +| V2 | Entscheidungen E1–E9 [entschieden]; O1–O5 vor U-C bzw. U-F (§9.2) | +| V3 | v0.11 auf stommer.info als Referenz; Stand in U-0 bestätigt | +| V4 | Zusammenführungsstand der Feature-Zweige geklärt (U-0) | +| V5 | Portalzuordnung §2.2 in `03` bestätigt (O2) | +| V6 | nur für die MariaDB-Ausweichlösung: getrennter DB-Benutzer ohne Rechte auf die Betriebsdatenbank | --- -## 7. Gemeinsame Abnahmekriterien der Umsetzung +## 7. Gemeinsame Abnahmekriterien -1. N1–N7 erfüllt, wie in `05` §6 beschrieben. -2. K01–K08 (Konfigurator) und T01–T06 (Tester) auf stommer.info erfüllt. -3. Der Golden Master ist identisch. Die volle Suite und `process:check` sind ohne Befund. -4. Kein bestehender Vorgang und kein bestehender Kanal wurde durch das Deployment verändert. Das wird per Prüfsumme der Spalten `bookings.profile` und `channels.process_overrides` vorher und nachher festgestellt. -5. Betreiberfreigabe auf Grundlage des Abnahmeprotokolls. Der Konfigurator ist **betriebsfähig**, und der Tester ist **schadensfrei**; beides wird gemeinsam freigegeben. +1. N1–N7 erfüllt (`05` §7). +2. K01–K10 und T01–T07 auf stommer.info erfüllt. +3. Verhaltensvergleich, Bestandsfälle, volle Suite und `process:check` ohne Befund. Das Fehlerregister ist vollständig entschieden. +4. Kein bestehender Vorgang und kein bestehender Kanal wurde durch das Deployment verändert (Prüfsumme `bookings.profile`, `channels.process_overrides` vor/nach). +5. Betreiberfreigabe auf Grundlage des Abnahmeprotokolls: Der Konfigurator ist **betriebsfähig**, der Tester ist **schadensfrei** im Sinne von `04` §3.5 und §7. Beides wird gemeinsam freigegeben. --- ## 8. Was ausdrücklich nicht umgesetzt wird -- Grafischer Designer, frei kombinierbare Bedingungen, Modellpflege in der Datenbank. -- Dynamisch geladene Fremdmodule, zweite Engine, neue Pakete. -- Konkrete Portal-API-Anbindungen. Es gibt nur Schnittstellen und einen Testadapter. -- Ein vollständiges Loyalty-Programm (Punkte, Stufen, Gastkonto). Es gibt nur die beiden Nachweismodule. -- Direktbuchung auf der Webseite (D6): Die Modellstelle `a1.direct_booking` ist vorgesehen, aber nicht wählbar. +- Grafischer Designer, frei kombinierbare Bedingungen, Modellpflege in der Datenbank, BPMN- oder Workflow-Engine. +- Dynamisch geladene Fremdmodule, neue Pakete. +- Konkrete Portal-API-Anbindungen; Umbau von iCal- und Mail-Eingang. +- Produktive Loyalty-Nutzung; Adressprüfung (nur als Prüffall der Modulgrenzen, `02` §2.1). +- Direktbuchung auf der Webseite (D6, spätere gesonderte Erweiterung). +- Merge nach `main`, Produktivdeployment. --- -## 9. Offene Entscheidungen (vor der Implementierung) +## 9. Entscheidungen -| # | Frage | Empfehlung | -|---|---|---| -| **E1** | Legt bei Buchungen (A3–A5) das gewählte Modell die Verantwortungen fest, oder bleiben die Einzelwerte `Documents`/`Payments` maßgeblich? | **Das Modell legt sie fest**: unzulässige Kombinationen sind dann ausgeschlossen. | -| **E2** | Welche Modelle sind je Portal zulässig (FeWo-direkt, Destination Solutions, weitere)? | Aus `PORTALE.md`/`R08`/`R09` ableiten und vom Betreiber bestätigen lassen. Vorschlag: FeWo-direkt Anfrage A2, Buchung A4 oder A5; Destination Solutions Buchung A3. | -| **E3** | Darf eine Kanaländerung in einen laufenden Vorgang übernommen werden? | **Nein.** Gilt nur für neue Vorgänge. | -| **E4** | Sandbox-Speicher: SQLite-Datei oder eigene MariaDB-Datenbank? | SQLite, wenn V1 erfüllt ist; sonst MariaDB. | -| **E5** | Loyalty bei Änderung einer verbindlichen Buchung? | Rabattzeile unverändert übernehmen, keine Neuberechnung; dazu ein Hinweis für eine manuelle Anpassung. | -| **E6** | Loyalty mit Sonderangeboten kombinierbar? | Vorgabe **nein**, der höhere Nachlass gilt; als Parameter einstellbar. | -| **E7** | Loyalty produktiv wählbar oder nur als Architekturnachweis? | Beide Module bauen. Variante wählbar, Vorgabe **aus**. Der Rabattsatz ist Pflichtangabe beim Einschalten. | -| **E8** | Wer darf den Tester nutzen, wie lange werden Berichte aufbewahrt? | Administratoren des Mandanten; 90 Tage. | -| **E9** | Wie viel darf der Vermieter an Szenarien verändern? | Nur vorgegebene Eingaben (Zeitraum, Personen, fehlende Felder, Stammgast ja/nein, Ausfallart); keine eigenen Ereignisfolgen. | +### 9.1 Entscheidungsmatrix -### Einordnung der Punkte D1–D6 aus dem Vorschlag Kanalkonfigurator +| # | Entscheidung | Begründung | Betroffene Komponenten | Auswirkung auf bestehende Abläufe | Testnachweis | +|---|---|---|---|---|---| +| E1 [entschieden] | Modell legt Grundverantwortungen fest; Kommunikation, ergänzende Unterlagen, Anreiseinformation und lokale Leistungen sind innerhalb des Modells wählbar | verhindert widersprüchliche Archetypen, erhält Flexibilität am Schritt | `ProcessModel::responsibilities`, `ConfigureChannelProcess`, `ChannelProcess` | Kanäle ohne Modell: abgeleitet, unverändert (§4.3) | `ResponsibilityMatrixTest`, K08 | +| E2 [entschieden: Regel] | zulässige Modelle nach Geschäfts- und Integrationsfähigkeit des Kanals; Zuordnung `03` §2.2 | R08, R09, PORTALE | Modellregister, Connector-/Portalprofil | keine | K01 | +| E3 [entschieden] | Konfigurationsänderungen nur für neue Vorgänge | Angebote und Verträge laufender Fälle bleiben konsistent | `CaseRecorder::freeze`, `ProcessPlan` | keine | K05, `OngoingCaseRegressionTest` | +| E4 [entschieden] | SQLite bevorzugt; MariaDB nur mit getrenntem Benutzer und Pool | sichere Trennung | `SandboxBootstrapper`, Deploy | keine | Negativtests N-DB*, V6-Servertest | +| E5 [entschieden] | Loyalty-Rabatt bei Änderung eingefroren (Nachweis) | Produktivregel später | `CasePricing`, `ChangeBooking` | keine (nur Tester) | `LoyaltyDiscountTest` | +| E6 [entschieden] | keine Produktivregel für Kombination; Tests mit vorgegebenem Verhalten | nicht freigegeben | `LoyaltyDiscount` | keine | S10 | +| E7 [entschieden] | Loyalty nur im Tester | Erweiterbarkeitsnachweis | `TesterOnly`, `ConfigureChannelProcess`, `ProcessPlan::freeze` | keine | `LoyaltyNotActivatableTest`, K09 | +| E8 [entschieden] | Tester für Mandanten-Administratoren; Aufbewahrung über Löschkonzept | Datenschutzkonzept einheitlich | Policy, `fewo.retention.*`, `AnonymizeGuests` | keine | Policy-Test, Löschtest | +| E9 [entschieden] | vordefinierte Szenarien, veränderbare Eingaben, schrittweise | keine Programmierung durch Vermieter | Szenariokatalog | keine | T01 | +| D3 [abgeleitet] | Mindestnachweise laut `03` §5; Auszahlung und Erstattung „nachgewiesen“ | R09, E-019 | Nachweisstufen, `case.settlement` | neu: „Nachweis fehlt“ beim Abschluss | K04 | +| D4 [entschieden: Regel] | akzeptierte Angaben = Zulässigkeit der Übernahme, nie Umgehung der Prüfungen | Herkunft und Konflikte bleiben maßgeblich | `guest.details`, `ContributeCaseFacts` | Vorgabe: wie heute | `AcceptedFieldsTest` | +| D6 [entschieden] | Direktbuchung Webseite später gesondert | Rechtsprüfung | – | keine | – | +| K1 | Runner mit abhängigkeitsbasierter Bereitschaft, Zustand abgeleitet, vorhandene Auslöser | unabhängige Schritte ohne zweite Wahrheit | `ProcessRunner`, Aufrufstellen (§1) | intendierte Abweichung: Wiederaufnahme nach Zeit-Actions | `RunnerIndependentStepsTest` | +| K3 | vier Ebenen, R1–R6 | laufende Vorgänge geschützt ohne Altversionen | Actions mit `readsContractData`, `process:check` | keine | `OngoingCaseRegressionTest` | +| K4 | M1–M4, keine Zuordnung Vertrauen → Nachweis | Meldung ≠ Geschäftshandlung | `Provenance`, `ChannelEventHandler` | keine (heutige E-019-Regeln bleiben) | `ChannelEventContractTest` | +| K5 | eigene Sandbox-Anfrage, standardmäßig gesperrt | Umschalten in der Admin-Anfrage nicht sicher | `SandboxBootstrapper`, Sandbox-Manager | keine | `04` §7 | +| K10 | Ereignisse als Ergänzung, Transporte unverändert | kleinster tragfähiger Ansatz | `ChannelEventHandler`, `PortalIntake` (2 Stellen) | keine | `TransportParityTest` | -| # | Stand | -|---|---| -| D1 Preisanfrage als Eingangsart | bleibt: **keine** eigene Eingangsart; Modell `a1.information` / `a2.information` | -| D2 Schablone nach Anpassung | entfällt als Frage: Das Modell bleibt gewählt, abweichende Parameter tragen die Herkunft „hier gesetzt“. Die Kennzeichnung „angepasst“ zeigt der Konfigurator, wenn Werte von den Modellvorgaben abweichen. | -| D3 Mindestnachweis je Modell | **offen** (Vorgaben wie im Vorschlag empfohlen) | -| D4 akzeptierte Angaben je Kanal | **offen**; wird Parameter von `guest.details` je Kanal (nicht ausgewählte Felder → Vorschlag statt Übernahme) | -| D5 Berechtigung | bestätigt: Administratoren des Mandanten | -| D6 Direktbuchung Webseite | bleibt eigene Entscheidung nach Rechtsprüfung | +### 9.2 Tatsächlich noch offen + +| # | Frage | Empfehlung | Nötig vor | +|---|---|---|---| +| **O1** | Bleibt die Vertragsdokumentation archetypbestimmend (`Documents = Portal` ⇒ A5, wie heute codiert)? | ja | U-C | +| **O2** | Lässt FeWo-direkt neben A4 auch A5 oder A3 zu? | zunächst nur A4 | U-C | +| **O3** | Aufbewahrungsfrist der Testberichte im Löschkonzept | kurz, z. B. 30 Tage; mit dem Löschkonzept bestätigen | U-D | +| **O4** | Setzt eine offene Portal-Storno-/Änderungsmeldung automatische Außenwirkungen aus? | ja (beabsichtigte Abweichung von v0.11) | U-A | +| **O5** | Kaufmännischer Abschluss A4/A5 ohne erfassten Auszahlungseingang? | nur als begründeter Abschluss mit Protokoll | U-C | + +Technische Prüfungen statt Entscheidungen: V1 und V6 (U-0). diff --git a/docs/Prozessarchitektur/README.md b/docs/Prozessarchitektur/README.md index 57c63e3..418517d 100644 --- a/docs/Prozessarchitektur/README.md +++ b/docs/Prozessarchitektur/README.md @@ -49,7 +49,7 @@ ## Geltung, Dokumente und Archiv - Die Dateien unter `Referenzen/` sind **Quellen- und Belegmaterial**, keine eigenständigen neuen Normen. Ihr historisches Versionsdatum bleibt unverändert. - Die **vollständige Original-v0.10 mit Originaldokumenten, Audit, damaligen Umsetzungs-/Abnahmeprotokollen, Screenshots und Vault-Dateien** liegt unverändert als [Historie/Prozessarchitektur_v0.10_ORIGINAL.zip](Historie/Prozessarchitektur_v0.10_ORIGINAL.zip) bei. Sie ist **nicht** parallel gültig. Ihre technischen und rechtlichen Prüfstände belegen nur v0.10. - Die Beschlussquelle für den neuen Bereich liegt in [Historie/CH_Entscheidungsstand_2026-11-03_v4.md](Historie/CH_Entscheidungsstand_2026-11-03_v4.md). Die normative aktuelle Regel ist die CH-Querschnittsdatei. -- Unter [Architektur/](Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md) liegt der **Architektur- und Umsetzungsplan** für die modulare Prozessarchitektur (Fachmodule, Prozessmodelle, Kanalkonfigurator, Prozess-Tester). Er ist eine Planung und noch nicht normativ; er löst `Vorschläge/KANALKONFIGURATOR.md` als Zielbild ab. +- Unter [Architektur/](Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md) liegt der **Architektur- und Umsetzungsplan** für die modulare Prozessarchitektur (Fachmodule, Prozessmodelle, Kanalkonfigurator, Prozess-Tester). Er ist nach Review V2 implementierungsreif, aber noch nicht umgesetzt; er löst `Vorschläge/KANALKONFIGURATOR.md` als Zielbild ab. - Die [Konsolidierungsprüfung](KONSOLIDIERUNGSBERICHT_v0.11.md) erklärt Herkunft, Änderungen und technische Freigabevorbehalte. **Es wurde kein aktueller Repository-Code geprüft.** ## Offene Nachweise vor produktivem Go-live diff --git a/docs/STATUS.md b/docs/STATUS.md index 51d1f28..9561664 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -24,7 +24,7 @@ ## Aktueller Stand (03.11.2026) - [Umsetzungsergebnis v0.11](Prozessarchitektur/Implementierungsstände/UMSETZUNGSERGEBNIS_V011.md) (Rückverfolgung, Entscheidungen, Einschränkungen, Go-live-Bedingungen); - [Abnahme auf dem Testsystem](Prozessarchitektur/Abnahme/V011_ABNAHME_TESTSYSTEM.md) (Dienste, Konfiguration, Drehbuch); - Planung: [Soll-Ist](Prozessarchitektur/Implementierungsstände/V011_SOLL_IST_ANALYSE.md), [Zielarchitektur](Prozessarchitektur/Implementierungsstände/V011_TECHNISCHE_ZIELARCHITEKTUR.md), [Umsetzungsplan](Prozessarchitektur/Implementierungsstände/V011_UMSETZUNGSPLAN.md). -- Nachfolgeplanung (04.11.2026, noch nicht umgesetzt): [Kontrolliert modulare Prozessarchitektur, Kanalkonfigurator und Prozess-Tester](Prozessarchitektur/Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md) – Entscheidungen E1–E9 offen. +- Nachfolgeplanung (04.11.2026, noch nicht umgesetzt): [Kontrolliert modulare Prozessarchitektur, Kanalkonfigurator und Prozess-Tester](Prozessarchitektur/Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md) – nach Review V2 implementierungsreif; E1–E9 entschieden, offen nur O1–O5. **Nächste Schritte:** 1. Abstimmung mit dem Betreiber: Auslieferung von `feature/aufenthalt` über `develop` auf das Testsystem (vier neue Migrationen), eigenes IMAP-Postfach, KI-Zugang des Mandanten unter „System › KI-Anbindung“ (Dienst vorher im Betreiberbereich einschalten). From 98df5e9e3b67b100cfc3a4152322b7b6831391a7 Mon Sep 17 00:00:00 2001 From: Lars Date: Wed, 4 Nov 2026 14:28:35 +0100 Subject: [PATCH 4/9] =?UTF-8?q?U-0:=20Bestandsaufnahme,=20Verhaltensrefere?= =?UTF-8?q?nz=20v0.11=20(11=20Abl=C3=A4ufe,=20198=20Konstellationen),=20Be?= =?UTF-8?q?standsf=C3=A4lle,=20Fehlerregister?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- ...0_BESTANDSAUFNAHME_PROZESSARCHITEKTUR_V2.md | 41 + .../Process/BehaviourComparisonTest.php | 404 + .../Process/OngoingCaseRegressionTest.php | 264 + .../process/behaviour/a1_complete.json | 928 + .../process/behaviour/a1_dates_taken.json | 468 + .../process/behaviour/a1_information.json | 555 + .../process/behaviour/a1_manual_reject.json | 634 + .../process/behaviour/a1_missing_address.json | 1012 + .../process/behaviour/a2_inquiry.json | 414 + .../process/behaviour/a3_booking.json | 648 + .../process/behaviour/a4_booking.json | 671 + .../process/behaviour/a5_booking.json | 140 + .../process/behaviour/a6_internal.json | 175 + .../behaviour/portal_mail_cancellation.json | 608 + .../process/behaviour/state_matrix.json | 19332 ++++++++++++++++ tests/Fixtures/process/defects.md | 10 + tests/Fixtures/process/intended.md | 11 + tests/Fixtures/process/ongoing/cases.json | 2409 ++ tests/Support/Process/BehaviourSnapshot.php | 131 + 19 files changed, 28855 insertions(+) create mode 100644 docs/Prozessarchitektur/Implementierungsstände/U0_BESTANDSAUFNAHME_PROZESSARCHITEKTUR_V2.md create mode 100644 tests/Feature/Process/BehaviourComparisonTest.php create mode 100644 tests/Feature/Process/OngoingCaseRegressionTest.php create mode 100644 tests/Fixtures/process/behaviour/a1_complete.json create mode 100644 tests/Fixtures/process/behaviour/a1_dates_taken.json create mode 100644 tests/Fixtures/process/behaviour/a1_information.json create mode 100644 tests/Fixtures/process/behaviour/a1_manual_reject.json create mode 100644 tests/Fixtures/process/behaviour/a1_missing_address.json create mode 100644 tests/Fixtures/process/behaviour/a2_inquiry.json create mode 100644 tests/Fixtures/process/behaviour/a3_booking.json create mode 100644 tests/Fixtures/process/behaviour/a4_booking.json create mode 100644 tests/Fixtures/process/behaviour/a5_booking.json create mode 100644 tests/Fixtures/process/behaviour/a6_internal.json create mode 100644 tests/Fixtures/process/behaviour/portal_mail_cancellation.json create mode 100644 tests/Fixtures/process/behaviour/state_matrix.json create mode 100644 tests/Fixtures/process/defects.md create mode 100644 tests/Fixtures/process/intended.md create mode 100644 tests/Fixtures/process/ongoing/cases.json create mode 100644 tests/Support/Process/BehaviourSnapshot.php diff --git a/docs/Prozessarchitektur/Implementierungsstände/U0_BESTANDSAUFNAHME_PROZESSARCHITEKTUR_V2.md b/docs/Prozessarchitektur/Implementierungsstände/U0_BESTANDSAUFNAHME_PROZESSARCHITEKTUR_V2.md new file mode 100644 index 0000000..9367132 --- /dev/null +++ b/docs/Prozessarchitektur/Implementierungsstände/U0_BESTANDSAUFNAHME_PROZESSARCHITEKTUR_V2.md @@ -0,0 +1,41 @@ +# U-0 Bestandsaufnahme – Modulare Prozessarchitektur V2 + +Stand: 04.11.2026 · Umsetzungszweig `feature/prozessarchitektur-v2` (abgezweigt von `feature/aufenthalt` @ `750c1ed`) + +## 1. Repository + +| Prüfung | Ergebnis | +|---|---| +| `origin/develop` | `7e4e208` (03.11.2026) | +| `feature/aufenthalt` | = `origin/develop` + 3 Planungscommits (`ef2783e`, `86f2d0a`, `750c1ed`), nicht gepusht | +| übrige Remote-Zweige (`feature/*`, `theme/seebad`, `main`) | **alle vollständig in `develop` enthalten** (0 Commits voraus) | +| lokale Zweige mit eigenen Commits | nur `feature/aufenthalt` (Planungsdokumente) | +| parallele Worktrees | `C:/Dev/fewo-design` (`feature/design-stufe2`, Design-Session B, 0 Commits voraus) und ein Scratch-Worktree `feature/bausteine` – werden nicht verändert | +| Deploymentworkflow | `.gitea/workflows/deploy.yml`: Push `develop` → Tests + Deployment `staging` (stommer.info); `main` → `production` | + +## 2. Testsystem stommer.info (nur lesend geprüft) + +| Prüfung | Ergebnis | +|---|---| +| aktive Version | `20261103170806-7e4e208d` = `develop` | +| PHP-CLI | 8.4, `pdo_sqlite`, `sqlite3`, `pdo_mysql` geladen; `disable_functions` leer; `open_basedir` leer; `memory_limit` 512M; `max_execution_time` (CLI) 0 | +| Daten | 2 Mandanten, 10 Buchungen (3 confirmed, 2 cancelled, 4 declined, 1 expired), 7 Kanäle (alle `case_intake = off`), 13 Sperrzeiten | +| Prüfsummen vor dem Vorhaben | `bookings` (Status, Profil, Preis, Bedingungen, Fristen): `ab8b708e0479aeb3bd902b3fd538462b`; `channels.process_overrides`: `b3ea60a060bea2b417fc78bba5dd852b`; `blocked_periods`: `d6305a420d17c1928cfce54f0c94bb8b` | + +Die Prüfsummen werden nach dem Deployment mit `php artisan process:fingerprint` erneut erhoben (`06` U-F Schritt 6). + +**Sandbox-Voraussetzung V1:** `pdo_sqlite` ist im CLI vorhanden. Ob er auch im Web-PHP geladen ist, wird zur Laufzeit geprüft (`ProcessSandbox::requirements()`). Fehlt er dort, ist der Tester deaktiviert. V6 (getrennter MariaDB-Benutzer) wird nicht benötigt, solange SQLite verfügbar ist. + +**Harte Betriebssystemisolation (T2):** Shared Hosting bietet keine Prozess-, Benutzer- oder Netzwerk-Isolation je Anfrage. Alle Anfragen laufen unter demselben Systembenutzer mit Zugriff auf `shared/.env`. Erreichbar ist nur **anwendungsseitige Isolation** (`04` §3). Die Restrisiken sind in `BETRIEB.md` dokumentiert. + +## 3. Ausgangsverhalten + +| Prüfung | Ergebnis | +|---|---| +| vollständige Suite auf `7e4e208` + Testwerkzeug | 772 Tests, 771 grün, 1 instabil (`TenantBrandRenderingTest`, einzeln grün; Fehlerregister F-003) | +| Verhaltensreferenz | `tests/Fixtures/process/behaviour/*.json`: 11 Abläufe (A1 vollständig, A1 fehlende Anschrift mit Klärungsreservierung und später Antwort, A1 belegter Zeitraum, A1 manuell/Ablehnung, A1 Auskunft/Wunsch, A2, A3, A4, A5, Portalmail mit Storno-Meldung, A6) und 198 Zustandskonstellationen | +| Bestandsfälle | `tests/Fixtures/process/ongoing/cases.json`: 12 eingefrorene Fälle (Klärung, Angebot, fest mit offener Anzahlung, angezahlt, storniert, Aufenthalt vorbei, A2, A3, A4 mit Portalraten, A5, A6, `origin = migration`) | +| Fehlerregister | `tests/Fixtures/process/defects.md` (F-001 bis F-004) | +| beabsichtigte Abweichungen | `tests/Fixtures/process/intended.md` | + +Die Referenzen wurden auf dem unveränderten v0.11-Prozesskern aufgenommen (`PROCESS_BEHAVIOUR_RECORD=1`, `PROCESS_ONGOING_RECORD=1`) und sind deterministisch (zwei Läufe identisch). diff --git a/tests/Feature/Process/BehaviourComparisonTest.php b/tests/Feature/Process/BehaviourComparisonTest.php new file mode 100644 index 0000000..b216d7b --- /dev/null +++ b/tests/Feature/Process/BehaviourComparisonTest.php @@ -0,0 +1,404 @@ +> */ + private array $steps = []; + + protected function setUp(): void + { + parent::setUp(); + + $this->travelTo(CarbonImmutable::parse('2026-10-23 18:00')); + $this->seed([PropertySeeder::class, SiteSeeder::class]); + $this->property = Property::sole(); + Storage::fake('local'); + Storage::fake('public'); + Content::save(['contract.terms' => '

Echte Bedingungen

', 'stay.cancellation' => '

Echtes Storno

']); + config(['mail.default' => 'array', 'fewo.spam.min_seconds' => 0]); + Mail::swap(new MailManager($this->app)); + Settings::tenant()->update(['bank_iban' => 'DE02120300000000202051', 'test_recipient' => 'test@example.org']); + Http::preventStrayRequests(); + BehaviourSnapshot::reset(); + } + + public function test_a1_complete_request_automatic_offer_acceptance_and_payment(): void + { + $this->automatic(); + $booking = $this->request(['street' => 'Lindenallee 12', 'postal_code' => '10115', 'city' => 'Berlin', 'country' => 'DE']); + $this->capture('request', $booking); + + app(AcceptOffer::class)->handle($booking->fresh(), $booking->fresh()->offer_version); + $this->capture('accepted', $booking); + + app(RecordPayment::class)->handle($booking->fresh(), (int) $booking->fresh()->deposit, now()); + $this->capture('deposit', $booking); + + $this->travelTo($booking->fresh()->arrival->subDays(2)->setTime(9, 0)); + $this->schedulers(); + $this->capture('before_arrival', $booking); + + $this->travelTo($booking->fresh()->departure->addDays(3)->setTime(9, 0)); + $this->schedulers(); + $this->capture('after_departure', $booking); + + $this->assertBehaviour('a1_complete'); + } + + public function test_a1_missing_address_clarification_hold_data_request_and_late_answer(): void + { + $this->automatic(['clarification_hold_auto_minutes' => 120, 'data_request_mode' => 'automatic']); + $booking = $this->request([]); + $this->capture('request', $booking); + + $this->travelTo(now()->addHours(2)->addMinutes(5)); + $this->schedulers(); + $this->capture('clarification_expired', $booking); + + $this->travelTo(now()->addHours(23)); + $this->schedulers(); + $this->capture('first_reminder', $booking); + + app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.street' => 'Lindenallee 12', 'guest.postal_code' => '10115', 'guest.city' => 'Berlin', 'guest.country' => 'DE'], FactSource::GuestLink); + $this->capture('answer', $booking); + + app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.street' => 'Lindenallee 12'], FactSource::GuestLink); + $this->capture('answer_repeated', $booking); + + $this->travelTo(now()->addHours(49)); + $this->schedulers(); + $this->capture('offer_expired', $booking); + + $this->assertBehaviour('a1_missing_address'); + } + + public function test_a1_late_answer_when_the_dates_are_taken_meanwhile(): void + { + $this->automatic(['clarification_hold_auto_minutes' => 30, 'data_request_mode' => 'automatic']); + $booking = $this->request([]); + $this->travelTo(now()->addHour()); + $this->schedulers(); + $this->capture('clarification_expired', $booking); + + $other = $this->request(['street' => 'Weg 1', 'postal_code' => '20095', 'city' => 'Hamburg', 'country' => 'DE'], 'zweiter@example.org'); + $this->capture('other_offer', $other); + + app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.street' => 'Lindenallee 12', 'guest.postal_code' => '10115', 'guest.city' => 'Berlin', 'guest.country' => 'DE'], FactSource::GuestLink); + $this->capture('answer_dates_taken', $booking); + + $this->assertBehaviour('a1_dates_taken'); + } + + public function test_a1_manual_offer_and_rejection(): void + { + $booking = $this->request(['street' => 'Lindenallee 12', 'postal_code' => '10115', 'city' => 'Berlin', 'country' => 'DE']); + $this->capture('request', $booking); + + app(SendOffer::class)->handle($booking->fresh()); + $this->capture('offer', $booking); + + app(SendOffer::class)->handle($booking->fresh()); + $this->capture('offer_version_2', $booking); + + app(RejectOffer::class)->handle($booking->fresh(), $booking->fresh()->offer_version); + $this->capture('rejected', $booking); + + $this->assertBehaviour('a1_manual_reject'); + } + + public function test_a1_information_wish_and_binding_confirmation(): void + { + $this->automatic(['pre_reservation' => false]); + DocumentReleases::set(DocumentKind::Information, true, 'Test'); + $booking = $this->request(['street' => 'Lindenallee 12', 'postal_code' => '10115', 'city' => 'Berlin', 'country' => 'DE']); + $this->capture('information', $booking); + + app(SubmitBookingWish::class)->handle($booking->fresh(), $booking->fresh()->information_version); + $this->capture('wish', $booking); + + $this->travelTo(now()->addMinutes(10)); + $this->schedulers(); + $this->capture('after_schedulers', $booking); + + $this->assertBehaviour('a1_information'); + } + + public function test_a2_portal_inquiry_without_details(): void + { + $this->automatic(['clarification_hold_auto_minutes' => 60, 'data_request_mode' => 'automatic']); + $channel = $this->channel('FeWo-direkt', 'mixed'); + $booking = app(TakeOverPortalInquiry::class)->handle($channel, CarbonImmutable::parse('2026-11-14'), CarbonImmutable::parse('2026-11-18'), 'HA-ANF1'); + $this->capture('inquiry', $booking); + + app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.first_name' => 'Gesa', 'guest.last_name' => 'Gast', 'guest.email' => 'gesa@example.org', 'booking.guests' => '2'], FactSource::PortalMail); + $this->capture('contact', $booking); + + app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.street' => 'Lindenallee 12', 'guest.postal_code' => '10115', 'guest.city' => 'Berlin', 'guest.country' => 'DE'], FactSource::Email); + $this->capture('address', $booking); + + $this->assertBehaviour('a2_inquiry'); + } + + public function test_a3_portal_booking_with_own_documents_and_payments(): void + { + $this->automatic(); + $channel = $this->channel('Destination Solutions', 'portal_booking'); + $booking = app(TakeOverExternalBooking::class)->handle($this->property, $channel, CarbonImmutable::parse('2026-12-05'), CarbonImmutable::parse('2026-12-12'), ['portal_reference' => 'DS-1']); + $this->capture('booking', $booking); + + app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.first_name' => 'Dora', 'guest.last_name' => 'Gast', 'guest.email' => 'dora@example.org', 'booking.guests' => '2'], FactSource::PortalMail); + $this->capture('guest', $booking); + + app(RecordPortalAmounts::class)->handle($booking->fresh(), 98000, [], [], 'Destination Solutions'); + $this->capture('price', $booking); + + app(RecordPortalAmounts::class)->handle($booking->fresh(), 98000, [], [], 'Destination Solutions'); + $this->capture('price_repeated', $booking); + + $this->assertBehaviour('a3_booking'); + } + + public function test_a4_portal_booking_with_portal_payments(): void + { + $this->automatic(); + $channel = $this->channel('FeWo-direkt', 'mixed', ['booking' => ['payments' => 'portal']]); + $booking = app(TakeOverExternalBooking::class)->handle($this->property, $channel, CarbonImmutable::parse('2027-07-10'), CarbonImmutable::parse('2027-07-17'), ['portal_reference' => 'HA-A4', 'portal_total' => 97951, 'guests' => 2]); + $this->capture('booking', $booking); + + app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.first_name' => 'Fiete', 'guest.last_name' => 'Gast', 'guest.email' => 'fiete@example.org'], FactSource::PortalMail); + $this->capture('guest', $booking); + + app(RecordPortalAmounts::class)->handle($booking->fresh(), null, [['kind' => 'payout_announced', 'amount' => 89469]], [['amount' => 39061, 'paid_on' => '2026-10-23']], 'FeWo-direkt'); + $this->capture('portal_amounts', $booking); + + app(RecordPortalAmounts::class)->handle($booking->fresh(), null, [['kind' => 'payout_announced', 'amount' => 89469]], [['amount' => 39061, 'paid_on' => '2026-10-23']], 'FeWo-direkt'); + $this->capture('portal_amounts_repeated', $booking); + + $this->assertBehaviour('a4_booking'); + } + + public function test_a5_portal_booking_with_portal_documents(): void + { + $this->automatic(); + $channel = $this->channel('Portal A5', 'portal_booking', ['booking' => ['payments' => 'portal', 'documents' => 'portal', 'guest_messages' => 'portal']]); + $booking = app(TakeOverExternalBooking::class)->handle($this->property, $channel, CarbonImmutable::parse('2026-12-19'), CarbonImmutable::parse('2026-12-23'), ['portal_reference' => 'P5-1', 'portal_total' => 60000]); + $this->capture('booking', $booking); + + $this->assertBehaviour('a5_booking'); + } + + public function test_portal_mail_booking_and_cancellation_report(): void + { + $channel = $this->channel('FeWo-direkt', 'mixed', [], ['email_senders' => 'fewo-direkt.de']); + $channel->update(['case_intake' => 'create']); + $text = "Gast: Max Mustermann\nAnreise: Sa., 7. Nov. 2026\nAbreise: Di., 10. Nov. 2026\nReisende: 2 Erwachsene\nBuchungsnummer: HA-7X3K9Q"; + app(ProcessPortalMail::class)->handle(new PortalMail('', 'noreply@fewo-direkt.de', 'Neue Buchung: Ferienwohnung', $text, CarbonImmutable::now())); + $booking = Booking::query()->sole(); + $this->capture('booking_mail', $booking); + + app(ProcessPortalMail::class)->handle(new PortalMail('', 'noreply@fewo-direkt.de', 'Neue Buchung: Ferienwohnung', $text, CarbonImmutable::now())); + $this->capture('booking_mail_repeated', $booking); + + app(ProcessPortalMail::class)->handle(new PortalMail('', 'noreply@fewo-direkt.de', 'Buchung storniert: HA-7X3K9Q', 'Die Buchung vom 07.11.2026 bis 10.11.2026 wurde storniert.', CarbonImmutable::now())); + $this->capture('cancellation_mail', $booking); + + app(CaseAutomation::class)->advance($booking->fresh()); + $this->capture('advance_after_cancellation', $booking); + + $this->assertBehaviour('portal_mail_cancellation'); + } + + public function test_a6_own_use(): void + { + $booking = app(CreateInternalCase::class)->handle($this->property, InternalKind::PrivateStay, CarbonImmutable::parse('2026-11-20'), CarbonImmutable::parse('2026-11-23'), ['occasion' => 'Familie']); + $this->capture('internal', $booking); + + $this->travelTo(CarbonImmutable::parse('2026-11-24 09:00')); + $this->schedulers(); + $this->capture('after', $booking); + + $this->assertBehaviour('a6_internal'); + } + + /** + * State matrix: intake × status × responsibilities × data × time, read only (activities, next step, situation and + * the automation's blockers) – the constellations the flows above do not reach. + */ + public function test_state_matrix(): void + { + $channels = [ + 'website' => null, + 'a2' => $this->channel('Anfrageportal', 'inquiry'), + 'a3' => $this->channel('Buchungsportal A3', 'portal_booking'), + 'a4' => $this->channel('Buchungsportal A4', 'portal_booking', ['booking' => ['payments' => 'portal']]), + 'a5' => $this->channel('Buchungsportal A5', 'portal_booking', ['booking' => ['payments' => 'portal', 'documents' => 'portal', 'guest_messages' => 'portal']]), + ]; + $statuses = ['reserved', 'offer_sent', 'confirmed', 'deposit_paid', 'paid', 'completed', 'cancelled', 'expired', 'declined']; + $guests = [ + 'complete' => ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org', 'street' => 'Weg 1', 'postal_code' => '10115', 'city' => 'Berlin', 'country' => 'DE'], + 'no_address' => ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org'], + 'none' => null, + ]; + $times = ['future' => ['2026-12-01', '2026-12-05'], 'past' => ['2026-10-10', '2026-10-14']]; + $index = 0; + + foreach ($channels as $channelKey => $channel) { + $intake = in_array($channelKey, ['website', 'a2'], true) ? 'inquiry' : 'booking'; + foreach ($statuses as $status) { + if ($intake === 'booking' && in_array($status, ['reserved', 'offer_sent', 'expired', 'declined'], true)) { + continue; + } + foreach ($guests as $guestKey => $guestData) { + foreach ($times as $timeKey => [$arrival, $departure]) { + $shift = $index++ * 10; + $profile = app(ProcessSettings::class)->resolve($this->property, $channel, IntakeKind::from($intake)); + $booking = Booking::factory()->for($this->property)->create([ + 'guest_id' => $guestData === null ? null : Guest::query()->create([...$guestData, 'email' => $guestData['email'] ? $index.$guestData['email'] : null, 'tenant_id' => $this->property->tenant_id])->id, + 'status' => $status, + 'intake' => $intake, + 'case_type' => $profile->caseType, + 'profile' => $profile->toArray(), + 'import_channel_id' => $channel?->id, + 'origin_channel_id' => $channel?->id, + 'source' => $channel === null ? 'website' : 'channel', + 'arrival' => CarbonImmutable::parse($arrival)->addDays($shift)->toDateString(), + 'departure' => CarbonImmutable::parse($departure)->addDays($shift)->toDateString(), + 'balance_due_on' => CarbonImmutable::parse($arrival)->addDays($shift - 28)->toDateString(), + 'total' => 80000, + 'deposit' => 20000, + 'hold_expires_at' => in_array($status, ['reserved', 'offer_sent'], true) ? now()->addHours(24) : null, + 'hold_purpose' => 'offer', + 'offer_version' => in_array($status, ['offer_sent', 'confirmed', 'deposit_paid', 'paid', 'completed', 'cancelled', 'declined'], true) && $intake === 'inquiry' ? 1 : 0, + 'confirmed_at' => in_array($status, ['confirmed', 'deposit_paid', 'paid', 'completed'], true) ? now() : null, + ]); + $snapshot = BehaviourSnapshot::of($booking); + $this->steps["{$channelKey}.{$status}.{$guestKey}.{$timeKey}"] = array_intersect_key($snapshot, array_flip(['activities', 'next', 'situation', 'automation', 'calendar'])); + } + } + } + } + + $this->assertBehaviour('state_matrix'); + } + + /** + * @param array $defaults + */ + private function automatic(array $defaults = []): void + { + Settings::tenant()->update(['process_defaults' => ['processing' => 'automatic', ...$defaults]]); + } + + /** + * @param array $address + */ + private function request(array $address, string $email = 'gesa@example.org'): Booking + { + return app(CreateReservation::class)->handle( + $this->property, + new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2), + ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => $email, ...$address], + ); + } + + /** + * @param array> $overrides + * @param array $settings + */ + private function channel(string $name, string $model, array $overrides = [], array $settings = []): Channel + { + return Channel::factory()->for($this->property)->create([ + 'name' => $name, + 'booking_model' => $model, + 'process_overrides' => $overrides, + 'settings' => ['import_url' => 'https://portal.example/'.md5($name).'.ics', ...$settings], + 'import_enabled' => false, + ]); + } + + /** The case-related schedulers in the order of routes/console.php. */ + private function schedulers(): void + { + foreach (['bookings:expire-holds', 'bookings:auto-offers', 'cases:data-requests'] as $command) { + $this->artisan($command)->assertSuccessful(); + } + app(SendBookingReminders::class)->handle(); + app(PrepareStays::class)->handle(); + app(RequestReviews::class)->handle(); + } + + private function capture(string $label, Booking $booking): void + { + $this->steps[$label] = BehaviourSnapshot::of($booking); + } + + private function assertBehaviour(string $flow): void + { + $path = base_path("tests/Fixtures/process/behaviour/{$flow}.json"); + $json = json_encode($this->steps, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)."\n"; + + if (env('PROCESS_BEHAVIOUR_RECORD')) { + @mkdir(dirname($path), 0777, true); + file_put_contents($path, $json); + $this->markTestIncomplete("Reference recorded: {$flow}"); + } + + $this->assertFileExists($path, 'No reference recorded for '.$flow); + $this->assertSame(json_decode((string) file_get_contents($path), true), json_decode($json, true), "Behaviour of {$flow} differs from the v0.11 reference."); + } +} diff --git a/tests/Feature/Process/OngoingCaseRegressionTest.php b/tests/Feature/Process/OngoingCaseRegressionTest.php new file mode 100644 index 0000000..107b964 --- /dev/null +++ b/tests/Feature/Process/OngoingCaseRegressionTest.php @@ -0,0 +1,264 @@ +travelTo(CarbonImmutable::parse('2026-10-23 18:00')); + $this->seed([PropertySeeder::class, SiteSeeder::class]); + $this->property = Property::sole(); + Storage::fake('local'); + Storage::fake('public'); + Content::save(['contract.terms' => '

Echte Bedingungen

', 'stay.cancellation' => '

Echtes Storno

']); + config(['mail.default' => 'array', 'fewo.spam.min_seconds' => 0]); + Mail::swap(new MailManager($this->app)); + Settings::tenant()->update(['bank_iban' => 'DE02120300000000202051', 'test_recipient' => 'test@example.org']); + Http::preventStrayRequests(); + Settings::tenant()->update(['process_defaults' => ['processing' => 'automatic', 'clarification_hold_auto_minutes' => 120, 'data_request_mode' => 'automatic']]); + } + + public function test_frozen_cases_keep_their_contract_values_activities_and_automation_decision(): void + { + $path = base_path('tests/Fixtures/process/ongoing/cases.json'); + + if (env('PROCESS_ONGOING_RECORD')) { + $this->record($path); + $this->markTestIncomplete('Ongoing cases recorded.'); + } + + $this->assertFileExists($path); + $cases = json_decode((string) file_get_contents($path), true); + $this->restore($cases); + $this->travelTo(CarbonImmutable::parse(self::NOW)); + + foreach ($cases as $label => $case) { + $booking = Booking::query()->findOrFail($case['id']); + $this->assertSame($case['expected'], $this->derive($booking), "Derived values of {$label} changed."); + + $before = $this->contract($booking); + app(CaseAutomation::class)->advance($booking->fresh()); + $this->assertSame($before, $this->contract($booking->fresh()), "Advancing {$label} changed its contract data."); + } + } + + private function record(string $path): void + { + $address = ['street' => 'Lindenallee 12', 'postal_code' => '10115', 'city' => 'Berlin', 'country' => 'DE']; + $cases = []; + + $cases['a1_clarification'] = $this->request('2026-11-07', '2026-11-10', 'klaer@example.org', []); + $cases['a1_offer_sent'] = $this->request('2026-11-14', '2026-11-17', 'angebot@example.org', $address); + + $confirmed = $this->request('2026-12-01', '2026-12-08', 'fest@example.org', $address); + app(AcceptOffer::class)->handle($confirmed->fresh(), $confirmed->fresh()->offer_version); + $cases['a1_confirmed_deposit_open'] = $confirmed; + + $paid = $this->request('2026-11-18', '2026-11-21', 'bezahlt@example.org', $address); + app(AcceptOffer::class)->handle($paid->fresh(), $paid->fresh()->offer_version); + app(RecordPayment::class)->handle($paid->fresh(), (int) $paid->fresh()->deposit, now()); + $cases['a1_deposit_paid'] = $paid; + + $cancelled = $this->request('2026-12-10', '2026-12-13', 'storno@example.org', $address); + app(AcceptOffer::class)->handle($cancelled->fresh(), $cancelled->fresh()->offer_version); + app(CancelBooking::class)->handle($cancelled->fresh(), reason: 'Gast verhindert'); + $cases['a1_cancelled'] = $cancelled; + + $past = $this->request('2026-10-26', '2026-10-30', 'vorbei@example.org', $address); + app(AcceptOffer::class)->handle($past->fresh(), $past->fresh()->offer_version); + $cases['a1_stay_over'] = $past; + + $fewo = $this->channel('FeWo-direkt', 'mixed', ['booking' => ['payments' => 'portal']]); + $inquiry = app(TakeOverPortalInquiry::class)->handle($fewo, CarbonImmutable::parse('2027-03-01'), CarbonImmutable::parse('2027-03-05'), 'HA-ANF'); + $cases['a2_inquiry'] = $inquiry; + + $ds = $this->channel('Destination Solutions', 'portal_booking'); + $a3 = app(TakeOverExternalBooking::class)->handle($this->property, $ds, CarbonImmutable::parse('2027-04-01'), CarbonImmutable::parse('2027-04-08'), ['portal_reference' => 'DS-1', 'portal_total' => 98000, 'guests' => 2]); + $cases['a3_booking'] = $a3; + + $a4 = app(TakeOverExternalBooking::class)->handle($this->property, $fewo, CarbonImmutable::parse('2027-07-10'), CarbonImmutable::parse('2027-07-17'), ['portal_reference' => 'HA-A4', 'portal_total' => 97951, 'guests' => 2]); + app(RecordPortalAmounts::class)->handle($a4->fresh(), null, [['kind' => 'payout_announced', 'amount' => 89469]], [['amount' => 39061, 'paid_on' => '2026-10-23']], 'FeWo-direkt'); + $cases['a4_portal_payments'] = $a4; + + $a5channel = $this->channel('Portal A5', 'portal_booking', ['booking' => ['payments' => 'portal', 'documents' => 'portal', 'guest_messages' => 'portal']]); + $cases['a5_booking'] = app(TakeOverExternalBooking::class)->handle($this->property, $a5channel, CarbonImmutable::parse('2027-05-01'), CarbonImmutable::parse('2027-05-04'), ['portal_reference' => 'P5-1', 'portal_total' => 60000]); + + $cases['a6_private'] = app(CreateInternalCase::class)->handle($this->property, InternalKind::PrivateStay, CarbonImmutable::parse('2027-06-01'), CarbonImmutable::parse('2027-06-04'), ['occasion' => 'Familie']); + + $migrated = $this->request('2026-11-24', '2026-11-27', 'alt@example.org', $address); + $migrated->forceFill(['profile' => [...(array) $migrated->fresh()->profile, 'origin' => 'migration']])->saveQuietly(); + $cases['legacy_migration_offer'] = $migrated; + + $this->travelTo(CarbonImmutable::parse(self::NOW)); + + $out = []; + foreach ($cases as $label => $booking) { + $booking = $booking->fresh(); + $out[$label] = ['id' => $booking->id, 'rows' => $this->rows($booking), 'expected' => $this->derive($booking)]; + } + + @mkdir(dirname($path), 0777, true); + file_put_contents($path, json_encode($out, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)."\n"); + } + + /** + * @return array>> + */ + private function rows(Booking $booking): array + { + $rows = []; + foreach (self::TABLES as $table) { + $query = DB::table($table); + $query = $table === 'bookings' ? $query->where('id', $booking->id) + : ($table === 'guests' ? $query->where('id', $booking->guest_id) : $query->where('booking_id', $booking->id)); + $rows[$table] = $query->orderBy('id')->get()->map(fn (object $row): array => (array) $row)->all(); + } + + return $rows; + } + + /** + * @param array>>}> $cases + */ + private function restore(array $cases): void + { + // Channels the cases point to, as they were configured when the cases were written. + $this->channel('FeWo-direkt', 'mixed', ['booking' => ['payments' => 'portal']]); + $this->channel('Destination Solutions', 'portal_booking'); + $this->channel('Portal A5', 'portal_booking', ['booking' => ['payments' => 'portal', 'documents' => 'portal', 'guest_messages' => 'portal']]); + + foreach (self::TABLES as $table) { + foreach ($cases as $case) { + foreach ($case['rows'][$table] as $row) { + if ($table === 'guests' && DB::table('guests')->where('id', $row['id'])->exists()) { + continue; + } + DB::table($table)->insert($row); + } + } + } + } + + /** + * Everything a release must derive identically from the frozen rows. + * + * @return array + */ + private function derive(Booking $booking): array + { + // As in a request of the landlord: the case's landlord is the current one (TenantConfig lays its data over config). + return app(TenantContext::class)->run($booking->property->tenant, fn (): array => $this->deriveInContext($booking)); + } + + /** + * @return array + */ + private function deriveInContext(Booking $booking): array + { + $booking = $booking->fresh(['guest', 'property', 'payments']); + $cost = fn (string $on): ?array => $booking->arrival === null ? null : CancellationCost::calculate($booking, CarbonImmutable::parse($on)); + [$view, $data] = app(RentalContract::class)->view($booking, DocumentKind::Confirmation, draft: true); + + return [ + 'cancellation' => [ + 'today' => $cost(self::NOW), + 'arrival_minus_40' => $cost($booking->arrival->subDays(40)->toDateString()), + 'arrival_minus_10' => $cost($booking->arrival->subDays(10)->toDateString()), + ], + 'rent' => CancellationCost::rent($booking), + 'deposit' => $booking->deposit, + 'balance' => $booking->total === null ? null : max(0, $booking->total - (int) $booking->deposit), + 'open_amount' => $booking->openAmount(), + 'due' => [$booking->deposit_due_on?->toDateString(), $booking->balance_due_on?->toDateString()], + 'contract_sha' => $booking->intake?->value === 'internal' || $booking->total === null ? null : sha1(view($view, $data)->render()), + 'case_type' => $booking->process()->caseType->value, + 'activities' => array_map(fn (Activity $activity): array => [$activity->key, $activity->state->value, $activity->detail, $activity->action], CaseActivities::for($booking)), + 'next' => CaseActivities::next($booking)?->key, + 'document_blockers' => app(CaseAutomation::class)->documentBlockers($booking), + ]; + } + + /** + * @return array + */ + private function contract(Booking $booking): array + { + return array_intersect_key($booking->getAttributes(), array_flip(self::CONTRACT_COLUMNS)); + } + + /** + * @param array $address + */ + private function request(string $arrival, string $departure, string $email, array $address): Booking + { + return app(CreateReservation::class)->handle($this->property, new StayRequest(CarbonImmutable::parse($arrival), CarbonImmutable::parse($departure), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => $email, ...$address]); + } + + /** + * @param array> $overrides + */ + private function channel(string $name, string $model, array $overrides = []): Channel + { + return Channel::query()->where('name', $name)->first() ?? Channel::factory()->for($this->property)->create([ + 'name' => $name, 'booking_model' => $model, 'process_overrides' => $overrides, + 'settings' => ['import_url' => 'https://portal.example/'.md5($name).'.ics'], 'import_enabled' => false, + ]); + } +} diff --git a/tests/Fixtures/process/behaviour/a1_complete.json b/tests/Fixtures/process/behaviour/a1_complete.json new file mode 100644 index 0000000..bb6e65c --- /dev/null +++ b/tests/Fixtures/process/behaviour/a1_complete.json @@ -0,0 +1,928 @@ +{ + "request": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot senden (automatisch)", + "state": "done", + "detail": "Version 1 vom 23.10.2026", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "waiting", + "detail": "Angebot gültig bis 25.10.2026, 17:00 Uhr", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "68,25 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Angebot liegt beim Gast bis 25.10., 17:00 Uhr", + "state": { + "status": "offer_sent", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "offer", + "hold_expires_at": "2026-10-25 17:00", + "offer_version": 1, + "information_version": 0, + "offer_sent_at": "2026-10-23 18:00", + "confirmed_at": null, + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": null, + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihr Angebot 2026-0001 – Ferienwohnung Stommer" + ], + [ + "test", + "Angebot automatisch versendet 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ] + ], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "facts", + "offer", + "document", + "mail", + "mail" + ] + }, + "accepted": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot senden (automatisch)", + "state": "done", + "detail": "Version 1 vom 23.10.2026", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "angenommen am 23.10.2026", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "done", + "detail": "gesendet am 23.10.2026", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "68,25 €, fällig 30.10.2026", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · fest gebucht · Anreise in 15 Tagen", + "state": { + "status": "confirmed", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 1, + "information_version": 0, + "offer_sent_at": "2026-10-23 18:00", + "confirmed_at": "2026-10-23 18:00", + "accepted_at": "2026-10-23 18:00", + "confirmation_sent_at": "2026-10-23 18:00", + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": "2026-10-30", + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": true, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihr Angebot 2026-0001 – Ferienwohnung Stommer" + ], + [ + "test", + "Angebot automatisch versendet 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ], + [ + "test", + "Buchungsbestätigung 2026-0001" + ], + [ + "test", + "Angebot angenommen: 2026-0001" + ] + ], + "mails": [ + [ + "Buchungsbestätigung 2026-0001", + "test@example.org" + ], + [ + "Angebot angenommen: 2026-0001", + "test@example.org" + ] + ] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "facts", + "offer", + "document", + "mail", + "mail", + "status", + "document", + "mail", + "fact", + "mail" + ] + }, + "deposit": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot senden (automatisch)", + "state": "done", + "detail": "Version 1 vom 23.10.2026", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "angenommen am 23.10.2026", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "done", + "detail": "gesendet am 23.10.2026", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "done", + "detail": "68,25 €, fällig 30.10.2026", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "waiting", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · fest gebucht, Anzahlung erhalten · Anreise in 15 Tagen", + "state": { + "status": "deposit_paid", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 1, + "information_version": 0, + "offer_sent_at": "2026-10-23 18:00", + "confirmed_at": "2026-10-23 18:00", + "accepted_at": "2026-10-23 18:00", + "confirmation_sent_at": "2026-10-23 18:00", + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": "2026-10-30", + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": true, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihr Angebot 2026-0001 – Ferienwohnung Stommer" + ], + [ + "test", + "Angebot automatisch versendet 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ], + [ + "test", + "Buchungsbestätigung 2026-0001" + ], + [ + "test", + "Angebot angenommen: 2026-0001" + ] + ], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "facts", + "offer", + "document", + "mail", + "mail", + "status", + "document", + "mail", + "fact", + "mail", + "payment", + "status" + ] + }, + "before_arrival": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot senden (automatisch)", + "state": "done", + "detail": "Version 1 vom 23.10.2026", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "angenommen am 23.10.2026", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "done", + "detail": "gesendet am 23.10.2026", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "done", + "detail": "68,25 €, fällig 30.10.2026", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "waiting", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "task_balance_reminder", + "label": "Restzahlung überfällig – anmahnen", + "state": "open", + "detail": "fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "done", + "detail": "gesendet am 05.11.2026", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "task_balance_reminder", + "situation": "Anfrage über die Webseite · fest gebucht, Anzahlung erhalten · Anreise in 2 Tagen", + "state": { + "status": "deposit_paid", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 1, + "information_version": 0, + "offer_sent_at": "2026-10-23 18:00", + "confirmed_at": "2026-10-23 18:00", + "accepted_at": "2026-10-23 18:00", + "confirmation_sent_at": "2026-10-23 18:00", + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": "2026-10-30", + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": true, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihr Angebot 2026-0001 – Ferienwohnung Stommer" + ], + [ + "test", + "Angebot automatisch versendet 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ], + [ + "test", + "Buchungsbestätigung 2026-0001" + ], + [ + "test", + "Angebot angenommen: 2026-0001" + ], + [ + "test", + "Bald geht es los: Ihre Anreise am 07.11.2026" + ] + ], + "mails": [] + }, + "tasks": [ + [ + "balance_reminder", + "open" + ] + ], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "facts", + "offer", + "document", + "mail", + "mail", + "status", + "document", + "mail", + "fact", + "mail", + "payment", + "status", + "task", + "mail", + "fact" + ] + }, + "after_departure": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot senden (automatisch)", + "state": "done", + "detail": "Version 1 vom 23.10.2026", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "angenommen am 23.10.2026", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "done", + "detail": "gesendet am 23.10.2026", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "done", + "detail": "68,25 €, fällig 30.10.2026", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "task_balance_reminder", + "label": "Restzahlung überfällig – anmahnen", + "state": "open", + "detail": "fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "done", + "detail": "gesendet am 05.11.2026", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "done", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "done", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 13.11.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 234,75 €. Aufgabe offen: Restzahlung überfällig – anmahnen.", + "action": "settle" + } + ], + "next": "task_balance_reminder", + "situation": "Anfrage über die Webseite · Aufenthalt abgeschlossen, kaufmännisch noch offen · abgereist am 10.11.2026", + "state": { + "status": "completed", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 1, + "information_version": 0, + "offer_sent_at": "2026-10-23 18:00", + "confirmed_at": "2026-10-23 18:00", + "accepted_at": "2026-10-23 18:00", + "confirmation_sent_at": "2026-10-23 18:00", + "wish_at": null, + "completed_at": "2026-11-13 09:00", + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": "2026-10-30", + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": true, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihr Angebot 2026-0001 – Ferienwohnung Stommer" + ], + [ + "test", + "Angebot automatisch versendet 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ], + [ + "test", + "Buchungsbestätigung 2026-0001" + ], + [ + "test", + "Angebot angenommen: 2026-0001" + ], + [ + "test", + "Bald geht es los: Ihre Anreise am 07.11.2026" + ], + [ + "test", + "Wie war Ihr Aufenthalt in Kühlungsborn?" + ] + ], + "mails": [] + }, + "tasks": [ + [ + "balance_reminder", + "open" + ] + ], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "facts", + "offer", + "document", + "mail", + "mail", + "status", + "document", + "mail", + "fact", + "mail", + "payment", + "status", + "task", + "mail", + "fact", + "status", + "mail", + "fact" + ] + } +} diff --git a/tests/Fixtures/process/behaviour/a1_dates_taken.json b/tests/Fixtures/process/behaviour/a1_dates_taken.json new file mode 100644 index 0000000..ef300e0 --- /dev/null +++ b/tests/Fixtures/process/behaviour/a1_dates_taken.json @@ -0,0 +1,468 @@ +{ + "clarification_expired": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Angaben für das Angebot vervollständigen", + "state": "waiting", + "detail": "fehlt: Straße und Hausnummer, PLZ, Ort, Land · beim Gast angefragt", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot senden (automatisch)", + "state": "later", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "68,25 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Zeitraum nicht reserviert", + "state": { + "status": "reserved", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "clarification", + "hold_expires_at": "2026-10-23 18:30", + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": null, + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": [ + "Für ein verbindliches Angebot fehlen noch Angaben: Straße und Hausnummer, PLZ, Ort, Land." + ], + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "expired" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": null, + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihre Anfrage 2026-0001: Bitte ergänzen Sie Ihre Angaben" + ], + [ + "test", + "Neue Anfrage 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ] + ], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [ + [ + "open", + 0, + [ + "guest.street", + "guest.postal_code", + "guest.city", + "guest.country" + ] + ] + ], + "events": [ + "created", + "facts", + "data_request", + "mail", + "data_request", + "mail" + ] + }, + "other_offer": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot senden (automatisch)", + "state": "done", + "detail": "Version 1 vom 23.10.2026", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "waiting", + "detail": "Angebot gültig bis 25.10.2026, 18:00 Uhr", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "68,25 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Angebot liegt beim Gast bis 25.10., 18:00 Uhr", + "state": { + "status": "offer_sent", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "offer", + "hold_expires_at": "2026-10-25 18:00", + "offer_version": 1, + "information_version": 0, + "offer_sent_at": "2026-10-23 19:00", + "confirmed_at": null, + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": null, + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihr Angebot 2026-0002 – Ferienwohnung Stommer" + ], + [ + "test", + "Angebot automatisch versendet 2026-0002: Gesa Gast, 07.11.–10.11.2026" + ] + ], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "facts", + "offer", + "document", + "mail", + "mail" + ] + }, + "answer_dates_taken": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot senden (automatisch)", + "state": "open", + "detail": "Zeitraum reserviert bis 23.10.2026, 18:30 Uhr", + "action": "sendOffer" + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "68,25 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "offer", + "situation": "Anfrage über die Webseite · Zeitraum nicht reserviert", + "state": { + "status": "reserved", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "clarification", + "hold_expires_at": "2026-10-23 18:30", + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": null, + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": [ + "Der Zeitraum ist inzwischen belegt." + ], + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "expired" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": null, + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihre Anfrage 2026-0001: Bitte ergänzen Sie Ihre Angaben" + ], + [ + "test", + "Neue Anfrage 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ] + ], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [ + [ + "completed", + 0, + [ + "guest.street", + "guest.postal_code", + "guest.city", + "guest.country" + ] + ] + ], + "events": [ + "created", + "facts", + "data_request", + "mail", + "data_request", + "mail", + "facts", + "data_request" + ] + } +} diff --git a/tests/Fixtures/process/behaviour/a1_information.json b/tests/Fixtures/process/behaviour/a1_information.json new file mode 100644 index 0000000..f399331 --- /dev/null +++ b/tests/Fixtures/process/behaviour/a1_information.json @@ -0,0 +1,555 @@ +{ + "information": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "information", + "label": "Unverbindliche Auskunft senden (automatisch)", + "state": "done", + "detail": "Version 1 vom 23.10.2026 · ohne Reservierung", + "action": null + }, + { + "key": "wish", + "label": "Gast fragt die Buchung an", + "state": "waiting", + "detail": "möglich bis 25.10.2026, 17:00 Uhr", + "action": null + }, + { + "key": "wish_check", + "label": "Erneut prüfen und verbindlich bestätigen", + "state": "later", + "detail": "automatisch, wenn alles passt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "68,25 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · unverbindliche Auskunft gesendet, Zeitraum nicht reserviert", + "state": { + "status": "reserved", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 1, + "offer_sent_at": null, + "confirmed_at": null, + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": [ + "Die Anfrage ist bereits beantwortet oder nicht mehr offen." + ], + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": null, + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Unverbindliche Auskunft zu Ihrer Anfrage 2026-0001" + ], + [ + "test", + "Angebot automatisch versendet 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ] + ], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "facts", + "information", + "document", + "mail", + "mail" + ] + }, + "wish": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "information", + "label": "Unverbindliche Auskunft senden (automatisch)", + "state": "done", + "detail": "Version 1 vom 23.10.2026 · ohne Reservierung", + "action": null + }, + { + "key": "wish", + "label": "Gast fragt die Buchung an", + "state": "done", + "detail": "angefragt am 23.10.2026, 18:00 Uhr", + "action": null + }, + { + "key": "wish_check", + "label": "Erneut prüfen und verbindlich bestätigen", + "state": "done", + "detail": "bestätigt am 23.10.2026 (automatisch nach erneuter Prüfung)", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "done", + "detail": "gesendet am 23.10.2026", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "68,25 €, fällig 30.10.2026", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · fest gebucht · Anreise in 15 Tagen", + "state": { + "status": "confirmed", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 1, + "offer_sent_at": null, + "confirmed_at": "2026-10-23 18:00", + "accepted_at": "2026-10-23 18:00", + "confirmation_sent_at": "2026-10-23 18:00", + "wish_at": "2026-10-23 18:00", + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": "2026-10-30", + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": true, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Unverbindliche Auskunft zu Ihrer Anfrage 2026-0001" + ], + [ + "test", + "Angebot automatisch versendet 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ], + [ + "test", + "Buchungsbestätigung 2026-0001" + ], + [ + "test", + "Buchungswunsch automatisch bestätigt 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ] + ], + "mails": [ + [ + "Buchungsbestätigung 2026-0001", + "test@example.org" + ], + [ + "Buchungswunsch automatisch bestätigt 2026-0001: Gesa Gast, 07.11.–10.11.2026", + "test@example.org" + ] + ] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "facts", + "information", + "document", + "mail", + "mail", + "status", + "wish", + "document", + "mail", + "fact", + "mail" + ] + }, + "after_schedulers": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "information", + "label": "Unverbindliche Auskunft senden (automatisch)", + "state": "done", + "detail": "Version 1 vom 23.10.2026 · ohne Reservierung", + "action": null + }, + { + "key": "wish", + "label": "Gast fragt die Buchung an", + "state": "done", + "detail": "angefragt am 23.10.2026, 18:00 Uhr", + "action": null + }, + { + "key": "wish_check", + "label": "Erneut prüfen und verbindlich bestätigen", + "state": "done", + "detail": "bestätigt am 23.10.2026 (automatisch nach erneuter Prüfung)", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "done", + "detail": "gesendet am 23.10.2026", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "68,25 €, fällig 30.10.2026", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "task_balance_reminder", + "label": "Restzahlung überfällig – anmahnen", + "state": "open", + "detail": "fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "task_balance_reminder", + "situation": "Anfrage über die Webseite · fest gebucht · Anreise in 15 Tagen", + "state": { + "status": "confirmed", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 1, + "offer_sent_at": null, + "confirmed_at": "2026-10-23 18:00", + "accepted_at": "2026-10-23 18:00", + "confirmation_sent_at": "2026-10-23 18:00", + "wish_at": "2026-10-23 18:00", + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": "2026-10-30", + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": true, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Unverbindliche Auskunft zu Ihrer Anfrage 2026-0001" + ], + [ + "test", + "Angebot automatisch versendet 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ], + [ + "test", + "Buchungsbestätigung 2026-0001" + ], + [ + "test", + "Buchungswunsch automatisch bestätigt 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ] + ], + "mails": [] + }, + "tasks": [ + [ + "balance_reminder", + "open" + ] + ], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "facts", + "information", + "document", + "mail", + "mail", + "status", + "wish", + "document", + "mail", + "fact", + "mail", + "task" + ] + } +} diff --git a/tests/Fixtures/process/behaviour/a1_manual_reject.json b/tests/Fixtures/process/behaviour/a1_manual_reject.json new file mode 100644 index 0000000..7fd2b10 --- /dev/null +++ b/tests/Fixtures/process/behaviour/a1_manual_reject.json @@ -0,0 +1,634 @@ +{ + "request": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "open", + "detail": "Zeitraum reserviert bis 25.10.2026, 17:00 Uhr", + "action": "sendOffer" + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "68,25 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "offer", + "situation": "Anfrage über die Webseite · Zeitraum reserviert bis 25.10., 17:00 Uhr", + "state": { + "status": "reserved", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "offer", + "hold_expires_at": "2026-10-25 17:00", + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": null, + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": [], + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": null, + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihre Anfrage 2026-0001 – Termin vorgemerkt, Angebot folgt" + ], + [ + "test", + "Neue Anfrage 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ] + ], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "facts", + "mail", + "mail" + ] + }, + "offer": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom 23.10.2026", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "waiting", + "detail": "Angebot gültig bis 25.10.2026, 17:00 Uhr", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "68,25 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Angebot liegt beim Gast bis 25.10., 17:00 Uhr", + "state": { + "status": "offer_sent", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "offer", + "hold_expires_at": "2026-10-25 17:00", + "offer_version": 1, + "information_version": 0, + "offer_sent_at": "2026-10-23 18:00", + "confirmed_at": null, + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": null, + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihre Anfrage 2026-0001 – Termin vorgemerkt, Angebot folgt" + ], + [ + "test", + "Neue Anfrage 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ], + [ + "test", + "Ihr Angebot 2026-0001 – Ferienwohnung Stommer" + ] + ], + "mails": [ + [ + "Ihr Angebot 2026-0001 – Ferienwohnung Stommer", + "test@example.org" + ] + ] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "facts", + "mail", + "mail", + "offer", + "document", + "mail" + ] + }, + "offer_version_2": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 2 vom 23.10.2026", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "waiting", + "detail": "Angebot gültig bis 25.10.2026, 17:00 Uhr", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "68,25 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Angebot liegt beim Gast bis 25.10., 17:00 Uhr", + "state": { + "status": "offer_sent", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "offer", + "hold_expires_at": "2026-10-25 17:00", + "offer_version": 2, + "information_version": 0, + "offer_sent_at": "2026-10-23 18:00", + "confirmed_at": null, + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": null, + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihre Anfrage 2026-0001 – Termin vorgemerkt, Angebot folgt" + ], + [ + "test", + "Neue Anfrage 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ], + [ + "test", + "Ihr Angebot 2026-0001 – Ferienwohnung Stommer" + ], + [ + "test", + "Ihr Angebot 2026-0001 – Ferienwohnung Stommer" + ] + ], + "mails": [ + [ + "Ihr Angebot 2026-0001 – Ferienwohnung Stommer", + "test@example.org" + ] + ] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "facts", + "mail", + "mail", + "offer", + "document", + "mail", + "offer", + "document", + "mail" + ] + }, + "rejected": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 2 vom 23.10.2026", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "68,25 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · ohne Buchung beendet", + "state": { + "status": "declined", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 2, + "information_version": 0, + "offer_sent_at": "2026-10-23 18:00", + "confirmed_at": null, + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": null, + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihre Anfrage 2026-0001 – Termin vorgemerkt, Angebot folgt" + ], + [ + "test", + "Neue Anfrage 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ], + [ + "test", + "Ihr Angebot 2026-0001 – Ferienwohnung Stommer" + ], + [ + "test", + "Ihr Angebot 2026-0001 – Ferienwohnung Stommer" + ], + [ + "test", + "Angebot abgelehnt: 2026-0001" + ] + ], + "mails": [ + [ + "Angebot abgelehnt: 2026-0001", + "test@example.org" + ] + ] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "facts", + "mail", + "mail", + "offer", + "document", + "mail", + "offer", + "document", + "mail", + "status", + "mail" + ] + } +} diff --git a/tests/Fixtures/process/behaviour/a1_missing_address.json b/tests/Fixtures/process/behaviour/a1_missing_address.json new file mode 100644 index 0000000..5e388b4 --- /dev/null +++ b/tests/Fixtures/process/behaviour/a1_missing_address.json @@ -0,0 +1,1012 @@ +{ + "request": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Angaben für das Angebot vervollständigen", + "state": "waiting", + "detail": "fehlt: Straße und Hausnummer, PLZ, Ort, Land · beim Gast angefragt", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot senden (automatisch)", + "state": "later", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "68,25 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Zeitraum reserviert bis 23.10., 20:00 Uhr", + "state": { + "status": "reserved", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "clarification", + "hold_expires_at": "2026-10-23 20:00", + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": null, + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": [ + "Für ein verbindliches Angebot fehlen noch Angaben: Straße und Hausnummer, PLZ, Ort, Land." + ], + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "active" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": null, + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihre Anfrage 2026-0001: Bitte ergänzen Sie Ihre Angaben" + ], + [ + "test", + "Neue Anfrage 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ] + ], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [ + [ + "open", + 0, + [ + "guest.street", + "guest.postal_code", + "guest.city", + "guest.country" + ] + ] + ], + "events": [ + "created", + "facts", + "data_request", + "mail", + "data_request", + "mail" + ] + }, + "clarification_expired": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Angaben für das Angebot vervollständigen", + "state": "waiting", + "detail": "fehlt: Straße und Hausnummer, PLZ, Ort, Land · beim Gast angefragt", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot senden (automatisch)", + "state": "later", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "68,25 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Zeitraum nicht reserviert", + "state": { + "status": "reserved", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "clarification", + "hold_expires_at": "2026-10-23 20:00", + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": null, + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": [ + "Für ein verbindliches Angebot fehlen noch Angaben: Straße und Hausnummer, PLZ, Ort, Land." + ], + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "expired" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": null, + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihre Anfrage 2026-0001: Bitte ergänzen Sie Ihre Angaben" + ], + [ + "test", + "Neue Anfrage 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ] + ], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [ + [ + "open", + 0, + [ + "guest.street", + "guest.postal_code", + "guest.city", + "guest.country" + ] + ] + ], + "events": [ + "created", + "facts", + "data_request", + "mail", + "data_request", + "mail" + ] + }, + "first_reminder": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Angaben für das Angebot vervollständigen", + "state": "waiting", + "detail": "fehlt: Straße und Hausnummer, PLZ, Ort, Land · beim Gast angefragt", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot senden (automatisch)", + "state": "later", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "68,25 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Zeitraum nicht reserviert", + "state": { + "status": "reserved", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "clarification", + "hold_expires_at": "2026-10-23 20:00", + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": null, + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": [ + "Für ein verbindliches Angebot fehlen noch Angaben: Straße und Hausnummer, PLZ, Ort, Land." + ], + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "expired" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": null, + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihre Anfrage 2026-0001: Bitte ergänzen Sie Ihre Angaben" + ], + [ + "test", + "Neue Anfrage 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ], + [ + "test", + "Erinnerung – Ihre Anfrage 2026-0001: Es fehlen noch Angaben" + ] + ], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [ + [ + "open", + 1, + [ + "guest.street", + "guest.postal_code", + "guest.city", + "guest.country" + ] + ] + ], + "events": [ + "created", + "facts", + "data_request", + "mail", + "data_request", + "mail", + "mail", + "data_request" + ] + }, + "answer": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot senden (automatisch)", + "state": "done", + "detail": "Version 1 vom 24.10.2026", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "waiting", + "detail": "Angebot gültig bis 26.10.2026, 18:05 Uhr", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "68,25 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Angebot liegt beim Gast bis 26.10., 18:05 Uhr", + "state": { + "status": "offer_sent", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "offer", + "hold_expires_at": "2026-10-26 18:05", + "offer_version": 1, + "information_version": 0, + "offer_sent_at": "2026-10-24 19:05", + "confirmed_at": null, + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": null, + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihre Anfrage 2026-0001: Bitte ergänzen Sie Ihre Angaben" + ], + [ + "test", + "Neue Anfrage 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ], + [ + "test", + "Erinnerung – Ihre Anfrage 2026-0001: Es fehlen noch Angaben" + ], + [ + "test", + "Ihr Angebot 2026-0001 – Ferienwohnung Stommer" + ] + ], + "mails": [ + [ + "Ihr Angebot 2026-0001 – Ferienwohnung Stommer", + "test@example.org" + ] + ] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [ + [ + "completed", + 1, + [ + "guest.street", + "guest.postal_code", + "guest.city", + "guest.country" + ] + ] + ], + "events": [ + "created", + "facts", + "data_request", + "mail", + "data_request", + "mail", + "mail", + "data_request", + "facts", + "data_request", + "offer", + "document", + "mail" + ] + }, + "answer_repeated": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot senden (automatisch)", + "state": "done", + "detail": "Version 1 vom 24.10.2026", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "waiting", + "detail": "Angebot gültig bis 26.10.2026, 18:05 Uhr", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "68,25 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Angebot liegt beim Gast bis 26.10., 18:05 Uhr", + "state": { + "status": "offer_sent", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "offer", + "hold_expires_at": "2026-10-26 18:05", + "offer_version": 1, + "information_version": 0, + "offer_sent_at": "2026-10-24 19:05", + "confirmed_at": null, + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": null, + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihre Anfrage 2026-0001: Bitte ergänzen Sie Ihre Angaben" + ], + [ + "test", + "Neue Anfrage 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ], + [ + "test", + "Erinnerung – Ihre Anfrage 2026-0001: Es fehlen noch Angaben" + ], + [ + "test", + "Ihr Angebot 2026-0001 – Ferienwohnung Stommer" + ] + ], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [ + [ + "completed", + 1, + [ + "guest.street", + "guest.postal_code", + "guest.city", + "guest.country" + ] + ] + ], + "events": [ + "created", + "facts", + "data_request", + "mail", + "data_request", + "mail", + "mail", + "data_request", + "facts", + "data_request", + "offer", + "document", + "mail" + ] + }, + "offer_expired": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot senden (automatisch)", + "state": "done", + "detail": "Version 1 vom 24.10.2026", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "68,25 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "234,75 €, fällig 10.10.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Frist abgelaufen, ohne Buchung beendet", + "state": { + "status": "expired", + "intake": "inquiry", + "case_type": "a1", + "hold_purpose": "offer", + "hold_expires_at": "2026-10-26 18:05", + "offer_version": 1, + "information_version": 0, + "offer_sent_at": "2026-10-24 19:05", + "confirmed_at": null, + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": 30300, + "deposit": 6825, + "lines": [ + [ + "accommodation", + 19500 + ], + [ + "cleaning", + 10800 + ] + ], + "deposit_due_on": null, + "balance_due_on": "2026-10-10" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihre Anfrage 2026-0001: Bitte ergänzen Sie Ihre Angaben" + ], + [ + "test", + "Neue Anfrage 2026-0001: Gesa Gast, 07.11.–10.11.2026" + ], + [ + "test", + "Erinnerung – Ihre Anfrage 2026-0001: Es fehlen noch Angaben" + ], + [ + "test", + "Ihr Angebot 2026-0001 – Ferienwohnung Stommer" + ], + [ + "test", + "Vormerkung abgelaufen: 2026-0001 (Gesa Gast)" + ] + ], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [ + [ + "completed", + 1, + [ + "guest.street", + "guest.postal_code", + "guest.city", + "guest.country" + ] + ] + ], + "events": [ + "created", + "facts", + "data_request", + "mail", + "data_request", + "mail", + "mail", + "data_request", + "facts", + "data_request", + "offer", + "document", + "mail", + "status", + "mail" + ] + } +} diff --git a/tests/Fixtures/process/behaviour/a2_inquiry.json b/tests/Fixtures/process/behaviour/a2_inquiry.json new file mode 100644 index 0000000..008c715 --- /dev/null +++ b/tests/Fixtures/process/behaviour/a2_inquiry.json @@ -0,0 +1,414 @@ +{ + "inquiry": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · FeWo-direkt", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot senden (automatisch)", + "state": "later", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlungen überwachen", + "state": "waiting", + "detail": "erst möglich, wenn der Preis bekannt ist", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "14.11.2026 – 18.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über FeWo-direkt · Zeitraum nicht reserviert", + "state": { + "status": "reserved", + "intake": "inquiry", + "case_type": "a2", + "hold_purpose": "clarification", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": null, + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": [ + "Die E-Mail-Adresse des Gastes fehlt.", + "FeWo-direkt (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen." + ], + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen.", + "Der Gesamtpreis (laut Portal) fehlt." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": null, + "deposit": null, + "lines": [], + "deposit_due_on": null, + "balance_due_on": null + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created" + ] + }, + "contact": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · FeWo-direkt", + "action": null + }, + { + "key": "contact", + "label": "Angaben für das Angebot vervollständigen", + "state": "waiting", + "detail": "fehlt: Straße und Hausnummer, PLZ, Ort, Land · beim Gast angefragt", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot senden (automatisch)", + "state": "later", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlungen überwachen", + "state": "waiting", + "detail": "erst möglich, wenn der Preis bekannt ist", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "14.11.2026 – 18.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über FeWo-direkt · Zeitraum nicht reserviert", + "state": { + "status": "reserved", + "intake": "inquiry", + "case_type": "a2", + "hold_purpose": "clarification", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": null, + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": [ + "Für ein verbindliches Angebot fehlen noch Angaben: Straße und Hausnummer, PLZ, Ort, Land.", + "FeWo-direkt (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen." + ], + "document_blockers": [ + "Der Gesamtpreis (laut Portal) fehlt." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": null, + "deposit": null, + "lines": [], + "deposit_due_on": null, + "balance_due_on": null + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihre Anfrage 2026-0001: Bitte ergänzen Sie Ihre Angaben" + ] + ], + "mails": [ + [ + "Ihre Anfrage 2026-0001: Bitte ergänzen Sie Ihre Angaben", + "test@example.org" + ] + ] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [ + [ + "open", + 0, + [ + "guest.street", + "guest.postal_code", + "guest.city", + "guest.country" + ] + ] + ], + "events": [ + "created", + "guest", + "facts", + "data_request", + "mail", + "data_request" + ] + }, + "address": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · FeWo-direkt", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot senden (automatisch)", + "state": "open", + "detail": null, + "action": "sendOffer" + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlungen überwachen", + "state": "waiting", + "detail": "erst möglich, wenn der Preis bekannt ist", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "14.11.2026 – 18.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "offer", + "situation": "Anfrage über FeWo-direkt · Zeitraum nicht reserviert", + "state": { + "status": "reserved", + "intake": "inquiry", + "case_type": "a2", + "hold_purpose": "clarification", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": null, + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": [ + "FeWo-direkt (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen." + ], + "document_blockers": [ + "Der Gesamtpreis (laut Portal) fehlt." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": null, + "deposit": null, + "lines": [], + "deposit_due_on": null, + "balance_due_on": null + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [ + [ + "test", + "Ihre Anfrage 2026-0001: Bitte ergänzen Sie Ihre Angaben" + ] + ], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [ + [ + "completed", + 0, + [ + "guest.street", + "guest.postal_code", + "guest.city", + "guest.country" + ] + ] + ], + "events": [ + "created", + "guest", + "facts", + "data_request", + "mail", + "data_request", + "facts", + "data_request" + ] + } +} diff --git a/tests/Fixtures/process/behaviour/a3_booking.json b/tests/Fixtures/process/behaviour/a3_booking.json new file mode 100644 index 0000000..c21b1f9 --- /dev/null +++ b/tests/Fixtures/process/behaviour/a3_booking.json @@ -0,0 +1,648 @@ +{ + "booking": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Destination Solutions", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": "Buchungsnummer DS-1", + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "open", + "detail": "noch nicht bekannt", + "action": "portalPrice" + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen. Der Gesamtpreis (laut Portal) fehlt.", + "action": null + }, + { + "key": "payment", + "label": "Zahlungen überwachen", + "state": "waiting", + "detail": "erst möglich, wenn der Preis bekannt ist", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "05.12.2026 – 12.12.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Gebucht über Destination Solutions · fest gebucht · Anreise in 43 Tagen", + "state": { + "status": "confirmed", + "intake": "booking", + "case_type": "a3", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": "2026-10-23 18:00", + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen.", + "Der Gesamtpreis (laut Portal) fehlt." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": null, + "deposit": null, + "lines": [], + "deposit_due_on": "2026-10-30", + "balance_due_on": null + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "status" + ] + }, + "guest": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Destination Solutions", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Dora Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": "Buchungsnummer DS-1", + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "open", + "detail": "noch nicht bekannt", + "action": "portalPrice" + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Der Gesamtpreis (laut Portal) fehlt.", + "action": null + }, + { + "key": "payment", + "label": "Zahlungen überwachen", + "state": "waiting", + "detail": "erst möglich, wenn der Preis bekannt ist", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "dora@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "data_request", + "label": "Fehlende Angaben beim Gast anfragen", + "state": "open", + "detail": "Straße und Hausnummer, PLZ, Ort, Land · Rückfrage vorbereitet – wartet auf Ihre Freigabe", + "action": "approveDataRequest" + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "05.12.2026 – 12.12.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "price", + "situation": "Gebucht über Destination Solutions · fest gebucht · Anreise in 43 Tagen", + "state": { + "status": "confirmed", + "intake": "booking", + "case_type": "a3", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": "2026-10-23 18:00", + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Der Gesamtpreis (laut Portal) fehlt." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": null, + "deposit": null, + "lines": [], + "deposit_due_on": "2026-10-30", + "balance_due_on": null + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [ + [ + "draft", + 0, + [ + "guest.street", + "guest.postal_code", + "guest.city", + "guest.country" + ] + ] + ], + "events": [ + "created", + "status", + "guest", + "facts", + "data_request" + ] + }, + "price": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Destination Solutions", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Dora Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": "Buchungsnummer DS-1", + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "980,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Destination Solutions ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Destination Solutions nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "343,00 €, fällig 30.10.2026", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "637,00 €, fällig 07.11.2026", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "dora@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "data_request", + "label": "Fehlende Angaben beim Gast anfragen", + "state": "open", + "detail": "Straße und Hausnummer, PLZ, Ort, Land · Rückfrage vorbereitet – wartet auf Ihre Freigabe", + "action": "approveDataRequest" + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "05.12.2026 – 12.12.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Destination Solutions · fest gebucht · Anreise in 43 Tagen", + "state": { + "status": "confirmed", + "intake": "booking", + "case_type": "a3", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": "2026-10-23 18:00", + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": 98000, + "deposit": 34300, + "lines": [ + [ + "accommodation", + 98000 + ] + ], + "deposit_due_on": "2026-10-30", + "balance_due_on": "2026-11-07" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [ + [ + "draft", + 0, + [ + "guest.street", + "guest.postal_code", + "guest.city", + "guest.country" + ] + ] + ], + "events": [ + "created", + "status", + "guest", + "facts", + "data_request", + "price" + ] + }, + "price_repeated": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Destination Solutions", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Dora Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": "Buchungsnummer DS-1", + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "980,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Destination Solutions ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Destination Solutions nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "343,00 €, fällig 30.10.2026", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "637,00 €, fällig 07.11.2026", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "dora@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "data_request", + "label": "Fehlende Angaben beim Gast anfragen", + "state": "open", + "detail": "Straße und Hausnummer, PLZ, Ort, Land · Rückfrage vorbereitet – wartet auf Ihre Freigabe", + "action": "approveDataRequest" + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "05.12.2026 – 12.12.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Destination Solutions · fest gebucht · Anreise in 43 Tagen", + "state": { + "status": "confirmed", + "intake": "booking", + "case_type": "a3", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": "2026-10-23 18:00", + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": 98000, + "deposit": 34300, + "lines": [ + [ + "accommodation", + 98000 + ] + ], + "deposit_due_on": "2026-10-30", + "balance_due_on": "2026-11-07" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [ + [ + "draft", + 0, + [ + "guest.street", + "guest.postal_code", + "guest.city", + "guest.country" + ] + ] + ], + "events": [ + "created", + "status", + "guest", + "facts", + "data_request", + "price" + ] + } +} diff --git a/tests/Fixtures/process/behaviour/a4_booking.json b/tests/Fixtures/process/behaviour/a4_booking.json new file mode 100644 index 0000000..9e56e5c --- /dev/null +++ b/tests/Fixtures/process/behaviour/a4_booking.json @@ -0,0 +1,671 @@ +{ + "booking": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · FeWo-direkt", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": "Buchungsnummer HA-A4", + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "979,51 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an FeWo-direkt", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von FeWo-direkt auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "10.07.2027 – 17.07.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Gebucht über FeWo-direkt · fest gebucht · Anreise in 260 Tagen", + "state": { + "status": "confirmed", + "intake": "booking", + "case_type": "a4", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": "2026-10-23 18:00", + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": 97951, + "deposit": 34283, + "lines": [ + [ + "accommodation", + 97951 + ] + ], + "deposit_due_on": "2026-10-30", + "balance_due_on": "2027-06-12" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "status" + ] + }, + "guest": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · FeWo-direkt", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Fiete Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": "Buchungsnummer HA-A4", + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "979,51 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über FeWo-direkt ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei FeWo-direkt nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an FeWo-direkt", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von FeWo-direkt auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "fiete@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "data_request", + "label": "Fehlende Angaben beim Gast anfragen", + "state": "open", + "detail": "Straße und Hausnummer, PLZ, Ort, Land · Rückfrage vorbereitet – wartet auf Ihre Freigabe", + "action": "approveDataRequest" + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "10.07.2027 – 17.07.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über FeWo-direkt · fest gebucht · Anreise in 260 Tagen", + "state": { + "status": "confirmed", + "intake": "booking", + "case_type": "a4", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": "2026-10-23 18:00", + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": 97951, + "deposit": 34283, + "lines": [ + [ + "accommodation", + 97951 + ] + ], + "deposit_due_on": "2026-10-30", + "balance_due_on": "2027-06-12" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [ + [ + "draft", + 0, + [ + "guest.street", + "guest.postal_code", + "guest.city", + "guest.country" + ] + ] + ], + "events": [ + "created", + "status", + "guest", + "facts", + "data_request" + ] + }, + "portal_amounts": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · FeWo-direkt", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Fiete Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": "Buchungsnummer HA-A4", + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "979,51 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über FeWo-direkt ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei FeWo-direkt nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an FeWo-direkt", + "state": "external", + "detail": "laut Portal bezahlt: 390,61 € von 979,51 € (Angabe des Portals, kein Geld bei uns)", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von FeWo-direkt auf unser Konto", + "state": "waiting", + "detail": "angekündigt 894,69 € · eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "fiete@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "data_request", + "label": "Fehlende Angaben beim Gast anfragen", + "state": "open", + "detail": "Straße und Hausnummer, PLZ, Ort, Land · Rückfrage vorbereitet – wartet auf Ihre Freigabe", + "action": "approveDataRequest" + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "10.07.2027 – 17.07.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über FeWo-direkt · fest gebucht · Anreise in 260 Tagen", + "state": { + "status": "confirmed", + "intake": "booking", + "case_type": "a4", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": "2026-10-23 18:00", + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": 97951, + "deposit": 34283, + "lines": [ + [ + "accommodation", + 97951 + ] + ], + "deposit_due_on": "2026-10-30", + "balance_due_on": "2027-06-12" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [ + [ + "draft", + 0, + [ + "guest.street", + "guest.postal_code", + "guest.city", + "guest.country" + ] + ] + ], + "events": [ + "created", + "status", + "guest", + "facts", + "data_request", + "amount", + "payment" + ] + }, + "portal_amounts_repeated": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · FeWo-direkt", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Fiete Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": "Buchungsnummer HA-A4", + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "979,51 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über FeWo-direkt ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei FeWo-direkt nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an FeWo-direkt", + "state": "external", + "detail": "laut Portal bezahlt: 390,61 € von 979,51 € (Angabe des Portals, kein Geld bei uns)", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von FeWo-direkt auf unser Konto", + "state": "waiting", + "detail": "angekündigt 894,69 € · eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "fiete@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "data_request", + "label": "Fehlende Angaben beim Gast anfragen", + "state": "open", + "detail": "Straße und Hausnummer, PLZ, Ort, Land · Rückfrage vorbereitet – wartet auf Ihre Freigabe", + "action": "approveDataRequest" + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "10.07.2027 – 17.07.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über FeWo-direkt · fest gebucht · Anreise in 260 Tagen", + "state": { + "status": "confirmed", + "intake": "booking", + "case_type": "a4", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": "2026-10-23 18:00", + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": 97951, + "deposit": 34283, + "lines": [ + [ + "accommodation", + 97951 + ] + ], + "deposit_due_on": "2026-10-30", + "balance_due_on": "2027-06-12" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [ + [ + "draft", + 0, + [ + "guest.street", + "guest.postal_code", + "guest.city", + "guest.country" + ] + ] + ], + "events": [ + "created", + "status", + "guest", + "facts", + "data_request", + "amount", + "payment" + ] + } +} diff --git a/tests/Fixtures/process/behaviour/a5_booking.json b/tests/Fixtures/process/behaviour/a5_booking.json new file mode 100644 index 0000000..a3158b8 --- /dev/null +++ b/tests/Fixtures/process/behaviour/a5_booking.json @@ -0,0 +1,140 @@ +{ + "booking": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Portal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": "Buchungsnummer P5-1", + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "600,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Portal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Portal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Portal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "19.12.2026 – 23.12.2026", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Portal A5 · fest gebucht · Anreise in 57 Tagen", + "state": { + "status": "confirmed", + "intake": "booking", + "case_type": "a5", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": "2026-10-23 18:00", + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": 60000, + "deposit": 21000, + "lines": [ + [ + "accommodation", + 60000 + ] + ], + "deposit_due_on": "2026-10-30", + "balance_due_on": "2026-11-21" + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "status" + ] + } +} diff --git a/tests/Fixtures/process/behaviour/a6_internal.json b/tests/Fixtures/process/behaviour/a6_internal.json new file mode 100644 index 0000000..fea00f5 --- /dev/null +++ b/tests/Fixtures/process/behaviour/a6_internal.json @@ -0,0 +1,175 @@ +{ + "internal": { + "activities": [ + { + "key": "intake", + "label": "Private Überlassung (Familie, Freunde) eingetragen", + "state": "done", + "detail": "Familie", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "20.11.2026 – 23.11.2026", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + } + ], + "next": null, + "situation": "Private Überlassung (Familie, Freunde) · Familie · 20.11.–23.11.2026", + "state": { + "status": "confirmed", + "intake": "internal", + "case_type": "a6", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": "2026-10-23 18:00", + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": 0, + "deposit": null, + "lines": [ + [ + "rent", + 0 + ] + ], + "deposit_due_on": null, + "balance_due_on": null + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "intake" + ] + }, + "after": { + "activities": [ + { + "key": "intake", + "label": "Private Überlassung (Familie, Freunde) eingetragen", + "state": "done", + "detail": "Familie", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "done", + "detail": "20.11.2026 – 23.11.2026", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 24.11.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "done", + "detail": "abgeschlossen am 24.11.2026", + "action": null + } + ], + "next": null, + "situation": "Private Überlassung (Familie, Freunde) · Familie · beendet am 23.11.2026", + "state": { + "status": "completed", + "intake": "internal", + "case_type": "a6", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": "2026-10-23 18:00", + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": "2026-11-24 09:00", + "settled_at": "2026-11-24 09:00" + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": 0, + "deposit": null, + "lines": [ + [ + "rent", + 0 + ] + ], + "deposit_due_on": null, + "balance_due_on": null + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "intake", + "status", + "settled" + ] + } +} diff --git a/tests/Fixtures/process/behaviour/portal_mail_cancellation.json b/tests/Fixtures/process/behaviour/portal_mail_cancellation.json new file mode 100644 index 0000000..9cd33dc --- /dev/null +++ b/tests/Fixtures/process/behaviour/portal_mail_cancellation.json @@ -0,0 +1,608 @@ +{ + "booking_mail": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · FeWo-direkt", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": "Buchungsnummer HA-7X3K9Q", + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "open", + "detail": "noch nicht bekannt", + "action": "portalPrice" + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen. Der Gesamtpreis (laut Portal) fehlt.", + "action": null + }, + { + "key": "payment", + "label": "Zahlungen überwachen", + "state": "waiting", + "detail": "erst möglich, wenn der Preis bekannt ist", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Gebucht über FeWo-direkt · fest gebucht · Anreise in 15 Tagen", + "state": { + "status": "confirmed", + "intake": "booking", + "case_type": "a3", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": "2026-10-23 18:00", + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen.", + "Der Gesamtpreis (laut Portal) fehlt." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": null, + "deposit": null, + "lines": [], + "deposit_due_on": "2026-10-30", + "balance_due_on": null + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [], + "mails": [ + [ + "FeWo-direkt-Buchung erkannt und gesperrt: 07.11.2026 – 10.11.2026", + "test@example.org" + ] + ] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "status", + "intake" + ] + }, + "booking_mail_repeated": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · FeWo-direkt", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": "Buchungsnummer HA-7X3K9Q", + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "open", + "detail": "noch nicht bekannt", + "action": "portalPrice" + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen. Der Gesamtpreis (laut Portal) fehlt.", + "action": null + }, + { + "key": "payment", + "label": "Zahlungen überwachen", + "state": "waiting", + "detail": "erst möglich, wenn der Preis bekannt ist", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Gebucht über FeWo-direkt · fest gebucht · Anreise in 15 Tagen", + "state": { + "status": "confirmed", + "intake": "booking", + "case_type": "a3", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": "2026-10-23 18:00", + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen.", + "Der Gesamtpreis (laut Portal) fehlt." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": null, + "deposit": null, + "lines": [], + "deposit_due_on": "2026-10-30", + "balance_due_on": null + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [], + "mails": [] + }, + "tasks": [], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "status", + "intake" + ] + }, + "cancellation_mail": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · FeWo-direkt", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": "Buchungsnummer HA-7X3K9Q", + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "open", + "detail": "noch nicht bekannt", + "action": "portalPrice" + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen. Der Gesamtpreis (laut Portal) fehlt.", + "action": null + }, + { + "key": "payment", + "label": "Zahlungen überwachen", + "state": "waiting", + "detail": "erst möglich, wenn der Preis bekannt ist", + "action": null + }, + { + "key": "task_portal_cancel_reported", + "label": "Das Portal meldet eine Stornierung – bitte prüfen", + "state": "open", + "detail": "fällig 23.10.2026 · FeWo-direkt meldet eine Stornierung (E-Mail „Buchung storniert: HA-7X3K9Q“). Bitte prüfen Sie die Buchung und die nächsten Schritte.", + "action": "confirmPortalCancellation" + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "task_portal_cancel_reported", + "situation": "Gebucht über FeWo-direkt · fest gebucht · Anreise in 15 Tagen", + "state": { + "status": "confirmed", + "intake": "booking", + "case_type": "a3", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": "2026-10-23 18:00", + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen.", + "Der Gesamtpreis (laut Portal) fehlt." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": null, + "deposit": null, + "lines": [], + "deposit_due_on": "2026-10-30", + "balance_due_on": null + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [], + "mails": [ + [ + "Bitte prüfen: E-Mail von FeWo-direkt", + "test@example.org" + ] + ] + }, + "tasks": [ + [ + "portal_cancel_reported", + "open" + ] + ], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "status", + "intake", + "task", + "portal_signal" + ] + }, + "advance_after_cancellation": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · FeWo-direkt", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": "Buchungsnummer HA-7X3K9Q", + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "open", + "detail": "noch nicht bekannt", + "action": "portalPrice" + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen. Der Gesamtpreis (laut Portal) fehlt.", + "action": null + }, + { + "key": "payment", + "label": "Zahlungen überwachen", + "state": "waiting", + "detail": "erst möglich, wenn der Preis bekannt ist", + "action": null + }, + { + "key": "task_portal_cancel_reported", + "label": "Das Portal meldet eine Stornierung – bitte prüfen", + "state": "open", + "detail": "fällig 23.10.2026 · FeWo-direkt meldet eine Stornierung (E-Mail „Buchung storniert: HA-7X3K9Q“). Bitte prüfen Sie die Buchung und die nächsten Schritte.", + "action": "confirmPortalCancellation" + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.11.2026 – 10.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "task_portal_cancel_reported", + "situation": "Gebucht über FeWo-direkt · fest gebucht · Anreise in 15 Tagen", + "state": { + "status": "confirmed", + "intake": "booking", + "case_type": "a3", + "hold_purpose": "offer", + "hold_expires_at": null, + "offer_version": 0, + "information_version": 0, + "offer_sent_at": null, + "confirmed_at": "2026-10-23 18:00", + "accepted_at": null, + "confirmation_sent_at": null, + "wish_at": null, + "completed_at": null, + "settled_at": null + }, + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen.", + "Der Gesamtpreis (laut Portal) fehlt." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + }, + "price": { + "total": null, + "deposit": null, + "lines": [], + "deposit_due_on": "2026-10-30", + "balance_due_on": null + }, + "documents": { + "contract": false, + "terms_template": null, + "cancellation_policy": null + }, + "communication": { + "messages": [], + "mails": [] + }, + "tasks": [ + [ + "portal_cancel_reported", + "open" + ] + ], + "channel_tasks": [], + "data_requests": [], + "events": [ + "created", + "status", + "intake", + "task", + "portal_signal" + ] + } +} diff --git a/tests/Fixtures/process/behaviour/state_matrix.json b/tests/Fixtures/process/behaviour/state_matrix.json new file mode 100644 index 0000000..3b25b9b --- /dev/null +++ b/tests/Fixtures/process/behaviour/state_matrix.json @@ -0,0 +1,19332 @@ +{ + "website.reserved.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "open", + "detail": "Zeitraum reserviert bis 24.10.2026, 18:00 Uhr", + "action": "sendOffer" + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 03.11.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "01.12.2026 – 05.12.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "offer", + "situation": "Anfrage über die Webseite · Zeitraum reserviert bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": [ + "Buchungsportal A3 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A4 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A5 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen." + ], + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "website.reserved.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "open", + "detail": "Zeitraum reserviert bis 24.10.2026, 18:00 Uhr", + "action": "sendOffer" + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 22.09.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "20.10.2026 – 24.10.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "offer", + "situation": "Anfrage über die Webseite · Zeitraum reserviert bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": [ + "Buchungsportal A3 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A4 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A5 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen." + ], + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "website.reserved.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Angaben für das Angebot vervollständigen", + "state": "open", + "detail": "fehlt: Straße und Hausnummer, PLZ, Ort, Land", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "later", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 23.11.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "21.12.2026 – 25.12.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über die Webseite · Zeitraum reserviert bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": [ + "Für ein verbindliches Angebot fehlen noch Angaben: Straße und Hausnummer, PLZ, Ort, Land.", + "Buchungsportal A3 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A4 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A5 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen." + ], + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "website.reserved.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Angaben für das Angebot vervollständigen", + "state": "open", + "detail": "fehlt: Straße und Hausnummer, PLZ, Ort, Land", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "later", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 12.10.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "09.11.2026 – 13.11.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über die Webseite · Zeitraum reserviert bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": [ + "Für ein verbindliches Angebot fehlen noch Angaben: Straße und Hausnummer, PLZ, Ort, Land.", + "Buchungsportal A3 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A4 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A5 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen." + ], + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "website.reserved.none.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "later", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 13.12.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "10.01.2027 – 14.01.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über die Webseite · Zeitraum reserviert bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": [ + "Die E-Mail-Adresse des Gastes fehlt.", + "Buchungsportal A3 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A4 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A5 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen." + ], + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "website.reserved.none.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "later", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 01.11.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "29.11.2026 – 03.12.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über die Webseite · Zeitraum reserviert bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": [ + "Die E-Mail-Adresse des Gastes fehlt.", + "Der Zeitraum ist inzwischen belegt.", + "Buchungsportal A3 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A4 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A5 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen." + ], + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "website.offer_sent.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "waiting", + "detail": "Angebot gültig bis 24.10.2026, 18:00 Uhr", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 02.01.2027", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "30.01.2027 – 03.02.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Angebot liegt beim Gast bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "website.offer_sent.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "waiting", + "detail": "Angebot gültig bis 24.10.2026, 18:00 Uhr", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 21.11.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "19.12.2026 – 23.12.2026", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Angebot liegt beim Gast bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "website.offer_sent.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "waiting", + "detail": "Angebot gültig bis 24.10.2026, 18:00 Uhr", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 22.01.2027", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "19.02.2027 – 23.02.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Angebot liegt beim Gast bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "website.offer_sent.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "waiting", + "detail": "Angebot gültig bis 24.10.2026, 18:00 Uhr", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 11.12.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "08.01.2027 – 12.01.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Angebot liegt beim Gast bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "website.offer_sent.none.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "waiting", + "detail": "Angebot gültig bis 24.10.2026, 18:00 Uhr", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 11.02.2027", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "11.03.2027 – 15.03.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über die Webseite · Angebot liegt beim Gast bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "website.offer_sent.none.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "waiting", + "detail": "Angebot gültig bis 24.10.2026, 18:00 Uhr", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 31.12.2026", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "28.01.2027 – 01.02.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über die Webseite · Angebot liegt beim Gast bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "website.confirmed.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 03.03.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "13gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "31.03.2027 – 04.04.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über die Webseite · fest gebucht · Anreise in 159 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.confirmed.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 20.01.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "14gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "17.02.2027 – 21.02.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über die Webseite · fest gebucht · Anreise in 117 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.confirmed.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 23.03.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "15gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "20.04.2027 – 24.04.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über die Webseite · fest gebucht · Anreise in 179 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.confirmed.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 09.02.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "16gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "09.03.2027 – 13.03.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über die Webseite · fest gebucht · Anreise in 137 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.confirmed.none.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 12.04.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "10.05.2027 – 14.05.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über die Webseite · fest gebucht · Anreise in 199 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.confirmed.none.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 01.03.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "29.03.2027 – 02.04.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über die Webseite · fest gebucht · Anreise in 157 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.deposit_paid.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 02.05.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "19gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "30.05.2027 – 03.06.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über die Webseite · fest gebucht, Anzahlung erhalten · Anreise in 219 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.deposit_paid.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 21.03.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "20gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "18.04.2027 – 22.04.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über die Webseite · fest gebucht, Anzahlung erhalten · Anreise in 177 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.deposit_paid.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 22.05.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "21gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "19.06.2027 – 23.06.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über die Webseite · fest gebucht, Anzahlung erhalten · Anreise in 239 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.deposit_paid.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 10.04.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "22gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "08.05.2027 – 12.05.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über die Webseite · fest gebucht, Anzahlung erhalten · Anreise in 197 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.deposit_paid.none.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 11.06.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "09.07.2027 – 13.07.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über die Webseite · fest gebucht, Anzahlung erhalten · Anreise in 259 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.deposit_paid.none.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 30.04.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "28.05.2027 – 01.06.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über die Webseite · fest gebucht, Anzahlung erhalten · Anreise in 217 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.paid.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 01.07.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "25gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "29.07.2027 – 02.08.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über die Webseite · fest gebucht, bezahlt · Anreise in 279 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.paid.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 20.05.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "26gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "17.06.2027 – 21.06.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über die Webseite · fest gebucht, bezahlt · Anreise in 237 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.paid.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 21.07.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "27gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "18.08.2027 – 22.08.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über die Webseite · fest gebucht, bezahlt · Anreise in 299 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.paid.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 09.06.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "28gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.07.2027 – 11.07.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über die Webseite · fest gebucht, bezahlt · Anreise in 257 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.paid.none.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 10.08.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.09.2027 – 11.09.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über die Webseite · fest gebucht, bezahlt · Anreise in 319 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.paid.none.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 29.06.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "27.07.2027 – 31.07.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über die Webseite · fest gebucht, bezahlt · Anreise in 277 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.completed.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "not_applicable", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 30.08.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "31gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "27.09.2027 – 01.10.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 800,00 €.", + "action": "settle" + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 339 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.completed.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "not_applicable", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 19.07.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "32gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "16.08.2027 – 20.08.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 800,00 €.", + "action": "settle" + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 297 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.completed.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "not_applicable", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 19.09.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "33gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "17.10.2027 – 21.10.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 800,00 €.", + "action": "settle" + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 359 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.completed.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "not_applicable", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 08.08.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "34gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "05.09.2027 – 09.09.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 800,00 €.", + "action": "settle" + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 317 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.completed.none.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "not_applicable", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 09.10.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "not_applicable", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "06.11.2027 – 10.11.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 800,00 €.", + "action": "settle" + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 379 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.completed.none.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "not_applicable", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 28.08.2027", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "not_applicable", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "25.09.2027 – 29.09.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 800,00 €.", + "action": "settle" + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 337 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "website.cancelled.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 29.10.2027", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "26.11.2027 – 30.11.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "website.cancelled.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 17.09.2027", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "15.10.2027 – 19.10.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "website.cancelled.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 18.11.2027", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "16.12.2027 – 20.12.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "website.cancelled.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 07.10.2027", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "04.11.2027 – 08.11.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "website.cancelled.none.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 08.12.2027", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "05.01.2028 – 09.01.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "website.cancelled.none.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 27.10.2027", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "24.11.2027 – 28.11.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "website.expired.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "not_applicable", + "detail": null, + "action": "sendOffer" + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 28.12.2027", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "25.01.2028 – 29.01.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Frist abgelaufen, ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "website.expired.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "not_applicable", + "detail": null, + "action": "sendOffer" + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 16.11.2027", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "14.12.2027 – 18.12.2027", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Frist abgelaufen, ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "website.expired.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Angaben für das Angebot vervollständigen", + "state": "not_applicable", + "detail": "fehlt: Straße und Hausnummer, PLZ, Ort, Land", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "not_applicable", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 17.01.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "14.02.2028 – 18.02.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Frist abgelaufen, ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "website.expired.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Angaben für das Angebot vervollständigen", + "state": "not_applicable", + "detail": "fehlt: Straße und Hausnummer, PLZ, Ort, Land", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "not_applicable", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 06.12.2027", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "03.01.2028 – 07.01.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Frist abgelaufen, ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "website.expired.none.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "not_applicable", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 06.02.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "05.03.2028 – 09.03.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Frist abgelaufen, ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "website.expired.none.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "not_applicable", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 26.12.2027", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "23.01.2028 – 27.01.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · Frist abgelaufen, ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "website.declined.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 26.02.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "25.03.2028 – 29.03.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "website.declined.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 15.01.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "12.02.2028 – 16.02.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "website.declined.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 17.03.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "14.04.2028 – 18.04.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "website.declined.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 04.02.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "03.03.2028 – 07.03.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "website.declined.none.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 06.04.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "04.05.2028 – 08.05.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "website.declined.none.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Eigene Webseite", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 24.02.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "23.03.2028 – 27.03.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über die Webseite · ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a2.reserved.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "open", + "detail": "Zeitraum reserviert bis 24.10.2026, 18:00 Uhr", + "action": "sendOffer" + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 26.04.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "24.05.2028 – 28.05.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "offer", + "situation": "Anfrage über Anfrageportal · Zeitraum reserviert bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": [ + "Buchungsportal A3 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A4 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A5 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen." + ], + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "a2.reserved.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "open", + "detail": "Zeitraum reserviert bis 24.10.2026, 18:00 Uhr", + "action": "sendOffer" + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 15.03.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "12.04.2028 – 16.04.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "offer", + "situation": "Anfrage über Anfrageportal · Zeitraum reserviert bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": [ + "Buchungsportal A3 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A4 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A5 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen." + ], + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "a2.reserved.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Angaben für das Angebot vervollständigen", + "state": "open", + "detail": "fehlt: Straße und Hausnummer, PLZ, Ort, Land", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "later", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 16.05.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "13.06.2028 – 17.06.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über Anfrageportal · Zeitraum reserviert bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": [ + "Für ein verbindliches Angebot fehlen noch Angaben: Straße und Hausnummer, PLZ, Ort, Land.", + "Buchungsportal A3 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A4 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A5 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen." + ], + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "a2.reserved.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Angaben für das Angebot vervollständigen", + "state": "open", + "detail": "fehlt: Straße und Hausnummer, PLZ, Ort, Land", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "later", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 04.04.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "02.05.2028 – 06.05.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über Anfrageportal · Zeitraum reserviert bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": [ + "Für ein verbindliches Angebot fehlen noch Angaben: Straße und Hausnummer, PLZ, Ort, Land.", + "Buchungsportal A3 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A4 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A5 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen." + ], + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "a2.reserved.none.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "later", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 05.06.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "03.07.2028 – 07.07.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über Anfrageportal · Zeitraum reserviert bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": [ + "Die E-Mail-Adresse des Gastes fehlt.", + "Buchungsportal A3 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A4 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A5 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen." + ], + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "a2.reserved.none.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "later", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 24.04.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "22.05.2028 – 26.05.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über Anfrageportal · Zeitraum reserviert bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": [ + "Die E-Mail-Adresse des Gastes fehlt.", + "Der Zeitraum ist inzwischen belegt.", + "Buchungsportal A3 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A4 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "Buchungsportal A5 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen." + ], + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "a2.offer_sent.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "waiting", + "detail": "Angebot gültig bis 24.10.2026, 18:00 Uhr", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 25.06.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "23.07.2028 – 27.07.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · Angebot liegt beim Gast bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "a2.offer_sent.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "waiting", + "detail": "Angebot gültig bis 24.10.2026, 18:00 Uhr", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 14.05.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "11.06.2028 – 15.06.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · Angebot liegt beim Gast bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "a2.offer_sent.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "waiting", + "detail": "Angebot gültig bis 24.10.2026, 18:00 Uhr", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 15.07.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "12.08.2028 – 16.08.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · Angebot liegt beim Gast bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "a2.offer_sent.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "waiting", + "detail": "Angebot gültig bis 24.10.2026, 18:00 Uhr", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 03.06.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "01.07.2028 – 05.07.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · Angebot liegt beim Gast bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "a2.offer_sent.none.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "waiting", + "detail": "Angebot gültig bis 24.10.2026, 18:00 Uhr", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 04.08.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "01.09.2028 – 05.09.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über Anfrageportal · Angebot liegt beim Gast bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "a2.offer_sent.none.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "waiting", + "detail": "Angebot gültig bis 24.10.2026, 18:00 Uhr", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "later", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 23.06.2028", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "21.07.2028 – 25.07.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über Anfrageportal · Angebot liegt beim Gast bis 24.10., 18:00 Uhr", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": true, + "clarification": "none" + } + }, + "a2.confirmed.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 24.08.2028", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "67gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "21.09.2028 – 25.09.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über Anfrageportal · fest gebucht · Anreise in 699 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.confirmed.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 13.07.2028", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "68gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "10.08.2028 – 14.08.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über Anfrageportal · fest gebucht · Anreise in 657 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.confirmed.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 13.09.2028", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "69gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "11.10.2028 – 15.10.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über Anfrageportal · fest gebucht · Anreise in 719 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.confirmed.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 02.08.2028", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "70gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "30.08.2028 – 03.09.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über Anfrageportal · fest gebucht · Anreise in 677 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.confirmed.none.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 03.10.2028", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "31.10.2028 – 04.11.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über Anfrageportal · fest gebucht · Anreise in 739 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.confirmed.none.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 22.08.2028", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "19.09.2028 – 23.09.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über Anfrageportal · fest gebucht · Anreise in 697 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.deposit_paid.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 23.10.2028", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "73gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "20.11.2028 – 24.11.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über Anfrageportal · fest gebucht, Anzahlung erhalten · Anreise in 759 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.deposit_paid.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 11.09.2028", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "74gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "09.10.2028 – 13.10.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über Anfrageportal · fest gebucht, Anzahlung erhalten · Anreise in 717 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.deposit_paid.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 12.11.2028", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "75gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "10.12.2028 – 14.12.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über Anfrageportal · fest gebucht, Anzahlung erhalten · Anreise in 779 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.deposit_paid.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 01.10.2028", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "76gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "29.10.2028 – 02.11.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über Anfrageportal · fest gebucht, Anzahlung erhalten · Anreise in 737 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.deposit_paid.none.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 02.12.2028", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "30.12.2028 – 03.01.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über Anfrageportal · fest gebucht, Anzahlung erhalten · Anreise in 799 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.deposit_paid.none.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 21.10.2028", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "18.11.2028 – 22.11.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über Anfrageportal · fest gebucht, Anzahlung erhalten · Anreise in 757 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.paid.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 22.12.2028", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "79gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "19.01.2029 – 23.01.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über Anfrageportal · fest gebucht, bezahlt · Anreise in 819 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.paid.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 10.11.2028", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "80gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "08.12.2028 – 12.12.2028", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über Anfrageportal · fest gebucht, bezahlt · Anreise in 777 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.paid.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 11.01.2029", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "81gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "08.02.2029 – 12.02.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über Anfrageportal · fest gebucht, bezahlt · Anreise in 839 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.paid.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "open", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 30.11.2028", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "82gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "28.12.2028 – 01.01.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Anfrage über Anfrageportal · fest gebucht, bezahlt · Anreise in 797 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.paid.none.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 31.01.2029", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "28.02.2029 – 04.03.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über Anfrageportal · fest gebucht, bezahlt · Anreise in 859 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.paid.none.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 20.12.2028", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "17.01.2029 – 21.01.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Anfrage über Anfrageportal · fest gebucht, bezahlt · Anreise in 817 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.completed.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "not_applicable", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 20.02.2029", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "85gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "20.03.2029 – 24.03.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 800,00 €.", + "action": "settle" + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 879 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.completed.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "not_applicable", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 09.01.2029", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "86gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "06.02.2029 – 10.02.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 800,00 €.", + "action": "settle" + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 837 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.completed.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "not_applicable", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 12.03.2029", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "87gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "09.04.2029 – 13.04.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 800,00 €.", + "action": "settle" + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 899 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.completed.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "not_applicable", + "detail": null, + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 29.01.2029", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "88gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "26.02.2029 – 02.03.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 800,00 €.", + "action": "settle" + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 857 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.completed.none.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "not_applicable", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 01.04.2029", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "not_applicable", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "29.04.2029 – 03.05.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 800,00 €.", + "action": "settle" + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 919 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.completed.none.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "done", + "detail": "direkt bestätigt", + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag prüfen und senden", + "state": "not_applicable", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 18.02.2029", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "not_applicable", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "18.03.2029 – 22.03.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 800,00 €.", + "action": "settle" + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 877 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a2.cancelled.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 21.04.2029", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "19.05.2029 – 23.05.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a2.cancelled.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 10.03.2029", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "07.04.2029 – 11.04.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a2.cancelled.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 11.05.2029", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "08.06.2029 – 12.06.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a2.cancelled.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 30.03.2029", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "27.04.2029 – 01.05.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a2.cancelled.none.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 31.05.2029", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "28.06.2029 – 02.07.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a2.cancelled.none.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 19.04.2029", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "17.05.2029 – 21.05.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a2.expired.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "not_applicable", + "detail": null, + "action": "sendOffer" + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 20.06.2029", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "18.07.2029 – 22.07.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · Frist abgelaufen, ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a2.expired.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "not_applicable", + "detail": null, + "action": "sendOffer" + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 09.05.2029", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "06.06.2029 – 10.06.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · Frist abgelaufen, ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a2.expired.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Angaben für das Angebot vervollständigen", + "state": "not_applicable", + "detail": "fehlt: Straße und Hausnummer, PLZ, Ort, Land", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "not_applicable", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 10.07.2029", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "07.08.2029 – 11.08.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · Frist abgelaufen, ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a2.expired.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Angaben für das Angebot vervollständigen", + "state": "not_applicable", + "detail": "fehlt: Straße und Hausnummer, PLZ, Ort, Land", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "not_applicable", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 29.05.2029", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "26.06.2029 – 30.06.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · Frist abgelaufen, ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a2.expired.none.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "not_applicable", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 30.07.2029", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "27.08.2029 – 31.08.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · Frist abgelaufen, ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a2.expired.none.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "not_applicable", + "detail": "erst wenn alle Angaben da sind", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 18.06.2029", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "16.07.2029 – 20.07.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · Frist abgelaufen, ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a2.declined.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 19.08.2029", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "16.09.2029 – 20.09.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a2.declined.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 08.07.2029", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "05.08.2029 – 09.08.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a2.declined.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 08.09.2029", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "06.10.2029 – 10.10.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a2.declined.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 28.07.2029", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "25.08.2029 – 29.08.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a2.declined.none.future": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 28.09.2029", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "26.10.2029 – 30.10.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a2.declined.none.past": { + "activities": [ + { + "key": "intake", + "label": "Anfrage eingegangen", + "state": "done", + "detail": "23.10.2026 · Anfrageportal", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "offer", + "label": "Angebot prüfen und senden", + "state": "done", + "detail": "Version 1 vom ", + "action": null + }, + { + "key": "acceptance", + "label": "Gast nimmt das Angebot an", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "documents", + "label": "Buchungsbestätigung mit Vertrag senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 17.08.2029", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "14.09.2029 – 18.09.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + } + ], + "next": null, + "situation": "Anfrage über Anfrageportal · ohne Buchung beendet", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a3.confirmed.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A3 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A3 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 18.10.2029", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "109gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "15.11.2029 – 19.11.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A3 · fest gebucht · Anreise in 1119 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.confirmed.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A3 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A3 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 06.09.2029", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "110gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "04.10.2029 – 08.10.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A3 · fest gebucht · Anreise in 1077 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.confirmed.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A3 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A3 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 07.11.2029", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "111gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "05.12.2029 – 09.12.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A3 · fest gebucht · Anreise in 1139 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.confirmed.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A3 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A3 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 26.09.2029", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "112gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "24.10.2029 – 28.10.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A3 · fest gebucht · Anreise in 1097 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.confirmed.none.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 27.11.2029", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "25.12.2029 – 29.12.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Gebucht über Buchungsportal A3 · fest gebucht · Anreise in 1159 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.confirmed.none.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 16.10.2029", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "13.11.2029 – 17.11.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Gebucht über Buchungsportal A3 · fest gebucht · Anreise in 1117 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.deposit_paid.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A3 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A3 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 17.12.2029", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "115gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "14.01.2030 – 18.01.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A3 · fest gebucht, Anzahlung erhalten · Anreise in 1179 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.deposit_paid.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A3 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A3 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 05.11.2029", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "116gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "03.12.2029 – 07.12.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A3 · fest gebucht, Anzahlung erhalten · Anreise in 1137 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.deposit_paid.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A3 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A3 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 06.01.2030", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "117gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "03.02.2030 – 07.02.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A3 · fest gebucht, Anzahlung erhalten · Anreise in 1199 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.deposit_paid.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A3 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A3 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 25.11.2029", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "118gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "23.12.2029 – 27.12.2029", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A3 · fest gebucht, Anzahlung erhalten · Anreise in 1157 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.deposit_paid.none.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 26.01.2030", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "23.02.2030 – 27.02.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Gebucht über Buchungsportal A3 · fest gebucht, Anzahlung erhalten · Anreise in 1219 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.deposit_paid.none.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 15.12.2029", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "12.01.2030 – 16.01.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Gebucht über Buchungsportal A3 · fest gebucht, Anzahlung erhalten · Anreise in 1177 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.paid.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A3 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A3 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 15.02.2030", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "121gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "15.03.2030 – 19.03.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A3 · fest gebucht, bezahlt · Anreise in 1239 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.paid.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A3 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A3 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 04.01.2030", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "122gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "01.02.2030 – 05.02.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A3 · fest gebucht, bezahlt · Anreise in 1197 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.paid.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A3 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A3 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 07.03.2030", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "123gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "04.04.2030 – 08.04.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A3 · fest gebucht, bezahlt · Anreise in 1259 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.paid.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A3 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A3 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 24.01.2030", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "124gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "21.02.2030 – 25.02.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A3 · fest gebucht, bezahlt · Anreise in 1217 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.paid.none.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 27.03.2030", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "24.04.2030 – 28.04.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Gebucht über Buchungsportal A3 · fest gebucht, bezahlt · Anreise in 1279 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.paid.none.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "waiting", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "later", + "detail": "600,00 €, fällig 13.02.2030", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "13.03.2030 – 17.03.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Gebucht über Buchungsportal A3 · fest gebucht, bezahlt · Anreise in 1237 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.completed.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "not_applicable", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A3 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A3 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 16.04.2030", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "127gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "14.05.2030 – 18.05.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 800,00 €.", + "action": "settle" + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A3 · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 1299 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.completed.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "not_applicable", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A3 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A3 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 05.03.2030", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "128gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "02.04.2030 – 06.04.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 800,00 €.", + "action": "settle" + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A3 · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 1257 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.completed.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "not_applicable", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A3 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A3 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 06.05.2030", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "129gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "03.06.2030 – 07.06.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 800,00 €.", + "action": "settle" + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A3 · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 1319 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.completed.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "not_applicable", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A3 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A3 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 25.03.2030", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "130gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "22.04.2030 – 26.04.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 800,00 €.", + "action": "settle" + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A3 · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 1277 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.completed.none.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "not_applicable", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 26.05.2030", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "not_applicable", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "23.06.2030 – 27.06.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 800,00 €.", + "action": "settle" + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A3 · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 1339 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.completed.none.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "not_applicable", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 14.04.2030", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "not_applicable", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "12.05.2030 – 16.05.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Noch offen vom Gast: 800,00 €.", + "action": "settle" + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A3 · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 1297 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a3.cancelled.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": "confirm" + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 15.06.2030", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "13.07.2030 – 17.07.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A3 · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a3.cancelled.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": "confirm" + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 04.05.2030", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "01.06.2030 – 05.06.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A3 · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a3.cancelled.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": "confirm" + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 05.07.2030", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "02.08.2030 – 06.08.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A3 · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a3.cancelled.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": "confirm" + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 24.05.2030", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "21.06.2030 – 25.06.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A3 · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a3.cancelled.none.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": "confirm" + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 25.07.2030", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "22.08.2030 – 26.08.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A3 · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a3.cancelled.none.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A3", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": "confirm" + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "deposit", + "label": "Anzahlung erhalten", + "state": "not_applicable", + "detail": "200,00 €", + "action": null + }, + { + "key": "balance", + "label": "Restzahlung erhalten", + "state": "not_applicable", + "detail": "600,00 €, fällig 13.06.2030", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "11.07.2030 – 15.07.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A3 · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a4.confirmed.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A4 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A4 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "139gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "11.09.2030 – 15.09.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A4 · fest gebucht · Anreise in 1419 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.confirmed.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A4 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A4 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "140gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "31.07.2030 – 04.08.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A4 · fest gebucht · Anreise in 1377 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.confirmed.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A4 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A4 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "141gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "01.10.2030 – 05.10.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A4 · fest gebucht · Anreise in 1439 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.confirmed.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A4 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A4 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "142gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "20.08.2030 – 24.08.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A4 · fest gebucht · Anreise in 1397 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.confirmed.none.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "21.10.2030 – 25.10.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Gebucht über Buchungsportal A4 · fest gebucht · Anreise in 1459 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.confirmed.none.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "09.09.2030 – 13.09.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Gebucht über Buchungsportal A4 · fest gebucht · Anreise in 1417 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.deposit_paid.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A4 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A4 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "145gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "10.11.2030 – 14.11.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A4 · fest gebucht, Anzahlung erhalten · Anreise in 1479 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.deposit_paid.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A4 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A4 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "146gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "29.09.2030 – 03.10.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A4 · fest gebucht, Anzahlung erhalten · Anreise in 1437 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.deposit_paid.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A4 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A4 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "147gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "30.11.2030 – 04.12.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A4 · fest gebucht, Anzahlung erhalten · Anreise in 1499 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.deposit_paid.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A4 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A4 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "148gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "19.10.2030 – 23.10.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A4 · fest gebucht, Anzahlung erhalten · Anreise in 1457 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.deposit_paid.none.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "20.12.2030 – 24.12.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Gebucht über Buchungsportal A4 · fest gebucht, Anzahlung erhalten · Anreise in 1519 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.deposit_paid.none.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "08.11.2030 – 12.11.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Gebucht über Buchungsportal A4 · fest gebucht, Anzahlung erhalten · Anreise in 1477 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.paid.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A4 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A4 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "151gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "09.01.2031 – 13.01.2031", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A4 · fest gebucht, bezahlt · Anreise in 1539 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.paid.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A4 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A4 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "152gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "28.11.2030 – 02.12.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A4 · fest gebucht, bezahlt · Anreise in 1497 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.paid.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A4 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A4 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "153gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "29.01.2031 – 02.02.2031", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A4 · fest gebucht, bezahlt · Anreise in 1559 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.paid.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "open", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A4 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A4 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "154gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "18.12.2030 – 22.12.2030", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "documents", + "situation": "Gebucht über Buchungsportal A4 · fest gebucht, bezahlt · Anreise in 1517 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.paid.none.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "18.02.2031 – 22.02.2031", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Gebucht über Buchungsportal A4 · fest gebucht, bezahlt · Anreise in 1579 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.paid.none.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "open", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "waiting", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "later", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "07.01.2031 – 11.01.2031", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "later", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": "contact", + "situation": "Gebucht über Buchungsportal A4 · fest gebucht, bezahlt · Anreise in 1537 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.completed.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "not_applicable", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A4 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A4 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "157gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "10.03.2031 – 14.03.2031", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Die Auszahlung von Buchungsportal A4 ist noch nicht eingegangen.", + "action": "settle" + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A4 · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 1599 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.completed.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "not_applicable", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A4 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A4 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "158gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "27.01.2031 – 31.01.2031", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Die Auszahlung von Buchungsportal A4 ist noch nicht eingegangen.", + "action": "settle" + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A4 · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 1557 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.completed.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "not_applicable", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A4 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A4 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "159gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "30.03.2031 – 03.04.2031", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Die Auszahlung von Buchungsportal A4 ist noch nicht eingegangen.", + "action": "settle" + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A4 · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 1619 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.completed.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "not_applicable", + "detail": "vor dem Versand zu prüfen: Die Texte für „Buchungsunterlagen (beim Portal gebucht)“ sind eine Arbeitsfassung und noch nicht freigegeben (So arbeite ich › Dokumente). Für Buchungen über Buchungsportal A4 ist keine eigene Vorlage hinterlegt. Die Unterlagen enthielten Ihre Mietbedingungen der Webseite – ihnen hat der Gast bei Buchungsportal A4 nicht zugestimmt.", + "action": "sendDocuments" + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "160gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "16.02.2031 – 20.02.2031", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Die Auszahlung von Buchungsportal A4 ist noch nicht eingegangen.", + "action": "settle" + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A4 · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 1577 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.completed.none.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "not_applicable", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "not_applicable", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "19.04.2031 – 23.04.2031", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Die Auszahlung von Buchungsportal A4 ist noch nicht eingegangen.", + "action": "settle" + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A4 · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 1639 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.completed.none.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen prüfen und senden", + "state": "not_applicable", + "detail": "wartet: Name und Kontaktdaten des Gastes fehlen.", + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "not_applicable", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "08.03.2031 – 12.03.2031", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Die Auszahlung von Buchungsportal A4 ist noch nicht eingegangen.", + "action": "settle" + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A4 · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 1597 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a4.cancelled.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": "confirm" + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "09.05.2031 – 13.05.2031", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A4 · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a4.cancelled.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": "confirm" + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "28.03.2031 – 01.04.2031", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A4 · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a4.cancelled.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": "confirm" + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "29.05.2031 – 02.06.2031", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A4 · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a4.cancelled.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Kontaktdaten des Gastes", + "state": "done", + "detail": "Gesa Gast", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": "confirm" + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "17.04.2031 – 21.04.2031", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A4 · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a4.cancelled.none.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": "confirm" + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "18.06.2031 – 22.06.2031", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A4 · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a4.cancelled.none.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A4", + "action": null + }, + { + "key": "contact", + "label": "Name und Kontaktdaten des Gastes eintragen", + "state": "not_applicable", + "detail": "fehlt noch", + "action": "provideContact" + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": "confirm" + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast senden", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A4", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A4 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast (automatisch)", + "state": "not_applicable", + "detail": "3 Tage vor Anreise", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "07.05.2031 – 11.05.2031", + "action": null + }, + { + "key": "review", + "label": "Bitte um eine Bewertung (automatisch)", + "state": "not_applicable", + "detail": null, + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A4 · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a5.confirmed.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "169gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "08.07.2031 – 12.07.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · fest gebucht · Anreise in 1719 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.confirmed.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "170gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "27.05.2031 – 31.05.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · fest gebucht · Anreise in 1677 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.confirmed.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "171gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "28.07.2031 – 01.08.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · fest gebucht · Anreise in 1739 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.confirmed.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "172gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "16.06.2031 – 20.06.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · fest gebucht · Anreise in 1697 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.confirmed.none.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "17.08.2031 – 21.08.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · fest gebucht · Anreise in 1759 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.confirmed.none.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "06.07.2031 – 10.07.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · fest gebucht · Anreise in 1717 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.deposit_paid.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "175gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "06.09.2031 – 10.09.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · fest gebucht, Anzahlung erhalten · Anreise in 1779 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.deposit_paid.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "176gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "26.07.2031 – 30.07.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · fest gebucht, Anzahlung erhalten · Anreise in 1737 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.deposit_paid.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "177gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "26.09.2031 – 30.09.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · fest gebucht, Anzahlung erhalten · Anreise in 1799 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.deposit_paid.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "178gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "15.08.2031 – 19.08.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · fest gebucht, Anzahlung erhalten · Anreise in 1757 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.deposit_paid.none.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "16.10.2031 – 20.10.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · fest gebucht, Anzahlung erhalten · Anreise in 1819 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.deposit_paid.none.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "04.09.2031 – 08.09.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · fest gebucht, Anzahlung erhalten · Anreise in 1777 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.paid.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "181gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "05.11.2031 – 09.11.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · fest gebucht, bezahlt · Anreise in 1839 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.paid.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "182gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "24.09.2031 – 28.09.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · fest gebucht, bezahlt · Anreise in 1797 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.paid.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "183gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "25.11.2031 – 29.11.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · fest gebucht, bezahlt · Anreise in 1859 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.paid.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "184gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "14.10.2031 – 18.10.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · fest gebucht, bezahlt · Anreise in 1817 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.paid.none.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "15.12.2031 – 19.12.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · fest gebucht, bezahlt · Anreise in 1879 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.paid.none.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "waiting", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "later", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "later", + "detail": "03.11.2031 – 07.11.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "later", + "detail": "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "later", + "detail": "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · fest gebucht, bezahlt · Anreise in 1837 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.completed.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "187gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "04.01.2032 – 08.01.2032", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Die Auszahlung von Buchungsportal A5 ist noch nicht eingegangen.", + "action": "settle" + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 1899 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.completed.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "188gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "23.11.2031 – 27.11.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Die Auszahlung von Buchungsportal A5 ist noch nicht eingegangen.", + "action": "settle" + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 1857 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.completed.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "189gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "24.01.2032 – 28.01.2032", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Die Auszahlung von Buchungsportal A5 ist noch nicht eingegangen.", + "action": "settle" + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 1919 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.completed.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "done", + "detail": "190gesa@example.org", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "13.12.2031 – 17.12.2031", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Die Auszahlung von Buchungsportal A5 ist noch nicht eingegangen.", + "action": "settle" + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 1877 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.completed.none.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "not_applicable", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "13.02.2032 – 17.02.2032", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Die Auszahlung von Buchungsportal A5 ist noch nicht eingegangen.", + "action": "settle" + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 1939 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.completed.none.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_details", + "label": "Anreisedaten", + "state": "not_applicable", + "detail": "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "02.01.2032 – 06.01.2032", + "action": null + }, + { + "key": "closure", + "label": "Aufenthalt abschließen", + "state": "done", + "detail": "abgeschlossen am 23.10.2026", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: Die Auszahlung von Buchungsportal A5 ist noch nicht eingegangen.", + "action": "settle" + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · Aufenthalt abgeschlossen, kaufmännisch noch offen · Anreise in 1897 Tagen", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": true, + "hold_active": false, + "clarification": "none" + } + }, + "a5.cancelled.complete.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": "confirm" + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "04.03.2032 – 08.03.2032", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a5.cancelled.complete.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": "confirm" + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "22.01.2032 – 26.01.2032", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a5.cancelled.no_address.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": "confirm" + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "24.03.2032 – 28.03.2032", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a5.cancelled.no_address.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": "confirm" + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "11.02.2032 – 15.02.2032", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a5.cancelled.none.future": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": "confirm" + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "13.04.2032 – 17.04.2032", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + }, + "a5.cancelled.none.past": { + "activities": [ + { + "key": "intake", + "label": "Buchung beim Portal eingegangen", + "state": "done", + "detail": "23.10.2026 · Buchungsportal A5", + "action": null + }, + { + "key": "binding", + "label": "Beim Portal fest gebucht", + "state": "external", + "detail": null, + "action": "confirm" + }, + { + "key": "price", + "label": "Gesamtpreis laut Portal eintragen", + "state": "done", + "detail": "800,00 €", + "action": null + }, + { + "key": "documents", + "label": "Buchungsunterlagen an den Gast", + "state": "external", + "detail": null, + "action": null + }, + { + "key": "payment", + "label": "Zahlung des Gastes an Buchungsportal A5", + "state": "external", + "detail": "zieht das Portal ein; noch keine Zahlungsangabe", + "action": null + }, + { + "key": "payout", + "label": "Auszahlung von Buchungsportal A5 auf unser Konto", + "state": "not_applicable", + "detail": "eingegangen 0,00 €", + "action": null + }, + { + "key": "arrival_info", + "label": "Anreise-Informationen an den Gast", + "state": "external", + "detail": "durch Buchungsportal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + "action": null + }, + { + "key": "stay", + "label": "Aufenthalt", + "state": "not_applicable", + "detail": "02.03.2032 – 06.03.2032", + "action": null + }, + { + "key": "settlement", + "label": "Kaufmännisch abschließen", + "state": "waiting", + "detail": "offen: ", + "action": null + } + ], + "next": null, + "situation": "Gebucht über Buchungsportal A5 · storniert", + "automation": { + "auto_offer_blockers": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + }, + "calendar": { + "occupying": false, + "hold_active": false, + "clarification": "none" + } + } +} diff --git a/tests/Fixtures/process/defects.md b/tests/Fixtures/process/defects.md new file mode 100644 index 0000000..a7f9298 --- /dev/null +++ b/tests/Fixtures/process/defects.md @@ -0,0 +1,10 @@ +# Fehlerregister: v0.11-Verhalten gegen beschlossene Anforderungen + +Stand: 04.11.2026 (U-0). Einträge hier sind **keine** Norm. Ein Snapshot des Verhaltensvergleichs, der einen Eintrag zeigt, gilt nur bis zur Entscheidung als Referenz. Danach wird der Fehler behoben (Test auf das Soll) oder begründet zurückgestellt. + +| # | Fundstelle | Anforderung | Ist (v0.11) | Soll | Entscheidung | +|---|---|---|---|---|---| +| F-001 | `CaseActivities::for`, Schritt `offer`; Snapshot `a1_dates_taken.answer_dates_taken` | v0.11 G2a / Architektur `02` §7.6: Ist der Zeitraum belegt, ist der Angebotsschritt ein Problem mit Grund | Schritt `offer` steht auf `open` mit Aktion `sendOffer`, obwohl `AutoOffer::blockers` „Der Zeitraum ist inzwischen belegt.“ meldet | `problem`, Detail „Der Zeitraum ist inzwischen belegt.“, keine Senden-Aktion | **behoben in U-A** (Modul `offer.binding`), beabsichtigte Abweichung I-004 | +| F-002 | `CaseActivities::for`, Detail des Schritts `offer` | CH §2a: Dem Vermieter wird nur der tatsächliche Reservierungszustand gezeigt (`clarificationState`) | Detail „Zeitraum reserviert bis 23.10.2026, 18:30 Uhr“ auch nach Ablauf der Klärungsreservierung | Bei abgelaufener Reservierung „Reservierung abgelaufen am …, Zeitraum nicht reserviert“ | **behoben in U-A**, beabsichtigte Abweichung I-005 | +| F-003 | `TenantBrandRenderingTest::test_booking_mail_embeds_only_the_logo_of_its_website` | Testsuite stabil | im Gesamtlauf einmal mit „Trying to access array offset on null“ (Zeile 94), einzeln grün | stabil | zurückgestellt: nicht prozessbezogen, Instabilität der Medienablage im Gesamtlauf; beobachten | +| F-004 | Verhaltensvergleich, Dimension `communication.mails` | – (Testwerkzeug) | Mails des ersten Ereignisses einer Folge erscheinen erst im nächsten Snapshot; die Spalte `messages` (`booking_messages`) ist vollständig | – | kein Anwendungsfehler; der Vergleich nutzt beide Spalten, maßgeblich ist `messages` | diff --git a/tests/Fixtures/process/intended.md b/tests/Fixtures/process/intended.md new file mode 100644 index 0000000..aa3e595 --- /dev/null +++ b/tests/Fixtures/process/intended.md @@ -0,0 +1,11 @@ +# Beabsichtigte Abweichungen von der v0.11-Referenz + +Jede Abweichung im Verhaltensvergleich (`BehaviourComparisonTest`, `OngoingCaseRegressionTest`) braucht hier einen Eintrag mit Begründung und eigenem Test. Die Referenzdateien werden nur zusammen mit einem Eintrag neu aufgenommen. + +| # | Abweichung | Begründung | Test | betroffene Referenzen | +|---|---|---|---|---| +| I-001 | Ereignistypen der Schrittdetails kommen aus der Moduldefinition statt aus `ActivityDetails::EVENT_TYPES` | eine Quelle (Architektur `02` §7.7) | `ActivityDetailsTest` unverändert grün | keine (gleiches Ergebnis) | +| I-002 | Offene, einem Vorgang zugeordnete Portalmeldung (Storno/Änderung) setzt automatische **Außenwirkungen** aus: Unterlagen, Erinnerungen, Anreiseinformation | Entscheidung O4 | `PortalReportSuspendsAutomationTest` | `portal_mail_cancellation` (nur wenn Außenwirkungen anstanden) | +| I-003 | Zeit-Actions (`ExpireReservations`, `RequestCaseData::handOver`) rufen danach `ProcessRunner::advance` für den Vorgang | K1: Wiederaufnahme ohne neuen Auslöser | `RunnerResumesAfterDeadlineTest` | keine erwartet | +| I-004 | Angebotsschritt bei belegtem Zeitraum = `problem` | Fehler F-001 | `OfferModuleTest::taken_dates_are_a_problem` | `a1_dates_taken.answer_dates_taken` | +| I-005 | Detail des Angebotsschritts zeigt den tatsächlichen Reservierungszustand | Fehler F-002 | `OfferModuleTest::expired_hold_is_not_shown_as_reserved` | `a1_dates_taken.*`, `a1_missing_address.clarification_expired`, `a1_missing_address.first_reminder` | diff --git a/tests/Fixtures/process/ongoing/cases.json b/tests/Fixtures/process/ongoing/cases.json new file mode 100644 index 0000000..18618a8 --- /dev/null +++ b/tests/Fixtures/process/ongoing/cases.json @@ -0,0 +1,2409 @@ +{ + "a1_clarification": { + "id": 1, + "rows": { + "guests": [ + { + "id": 1, + "first_name": "Gesa", + "last_name": "Gast", + "email": "klaer@example.org", + "phone": null, + "street": null, + "postal_code": null, + "city": null, + "country": null, + "locale": "de", + "notes": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "tags": null, + "marketing_consent_at": null, + "anonymized_at": null, + "tenant_id": 1 + } + ], + "bookings": [ + { + "id": 1, + "reference": "2026-0001", + "property_id": 1, + "guest_id": 1, + "status": "reserved", + "source": "website", + "arrival": "2026-11-07 00:00:00", + "departure": "2026-11-10 00:00:00", + "guests": 2, + "extras": "[]", + "promo_code": null, + "quote": "{\"arrival\":\"2026-11-07\",\"departure\":\"2026-11-10\",\"nights\":3,\"guests\":2,\"lines\":[{\"type\":\"accommodation\",\"label\":\"Zwischensaison (3 N\\u00e4chte)\",\"quantity\":3,\"unit_price\":6500,\"amount\":19500},{\"type\":\"cleaning\",\"label\":\"Endreinigung & Service\",\"quantity\":1,\"unit_price\":10800,\"amount\":10800}],\"total\":30300,\"deposit\":6825,\"balance\":23475,\"balance_due_on\":\"2026-10-10\",\"discount\":0}", + "total": 30300, + "deposit": 6825, + "balance_due_on": "2026-10-10 00:00:00", + "hold_expires_at": "2026-10-23 20:00:00", + "message": null, + "internal_notes": "Automatisches Angebot nicht versendet:\n- Für ein verbindliches Angebot fehlen noch Angaben: Straße und Hausnummer, PLZ, Ort, Land.", + "confirmed_at": null, + "cancelled_at": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "review_requested_at": null, + "referral_source": null, + "utm_source": null, + "utm_medium": null, + "utm_campaign": null, + "deposit_due_on": null, + "contract_path": null, + "deposit_reminded_at": null, + "balance_requested_at": null, + "balance_reminded_at": null, + "arrival_info_sent_at": null, + "offer_version": 0, + "offer_sent_at": null, + "offer_message": null, + "offer_path": null, + "price_adjustment": null, + "price_adjustment_label": null, + "accepted_at": null, + "acceptance": null, + "declined_by": null, + "tenant_id": 1, + "import_channel_id": null, + "origin_channel_id": null, + "offer_terms": null, + "offer_hash": null, + "confirmation_sent_at": null, + "confirmation_failed_at": null, + "offer_pdf_sha256": null, + "contract_pdf_sha256": null, + "portal_reference": null, + "contact_requested_at": null, + "guest_confirmed_at": null, + "archived_at": null, + "intake": "inquiry", + "case_type": "a1", + "profile": "{\"intake\":\"inquiry\",\"case_type\":\"a1\",\"values\":{\"processing\":\"automatic\",\"pre_reservation\":true,\"hold_hours\":48,\"documents\":\"landlord\",\"payments\":\"landlord\",\"guest_messages\":\"landlord\",\"arrival_info_days_before\":3,\"clarification_hold_auto_minutes\":120,\"clarification_hold_manual_minutes\":180,\"data_request_mode\":\"automatic\",\"data_request_reminders_max\":2,\"data_request_followups_max\":2,\"data_request_reminder_hours\":24,\"guest_link_valid_days\":14,\"form_requires_address\":false},\"sources\":{\"processing\":\"tenant\",\"pre_reservation\":\"system\",\"hold_hours\":\"system\",\"documents\":\"system\",\"payments\":\"system\",\"guest_messages\":\"system\",\"arrival_info_days_before\":\"system\",\"clarification_hold_auto_minutes\":\"tenant\",\"clarification_hold_manual_minutes\":\"system\",\"data_request_mode\":\"tenant\",\"data_request_reminders_max\":\"system\",\"data_request_followups_max\":\"system\",\"data_request_reminder_hours\":\"system\",\"guest_link_valid_days\":\"system\",\"form_requires_address\":\"system\"},\"frozen_at\":\"2026-10-23T18:00:00+02:00\",\"origin\":\"intake\"}", + "processing_mode": null, + "internal_kind": null, + "occasion": null, + "export_uid": null, + "tourist_tax_persons": null, + "tourist_tax_note": null, + "portal_cancellation_requested_at": null, + "information_version": 0, + "information_sent_at": null, + "information_valid_until": null, + "information": null, + "wish_at": null, + "wish": null, + "arrival_time": null, + "completed_at": null, + "settled_at": null, + "settled_note": null, + "settled_by": null, + "hold_purpose": "clarification" + } + ], + "booking_tasks": [], + "data_requests": [ + { + "id": 1, + "tenant_id": 1, + "booking_id": 1, + "status": "open", + "mode": "automatic", + "purpose": "offer", + "fields": "[\"guest.street\",\"guest.postal_code\",\"guest.city\",\"guest.country\"]", + "followups_sent": 0, + "reminders_sent": 0, + "link_version": 1, + "last_message": "initial", + "last_sent_at": "2026-10-23 18:00:00", + "response_due_at": "2026-10-24 18:00:00", + "next_reminder_at": "2026-10-24 18:00:00", + "answered_at": null, + "closed_at": null, + "closed_reason": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00" + } + ], + "case_amounts": [], + "payments": [], + "cancellations": [], + "booking_changes": [] + }, + "expected": { + "cancellation": { + "today": null, + "arrival_minus_40": null, + "arrival_minus_10": null + }, + "rent": 19500, + "deposit": 6825, + "balance": 23475, + "open_amount": 30300, + "due": [ + null, + "2026-10-10" + ], + "contract_sha": "a09de7a057f0a74f8309d0fbb8084030051e884a", + "case_type": "a1", + "activities": [ + [ + "intake", + "done", + "23.10.2026 · Eigene Webseite", + null + ], + [ + "contact", + "waiting", + "fehlt: Straße und Hausnummer, PLZ, Ort, Land · beim Gast angefragt", + "provideContact" + ], + [ + "offer", + "later", + "erst wenn alle Angaben da sind", + null + ], + [ + "acceptance", + "later", + null, + null + ], + [ + "documents", + "later", + null, + null + ], + [ + "deposit", + "later", + "68,25 €", + null + ], + [ + "balance", + "later", + "234,75 €, fällig 10.10.2026", + null + ], + [ + "arrival_info", + "later", + "3 Tage vor Anreise", + null + ], + [ + "stay", + "later", + "07.11.2026 – 10.11.2026", + null + ], + [ + "review", + "later", + null, + null + ] + ], + "next": null, + "document_blockers": [] + } + }, + "a1_offer_sent": { + "id": 2, + "rows": { + "guests": [ + { + "id": 2, + "first_name": "Gesa", + "last_name": "Gast", + "email": "angebot@example.org", + "phone": null, + "street": "Lindenallee 12", + "postal_code": "10115", + "city": "Berlin", + "country": "DE", + "locale": "de", + "notes": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "tags": null, + "marketing_consent_at": null, + "anonymized_at": null, + "tenant_id": 1 + } + ], + "bookings": [ + { + "id": 2, + "reference": "2026-0002", + "property_id": 1, + "guest_id": 2, + "status": "offer_sent", + "source": "website", + "arrival": "2026-11-14 00:00:00", + "departure": "2026-11-17 00:00:00", + "guests": 2, + "extras": "[]", + "promo_code": null, + "quote": "{\"arrival\":\"2026-11-14\",\"departure\":\"2026-11-17\",\"nights\":3,\"guests\":2,\"lines\":[{\"type\":\"accommodation\",\"label\":\"Zwischensaison (3 N\\u00e4chte)\",\"quantity\":3,\"unit_price\":6500,\"amount\":19500},{\"type\":\"cleaning\",\"label\":\"Endreinigung & Service\",\"quantity\":1,\"unit_price\":10800,\"amount\":10800}],\"total\":30300,\"deposit\":6825,\"balance\":23475,\"balance_due_on\":\"2026-10-17\",\"discount\":0}", + "total": 30300, + "deposit": 6825, + "balance_due_on": "2026-10-17 00:00:00", + "hold_expires_at": "2026-10-25 17:00:00", + "message": null, + "internal_notes": null, + "confirmed_at": null, + "cancelled_at": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "review_requested_at": null, + "referral_source": null, + "utm_source": null, + "utm_medium": null, + "utm_campaign": null, + "deposit_due_on": null, + "contract_path": null, + "deposit_reminded_at": null, + "balance_requested_at": null, + "balance_reminded_at": null, + "arrival_info_sent_at": null, + "offer_version": 1, + "offer_sent_at": "2026-10-23 18:00:00", + "offer_message": null, + "offer_path": "contracts/tenants/1/bookings/2/Angebot-2026-0002-v1.pdf", + "price_adjustment": null, + "price_adjustment_label": null, + "accepted_at": null, + "acceptance": null, + "declined_by": null, + "tenant_id": 1, + "import_channel_id": null, + "origin_channel_id": null, + "offer_terms": "{\"captured_at\":\"2026-10-23T18:00:00+02:00\",\"template\":null,\"document\":null,\"annex_ids\":[],\"annexes\":[],\"cancellation_policy\":null,\"property_data\":[],\"texts\":{\"contract.intro\":\"Zwischen Vermieter und Mieter wird folgender Mietvertrag \\u00fcber die Ferienwohnung geschlossen. Der Vertrag kommt zustande, wenn der Mieter das Angebot des Vermieters annimmt.\",\"contract.terms\":\"

Echte Bedingungen<\\/p>\",\"contract.closing\":\"Wir freuen uns auf Ihren Besuch und w\\u00fcnschen Ihnen schon jetzt einen erholsamen Aufenthalt an der Ostsee.\",\"stay.cancellation\":\"

Echtes Storno<\\/p>\",\"stay.house_rules\":null,\"offer.contract_note\":\"Dies ist ein Angebot. Der Mietvertrag wird verbindlich, sobald Sie das Angebot \\u00fcber den Link in unserer E-Mail annehmen.\",\"offer.accept_note\":\"Mit Klick auf den Button nehmen Sie unser Angebot verbindlich an. Damit kommt der Mietvertrag zu den oben genannten Bedingungen zustande und die genannten Zahlungen werden f\\u00e4llig.\",\"offer.accept_button\":\"Angebot zahlungspflichtig annehmen\"},\"deposit_due_days\":7,\"owner\":{\"name\":\"Brigitte Stommer\",\"street\":\"Erbstollen 3\",\"city\":\"44225 Dortmund\",\"phone\":\"0170 8165208\",\"email\":\"fewo@stommer.de\"},\"bank\":{\"account_holder\":null,\"iban\":\"DE02120300000000202051\",\"bic\":null,\"bank_name\":null}}", + "offer_hash": "ccbc26adad03b74e067cacdd227a28dc9026539756f304f6a6f274d100cfccae", + "confirmation_sent_at": null, + "confirmation_failed_at": null, + "offer_pdf_sha256": "4fdea1b1e5957ce60bc534e5c7ad8317dfefb28e70ee769ca5298f3514cc574f", + "contract_pdf_sha256": null, + "portal_reference": null, + "contact_requested_at": null, + "guest_confirmed_at": null, + "archived_at": null, + "intake": "inquiry", + "case_type": "a1", + "profile": "{\"intake\":\"inquiry\",\"case_type\":\"a1\",\"values\":{\"processing\":\"automatic\",\"pre_reservation\":true,\"hold_hours\":48,\"documents\":\"landlord\",\"payments\":\"landlord\",\"guest_messages\":\"landlord\",\"arrival_info_days_before\":3,\"clarification_hold_auto_minutes\":120,\"clarification_hold_manual_minutes\":180,\"data_request_mode\":\"automatic\",\"data_request_reminders_max\":2,\"data_request_followups_max\":2,\"data_request_reminder_hours\":24,\"guest_link_valid_days\":14,\"form_requires_address\":false},\"sources\":{\"processing\":\"tenant\",\"pre_reservation\":\"system\",\"hold_hours\":\"system\",\"documents\":\"system\",\"payments\":\"system\",\"guest_messages\":\"system\",\"arrival_info_days_before\":\"system\",\"clarification_hold_auto_minutes\":\"tenant\",\"clarification_hold_manual_minutes\":\"system\",\"data_request_mode\":\"tenant\",\"data_request_reminders_max\":\"system\",\"data_request_followups_max\":\"system\",\"data_request_reminder_hours\":\"system\",\"guest_link_valid_days\":\"system\",\"form_requires_address\":\"system\"},\"frozen_at\":\"2026-10-23T18:00:00+02:00\",\"origin\":\"intake\"}", + "processing_mode": null, + "internal_kind": null, + "occasion": null, + "export_uid": null, + "tourist_tax_persons": null, + "tourist_tax_note": null, + "portal_cancellation_requested_at": null, + "information_version": 0, + "information_sent_at": null, + "information_valid_until": null, + "information": null, + "wish_at": null, + "wish": null, + "arrival_time": null, + "completed_at": null, + "settled_at": null, + "settled_note": null, + "settled_by": null, + "hold_purpose": "offer" + } + ], + "booking_tasks": [], + "data_requests": [], + "case_amounts": [], + "payments": [], + "cancellations": [], + "booking_changes": [] + }, + "expected": { + "cancellation": { + "today": null, + "arrival_minus_40": null, + "arrival_minus_10": null + }, + "rent": 19500, + "deposit": 6825, + "balance": 23475, + "open_amount": 30300, + "due": [ + null, + "2026-10-17" + ], + "contract_sha": "d56f15995968b671eb7909d16048984bcc015115", + "case_type": "a1", + "activities": [ + [ + "intake", + "done", + "23.10.2026 · Eigene Webseite", + null + ], + [ + "contact", + "done", + "Gesa Gast", + null + ], + [ + "offer", + "done", + "Version 1 vom 23.10.2026", + null + ], + [ + "acceptance", + "waiting", + "Angebot gültig bis 25.10.2026, 17:00 Uhr", + null + ], + [ + "documents", + "later", + null, + null + ], + [ + "deposit", + "later", + "68,25 €", + null + ], + [ + "balance", + "later", + "234,75 €, fällig 17.10.2026", + null + ], + [ + "arrival_info", + "later", + "3 Tage vor Anreise", + null + ], + [ + "stay", + "later", + "14.11.2026 – 17.11.2026", + null + ], + [ + "review", + "later", + null, + null + ] + ], + "next": null, + "document_blockers": [] + } + }, + "a1_confirmed_deposit_open": { + "id": 3, + "rows": { + "guests": [ + { + "id": 3, + "first_name": "Gesa", + "last_name": "Gast", + "email": "fest@example.org", + "phone": null, + "street": "Lindenallee 12", + "postal_code": "10115", + "city": "Berlin", + "country": "DE", + "locale": "de", + "notes": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "tags": null, + "marketing_consent_at": null, + "anonymized_at": null, + "tenant_id": 1 + } + ], + "bookings": [ + { + "id": 3, + "reference": "2026-0003", + "property_id": 1, + "guest_id": 3, + "status": "confirmed", + "source": "website", + "arrival": "2026-12-01 00:00:00", + "departure": "2026-12-08 00:00:00", + "guests": 2, + "extras": "[]", + "promo_code": null, + "quote": "{\"arrival\":\"2026-12-01\",\"departure\":\"2026-12-08\",\"nights\":7,\"guests\":2,\"lines\":[{\"type\":\"accommodation\",\"label\":\"Zwischensaison (7 N\\u00e4chte)\",\"quantity\":7,\"unit_price\":6500,\"amount\":45500},{\"type\":\"cleaning\",\"label\":\"Endreinigung & Service\",\"quantity\":1,\"unit_price\":10800,\"amount\":10800}],\"total\":56300,\"deposit\":15925,\"balance\":40375,\"balance_due_on\":\"2026-11-03\",\"discount\":0}", + "total": 56300, + "deposit": 15925, + "balance_due_on": "2026-11-03 00:00:00", + "hold_expires_at": null, + "message": null, + "internal_notes": null, + "confirmed_at": "2026-10-23 18:00:00", + "cancelled_at": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "review_requested_at": null, + "referral_source": null, + "utm_source": null, + "utm_medium": null, + "utm_campaign": null, + "deposit_due_on": "2026-10-30 00:00:00", + "contract_path": "contracts/tenants/1/bookings/3/Mietvertrag-2026-0003.pdf", + "deposit_reminded_at": null, + "balance_requested_at": null, + "balance_reminded_at": null, + "arrival_info_sent_at": null, + "offer_version": 1, + "offer_sent_at": "2026-10-23 18:00:00", + "offer_message": null, + "offer_path": "contracts/tenants/1/bookings/3/Angebot-2026-0003-v1.pdf", + "price_adjustment": null, + "price_adjustment_label": null, + "accepted_at": "2026-10-23 18:00:00", + "acceptance": "{\"offer_version\":1,\"accepted_at\":\"2026-10-23T18:00:00+02:00\",\"offer_sent_at\":\"2026-10-23T18:00:00+02:00\",\"valid_until\":\"2026-10-25T17:00:00+01:00\",\"total\":56300,\"offer_hash\":\"4dac165c8824c05ce39ce99d4effc14018cc6da624bf5f93e0a8e146c3ab3878\",\"quote_sha256\":\"98e50353f64e0a8074bac10211e4b81412186f880f820eb72c70b35028ffcfa6\",\"terms_sha256\":\"f18a879fe8b43cdb64e4970841dbe99ddd6cb441ed2ffdeecdc23d97abcd01b9\",\"accept_button\":\"Angebot zahlungspflichtig annehmen\",\"via\":\"offer_link\"}", + "declined_by": null, + "tenant_id": 1, + "import_channel_id": null, + "origin_channel_id": null, + "offer_terms": "{\"captured_at\":\"2026-10-23T18:00:00+02:00\",\"template\":null,\"document\":null,\"annex_ids\":[],\"annexes\":[],\"cancellation_policy\":null,\"property_data\":[],\"texts\":{\"contract.intro\":\"Zwischen Vermieter und Mieter wird folgender Mietvertrag \\u00fcber die Ferienwohnung geschlossen. Der Vertrag kommt zustande, wenn der Mieter das Angebot des Vermieters annimmt.\",\"contract.terms\":\"

Echte Bedingungen<\\/p>\",\"contract.closing\":\"Wir freuen uns auf Ihren Besuch und w\\u00fcnschen Ihnen schon jetzt einen erholsamen Aufenthalt an der Ostsee.\",\"stay.cancellation\":\"

Echtes Storno<\\/p>\",\"stay.house_rules\":null,\"offer.contract_note\":\"Dies ist ein Angebot. Der Mietvertrag wird verbindlich, sobald Sie das Angebot \\u00fcber den Link in unserer E-Mail annehmen.\",\"offer.accept_note\":\"Mit Klick auf den Button nehmen Sie unser Angebot verbindlich an. Damit kommt der Mietvertrag zu den oben genannten Bedingungen zustande und die genannten Zahlungen werden f\\u00e4llig.\",\"offer.accept_button\":\"Angebot zahlungspflichtig annehmen\"},\"deposit_due_days\":7,\"owner\":{\"name\":\"Brigitte Stommer\",\"street\":\"Erbstollen 3\",\"city\":\"44225 Dortmund\",\"phone\":\"0170 8165208\",\"email\":\"fewo@stommer.de\"},\"bank\":{\"account_holder\":null,\"iban\":\"DE02120300000000202051\",\"bic\":null,\"bank_name\":null}}", + "offer_hash": "4dac165c8824c05ce39ce99d4effc14018cc6da624bf5f93e0a8e146c3ab3878", + "confirmation_sent_at": "2026-10-23 18:00:00", + "confirmation_failed_at": null, + "offer_pdf_sha256": "4eb20ef8e7485ab0a90edaaabc8e9937c3d38cd350f39736f6be0746c5aa7884", + "contract_pdf_sha256": "f0af3ace8b78d704e7cb1d5c2742f7ad16a567841577dff8810e410b644e4a12", + "portal_reference": null, + "contact_requested_at": null, + "guest_confirmed_at": null, + "archived_at": null, + "intake": "inquiry", + "case_type": "a1", + "profile": "{\"intake\":\"inquiry\",\"case_type\":\"a1\",\"values\":{\"processing\":\"automatic\",\"pre_reservation\":true,\"hold_hours\":48,\"documents\":\"landlord\",\"payments\":\"landlord\",\"guest_messages\":\"landlord\",\"arrival_info_days_before\":3,\"clarification_hold_auto_minutes\":120,\"clarification_hold_manual_minutes\":180,\"data_request_mode\":\"automatic\",\"data_request_reminders_max\":2,\"data_request_followups_max\":2,\"data_request_reminder_hours\":24,\"guest_link_valid_days\":14,\"form_requires_address\":false},\"sources\":{\"processing\":\"tenant\",\"pre_reservation\":\"system\",\"hold_hours\":\"system\",\"documents\":\"system\",\"payments\":\"system\",\"guest_messages\":\"system\",\"arrival_info_days_before\":\"system\",\"clarification_hold_auto_minutes\":\"tenant\",\"clarification_hold_manual_minutes\":\"system\",\"data_request_mode\":\"tenant\",\"data_request_reminders_max\":\"system\",\"data_request_followups_max\":\"system\",\"data_request_reminder_hours\":\"system\",\"guest_link_valid_days\":\"system\",\"form_requires_address\":\"system\"},\"frozen_at\":\"2026-10-23T18:00:00+02:00\",\"origin\":\"intake\"}", + "processing_mode": null, + "internal_kind": null, + "occasion": null, + "export_uid": null, + "tourist_tax_persons": null, + "tourist_tax_note": null, + "portal_cancellation_requested_at": null, + "information_version": 0, + "information_sent_at": null, + "information_valid_until": null, + "information": null, + "wish_at": null, + "wish": null, + "arrival_time": null, + "completed_at": null, + "settled_at": null, + "settled_note": null, + "settled_by": null, + "hold_purpose": "offer" + } + ], + "booking_tasks": [], + "data_requests": [], + "case_amounts": [], + "payments": [], + "cancellations": [], + "booking_changes": [] + }, + "expected": { + "cancellation": { + "today": null, + "arrival_minus_40": null, + "arrival_minus_10": null + }, + "rent": 45500, + "deposit": 15925, + "balance": 40375, + "open_amount": 56300, + "due": [ + "2026-10-30", + "2026-11-03" + ], + "contract_sha": "8b20669992335d4fabb7bcf2665537f71dd72145", + "case_type": "a1", + "activities": [ + [ + "intake", + "done", + "23.10.2026 · Eigene Webseite", + null + ], + [ + "contact", + "done", + "Gesa Gast", + null + ], + [ + "offer", + "done", + "Version 1 vom 23.10.2026", + null + ], + [ + "acceptance", + "done", + "angenommen am 23.10.2026", + null + ], + [ + "documents", + "done", + "gesendet am 23.10.2026", + null + ], + [ + "deposit", + "waiting", + "159,25 €, fällig 30.10.2026", + null + ], + [ + "balance", + "later", + "403,75 €, fällig 03.11.2026", + null + ], + [ + "arrival_details", + "done", + "fest@example.org", + null + ], + [ + "arrival_info", + "later", + "3 Tage vor Anreise", + null + ], + [ + "stay", + "later", + "01.12.2026 – 08.12.2026", + null + ], + [ + "review", + "later", + null, + null + ], + [ + "closure", + "later", + "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + null + ], + [ + "settlement", + "later", + "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + null + ] + ], + "next": null, + "document_blockers": [] + } + }, + "a1_deposit_paid": { + "id": 4, + "rows": { + "guests": [ + { + "id": 4, + "first_name": "Gesa", + "last_name": "Gast", + "email": "bezahlt@example.org", + "phone": null, + "street": "Lindenallee 12", + "postal_code": "10115", + "city": "Berlin", + "country": "DE", + "locale": "de", + "notes": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "tags": null, + "marketing_consent_at": null, + "anonymized_at": null, + "tenant_id": 1 + } + ], + "bookings": [ + { + "id": 4, + "reference": "2026-0004", + "property_id": 1, + "guest_id": 4, + "status": "deposit_paid", + "source": "website", + "arrival": "2026-11-18 00:00:00", + "departure": "2026-11-21 00:00:00", + "guests": 2, + "extras": "[]", + "promo_code": null, + "quote": "{\"arrival\":\"2026-11-18\",\"departure\":\"2026-11-21\",\"nights\":3,\"guests\":2,\"lines\":[{\"type\":\"accommodation\",\"label\":\"Zwischensaison (3 N\\u00e4chte)\",\"quantity\":3,\"unit_price\":6500,\"amount\":19500},{\"type\":\"cleaning\",\"label\":\"Endreinigung & Service\",\"quantity\":1,\"unit_price\":10800,\"amount\":10800}],\"total\":30300,\"deposit\":6825,\"balance\":23475,\"balance_due_on\":\"2026-10-21\",\"discount\":0}", + "total": 30300, + "deposit": 6825, + "balance_due_on": "2026-10-21 00:00:00", + "hold_expires_at": null, + "message": null, + "internal_notes": null, + "confirmed_at": "2026-10-23 18:00:00", + "cancelled_at": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "review_requested_at": null, + "referral_source": null, + "utm_source": null, + "utm_medium": null, + "utm_campaign": null, + "deposit_due_on": "2026-10-30 00:00:00", + "contract_path": "contracts/tenants/1/bookings/4/Mietvertrag-2026-0004.pdf", + "deposit_reminded_at": null, + "balance_requested_at": null, + "balance_reminded_at": null, + "arrival_info_sent_at": null, + "offer_version": 1, + "offer_sent_at": "2026-10-23 18:00:00", + "offer_message": null, + "offer_path": "contracts/tenants/1/bookings/4/Angebot-2026-0004-v1.pdf", + "price_adjustment": null, + "price_adjustment_label": null, + "accepted_at": "2026-10-23 18:00:00", + "acceptance": "{\"offer_version\":1,\"accepted_at\":\"2026-10-23T18:00:00+02:00\",\"offer_sent_at\":\"2026-10-23T18:00:00+02:00\",\"valid_until\":\"2026-10-25T17:00:00+01:00\",\"total\":30300,\"offer_hash\":\"e5281104509792f88c1fcdb102e1559efcaad9050696e6181041ddbcb2d35da2\",\"quote_sha256\":\"8862be2a2d272e09b46076b8d4b06029f941e4cf8cbe7e92d0aa28739df9841d\",\"terms_sha256\":\"f18a879fe8b43cdb64e4970841dbe99ddd6cb441ed2ffdeecdc23d97abcd01b9\",\"accept_button\":\"Angebot zahlungspflichtig annehmen\",\"via\":\"offer_link\"}", + "declined_by": null, + "tenant_id": 1, + "import_channel_id": null, + "origin_channel_id": null, + "offer_terms": "{\"captured_at\":\"2026-10-23T18:00:00+02:00\",\"template\":null,\"document\":null,\"annex_ids\":[],\"annexes\":[],\"cancellation_policy\":null,\"property_data\":[],\"texts\":{\"contract.intro\":\"Zwischen Vermieter und Mieter wird folgender Mietvertrag \\u00fcber die Ferienwohnung geschlossen. Der Vertrag kommt zustande, wenn der Mieter das Angebot des Vermieters annimmt.\",\"contract.terms\":\"

Echte Bedingungen<\\/p>\",\"contract.closing\":\"Wir freuen uns auf Ihren Besuch und w\\u00fcnschen Ihnen schon jetzt einen erholsamen Aufenthalt an der Ostsee.\",\"stay.cancellation\":\"

Echtes Storno<\\/p>\",\"stay.house_rules\":null,\"offer.contract_note\":\"Dies ist ein Angebot. Der Mietvertrag wird verbindlich, sobald Sie das Angebot \\u00fcber den Link in unserer E-Mail annehmen.\",\"offer.accept_note\":\"Mit Klick auf den Button nehmen Sie unser Angebot verbindlich an. Damit kommt der Mietvertrag zu den oben genannten Bedingungen zustande und die genannten Zahlungen werden f\\u00e4llig.\",\"offer.accept_button\":\"Angebot zahlungspflichtig annehmen\"},\"deposit_due_days\":7,\"owner\":{\"name\":\"Brigitte Stommer\",\"street\":\"Erbstollen 3\",\"city\":\"44225 Dortmund\",\"phone\":\"0170 8165208\",\"email\":\"fewo@stommer.de\"},\"bank\":{\"account_holder\":null,\"iban\":\"DE02120300000000202051\",\"bic\":null,\"bank_name\":null}}", + "offer_hash": "e5281104509792f88c1fcdb102e1559efcaad9050696e6181041ddbcb2d35da2", + "confirmation_sent_at": "2026-10-23 18:00:00", + "confirmation_failed_at": null, + "offer_pdf_sha256": "60c18a4e66a107bd1af3a3b656ffdd217ef88936cb4b3404f2e0b32860fd1ca3", + "contract_pdf_sha256": "6ab2d04489e304bd517f7fc6a37cbafc08d887c6209ef58018fdc8bf9be88c4a", + "portal_reference": null, + "contact_requested_at": null, + "guest_confirmed_at": null, + "archived_at": null, + "intake": "inquiry", + "case_type": "a1", + "profile": "{\"intake\":\"inquiry\",\"case_type\":\"a1\",\"values\":{\"processing\":\"automatic\",\"pre_reservation\":true,\"hold_hours\":48,\"documents\":\"landlord\",\"payments\":\"landlord\",\"guest_messages\":\"landlord\",\"arrival_info_days_before\":3,\"clarification_hold_auto_minutes\":120,\"clarification_hold_manual_minutes\":180,\"data_request_mode\":\"automatic\",\"data_request_reminders_max\":2,\"data_request_followups_max\":2,\"data_request_reminder_hours\":24,\"guest_link_valid_days\":14,\"form_requires_address\":false},\"sources\":{\"processing\":\"tenant\",\"pre_reservation\":\"system\",\"hold_hours\":\"system\",\"documents\":\"system\",\"payments\":\"system\",\"guest_messages\":\"system\",\"arrival_info_days_before\":\"system\",\"clarification_hold_auto_minutes\":\"tenant\",\"clarification_hold_manual_minutes\":\"system\",\"data_request_mode\":\"tenant\",\"data_request_reminders_max\":\"system\",\"data_request_followups_max\":\"system\",\"data_request_reminder_hours\":\"system\",\"guest_link_valid_days\":\"system\",\"form_requires_address\":\"system\"},\"frozen_at\":\"2026-10-23T18:00:00+02:00\",\"origin\":\"intake\"}", + "processing_mode": null, + "internal_kind": null, + "occasion": null, + "export_uid": null, + "tourist_tax_persons": null, + "tourist_tax_note": null, + "portal_cancellation_requested_at": null, + "information_version": 0, + "information_sent_at": null, + "information_valid_until": null, + "information": null, + "wish_at": null, + "wish": null, + "arrival_time": null, + "completed_at": null, + "settled_at": null, + "settled_note": null, + "settled_by": null, + "hold_purpose": "offer" + } + ], + "booking_tasks": [], + "data_requests": [], + "case_amounts": [], + "payments": [ + { + "id": 1, + "booking_id": 4, + "amount": 6825, + "paid_on": "2026-10-23 00:00:00", + "method": "transfer", + "note": null, + "recorded_by": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "tenant_id": 1, + "kind": "guest", + "source": null + } + ], + "cancellations": [], + "booking_changes": [] + }, + "expected": { + "cancellation": { + "today": null, + "arrival_minus_40": null, + "arrival_minus_10": null + }, + "rent": 19500, + "deposit": 6825, + "balance": 23475, + "open_amount": 23475, + "due": [ + "2026-10-30", + "2026-10-21" + ], + "contract_sha": "48fc8b4c91e70730366edbb99b67647a2df09528", + "case_type": "a1", + "activities": [ + [ + "intake", + "done", + "23.10.2026 · Eigene Webseite", + null + ], + [ + "contact", + "done", + "Gesa Gast", + null + ], + [ + "offer", + "done", + "Version 1 vom 23.10.2026", + null + ], + [ + "acceptance", + "done", + "angenommen am 23.10.2026", + null + ], + [ + "documents", + "done", + "gesendet am 23.10.2026", + null + ], + [ + "deposit", + "done", + "68,25 €, fällig 30.10.2026", + null + ], + [ + "balance", + "waiting", + "234,75 €, fällig 21.10.2026", + null + ], + [ + "arrival_details", + "done", + "bezahlt@example.org", + null + ], + [ + "arrival_info", + "later", + "3 Tage vor Anreise", + null + ], + [ + "stay", + "later", + "18.11.2026 – 21.11.2026", + null + ], + [ + "review", + "later", + null, + null + ], + [ + "closure", + "later", + "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + null + ], + [ + "settlement", + "later", + "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + null + ] + ], + "next": null, + "document_blockers": [] + } + }, + "a1_cancelled": { + "id": 5, + "rows": { + "guests": [ + { + "id": 5, + "first_name": "Gesa", + "last_name": "Gast", + "email": "storno@example.org", + "phone": null, + "street": "Lindenallee 12", + "postal_code": "10115", + "city": "Berlin", + "country": "DE", + "locale": "de", + "notes": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "tags": null, + "marketing_consent_at": null, + "anonymized_at": null, + "tenant_id": 1 + } + ], + "bookings": [ + { + "id": 5, + "reference": "2026-0005", + "property_id": 1, + "guest_id": 5, + "status": "cancelled", + "source": "website", + "arrival": "2026-12-10 00:00:00", + "departure": "2026-12-13 00:00:00", + "guests": 2, + "extras": "[]", + "promo_code": null, + "quote": "{\"arrival\":\"2026-12-10\",\"departure\":\"2026-12-13\",\"nights\":3,\"guests\":2,\"lines\":[{\"type\":\"accommodation\",\"label\":\"Zwischensaison (3 N\\u00e4chte)\",\"quantity\":3,\"unit_price\":6500,\"amount\":19500},{\"type\":\"cleaning\",\"label\":\"Endreinigung & Service\",\"quantity\":1,\"unit_price\":10800,\"amount\":10800}],\"total\":30300,\"deposit\":6825,\"balance\":23475,\"balance_due_on\":\"2026-11-12\",\"discount\":0}", + "total": 30300, + "deposit": 6825, + "balance_due_on": "2026-11-12 00:00:00", + "hold_expires_at": null, + "message": null, + "internal_notes": null, + "confirmed_at": "2026-10-23 18:00:00", + "cancelled_at": "2026-10-23 18:00:00", + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "review_requested_at": null, + "referral_source": null, + "utm_source": null, + "utm_medium": null, + "utm_campaign": null, + "deposit_due_on": "2026-10-30 00:00:00", + "contract_path": "contracts/tenants/1/bookings/5/Mietvertrag-2026-0005.pdf", + "deposit_reminded_at": null, + "balance_requested_at": null, + "balance_reminded_at": null, + "arrival_info_sent_at": null, + "offer_version": 1, + "offer_sent_at": "2026-10-23 18:00:00", + "offer_message": null, + "offer_path": "contracts/tenants/1/bookings/5/Angebot-2026-0005-v1.pdf", + "price_adjustment": null, + "price_adjustment_label": null, + "accepted_at": "2026-10-23 18:00:00", + "acceptance": "{\"offer_version\":1,\"accepted_at\":\"2026-10-23T18:00:00+02:00\",\"offer_sent_at\":\"2026-10-23T18:00:00+02:00\",\"valid_until\":\"2026-10-25T17:00:00+01:00\",\"total\":30300,\"offer_hash\":\"a8caa76b2c89fa87ae9a4b6471046084f65abd25f71de895d51ecb0429e7538a\",\"quote_sha256\":\"9416adb728a10fbd5646ec1f9a3bc0a4b26808b5f2e6bc7e557ef81f1ea92a27\",\"terms_sha256\":\"f18a879fe8b43cdb64e4970841dbe99ddd6cb441ed2ffdeecdc23d97abcd01b9\",\"accept_button\":\"Angebot zahlungspflichtig annehmen\",\"via\":\"offer_link\"}", + "declined_by": null, + "tenant_id": 1, + "import_channel_id": null, + "origin_channel_id": null, + "offer_terms": "{\"captured_at\":\"2026-10-23T18:00:00+02:00\",\"template\":null,\"document\":null,\"annex_ids\":[],\"annexes\":[],\"cancellation_policy\":null,\"property_data\":[],\"texts\":{\"contract.intro\":\"Zwischen Vermieter und Mieter wird folgender Mietvertrag \\u00fcber die Ferienwohnung geschlossen. Der Vertrag kommt zustande, wenn der Mieter das Angebot des Vermieters annimmt.\",\"contract.terms\":\"

Echte Bedingungen<\\/p>\",\"contract.closing\":\"Wir freuen uns auf Ihren Besuch und w\\u00fcnschen Ihnen schon jetzt einen erholsamen Aufenthalt an der Ostsee.\",\"stay.cancellation\":\"

Echtes Storno<\\/p>\",\"stay.house_rules\":null,\"offer.contract_note\":\"Dies ist ein Angebot. Der Mietvertrag wird verbindlich, sobald Sie das Angebot \\u00fcber den Link in unserer E-Mail annehmen.\",\"offer.accept_note\":\"Mit Klick auf den Button nehmen Sie unser Angebot verbindlich an. Damit kommt der Mietvertrag zu den oben genannten Bedingungen zustande und die genannten Zahlungen werden f\\u00e4llig.\",\"offer.accept_button\":\"Angebot zahlungspflichtig annehmen\"},\"deposit_due_days\":7,\"owner\":{\"name\":\"Brigitte Stommer\",\"street\":\"Erbstollen 3\",\"city\":\"44225 Dortmund\",\"phone\":\"0170 8165208\",\"email\":\"fewo@stommer.de\"},\"bank\":{\"account_holder\":null,\"iban\":\"DE02120300000000202051\",\"bic\":null,\"bank_name\":null}}", + "offer_hash": "a8caa76b2c89fa87ae9a4b6471046084f65abd25f71de895d51ecb0429e7538a", + "confirmation_sent_at": "2026-10-23 18:00:00", + "confirmation_failed_at": null, + "offer_pdf_sha256": "a39616da560ea47b0344c25e82ede9d436b6e71d314ef943cbd03fcaf9381e52", + "contract_pdf_sha256": "f2e4c7055e9a4330c500e907e084283338c9c23fa42b6fb0a16b7695b821e9b1", + "portal_reference": null, + "contact_requested_at": null, + "guest_confirmed_at": null, + "archived_at": null, + "intake": "inquiry", + "case_type": "a1", + "profile": "{\"intake\":\"inquiry\",\"case_type\":\"a1\",\"values\":{\"processing\":\"automatic\",\"pre_reservation\":true,\"hold_hours\":48,\"documents\":\"landlord\",\"payments\":\"landlord\",\"guest_messages\":\"landlord\",\"arrival_info_days_before\":3,\"clarification_hold_auto_minutes\":120,\"clarification_hold_manual_minutes\":180,\"data_request_mode\":\"automatic\",\"data_request_reminders_max\":2,\"data_request_followups_max\":2,\"data_request_reminder_hours\":24,\"guest_link_valid_days\":14,\"form_requires_address\":false},\"sources\":{\"processing\":\"tenant\",\"pre_reservation\":\"system\",\"hold_hours\":\"system\",\"documents\":\"system\",\"payments\":\"system\",\"guest_messages\":\"system\",\"arrival_info_days_before\":\"system\",\"clarification_hold_auto_minutes\":\"tenant\",\"clarification_hold_manual_minutes\":\"system\",\"data_request_mode\":\"tenant\",\"data_request_reminders_max\":\"system\",\"data_request_followups_max\":\"system\",\"data_request_reminder_hours\":\"system\",\"guest_link_valid_days\":\"system\",\"form_requires_address\":\"system\"},\"frozen_at\":\"2026-10-23T18:00:00+02:00\",\"origin\":\"intake\"}", + "processing_mode": null, + "internal_kind": null, + "occasion": null, + "export_uid": null, + "tourist_tax_persons": null, + "tourist_tax_note": null, + "portal_cancellation_requested_at": null, + "information_version": 0, + "information_sent_at": null, + "information_valid_until": null, + "information": null, + "wish_at": null, + "wish": null, + "arrival_time": null, + "completed_at": null, + "settled_at": null, + "settled_note": null, + "settled_by": null, + "hold_purpose": "offer" + } + ], + "booking_tasks": [ + { + "id": 1, + "tenant_id": 1, + "booking_id": 5, + "kind": "cancellation_fee", + "status": "open", + "due_on": "2026-10-23 00:00:00", + "note": "Keine Stornoregel hinterlegt – Kosten von Hand festlegen.", + "completed_by": null, + "completed_at": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "subject": "", + "title": null, + "responsible": null + } + ], + "data_requests": [], + "case_amounts": [], + "payments": [], + "cancellations": [ + { + "id": 1, + "tenant_id": 1, + "booking_id": 5, + "cancelled_on": "2026-10-23 00:00:00", + "initiated_by": "landlord", + "has_policy": 0, + "policy_name": null, + "days_before": null, + "percent": null, + "base_amount": null, + "calculated_fee": null, + "final_fee": null, + "paid_amount": 0, + "status": "open", + "note": null, + "settled_at": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "reason": "Gast verhindert", + "recorded_by": "Verwaltung" + } + ], + "booking_changes": [] + }, + "expected": { + "cancellation": { + "today": null, + "arrival_minus_40": null, + "arrival_minus_10": null + }, + "rent": 19500, + "deposit": 6825, + "balance": 23475, + "open_amount": 30300, + "due": [ + "2026-10-30", + "2026-11-12" + ], + "contract_sha": "19828d20d3602a451df82097810debcab4c17041", + "case_type": "a1", + "activities": [ + [ + "intake", + "done", + "23.10.2026 · Eigene Webseite", + null + ], + [ + "contact", + "done", + "Gesa Gast", + null + ], + [ + "offer", + "done", + "Version 1 vom 23.10.2026", + null + ], + [ + "acceptance", + "not_applicable", + "angenommen am 23.10.2026", + null + ], + [ + "documents", + "done", + "gesendet am 23.10.2026", + null + ], + [ + "deposit", + "not_applicable", + "68,25 €, fällig 30.10.2026", + null + ], + [ + "balance", + "not_applicable", + "234,75 €, fällig 12.11.2026", + null + ], + [ + "task_cancellation_fee", + "open", + "fällig 23.10.2026 · Keine Stornoregel hinterlegt – Kosten von Hand festlegen.", + "completeTask" + ], + [ + "arrival_info", + "not_applicable", + "3 Tage vor Anreise", + null + ], + [ + "stay", + "not_applicable", + "10.12.2026 – 13.12.2026", + null + ], + [ + "review", + "not_applicable", + null, + null + ], + [ + "settlement", + "waiting", + "offen: Aufgabe offen: Stornokosten prüfen und abrechnen.", + "settle" + ] + ], + "next": "task_cancellation_fee", + "document_blockers": [] + } + }, + "a1_stay_over": { + "id": 6, + "rows": { + "guests": [ + { + "id": 6, + "first_name": "Gesa", + "last_name": "Gast", + "email": "vorbei@example.org", + "phone": null, + "street": "Lindenallee 12", + "postal_code": "10115", + "city": "Berlin", + "country": "DE", + "locale": "de", + "notes": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "tags": null, + "marketing_consent_at": null, + "anonymized_at": null, + "tenant_id": 1 + } + ], + "bookings": [ + { + "id": 6, + "reference": "2026-0006", + "property_id": 1, + "guest_id": 6, + "status": "confirmed", + "source": "website", + "arrival": "2026-10-26 00:00:00", + "departure": "2026-10-30 00:00:00", + "guests": 2, + "extras": "[]", + "promo_code": null, + "quote": "{\"arrival\":\"2026-10-26\",\"departure\":\"2026-10-30\",\"nights\":4,\"guests\":2,\"lines\":[{\"type\":\"accommodation\",\"label\":\"Nachsaison (4 N\\u00e4chte)\",\"quantity\":4,\"unit_price\":8500,\"amount\":34000},{\"type\":\"cleaning\",\"label\":\"Endreinigung & Service\",\"quantity\":1,\"unit_price\":10800,\"amount\":10800}],\"total\":44800,\"deposit\":11900,\"balance\":32900,\"balance_due_on\":\"2026-09-28\",\"discount\":0}", + "total": 44800, + "deposit": 11900, + "balance_due_on": "2026-09-28 00:00:00", + "hold_expires_at": null, + "message": null, + "internal_notes": null, + "confirmed_at": "2026-10-23 18:00:00", + "cancelled_at": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "review_requested_at": null, + "referral_source": null, + "utm_source": null, + "utm_medium": null, + "utm_campaign": null, + "deposit_due_on": "2026-10-30 00:00:00", + "contract_path": "contracts/tenants/1/bookings/6/Mietvertrag-2026-0006.pdf", + "deposit_reminded_at": null, + "balance_requested_at": null, + "balance_reminded_at": null, + "arrival_info_sent_at": null, + "offer_version": 1, + "offer_sent_at": "2026-10-23 18:00:00", + "offer_message": null, + "offer_path": "contracts/tenants/1/bookings/6/Angebot-2026-0006-v1.pdf", + "price_adjustment": null, + "price_adjustment_label": null, + "accepted_at": "2026-10-23 18:00:00", + "acceptance": "{\"offer_version\":1,\"accepted_at\":\"2026-10-23T18:00:00+02:00\",\"offer_sent_at\":\"2026-10-23T18:00:00+02:00\",\"valid_until\":\"2026-10-25T17:00:00+01:00\",\"total\":44800,\"offer_hash\":\"be1dd311c67085a77da37f45779ed1e8ac0c99c55ed28bb04258dae3e22b0be2\",\"quote_sha256\":\"b51ddcc58265ddcd205e5377f33e94ca17767d2d6f86291110ea4bf5a0f35081\",\"terms_sha256\":\"f18a879fe8b43cdb64e4970841dbe99ddd6cb441ed2ffdeecdc23d97abcd01b9\",\"accept_button\":\"Angebot zahlungspflichtig annehmen\",\"via\":\"offer_link\"}", + "declined_by": null, + "tenant_id": 1, + "import_channel_id": null, + "origin_channel_id": null, + "offer_terms": "{\"captured_at\":\"2026-10-23T18:00:00+02:00\",\"template\":null,\"document\":null,\"annex_ids\":[],\"annexes\":[],\"cancellation_policy\":null,\"property_data\":[],\"texts\":{\"contract.intro\":\"Zwischen Vermieter und Mieter wird folgender Mietvertrag \\u00fcber die Ferienwohnung geschlossen. Der Vertrag kommt zustande, wenn der Mieter das Angebot des Vermieters annimmt.\",\"contract.terms\":\"

Echte Bedingungen<\\/p>\",\"contract.closing\":\"Wir freuen uns auf Ihren Besuch und w\\u00fcnschen Ihnen schon jetzt einen erholsamen Aufenthalt an der Ostsee.\",\"stay.cancellation\":\"

Echtes Storno<\\/p>\",\"stay.house_rules\":null,\"offer.contract_note\":\"Dies ist ein Angebot. Der Mietvertrag wird verbindlich, sobald Sie das Angebot \\u00fcber den Link in unserer E-Mail annehmen.\",\"offer.accept_note\":\"Mit Klick auf den Button nehmen Sie unser Angebot verbindlich an. Damit kommt der Mietvertrag zu den oben genannten Bedingungen zustande und die genannten Zahlungen werden f\\u00e4llig.\",\"offer.accept_button\":\"Angebot zahlungspflichtig annehmen\"},\"deposit_due_days\":7,\"owner\":{\"name\":\"Brigitte Stommer\",\"street\":\"Erbstollen 3\",\"city\":\"44225 Dortmund\",\"phone\":\"0170 8165208\",\"email\":\"fewo@stommer.de\"},\"bank\":{\"account_holder\":null,\"iban\":\"DE02120300000000202051\",\"bic\":null,\"bank_name\":null}}", + "offer_hash": "be1dd311c67085a77da37f45779ed1e8ac0c99c55ed28bb04258dae3e22b0be2", + "confirmation_sent_at": "2026-10-23 18:00:00", + "confirmation_failed_at": null, + "offer_pdf_sha256": "9879d2b2f5f531176a2e52d8d3c0c24630cbf6434106c78d806e08e460754cd0", + "contract_pdf_sha256": "71b7036932dfab7ea6a2cbb209e928c1c177f496d421527b5344384ddb837ba6", + "portal_reference": null, + "contact_requested_at": null, + "guest_confirmed_at": null, + "archived_at": null, + "intake": "inquiry", + "case_type": "a1", + "profile": "{\"intake\":\"inquiry\",\"case_type\":\"a1\",\"values\":{\"processing\":\"automatic\",\"pre_reservation\":true,\"hold_hours\":48,\"documents\":\"landlord\",\"payments\":\"landlord\",\"guest_messages\":\"landlord\",\"arrival_info_days_before\":3,\"clarification_hold_auto_minutes\":120,\"clarification_hold_manual_minutes\":180,\"data_request_mode\":\"automatic\",\"data_request_reminders_max\":2,\"data_request_followups_max\":2,\"data_request_reminder_hours\":24,\"guest_link_valid_days\":14,\"form_requires_address\":false},\"sources\":{\"processing\":\"tenant\",\"pre_reservation\":\"system\",\"hold_hours\":\"system\",\"documents\":\"system\",\"payments\":\"system\",\"guest_messages\":\"system\",\"arrival_info_days_before\":\"system\",\"clarification_hold_auto_minutes\":\"tenant\",\"clarification_hold_manual_minutes\":\"system\",\"data_request_mode\":\"tenant\",\"data_request_reminders_max\":\"system\",\"data_request_followups_max\":\"system\",\"data_request_reminder_hours\":\"system\",\"guest_link_valid_days\":\"system\",\"form_requires_address\":\"system\"},\"frozen_at\":\"2026-10-23T18:00:00+02:00\",\"origin\":\"intake\"}", + "processing_mode": null, + "internal_kind": null, + "occasion": null, + "export_uid": null, + "tourist_tax_persons": null, + "tourist_tax_note": null, + "portal_cancellation_requested_at": null, + "information_version": 0, + "information_sent_at": null, + "information_valid_until": null, + "information": null, + "wish_at": null, + "wish": null, + "arrival_time": null, + "completed_at": null, + "settled_at": null, + "settled_note": null, + "settled_by": null, + "hold_purpose": "offer" + } + ], + "booking_tasks": [], + "data_requests": [], + "case_amounts": [], + "payments": [], + "cancellations": [], + "booking_changes": [] + }, + "expected": { + "cancellation": { + "today": null, + "arrival_minus_40": null, + "arrival_minus_10": null + }, + "rent": 34000, + "deposit": 11900, + "balance": 32900, + "open_amount": 44800, + "due": [ + "2026-10-30", + "2026-09-28" + ], + "contract_sha": "20d05b7e6b65e5f18a0f8f79d98fa41b3407a98d", + "case_type": "a1", + "activities": [ + [ + "intake", + "done", + "23.10.2026 · Eigene Webseite", + null + ], + [ + "contact", + "done", + "Gesa Gast", + null + ], + [ + "offer", + "done", + "Version 1 vom 23.10.2026", + null + ], + [ + "acceptance", + "done", + "angenommen am 23.10.2026", + null + ], + [ + "documents", + "done", + "gesendet am 23.10.2026", + null + ], + [ + "deposit", + "not_applicable", + "119,00 €, fällig 30.10.2026", + null + ], + [ + "balance", + "not_applicable", + "329,00 €, fällig 28.09.2026", + null + ], + [ + "arrival_details", + "done", + "vorbei@example.org", + null + ], + [ + "arrival_info", + "not_applicable", + "3 Tage vor Anreise", + null + ], + [ + "stay", + "done", + "26.10.2026 – 30.10.2026", + null + ], + [ + "review", + "not_applicable", + null, + null + ], + [ + "closure", + "waiting", + "geschieht automatisch über Nacht – oder jetzt von Hand", + "closeStay" + ], + [ + "settlement", + "later", + "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + null + ] + ], + "next": null, + "document_blockers": [] + } + }, + "a2_inquiry": { + "id": 7, + "rows": { + "guests": [], + "bookings": [ + { + "id": 7, + "reference": "2026-0007", + "property_id": 1, + "guest_id": null, + "status": "reserved", + "source": "portal", + "arrival": "2027-03-01 00:00:00", + "departure": "2027-03-05 00:00:00", + "guests": null, + "extras": null, + "promo_code": null, + "quote": null, + "total": null, + "deposit": null, + "balance_due_on": null, + "hold_expires_at": null, + "message": null, + "internal_notes": null, + "confirmed_at": null, + "cancelled_at": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "review_requested_at": null, + "referral_source": null, + "utm_source": null, + "utm_medium": null, + "utm_campaign": null, + "deposit_due_on": null, + "contract_path": null, + "deposit_reminded_at": null, + "balance_requested_at": null, + "balance_reminded_at": null, + "arrival_info_sent_at": null, + "offer_version": 0, + "offer_sent_at": null, + "offer_message": null, + "offer_path": null, + "price_adjustment": null, + "price_adjustment_label": null, + "accepted_at": null, + "acceptance": null, + "declined_by": null, + "tenant_id": 1, + "import_channel_id": null, + "origin_channel_id": 1, + "offer_terms": null, + "offer_hash": null, + "confirmation_sent_at": null, + "confirmation_failed_at": null, + "offer_pdf_sha256": null, + "contract_pdf_sha256": null, + "portal_reference": "HA-ANF", + "contact_requested_at": null, + "guest_confirmed_at": null, + "archived_at": null, + "intake": "inquiry", + "case_type": "a2", + "profile": "{\"intake\":\"inquiry\",\"case_type\":\"a2\",\"values\":{\"processing\":\"automatic\",\"pre_reservation\":true,\"hold_hours\":48,\"documents\":\"landlord\",\"payments\":\"landlord\",\"guest_messages\":\"landlord\",\"arrival_info_days_before\":3,\"clarification_hold_auto_minutes\":120,\"clarification_hold_manual_minutes\":180,\"data_request_mode\":\"automatic\",\"data_request_reminders_max\":2,\"data_request_followups_max\":2,\"data_request_reminder_hours\":24,\"guest_link_valid_days\":14,\"form_requires_address\":false},\"sources\":{\"processing\":\"tenant\",\"pre_reservation\":\"system\",\"hold_hours\":\"system\",\"documents\":\"system\",\"payments\":\"system\",\"guest_messages\":\"system\",\"arrival_info_days_before\":\"system\",\"clarification_hold_auto_minutes\":\"tenant\",\"clarification_hold_manual_minutes\":\"system\",\"data_request_mode\":\"tenant\",\"data_request_reminders_max\":\"system\",\"data_request_followups_max\":\"system\",\"data_request_reminder_hours\":\"system\",\"guest_link_valid_days\":\"system\",\"form_requires_address\":\"system\"},\"frozen_at\":\"2026-10-23T18:00:00+02:00\",\"origin\":\"intake\"}", + "processing_mode": null, + "internal_kind": null, + "occasion": null, + "export_uid": null, + "tourist_tax_persons": null, + "tourist_tax_note": null, + "portal_cancellation_requested_at": null, + "information_version": 0, + "information_sent_at": null, + "information_valid_until": null, + "information": null, + "wish_at": null, + "wish": null, + "arrival_time": null, + "completed_at": null, + "settled_at": null, + "settled_note": null, + "settled_by": null, + "hold_purpose": "clarification" + } + ], + "booking_tasks": [], + "data_requests": [], + "case_amounts": [], + "payments": [], + "cancellations": [], + "booking_changes": [] + }, + "expected": { + "cancellation": { + "today": null, + "arrival_minus_40": null, + "arrival_minus_10": null + }, + "rent": 0, + "deposit": null, + "balance": null, + "open_amount": 0, + "due": [ + null, + null + ], + "contract_sha": null, + "case_type": "a2", + "activities": [ + [ + "intake", + "done", + "23.10.2026 · FeWo-direkt", + null + ], + [ + "contact", + "open", + "fehlt noch", + "provideContact" + ], + [ + "offer", + "later", + "erst wenn alle Angaben da sind", + null + ], + [ + "acceptance", + "later", + null, + null + ], + [ + "documents", + "later", + null, + null + ], + [ + "payment", + "waiting", + "erst möglich, wenn der Preis bekannt ist", + null + ], + [ + "arrival_info", + "later", + "3 Tage vor Anreise", + null + ], + [ + "stay", + "later", + "01.03.2027 – 05.03.2027", + null + ], + [ + "review", + "later", + null, + null + ] + ], + "next": "contact", + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen.", + "Der Gesamtpreis (laut Portal) fehlt." + ] + } + }, + "a3_booking": { + "id": 8, + "rows": { + "guests": [], + "bookings": [ + { + "id": 8, + "reference": "2026-0008", + "property_id": 1, + "guest_id": null, + "status": "confirmed", + "source": "portal", + "arrival": "2027-04-01 00:00:00", + "departure": "2027-04-08 00:00:00", + "guests": 2, + "extras": null, + "promo_code": null, + "quote": "{\"arrival\":\"2027-04-01\",\"departure\":\"2027-04-08\",\"nights\":7,\"guests\":2,\"lines\":[{\"type\":\"accommodation\",\"label\":\"Gesamtpreis laut Portal (Destination Solutions)\",\"quantity\":1,\"unit_price\":98000,\"amount\":98000}],\"total\":98000,\"deposit\":34300,\"balance\":63700,\"balance_due_on\":\"2027-03-04\",\"discount\":0,\"source\":\"portal\"}", + "total": 98000, + "deposit": 34300, + "balance_due_on": "2027-03-04 00:00:00", + "hold_expires_at": null, + "message": null, + "internal_notes": null, + "confirmed_at": "2026-10-23 18:00:00", + "cancelled_at": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "review_requested_at": null, + "referral_source": null, + "utm_source": null, + "utm_medium": null, + "utm_campaign": null, + "deposit_due_on": "2026-10-30 00:00:00", + "contract_path": null, + "deposit_reminded_at": null, + "balance_requested_at": null, + "balance_reminded_at": null, + "arrival_info_sent_at": null, + "offer_version": 0, + "offer_sent_at": null, + "offer_message": null, + "offer_path": null, + "price_adjustment": null, + "price_adjustment_label": null, + "accepted_at": null, + "acceptance": null, + "declined_by": null, + "tenant_id": 1, + "import_channel_id": null, + "origin_channel_id": 2, + "offer_terms": "{\"captured_at\":\"2026-10-23T18:00:00+02:00\",\"template\":null,\"document\":null,\"annex_ids\":[],\"annexes\":[],\"cancellation_policy\":null,\"property_data\":[],\"texts\":{\"contract.intro\":\"Zwischen Vermieter und Mieter wird folgender Mietvertrag \\u00fcber die Ferienwohnung geschlossen. Der Vertrag kommt zustande, wenn der Mieter das Angebot des Vermieters annimmt.\",\"contract.terms\":\"

Echte Bedingungen<\\/p>\",\"contract.closing\":\"Wir freuen uns auf Ihren Besuch und w\\u00fcnschen Ihnen schon jetzt einen erholsamen Aufenthalt an der Ostsee.\",\"stay.cancellation\":\"

Echtes Storno<\\/p>\",\"stay.house_rules\":null,\"offer.contract_note\":\"Dies ist ein Angebot. Der Mietvertrag wird verbindlich, sobald Sie das Angebot \\u00fcber den Link in unserer E-Mail annehmen.\",\"offer.accept_note\":\"Mit Klick auf den Button nehmen Sie unser Angebot verbindlich an. Damit kommt der Mietvertrag zu den oben genannten Bedingungen zustande und die genannten Zahlungen werden f\\u00e4llig.\",\"offer.accept_button\":\"Angebot zahlungspflichtig annehmen\"},\"deposit_due_days\":7,\"owner\":{\"name\":\"Brigitte Stommer\",\"street\":\"Erbstollen 3\",\"city\":\"44225 Dortmund\",\"phone\":\"0170 8165208\",\"email\":\"fewo@stommer.de\"},\"bank\":{\"account_holder\":null,\"iban\":\"DE02120300000000202051\",\"bic\":null,\"bank_name\":null}}", + "offer_hash": null, + "confirmation_sent_at": null, + "confirmation_failed_at": null, + "offer_pdf_sha256": null, + "contract_pdf_sha256": null, + "portal_reference": "DS-1", + "contact_requested_at": null, + "guest_confirmed_at": null, + "archived_at": null, + "intake": "booking", + "case_type": "a3", + "profile": "{\"intake\":\"booking\",\"case_type\":\"a3\",\"values\":{\"processing\":\"automatic\",\"pre_reservation\":true,\"hold_hours\":48,\"documents\":\"landlord\",\"payments\":\"landlord\",\"guest_messages\":\"landlord\",\"arrival_info_days_before\":3,\"clarification_hold_auto_minutes\":120,\"clarification_hold_manual_minutes\":180,\"data_request_mode\":\"automatic\",\"data_request_reminders_max\":2,\"data_request_followups_max\":2,\"data_request_reminder_hours\":24,\"guest_link_valid_days\":14,\"form_requires_address\":false},\"sources\":{\"processing\":\"tenant\",\"pre_reservation\":\"system\",\"hold_hours\":\"system\",\"documents\":\"system\",\"payments\":\"system\",\"guest_messages\":\"system\",\"arrival_info_days_before\":\"system\",\"clarification_hold_auto_minutes\":\"tenant\",\"clarification_hold_manual_minutes\":\"system\",\"data_request_mode\":\"tenant\",\"data_request_reminders_max\":\"system\",\"data_request_followups_max\":\"system\",\"data_request_reminder_hours\":\"system\",\"guest_link_valid_days\":\"system\",\"form_requires_address\":\"system\"},\"frozen_at\":\"2026-10-23T18:00:00+02:00\",\"origin\":\"intake\"}", + "processing_mode": null, + "internal_kind": null, + "occasion": null, + "export_uid": null, + "tourist_tax_persons": null, + "tourist_tax_note": null, + "portal_cancellation_requested_at": null, + "information_version": 0, + "information_sent_at": null, + "information_valid_until": null, + "information": null, + "wish_at": null, + "wish": null, + "arrival_time": null, + "completed_at": null, + "settled_at": null, + "settled_note": null, + "settled_by": null, + "hold_purpose": "offer" + } + ], + "booking_tasks": [], + "data_requests": [], + "case_amounts": [], + "payments": [], + "cancellations": [], + "booking_changes": [] + }, + "expected": { + "cancellation": { + "today": null, + "arrival_minus_40": null, + "arrival_minus_10": null + }, + "rent": 98000, + "deposit": 34300, + "balance": 63700, + "open_amount": 98000, + "due": [ + "2026-10-30", + "2027-03-04" + ], + "contract_sha": "20b72fa9706e04d416166f417c13436a3ba388a6", + "case_type": "a3", + "activities": [ + [ + "intake", + "done", + "23.10.2026 · Destination Solutions", + null + ], + [ + "contact", + "open", + "fehlt noch", + "provideContact" + ], + [ + "binding", + "external", + "Buchungsnummer DS-1", + null + ], + [ + "price", + "done", + "980,00 €", + null + ], + [ + "documents", + "waiting", + "wartet: Name und Kontaktdaten des Gastes fehlen.", + null + ], + [ + "deposit", + "waiting", + "343,00 €, fällig 30.10.2026", + null + ], + [ + "balance", + "later", + "637,00 €, fällig 04.03.2027", + null + ], + [ + "arrival_details", + "later", + "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + null + ], + [ + "arrival_info", + "later", + "3 Tage vor Anreise", + null + ], + [ + "stay", + "later", + "01.04.2027 – 08.04.2027", + null + ], + [ + "review", + "later", + null, + null + ], + [ + "closure", + "later", + "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + null + ], + [ + "settlement", + "later", + "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + null + ] + ], + "next": "contact", + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + } + }, + "a4_portal_payments": { + "id": 9, + "rows": { + "guests": [], + "bookings": [ + { + "id": 9, + "reference": "2026-0009", + "property_id": 1, + "guest_id": null, + "status": "confirmed", + "source": "portal", + "arrival": "2027-07-10 00:00:00", + "departure": "2027-07-17 00:00:00", + "guests": 2, + "extras": null, + "promo_code": null, + "quote": "{\"arrival\":\"2027-07-10\",\"departure\":\"2027-07-17\",\"nights\":7,\"guests\":2,\"lines\":[{\"type\":\"accommodation\",\"label\":\"Gesamtpreis laut Portal (FeWo-direkt)\",\"quantity\":1,\"unit_price\":97951,\"amount\":97951}],\"total\":97951,\"deposit\":34283,\"balance\":63668,\"balance_due_on\":\"2027-06-12\",\"discount\":0,\"source\":\"portal\"}", + "total": 97951, + "deposit": 34283, + "balance_due_on": "2027-06-12 00:00:00", + "hold_expires_at": null, + "message": null, + "internal_notes": null, + "confirmed_at": "2026-10-23 18:00:00", + "cancelled_at": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "review_requested_at": null, + "referral_source": null, + "utm_source": null, + "utm_medium": null, + "utm_campaign": null, + "deposit_due_on": "2026-10-30 00:00:00", + "contract_path": null, + "deposit_reminded_at": null, + "balance_requested_at": null, + "balance_reminded_at": null, + "arrival_info_sent_at": null, + "offer_version": 0, + "offer_sent_at": null, + "offer_message": null, + "offer_path": null, + "price_adjustment": null, + "price_adjustment_label": null, + "accepted_at": null, + "acceptance": null, + "declined_by": null, + "tenant_id": 1, + "import_channel_id": null, + "origin_channel_id": 1, + "offer_terms": "{\"captured_at\":\"2026-10-23T18:00:00+02:00\",\"template\":null,\"document\":null,\"annex_ids\":[],\"annexes\":[],\"cancellation_policy\":null,\"property_data\":[],\"texts\":{\"contract.intro\":\"Zwischen Vermieter und Mieter wird folgender Mietvertrag \\u00fcber die Ferienwohnung geschlossen. Der Vertrag kommt zustande, wenn der Mieter das Angebot des Vermieters annimmt.\",\"contract.terms\":\"

Echte Bedingungen<\\/p>\",\"contract.closing\":\"Wir freuen uns auf Ihren Besuch und w\\u00fcnschen Ihnen schon jetzt einen erholsamen Aufenthalt an der Ostsee.\",\"stay.cancellation\":\"

Echtes Storno<\\/p>\",\"stay.house_rules\":null,\"offer.contract_note\":\"Dies ist ein Angebot. Der Mietvertrag wird verbindlich, sobald Sie das Angebot \\u00fcber den Link in unserer E-Mail annehmen.\",\"offer.accept_note\":\"Mit Klick auf den Button nehmen Sie unser Angebot verbindlich an. Damit kommt der Mietvertrag zu den oben genannten Bedingungen zustande und die genannten Zahlungen werden f\\u00e4llig.\",\"offer.accept_button\":\"Angebot zahlungspflichtig annehmen\"},\"deposit_due_days\":7,\"owner\":{\"name\":\"Brigitte Stommer\",\"street\":\"Erbstollen 3\",\"city\":\"44225 Dortmund\",\"phone\":\"0170 8165208\",\"email\":\"fewo@stommer.de\"},\"bank\":{\"account_holder\":null,\"iban\":\"DE02120300000000202051\",\"bic\":null,\"bank_name\":null}}", + "offer_hash": null, + "confirmation_sent_at": null, + "confirmation_failed_at": null, + "offer_pdf_sha256": null, + "contract_pdf_sha256": null, + "portal_reference": "HA-A4", + "contact_requested_at": null, + "guest_confirmed_at": null, + "archived_at": null, + "intake": "booking", + "case_type": "a4", + "profile": "{\"intake\":\"booking\",\"case_type\":\"a4\",\"values\":{\"processing\":\"automatic\",\"pre_reservation\":true,\"hold_hours\":48,\"documents\":\"landlord\",\"payments\":\"portal\",\"guest_messages\":\"landlord\",\"arrival_info_days_before\":3,\"clarification_hold_auto_minutes\":120,\"clarification_hold_manual_minutes\":180,\"data_request_mode\":\"automatic\",\"data_request_reminders_max\":2,\"data_request_followups_max\":2,\"data_request_reminder_hours\":24,\"guest_link_valid_days\":14,\"form_requires_address\":false},\"sources\":{\"processing\":\"tenant\",\"pre_reservation\":\"system\",\"hold_hours\":\"system\",\"documents\":\"system\",\"payments\":\"channel\",\"guest_messages\":\"system\",\"arrival_info_days_before\":\"system\",\"clarification_hold_auto_minutes\":\"tenant\",\"clarification_hold_manual_minutes\":\"system\",\"data_request_mode\":\"tenant\",\"data_request_reminders_max\":\"system\",\"data_request_followups_max\":\"system\",\"data_request_reminder_hours\":\"system\",\"guest_link_valid_days\":\"system\",\"form_requires_address\":\"system\"},\"frozen_at\":\"2026-10-23T18:00:00+02:00\",\"origin\":\"intake\"}", + "processing_mode": null, + "internal_kind": null, + "occasion": null, + "export_uid": null, + "tourist_tax_persons": null, + "tourist_tax_note": null, + "portal_cancellation_requested_at": null, + "information_version": 0, + "information_sent_at": null, + "information_valid_until": null, + "information": null, + "wish_at": null, + "wish": null, + "arrival_time": null, + "completed_at": null, + "settled_at": null, + "settled_note": null, + "settled_by": null, + "hold_purpose": "offer" + } + ], + "booking_tasks": [], + "data_requests": [], + "case_amounts": [ + { + "id": 1, + "tenant_id": 1, + "booking_id": 9, + "kind": "payout_announced", + "label": null, + "amount": 89469, + "source": "FeWo-direkt", + "stated_on": "2026-10-23 00:00:00", + "due_on": null, + "note": null, + "recorded_by": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00" + } + ], + "payments": [ + { + "id": 2, + "booking_id": 9, + "amount": 39061, + "paid_on": "2026-10-23 00:00:00", + "method": "other", + "note": "laut FeWo-direkt", + "recorded_by": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "tenant_id": 1, + "kind": "guest_via_portal", + "source": "FeWo-direkt" + } + ], + "cancellations": [], + "booking_changes": [] + }, + "expected": { + "cancellation": { + "today": null, + "arrival_minus_40": null, + "arrival_minus_10": null + }, + "rent": 97951, + "deposit": 34283, + "balance": 63668, + "open_amount": 58890, + "due": [ + "2026-10-30", + "2027-06-12" + ], + "contract_sha": "f41dd3d8d73545657737283b65b4615d879dd380", + "case_type": "a4", + "activities": [ + [ + "intake", + "done", + "23.10.2026 · FeWo-direkt", + null + ], + [ + "contact", + "open", + "fehlt noch", + "provideContact" + ], + [ + "binding", + "external", + "Buchungsnummer HA-A4", + null + ], + [ + "price", + "done", + "979,51 €", + null + ], + [ + "documents", + "waiting", + "wartet: Name und Kontaktdaten des Gastes fehlen.", + null + ], + [ + "payment", + "external", + "laut Portal bezahlt: 390,61 € von 979,51 € (Angabe des Portals, kein Geld bei uns)", + null + ], + [ + "payout", + "waiting", + "angekündigt 894,69 € · eingegangen 0,00 €", + null + ], + [ + "arrival_details", + "later", + "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + null + ], + [ + "arrival_info", + "later", + "3 Tage vor Anreise", + null + ], + [ + "stay", + "later", + "10.07.2027 – 17.07.2027", + null + ], + [ + "review", + "later", + null, + null + ], + [ + "closure", + "later", + "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + null + ], + [ + "settlement", + "later", + "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + null + ] + ], + "next": "contact", + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + } + }, + "a5_booking": { + "id": 10, + "rows": { + "guests": [], + "bookings": [ + { + "id": 10, + "reference": "2026-0010", + "property_id": 1, + "guest_id": null, + "status": "confirmed", + "source": "portal", + "arrival": "2027-05-01 00:00:00", + "departure": "2027-05-04 00:00:00", + "guests": null, + "extras": null, + "promo_code": null, + "quote": "{\"arrival\":\"2027-05-01\",\"departure\":\"2027-05-04\",\"nights\":3,\"guests\":0,\"lines\":[{\"type\":\"accommodation\",\"label\":\"Gesamtpreis laut Portal (Portal A5)\",\"quantity\":1,\"unit_price\":60000,\"amount\":60000}],\"total\":60000,\"deposit\":21000,\"balance\":39000,\"balance_due_on\":\"2027-04-03\",\"discount\":0,\"source\":\"portal\"}", + "total": 60000, + "deposit": 21000, + "balance_due_on": "2027-04-03 00:00:00", + "hold_expires_at": null, + "message": null, + "internal_notes": null, + "confirmed_at": "2026-10-23 18:00:00", + "cancelled_at": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "review_requested_at": null, + "referral_source": null, + "utm_source": null, + "utm_medium": null, + "utm_campaign": null, + "deposit_due_on": "2026-10-30 00:00:00", + "contract_path": null, + "deposit_reminded_at": null, + "balance_requested_at": null, + "balance_reminded_at": null, + "arrival_info_sent_at": null, + "offer_version": 0, + "offer_sent_at": null, + "offer_message": null, + "offer_path": null, + "price_adjustment": null, + "price_adjustment_label": null, + "accepted_at": null, + "acceptance": null, + "declined_by": null, + "tenant_id": 1, + "import_channel_id": null, + "origin_channel_id": 3, + "offer_terms": "{\"captured_at\":\"2026-10-23T18:00:00+02:00\",\"template\":null,\"document\":null,\"annex_ids\":[],\"annexes\":[],\"cancellation_policy\":null,\"property_data\":[],\"texts\":{\"contract.intro\":\"Zwischen Vermieter und Mieter wird folgender Mietvertrag \\u00fcber die Ferienwohnung geschlossen. Der Vertrag kommt zustande, wenn der Mieter das Angebot des Vermieters annimmt.\",\"contract.terms\":\"

Echte Bedingungen<\\/p>\",\"contract.closing\":\"Wir freuen uns auf Ihren Besuch und w\\u00fcnschen Ihnen schon jetzt einen erholsamen Aufenthalt an der Ostsee.\",\"stay.cancellation\":\"

Echtes Storno<\\/p>\",\"stay.house_rules\":null,\"offer.contract_note\":\"Dies ist ein Angebot. Der Mietvertrag wird verbindlich, sobald Sie das Angebot \\u00fcber den Link in unserer E-Mail annehmen.\",\"offer.accept_note\":\"Mit Klick auf den Button nehmen Sie unser Angebot verbindlich an. Damit kommt der Mietvertrag zu den oben genannten Bedingungen zustande und die genannten Zahlungen werden f\\u00e4llig.\",\"offer.accept_button\":\"Angebot zahlungspflichtig annehmen\"},\"deposit_due_days\":7,\"owner\":{\"name\":\"Brigitte Stommer\",\"street\":\"Erbstollen 3\",\"city\":\"44225 Dortmund\",\"phone\":\"0170 8165208\",\"email\":\"fewo@stommer.de\"},\"bank\":{\"account_holder\":null,\"iban\":\"DE02120300000000202051\",\"bic\":null,\"bank_name\":null}}", + "offer_hash": null, + "confirmation_sent_at": null, + "confirmation_failed_at": null, + "offer_pdf_sha256": null, + "contract_pdf_sha256": null, + "portal_reference": "P5-1", + "contact_requested_at": null, + "guest_confirmed_at": null, + "archived_at": null, + "intake": "booking", + "case_type": "a5", + "profile": "{\"intake\":\"booking\",\"case_type\":\"a5\",\"values\":{\"processing\":\"automatic\",\"pre_reservation\":true,\"hold_hours\":48,\"documents\":\"portal\",\"payments\":\"portal\",\"guest_messages\":\"portal\",\"arrival_info_days_before\":3,\"clarification_hold_auto_minutes\":120,\"clarification_hold_manual_minutes\":180,\"data_request_mode\":\"automatic\",\"data_request_reminders_max\":2,\"data_request_followups_max\":2,\"data_request_reminder_hours\":24,\"guest_link_valid_days\":14,\"form_requires_address\":false},\"sources\":{\"processing\":\"tenant\",\"pre_reservation\":\"system\",\"hold_hours\":\"system\",\"documents\":\"channel\",\"payments\":\"channel\",\"guest_messages\":\"channel\",\"arrival_info_days_before\":\"system\",\"clarification_hold_auto_minutes\":\"tenant\",\"clarification_hold_manual_minutes\":\"system\",\"data_request_mode\":\"tenant\",\"data_request_reminders_max\":\"system\",\"data_request_followups_max\":\"system\",\"data_request_reminder_hours\":\"system\",\"guest_link_valid_days\":\"system\",\"form_requires_address\":\"system\"},\"frozen_at\":\"2026-10-23T18:00:00+02:00\",\"origin\":\"intake\"}", + "processing_mode": null, + "internal_kind": null, + "occasion": null, + "export_uid": null, + "tourist_tax_persons": null, + "tourist_tax_note": null, + "portal_cancellation_requested_at": null, + "information_version": 0, + "information_sent_at": null, + "information_valid_until": null, + "information": null, + "wish_at": null, + "wish": null, + "arrival_time": null, + "completed_at": null, + "settled_at": null, + "settled_note": null, + "settled_by": null, + "hold_purpose": "offer" + } + ], + "booking_tasks": [], + "data_requests": [], + "case_amounts": [], + "payments": [], + "cancellations": [], + "booking_changes": [] + }, + "expected": { + "cancellation": { + "today": null, + "arrival_minus_40": null, + "arrival_minus_10": null + }, + "rent": 60000, + "deposit": 21000, + "balance": 39000, + "open_amount": 60000, + "due": [ + "2026-10-30", + "2027-04-03" + ], + "contract_sha": "9e4295c2670754095c00917457c63f56ba625c97", + "case_type": "a5", + "activities": [ + [ + "intake", + "done", + "23.10.2026 · Portal A5", + null + ], + [ + "binding", + "external", + "Buchungsnummer P5-1", + null + ], + [ + "price", + "done", + "600,00 €", + null + ], + [ + "documents", + "external", + null, + null + ], + [ + "payment", + "external", + "zieht das Portal ein; noch keine Zahlungsangabe", + null + ], + [ + "payout", + "waiting", + "eingegangen 0,00 €", + null + ], + [ + "arrival_details", + "later", + "es fehlt: Name und Kontakt des Gastes – wird rechtzeitig als Aufgabe gemeldet", + null + ], + [ + "arrival_info", + "external", + "durch Portal A5 (angekündigt) – eine Zustellung ist damit nicht nachgewiesen", + null + ], + [ + "stay", + "later", + "01.05.2027 – 04.05.2027", + null + ], + [ + "closure", + "later", + "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + null + ], + [ + "settlement", + "later", + "nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind", + null + ] + ], + "next": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + } + }, + "a6_private": { + "id": 11, + "rows": { + "guests": [], + "bookings": [ + { + "id": 11, + "reference": "2026-0011", + "property_id": 1, + "guest_id": null, + "status": "confirmed", + "source": "internal", + "arrival": "2027-06-01 00:00:00", + "departure": "2027-06-04 00:00:00", + "guests": null, + "extras": "[]", + "promo_code": null, + "quote": "{\"arrival\":\"2027-06-01\",\"departure\":\"2027-06-04\",\"nights\":3,\"guests\":0,\"lines\":[{\"type\":\"rent\",\"label\":\"Miete (vereinbart)\",\"quantity\":1,\"unit_price\":0,\"amount\":0}],\"total\":0,\"deposit\":0,\"balance\":0,\"balance_due_on\":\"2027-06-01\",\"discount\":0}", + "total": 0, + "deposit": null, + "balance_due_on": null, + "hold_expires_at": null, + "message": null, + "internal_notes": null, + "confirmed_at": "2026-10-23 18:00:00", + "cancelled_at": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "review_requested_at": null, + "referral_source": null, + "utm_source": null, + "utm_medium": null, + "utm_campaign": null, + "deposit_due_on": null, + "contract_path": null, + "deposit_reminded_at": null, + "balance_requested_at": null, + "balance_reminded_at": null, + "arrival_info_sent_at": null, + "offer_version": 0, + "offer_sent_at": null, + "offer_message": null, + "offer_path": null, + "price_adjustment": null, + "price_adjustment_label": null, + "accepted_at": null, + "acceptance": null, + "declined_by": null, + "tenant_id": 1, + "import_channel_id": null, + "origin_channel_id": null, + "offer_terms": null, + "offer_hash": null, + "confirmation_sent_at": null, + "confirmation_failed_at": null, + "offer_pdf_sha256": null, + "contract_pdf_sha256": null, + "portal_reference": null, + "contact_requested_at": null, + "guest_confirmed_at": null, + "archived_at": null, + "intake": "internal", + "case_type": "a6", + "profile": "{\"intake\":\"internal\",\"case_type\":\"a6\",\"values\":{\"processing\":\"automatic\",\"pre_reservation\":true,\"hold_hours\":48,\"documents\":\"none\",\"payments\":\"none\",\"guest_messages\":\"none\",\"arrival_info_days_before\":3,\"clarification_hold_auto_minutes\":120,\"clarification_hold_manual_minutes\":180,\"data_request_mode\":\"automatic\",\"data_request_reminders_max\":2,\"data_request_followups_max\":2,\"data_request_reminder_hours\":24,\"guest_link_valid_days\":14,\"form_requires_address\":false},\"sources\":{\"processing\":\"tenant\",\"pre_reservation\":\"system\",\"hold_hours\":\"system\",\"documents\":\"case_type\",\"payments\":\"case_type\",\"guest_messages\":\"case_type\",\"arrival_info_days_before\":\"system\",\"clarification_hold_auto_minutes\":\"tenant\",\"clarification_hold_manual_minutes\":\"system\",\"data_request_mode\":\"tenant\",\"data_request_reminders_max\":\"system\",\"data_request_followups_max\":\"system\",\"data_request_reminder_hours\":\"system\",\"guest_link_valid_days\":\"system\",\"form_requires_address\":\"system\"},\"frozen_at\":\"2026-10-23T18:00:00+02:00\",\"origin\":\"intake\"}", + "processing_mode": null, + "internal_kind": "private_stay", + "occasion": "Familie", + "export_uid": null, + "tourist_tax_persons": null, + "tourist_tax_note": null, + "portal_cancellation_requested_at": null, + "information_version": 0, + "information_sent_at": null, + "information_valid_until": null, + "information": null, + "wish_at": null, + "wish": null, + "arrival_time": null, + "completed_at": null, + "settled_at": null, + "settled_note": null, + "settled_by": null, + "hold_purpose": "offer" + } + ], + "booking_tasks": [], + "data_requests": [], + "case_amounts": [], + "payments": [], + "cancellations": [], + "booking_changes": [] + }, + "expected": { + "cancellation": { + "today": null, + "arrival_minus_40": null, + "arrival_minus_10": null + }, + "rent": 0, + "deposit": null, + "balance": 0, + "open_amount": 0, + "due": [ + null, + null + ], + "contract_sha": null, + "case_type": "a6", + "activities": [ + [ + "intake", + "done", + "Familie", + null + ], + [ + "stay", + "later", + "01.06.2027 – 04.06.2027", + null + ], + [ + "closure", + "later", + "nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist", + null + ] + ], + "next": null, + "document_blockers": [ + "Name und Kontaktdaten des Gastes fehlen." + ] + } + }, + "legacy_migration_offer": { + "id": 12, + "rows": { + "guests": [ + { + "id": 7, + "first_name": "Gesa", + "last_name": "Gast", + "email": "alt@example.org", + "phone": null, + "street": "Lindenallee 12", + "postal_code": "10115", + "city": "Berlin", + "country": "DE", + "locale": "de", + "notes": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "tags": null, + "marketing_consent_at": null, + "anonymized_at": null, + "tenant_id": 1 + } + ], + "bookings": [ + { + "id": 12, + "reference": "2026-0012", + "property_id": 1, + "guest_id": 7, + "status": "reserved", + "source": "website", + "arrival": "2026-11-24 00:00:00", + "departure": "2026-11-27 00:00:00", + "guests": 2, + "extras": "[]", + "promo_code": null, + "quote": "{\"arrival\":\"2026-11-24\",\"departure\":\"2026-11-27\",\"nights\":3,\"guests\":2,\"lines\":[{\"type\":\"accommodation\",\"label\":\"Zwischensaison (3 N\\u00e4chte)\",\"quantity\":3,\"unit_price\":6500,\"amount\":19500},{\"type\":\"cleaning\",\"label\":\"Endreinigung & Service\",\"quantity\":1,\"unit_price\":10800,\"amount\":10800}],\"total\":30300,\"deposit\":6825,\"balance\":23475,\"balance_due_on\":\"2026-10-27\",\"discount\":0}", + "total": 30300, + "deposit": 6825, + "balance_due_on": "2026-10-27 00:00:00", + "hold_expires_at": "2026-10-25 17:00:00", + "message": null, + "internal_notes": "Automatisches Angebot nicht versendet:\n- FeWo-direkt (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.\n- Destination Solutions (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.\n- Portal A5 (Sofortbuchung) hat unseren Kalender seit der Sperre noch nicht abgerufen.", + "confirmed_at": null, + "cancelled_at": null, + "created_at": "2026-10-23 18:00:00", + "updated_at": "2026-10-23 18:00:00", + "review_requested_at": null, + "referral_source": null, + "utm_source": null, + "utm_medium": null, + "utm_campaign": null, + "deposit_due_on": null, + "contract_path": null, + "deposit_reminded_at": null, + "balance_requested_at": null, + "balance_reminded_at": null, + "arrival_info_sent_at": null, + "offer_version": 0, + "offer_sent_at": null, + "offer_message": null, + "offer_path": null, + "price_adjustment": null, + "price_adjustment_label": null, + "accepted_at": null, + "acceptance": null, + "declined_by": null, + "tenant_id": 1, + "import_channel_id": null, + "origin_channel_id": null, + "offer_terms": null, + "offer_hash": null, + "confirmation_sent_at": null, + "confirmation_failed_at": null, + "offer_pdf_sha256": null, + "contract_pdf_sha256": null, + "portal_reference": null, + "contact_requested_at": null, + "guest_confirmed_at": null, + "archived_at": null, + "intake": "inquiry", + "case_type": "a1", + "profile": "{\"intake\":\"inquiry\",\"case_type\":\"a1\",\"values\":{\"processing\":\"automatic\",\"pre_reservation\":true,\"hold_hours\":48,\"documents\":\"landlord\",\"payments\":\"landlord\",\"guest_messages\":\"landlord\",\"arrival_info_days_before\":3,\"clarification_hold_auto_minutes\":120,\"clarification_hold_manual_minutes\":180,\"data_request_mode\":\"automatic\",\"data_request_reminders_max\":2,\"data_request_followups_max\":2,\"data_request_reminder_hours\":24,\"guest_link_valid_days\":14,\"form_requires_address\":false},\"sources\":{\"processing\":\"tenant\",\"pre_reservation\":\"system\",\"hold_hours\":\"system\",\"documents\":\"system\",\"payments\":\"system\",\"guest_messages\":\"system\",\"arrival_info_days_before\":\"system\",\"clarification_hold_auto_minutes\":\"tenant\",\"clarification_hold_manual_minutes\":\"system\",\"data_request_mode\":\"tenant\",\"data_request_reminders_max\":\"system\",\"data_request_followups_max\":\"system\",\"data_request_reminder_hours\":\"system\",\"guest_link_valid_days\":\"system\",\"form_requires_address\":\"system\"},\"frozen_at\":\"2026-10-23T18:00:00+02:00\",\"origin\":\"migration\"}", + "processing_mode": null, + "internal_kind": null, + "occasion": null, + "export_uid": null, + "tourist_tax_persons": null, + "tourist_tax_note": null, + "portal_cancellation_requested_at": null, + "information_version": 0, + "information_sent_at": null, + "information_valid_until": null, + "information": null, + "wish_at": null, + "wish": null, + "arrival_time": null, + "completed_at": null, + "settled_at": null, + "settled_note": null, + "settled_by": null, + "hold_purpose": "offer" + } + ], + "booking_tasks": [], + "data_requests": [], + "case_amounts": [], + "payments": [], + "cancellations": [], + "booking_changes": [] + }, + "expected": { + "cancellation": { + "today": null, + "arrival_minus_40": null, + "arrival_minus_10": null + }, + "rent": 19500, + "deposit": 6825, + "balance": 23475, + "open_amount": 30300, + "due": [ + null, + "2026-10-27" + ], + "contract_sha": "1a776155606a3c76535649fab96b1ca1a05e031f", + "case_type": "a1", + "activities": [ + [ + "intake", + "done", + "23.10.2026 · Eigene Webseite", + null + ], + [ + "contact", + "done", + "Gesa Gast", + null + ], + [ + "offer", + "open", + "Zeitraum reserviert bis 25.10.2026, 17:00 Uhr", + "sendOffer" + ], + [ + "acceptance", + "later", + null, + null + ], + [ + "documents", + "later", + null, + null + ], + [ + "deposit", + "later", + "68,25 €", + null + ], + [ + "balance", + "later", + "234,75 €, fällig 27.10.2026", + null + ], + [ + "arrival_info", + "later", + "3 Tage vor Anreise", + null + ], + [ + "stay", + "later", + "24.11.2026 – 27.11.2026", + null + ], + [ + "review", + "later", + null, + null + ] + ], + "next": "offer", + "document_blockers": [] + } + } +} diff --git a/tests/Support/Process/BehaviourSnapshot.php b/tests/Support/Process/BehaviourSnapshot.php new file mode 100644 index 0000000..07e67bc --- /dev/null +++ b/tests/Support/Process/BehaviourSnapshot.php @@ -0,0 +1,131 @@ + + */ + public static function of(Booking $booking): array + { + $booking = $booking->fresh(['guest', 'property', 'payments']) ?? $booking; + + return [ + 'activities' => array_map(fn (Activity $activity): array => [ + 'key' => $activity->key, + 'label' => $activity->label, + 'state' => $activity->state->value, + 'detail' => $activity->detail, + 'action' => $activity->action, + ], CaseActivities::for($booking)), + 'next' => CaseActivities::next($booking)?->key, + 'situation' => CaseActivities::situation($booking), + 'state' => [ + 'status' => $booking->status->value, + 'intake' => $booking->intake?->value, + 'case_type' => $booking->case_type?->value, + 'hold_purpose' => $booking->hold_purpose, + 'hold_expires_at' => self::time($booking->hold_expires_at), + 'offer_version' => $booking->offer_version, + 'information_version' => $booking->information_version, + 'offer_sent_at' => self::time($booking->offer_sent_at), + 'confirmed_at' => self::time($booking->confirmed_at), + 'accepted_at' => self::time($booking->accepted_at), + 'confirmation_sent_at' => self::time($booking->confirmation_sent_at), + 'wish_at' => self::time($booking->wish_at), + 'completed_at' => self::time($booking->completed_at), + 'settled_at' => self::time($booking->settled_at), + ], + 'automation' => [ + 'auto_offer_blockers' => $booking->intake?->value !== 'booking' && in_array($booking->status->value, ['reserved'], true) + ? app(AutoOffer::class)->blockers($booking) : null, + 'document_blockers' => app(CaseAutomation::class)->documentBlockers($booking), + ], + 'calendar' => [ + 'occupying' => Booking::query()->occupying()->whereKey($booking->id)->exists(), + 'hold_active' => $booking->isHoldActive(), + 'clarification' => $booking->clarificationState()['state'], + ], + 'price' => [ + 'total' => $booking->total, + 'deposit' => $booking->deposit, + 'lines' => array_map(fn (array $line): array => [$line['type'] ?? null, $line['amount'] ?? null], (array) ($booking->quote['lines'] ?? [])), + 'deposit_due_on' => $booking->deposit_due_on?->toDateString(), + 'balance_due_on' => $booking->balance_due_on?->toDateString(), + ], + 'documents' => [ + 'contract' => $booking->contract_path !== null, + 'terms_template' => $booking->offer_terms['template']['name'] ?? null, + 'cancellation_policy' => $booking->offer_terms['cancellation_policy']['name'] ?? null, + ], + 'communication' => [ + 'messages' => BookingMessage::query()->where('booking_id', $booking->id)->orderBy('id')->get() + ->map(fn (BookingMessage $message): array => [$message->audience, $message->subject])->all(), + 'mails' => self::newMails(), + ], + 'tasks' => BookingTask::query()->where('booking_id', $booking->id)->orderBy('id')->get() + ->map(fn (BookingTask $task): array => [$task->kind->value, $task->status->value])->all(), + 'channel_tasks' => ChannelTask::query()->whereHas('channel', fn ($query) => $query->where('property_id', $booking->property_id))->orderBy('id')->get() + ->map(fn (ChannelTask $task): array => [$task->channel_id, $task->action->value, $task->status->value])->all(), + 'data_requests' => DataRequest::query()->where('booking_id', $booking->id)->orderBy('id')->get() + ->map(fn (DataRequest $request): array => [$request->status, $request->reminders_sent, $request->fields])->all(), + 'events' => BookingEvent::query()->where('booking_id', $booking->id)->orderBy('id')->pluck('type')->all(), + ]; + } + + /** + * Subjects and recipients of the mails sent since the last snapshot. + * + * @return list + */ + private static function newMails(): array + { + $transport = Mail::mailer('array')->getSymfonyTransport(); + if (! $transport instanceof ArrayTransport) { + return []; + } + + $all = $transport->messages()->all(); + $new = array_slice($all, self::$mailsSeen); + self::$mailsSeen = count($all); + + return array_values(array_map(function ($sent): array { + $email = $sent->getOriginalMessage(); + + return [(string) $email->getSubject(), implode(',', array_map(fn ($address): string => $address->getAddress(), $email->getTo()))]; + }, $new)); + } + + private static function time(?CarbonInterface $value): ?string + { + return $value?->format('Y-m-d H:i'); + } +} From 7e22e12cac25fdfbe42bac9e38961876f5f9d9a7 Mon Sep 17 00:00:00 2001 From: Lars Date: Wed, 4 Nov 2026 14:49:44 +0100 Subject: [PATCH 5/9] =?UTF-8?q?U-A/U-B:=20Prozesskern=20mit=20Fachmodulen,?= =?UTF-8?q?=20versionierten=20Modellen,=20eingefrorenem=20Prozessplan,=20P?= =?UTF-8?q?rocessRunner=20(harte/weiche=20Abh=C3=A4ngigkeiten),=20CasePric?= =?UTF-8?q?ing,=20Loyalty=20nur=20im=20Tester?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CaseActivities/CaseAutomation sind Fassaden über ProcessRunner. Verhaltensvergleich v0.11: 11 Abläufe und 198 Konstellationen gleich, beabsichtigte Abweichungen I-004/I-005 (F-001/F-002). Volle Suite vor U-B: 785/785. Co-Authored-By: Claude Opus 5.5 --- app/Actions/CreateReservation.php | 34 +- app/Actions/SendOffer.php | 4 +- app/Actions/SubmitBookingWish.php | 3 +- app/Actions/TakeOverExternalBooking.php | 8 +- .../Commands/SendPendingAutoOffers.php | 8 +- app/Pricing/CasePricing.php | 43 ++ app/Process/AdvanceResult.php | 35 ++ app/Process/CaseActivities.php | 368 +----------------- app/Process/CaseAutomation.php | 49 +-- app/Process/CaseContext.php | 63 +++ app/Process/CaseRecorder.php | 27 +- app/Process/Models/A1InformationModel.php | 41 ++ app/Process/Models/A1OfferModel.php | 52 +++ app/Process/Models/A2InformationModel.php | 47 +++ app/Process/Models/A2OfferModel.php | 47 +++ app/Process/Models/A3PortalBookingModel.php | 50 +++ app/Process/Models/A4PortalBookingModel.php | 50 +++ app/Process/Models/A5PortalBookingModel.php | 50 +++ app/Process/Models/A6InternalModel.php | 62 +++ app/Process/Models/InquiryModel.php | 86 ++++ app/Process/Models/Point.php | 30 ++ app/Process/Models/PortalBookingModel.php | 30 ++ app/Process/Models/ProcessModel.php | 103 +++++ app/Process/Models/Responsibilities.php | 70 ++++ app/Process/Models/Step.php | 26 ++ app/Process/Models/Variant.php | 57 +++ app/Process/Modules/ContributesToPrice.php | 19 + app/Process/Modules/Dependency.php | 29 ++ .../Modules/Intake/AvailabilityCheck.php | 49 +++ app/Process/Modules/Intake/ChannelBlocks.php | 60 +++ .../Modules/Intake/GuestDataRequest.php | 95 +++++ app/Process/Modules/Intake/GuestDetails.php | 84 ++++ app/Process/Modules/Intake/Hold.php | 63 +++ app/Process/Modules/Intake/IntakeRecord.php | 43 ++ app/Process/Modules/Intake/PortalBinding.php | 54 +++ .../Modules/Loyalty/LoyaltyDiscount.php | 69 ++++ .../Modules/Loyalty/LoyaltyStatusCheck.php | 90 +++++ app/Process/Modules/Module.php | 28 ++ app/Process/Modules/ModuleDefinition.php | 72 ++++ app/Process/Modules/Money/InternalPayment.php | 47 +++ .../Modules/Money/PaymentMonitoring.php | 81 ++++ app/Process/Modules/Money/PortalPayout.php | 57 +++ app/Process/Modules/Offer/AnswersRequest.php | 44 +++ app/Process/Modules/Offer/BindingOffer.php | 86 ++++ app/Process/Modules/Offer/Information.php | 86 ++++ app/Process/Modules/Offer/OfferAcceptance.php | 59 +++ app/Process/Modules/ProcessModule.php | 37 ++ app/Process/Modules/RunsAutomatically.php | 30 ++ .../Modules/Settlement/BookingDocuments.php | 116 ++++++ app/Process/Modules/Settlement/CaseTasks.php | 90 +++++ .../Modules/Settlement/ChangeProposal.php | 53 +++ .../Settlement/CommercialSettlement.php | 65 ++++ .../Modules/Settlement/StayClosure.php | 62 +++ .../Modules/Settlement/StayConfirmation.php | 47 +++ app/Process/Modules/Stay/ArrivalDetails.php | 57 +++ .../Modules/Stay/ArrivalInformation.php | 48 +++ app/Process/Modules/Stay/ReviewRequest.php | 49 +++ app/Process/Modules/Stay/Stay.php | 53 +++ app/Process/Modules/StepState.php | 48 +++ app/Process/OutwardSuspension.php | 32 ++ app/Process/ProcessCatalogue.php | 214 ++++++++++ app/Process/ProcessPlan.php | 224 +++++++++++ app/Process/ProcessRunner.php | 197 ++++++++++ app/Process/StepResult.php | 44 +++ app/Providers/AppServiceProvider.php | 2 + config/process.php | 70 ++++ .../Process/LoyaltyArchitectureProofTest.php | 155 ++++++++ tests/Feature/Process/ProcessCoreTest.php | 167 ++++++++ tests/Feature/Process/ProcessRunnerTest.php | 207 ++++++++++ .../process/behaviour/a1_dates_taken.json | 6 +- tests/Fixtures/process/intended.md | 7 +- tests/Fixtures/process/ongoing/cases.json | 2 +- tests/Support/Process/A1WithAddressCheck.php | 49 +++ tests/Support/Process/AddressVerification.php | 77 ++++ tests/Support/Process/FakeModel.php | 62 +++ tests/Support/Process/FakeModule.php | 101 +++++ tests/Support/Process/FakeModuleA.php | 11 + tests/Support/Process/FakeModuleB.php | 11 + tests/Support/Process/FakeModuleC.php | 11 + tests/Support/Process/FakeModuleD.php | 11 + 80 files changed, 4628 insertions(+), 445 deletions(-) create mode 100644 app/Pricing/CasePricing.php create mode 100644 app/Process/AdvanceResult.php create mode 100644 app/Process/CaseContext.php create mode 100644 app/Process/Models/A1InformationModel.php create mode 100644 app/Process/Models/A1OfferModel.php create mode 100644 app/Process/Models/A2InformationModel.php create mode 100644 app/Process/Models/A2OfferModel.php create mode 100644 app/Process/Models/A3PortalBookingModel.php create mode 100644 app/Process/Models/A4PortalBookingModel.php create mode 100644 app/Process/Models/A5PortalBookingModel.php create mode 100644 app/Process/Models/A6InternalModel.php create mode 100644 app/Process/Models/InquiryModel.php create mode 100644 app/Process/Models/Point.php create mode 100644 app/Process/Models/PortalBookingModel.php create mode 100644 app/Process/Models/ProcessModel.php create mode 100644 app/Process/Models/Responsibilities.php create mode 100644 app/Process/Models/Step.php create mode 100644 app/Process/Models/Variant.php create mode 100644 app/Process/Modules/ContributesToPrice.php create mode 100644 app/Process/Modules/Dependency.php create mode 100644 app/Process/Modules/Intake/AvailabilityCheck.php create mode 100644 app/Process/Modules/Intake/ChannelBlocks.php create mode 100644 app/Process/Modules/Intake/GuestDataRequest.php create mode 100644 app/Process/Modules/Intake/GuestDetails.php create mode 100644 app/Process/Modules/Intake/Hold.php create mode 100644 app/Process/Modules/Intake/IntakeRecord.php create mode 100644 app/Process/Modules/Intake/PortalBinding.php create mode 100644 app/Process/Modules/Loyalty/LoyaltyDiscount.php create mode 100644 app/Process/Modules/Loyalty/LoyaltyStatusCheck.php create mode 100644 app/Process/Modules/Module.php create mode 100644 app/Process/Modules/ModuleDefinition.php create mode 100644 app/Process/Modules/Money/InternalPayment.php create mode 100644 app/Process/Modules/Money/PaymentMonitoring.php create mode 100644 app/Process/Modules/Money/PortalPayout.php create mode 100644 app/Process/Modules/Offer/AnswersRequest.php create mode 100644 app/Process/Modules/Offer/BindingOffer.php create mode 100644 app/Process/Modules/Offer/Information.php create mode 100644 app/Process/Modules/Offer/OfferAcceptance.php create mode 100644 app/Process/Modules/ProcessModule.php create mode 100644 app/Process/Modules/RunsAutomatically.php create mode 100644 app/Process/Modules/Settlement/BookingDocuments.php create mode 100644 app/Process/Modules/Settlement/CaseTasks.php create mode 100644 app/Process/Modules/Settlement/ChangeProposal.php create mode 100644 app/Process/Modules/Settlement/CommercialSettlement.php create mode 100644 app/Process/Modules/Settlement/StayClosure.php create mode 100644 app/Process/Modules/Settlement/StayConfirmation.php create mode 100644 app/Process/Modules/Stay/ArrivalDetails.php create mode 100644 app/Process/Modules/Stay/ArrivalInformation.php create mode 100644 app/Process/Modules/Stay/ReviewRequest.php create mode 100644 app/Process/Modules/Stay/Stay.php create mode 100644 app/Process/Modules/StepState.php create mode 100644 app/Process/OutwardSuspension.php create mode 100644 app/Process/ProcessCatalogue.php create mode 100644 app/Process/ProcessPlan.php create mode 100644 app/Process/ProcessRunner.php create mode 100644 app/Process/StepResult.php create mode 100644 config/process.php create mode 100644 tests/Feature/Process/LoyaltyArchitectureProofTest.php create mode 100644 tests/Feature/Process/ProcessCoreTest.php create mode 100644 tests/Feature/Process/ProcessRunnerTest.php create mode 100644 tests/Support/Process/A1WithAddressCheck.php create mode 100644 tests/Support/Process/AddressVerification.php create mode 100644 tests/Support/Process/FakeModel.php create mode 100644 tests/Support/Process/FakeModule.php create mode 100644 tests/Support/Process/FakeModuleA.php create mode 100644 tests/Support/Process/FakeModuleB.php create mode 100644 tests/Support/Process/FakeModuleC.php create mode 100644 tests/Support/Process/FakeModuleD.php diff --git a/app/Actions/CreateReservation.php b/app/Actions/CreateReservation.php index b44dec2..800b584 100644 --- a/app/Actions/CreateReservation.php +++ b/app/Actions/CreateReservation.php @@ -6,6 +6,7 @@ use App\Enums\BookingStatus; use App\Enums\FactSource; use App\Enums\IntakeKind; +use App\Enums\ProcessingMode; use App\Exceptions\ReservationException; use App\Mail\NewReservation; use App\Mail\ReservationReceived; @@ -16,6 +17,7 @@ use App\Pricing\PriceCalculator; use App\Pricing\QuoteException; use App\Pricing\StayRequest; +use App\Process\ProcessRunner; use App\Process\ProcessSettings; use App\Process\RequestHold; use App\Support\Settings; @@ -174,35 +176,27 @@ private function sendMails(Booking $booking): void { $blockers = []; $offerSent = false; + $asked = false; + // The process core answers the request as far as its data allows (Architektur V2, trigger request.created): + // automatic mode sends the offer or information; if details are missing, the data request asks for them + // (and then replaces the receipt) – independently of the offer, which waits for the details. try { - $auto = app(AutoOffer::class); - if ($auto->applies($booking)) { - $blockers = $auto->handle($booking); - $offerSent = $blockers === []; - if (! $offerSent) { - $booking->update(['internal_notes' => trim(($booking->internal_notes ? $booking->internal_notes."\n\n" : '')."Automatisches Angebot nicht versendet:\n- ".implode("\n- ", $blockers))]); - } - $booking->refresh(); + $result = app(ProcessRunner::class)->advance($booking, 'request.created'); + $offerSent = $result->ran('offer.binding') || $result->ran('offer.information'); + $booking->refresh(); + if (! $offerSent && $booking->processingMode() === ProcessingMode::Automatic) { + $blockers = [...$result->reasons('offer.binding'), ...$result->reasons('offer.information')]; + $booking->update(['internal_notes' => trim(($booking->internal_notes ? $booking->internal_notes."\n\n" : '')."Automatisches Angebot nicht versendet:\n- ".implode("\n- ", $blockers))]); } + $asked = $result->ran('guest.data_request') && $booking->openDataRequest()?->last_sent_at !== null; + $booking->refresh(); } catch (Throwable $exception) { Log::warning('Automatisches Angebot fehlgeschlagen', ['booking' => $booking->id, 'exception' => $exception::class]); $blockers = ['Technischer Fehler beim automatischen Angebot – bitte von Hand bearbeiten.']; $offerSent = false; } - // v0.11: details for the offer are missing – the data request asks for them (and then replaces the receipt). - $asked = false; - if (! $offerSent) { - try { - $request = app(RequestCaseData::class)->forNextStep($booking); - $asked = $request?->last_sent_at !== null; - $booking->refresh(); - } catch (Throwable $exception) { - Log::warning('Rückfrage fehlgeschlagen', ['booking' => $booking->id, 'exception' => $exception::class]); - } - } - try { if (! $offerSent && ! $asked && filled($booking->guest?->email)) { Mail::to($booking->guest->email, $booking->guest->full_name)->send(new ReservationReceived($booking)); diff --git a/app/Actions/SendOffer.php b/app/Actions/SendOffer.php index 1fc2587..236bea4 100644 --- a/app/Actions/SendOffer.php +++ b/app/Actions/SendOffer.php @@ -14,6 +14,7 @@ use App\Filament\Resources\Bookings\BookingResource; use App\Mail\OfferMade; use App\Models\Booking; +use App\Pricing\CasePricing; use App\Pricing\PriceCalculator; use App\Pricing\PriceQuote; use App\Pricing\QuoteException; @@ -189,7 +190,8 @@ public function offerUrl(Booking $booking): string */ public function quoteFor(Booking $booking, StayRequest $stay, int $adjustment, string $label): PriceQuote { - $quote = $this->calculator->calculate($booking->property, $stay); + // Extension point BeforePriceFixing (Architektur V2): PriceCalculator plus the lines of contributing modules. + $quote = app(CasePricing::class)->quote($booking, $stay); if ($adjustment === 0) { return $quote; } diff --git a/app/Actions/SubmitBookingWish.php b/app/Actions/SubmitBookingWish.php index 194231c..fc00321 100644 --- a/app/Actions/SubmitBookingWish.php +++ b/app/Actions/SubmitBookingWish.php @@ -21,6 +21,7 @@ use App\Process\CaseAutomation; use App\Process\CaseLog; use App\Process\CaseRequirements; +use App\Process\ProcessRunner; use App\Support\Inbox; use App\Support\Money; use App\Support\Settings; @@ -148,7 +149,7 @@ public function handle(Booking $booking, int $version, ?string $ip = null): stri // v0.11 (B3): the binding confirmation needs every detail – ask the guest for what is missing. if ($outcome === self::PENDING) { - rescue(fn () => app(RequestCaseData::class)->forNextStep($booking->fresh()), report: true); + app(ProcessRunner::class)->advance($booking->fresh(), 'wish'); } return $outcome; diff --git a/app/Actions/TakeOverExternalBooking.php b/app/Actions/TakeOverExternalBooking.php index eeb94c5..68807a2 100644 --- a/app/Actions/TakeOverExternalBooking.php +++ b/app/Actions/TakeOverExternalBooking.php @@ -13,7 +13,7 @@ use App\Models\Guest; use App\Models\Property; use App\Pricing\PortalPrice; -use App\Process\CaseAutomation; +use App\Process\ProcessRunner; use Carbon\CarbonImmutable; use Illuminate\Support\Arr; use Illuminate\Support\Facades\DB; @@ -96,9 +96,9 @@ public function handle(Property $property, Channel $channel, CarbonImmutable $ar return $booking->refresh(); }); - app(CaseAutomation::class)->advance($booking); - // v0.11 (E-036): the booking stays binding; only missing administrative details of a reachable guest are asked for. - rescue(fn () => app(RequestCaseData::class)->forNextStep($booking->fresh()), report: true); + // The process core sends the documents when everything is there (automatic mode); v0.11 (E-036): the booking + // stays binding, only missing administrative details of a reachable guest are asked for. + app(ProcessRunner::class)->advance($booking, 'booking.taken_over'); return $booking->refresh(); } diff --git a/app/Console/Commands/SendPendingAutoOffers.php b/app/Console/Commands/SendPendingAutoOffers.php index bef4684..bd59be1 100644 --- a/app/Console/Commands/SendPendingAutoOffers.php +++ b/app/Console/Commands/SendPendingAutoOffers.php @@ -6,6 +6,7 @@ use App\Enums\BookingStatus; use App\Models\Booking; use App\Models\Tenant; +use App\Process\ProcessRunner; use App\Tenancy\TenantRunner; use Illuminate\Console\Attributes\Description; use Illuminate\Console\Attributes\Signature; @@ -19,9 +20,9 @@ class SendPendingAutoOffers extends Command /** * Execute the console command. */ - public function handle(AutoOffer $autoOffer, TenantRunner $runner): int + public function handle(AutoOffer $autoOffer, TenantRunner $tenants, ProcessRunner $runner): int { - $runner->each(function (Tenant $tenant) use ($autoOffer): void { + $tenants->each(function (Tenant $tenant) use ($autoOffer, $runner): void { $pending = Booking::query() ->where('status', BookingStatus::Reserved) ->where('offer_version', 0) @@ -36,7 +37,8 @@ public function handle(AutoOffer $autoOffer, TenantRunner $runner): int $sent = 0; foreach ($pending as $booking) { try { - $sent += $autoOffer->handle($booking) === [] ? 1 : 0; + $result = $runner->advance($booking, 'schedule:bookings:auto-offers'); + $sent += $result->ran('offer.binding') || $result->ran('offer.information') ? 1 : 0; } catch (Throwable) { // The request stays pending for the landlord; the next run tries again. } diff --git a/app/Pricing/CasePricing.php b/app/Pricing/CasePricing.php new file mode 100644 index 0000000..7a14b17 --- /dev/null +++ b/app/Pricing/CasePricing.php @@ -0,0 +1,43 @@ +calculator->calculate($booking->property, $stay); + if ($booking->isBinding() || ! $booking->exists) { + return $quote; + } + + $context = CaseContext::of($booking); + foreach ($context->plan->moduleKeys() as $key) { + if (! $this->catalogue->hasModule($key) || ! $context->plan->enabled($key)) { + continue; + } + $module = $this->catalogue->module($key); + if (! $module instanceof ContributesToPrice || ! $module->applies($context)) { + continue; + } + foreach ($module->priceLines($context, $quote) as $line) { + $quote = $quote->withLine($line); + } + } + + return $quote; + } +} diff --git a/app/Process/AdvanceResult.php b/app/Process/AdvanceResult.php new file mode 100644 index 0000000..b94b287 --- /dev/null +++ b/app/Process/AdvanceResult.php @@ -0,0 +1,35 @@ + */ + public array $ran = []; + + /** @var array> module key => reasons */ + public array $held = []; + + public function ran(string $module): bool + { + return in_array($module, $this->ran, true); + } + + /** + * Reasons of one step, or of all steps that were held back. + * + * @return list + */ + public function reasons(?string $module = null): array + { + if ($module !== null) { + return $this->held[$module] ?? []; + } + + return array_values(array_unique(array_merge(...array_values($this->held ?: [[]])))); + } +} diff --git a/app/Process/CaseActivities.php b/app/Process/CaseActivities.php index d842187..8dd893d 100644 --- a/app/Process/CaseActivities.php +++ b/app/Process/CaseActivities.php @@ -3,26 +3,9 @@ namespace App\Process; use App\Actions\EndInternalCase; -use App\Actions\PrepareStays; -use App\Actions\SendBookingDocuments; -use App\Availability\AvailabilityChecker; -use App\Enums\ActivityState; use App\Enums\BookingStatus; -use App\Enums\BookingTaskKind; -use App\Enums\BookingTaskStatus; -use App\Enums\ChangeStatus; -use App\Enums\ChannelTaskStatus; use App\Enums\IntakeKind; -use App\Enums\InternalKind; -use App\Enums\ProcessingMode; -use App\Enums\Responsibility; -use App\Filament\Resources\ChannelTasks\ChannelTaskResource; use App\Models\Booking; -use App\Models\BookingTask; -use App\Models\ChannelTask; -use App\Models\DataRequest; -use App\Pricing\CaseMoney; -use App\Support\Money; use Carbon\CarbonImmutable; /** @@ -39,341 +22,13 @@ class CaseActivities private const URGENT = ['task_portal_cancel_reported', 'task_portal_change_reported', 'task_portal_cancellation']; /** + * The activities of the case in the order of its frozen process plan (ProcessRunner, Architektur V2). + * * @return list */ public static function for(Booking $booking): array { - $booking->loadMissing(['guest', 'property', 'payments']); - $profile = $booking->process(); - $closed = in_array($booking->status, [BookingStatus::Cancelled, BookingStatus::Declined, BookingStatus::Expired], true); - $binding = $booking->isBinding(); - $inquiry = $booking->intake !== IntakeKind::Booking; - $today = CarbonImmutable::today(); - // After the end of a case (or of its stay) what was not done before is no longer to do; open money and other - // follow-ups are tasks and the commercial closing of their own (package 9). - // A stay whose departure has passed counts as over for the steps before it, too. - $over = $closed || $booking->status === BookingStatus::Completed || ($binding && $booking->departure->isBefore($today)); - $later = fn (ActivityState $state): ActivityState => $over && ! in_array($state, [ActivityState::Done, ActivityState::External], true) ? ActivityState::NotApplicable : $state; - $activities = []; - - if ($booking->isInternal()) { - return self::internal($booking, $closed, $later); - } - - $activities[] = new Activity('intake', $inquiry ? 'Anfrage eingegangen' : 'Buchung beim Portal eingegangen', ActivityState::Done, $booking->created_at?->format('d.m.Y').' · '.$booking->bookingChannelLabel()); - - $needsContact = $inquiry || $profile->documents() === Responsibility::Landlord || $profile->guestMessages() === Responsibility::Landlord || $profile->payments() === Responsibility::Landlord; - if ($needsContact) { - $hasEmail = filled($booking->guest?->email); - // v0.11 (G2a): before the own binding offer – or the binding confirmation of a wish – every required detail. - $action = $profile->preReservation() || $booking->offer_version > 0 ? CaseRequirements::OFFER : CaseRequirements::WISH_CONFIRMATION; - $needsDetails = $inquiry && ! $binding && $booking->offer_version === 0 && ($action === CaseRequirements::OFFER || $booking->wish_at !== null); - $missing = $hasEmail && $needsDetails ? CaseRequirements::missing($booking, $action) : []; - $request = $booking->openDataRequest(); - $asked = $booking->contact_requested_at !== null || $request?->status === DataRequest::OPEN; - $state = match (true) { - $hasEmail && $missing === [] => ActivityState::Done, - $asked => ActivityState::Waiting, - default => ActivityState::Open, - }; - $title = match (true) { - $booking->guest === null => 'Name und Kontaktdaten des Gastes eintragen', - ! $hasEmail => 'E-Mail-Adresse des Gastes eintragen', - $missing !== [] => $action === CaseRequirements::OFFER ? 'Angaben für das Angebot vervollständigen' : 'Angaben für die Bestätigung vervollständigen', - default => 'Kontaktdaten des Gastes', - }; - $detail = match (true) { - $state === ActivityState::Done => $booking->guestName(), - $missing !== [] => 'fehlt: '.implode(', ', CaseRequirements::labels($missing)).($request !== null ? ' · '.$request->statusLabel() : ($asked ? ' · beim Gast angefragt' : '')), - $booking->contact_requested_at !== null => 'beim Gast erfragt am '.$booking->contact_requested_at->format('d.m.Y'), - default => 'fehlt noch', - }; - // A prepared data request waits for the landlord's release: that is the next step, otherwise entering the details. - $draft = $needsDetails && $request?->status === DataRequest::DRAFT; - $activities[] = new Activity('contact', $title, $later($draft ? ActivityState::Open : $state), $detail, $state === ActivityState::Done ? null : ($draft ? 'approveDataRequest' : 'provideContact')); - } - - if ($inquiry && ! $profile->preReservation() && $booking->offer_version === 0) { - // Package 7: a request without a hold is answered with an information "unter Vorbehalt"; the guest asks for the booking. - $informed = $booking->information_version > 0 || $binding; - $activities[] = new Activity('information', $booking->processingMode() === ProcessingMode::Automatic ? 'Unverbindliche Auskunft senden (automatisch)' : 'Unverbindliche Auskunft prüfen und senden', $later(match (true) { - $booking->information_version > 0 => ActivityState::Done, - $binding => ActivityState::NotApplicable, - $booking->status === BookingStatus::Reserved && filled($booking->guest?->email) => ActivityState::Open, - default => ActivityState::Later, - }), $booking->information_version > 0 ? 'Version '.$booking->information_version.' vom '.$booking->information_sent_at?->format('d.m.Y').' · ohne Reservierung' : 'der Zeitraum wird nicht reserviert', $informed ? null : 'sendInformation'); - - $activities[] = new Activity('wish', 'Gast fragt die Buchung an', $later(match (true) { - $booking->wish_at !== null => ActivityState::Done, - $binding => ActivityState::NotApplicable, - $booking->information_version > 0 && $booking->information_valid_until?->isFuture() => ActivityState::Waiting, - default => ActivityState::Later, - }), match (true) { - $booking->wish_at !== null => 'angefragt am '.$booking->wish_at->format('d.m.Y, H:i').' Uhr', - $booking->information_version > 0 => 'möglich bis '.$booking->information_valid_until?->format('d.m.Y, H:i').' Uhr', - default => null, - }); - $activities[] = new Activity('wish_check', 'Erneut prüfen und verbindlich bestätigen', $later(match (true) { - $binding => ActivityState::Done, - $booking->wish_at !== null && $booking->status === BookingStatus::Reserved => ActivityState::Waiting, - default => ActivityState::Later, - }), match (true) { - $booking->accepted_at !== null && ($booking->acceptance['via'] ?? null) === 'booking_wish' => 'bestätigt am '.$booking->confirmed_at?->format('d.m.Y').' ('.($booking->acceptance['confirmed_by'] ?? '').')', - $booking->wish_at !== null && $booking->status === BookingStatus::Reserved => 'siehe Aufgabe „Buchungswunsch bestätigen?“', - $binding => 'direkt verbindlich bestätigt (ohne Buchungswunsch)', - default => $booking->processingMode() === ProcessingMode::Automatic ? 'automatisch, wenn alles passt' : 'durch Sie', - }); - } elseif ($inquiry) { - $offerDone = $booking->offer_version > 0 || $binding; - // G2a (v0.11): without every required detail there is no offer – the step waits for the guest's answer - // (mail, link or the landlord's entry) instead of being offered as the next step. - $offerMissing = $offerDone ? [] : CaseRequirements::missing($booking, CaseRequirements::OFFER); - $activities[] = new Activity('offer', $booking->processingMode() === ProcessingMode::Automatic ? 'Angebot senden (automatisch)' : 'Angebot prüfen und senden', $later(match (true) { - $offerDone => ActivityState::Done, - $offerMissing !== [] => ActivityState::Later, - $booking->status === BookingStatus::Reserved && filled($booking->guest?->email) => ActivityState::Open, - default => ActivityState::Later, - }), match (true) { - $booking->offer_version > 0 => 'Version '.$booking->offer_version.' vom '.$booking->offer_sent_at?->format('d.m.Y'), - $offerMissing !== [] => 'erst wenn alle Angaben da sind', - $booking->hold_expires_at !== null => 'Zeitraum reserviert bis '.$booking->hold_expires_at->format('d.m.Y, H:i').' Uhr', - default => null, - }, $offerDone || $offerMissing !== [] ? null : 'sendOffer'); - - $activities[] = new Activity('acceptance', 'Gast nimmt das Angebot an', $later(match (true) { - $binding => ActivityState::Done, - $booking->status === BookingStatus::OfferSent => ActivityState::Waiting, - default => ActivityState::Later, - }), match (true) { - $booking->accepted_at !== null => 'angenommen am '.$booking->accepted_at->format('d.m.Y'), - $binding => 'direkt bestätigt', - $booking->status === BookingStatus::OfferSent => 'Angebot gültig bis '.$booking->hold_expires_at?->format('d.m.Y, H:i').' Uhr', - default => null, - }); - } else { - $activities[] = new Activity('binding', 'Beim Portal fest gebucht', $binding || $closed ? ActivityState::External : ActivityState::Open, $booking->portal_reference ? 'Buchungsnummer '.$booking->portal_reference : null, $binding ? null : 'confirm'); - $activities[] = new Activity('price', 'Gesamtpreis laut Portal eintragen', $later($booking->total === null ? ActivityState::Open : ActivityState::Done), $booking->total === null ? 'noch nicht bekannt' : Money::format($booking->total), $booking->total === null ? 'portalPrice' : null); - } - - if ($profile->documents() === Responsibility::Portal) { - $activities[] = new Activity('documents', 'Buchungsunterlagen an den Gast', ActivityState::External); - } else { - $state = match (true) { - $booking->confirmation_sent_at !== null => ActivityState::Done, - ! $binding => ActivityState::Later, - $booking->confirmation_failed_at !== null => ActivityState::Problem, - default => ActivityState::Open, - }; - $missing = $binding && $state === ActivityState::Open ? app(CaseAutomation::class)->documentBlockers($booking) : []; - // What the landlord still has to confirm (unreleased texts, terms not shown to be agreed on the portal). - $toConfirm = $binding && $state === ActivityState::Open && $missing === [] ? app(SendBookingDocuments::class)->compose($booking)->toConfirm() : []; - $activities[] = new Activity('documents', match (true) { - $state !== ActivityState::Open => $inquiry ? 'Buchungsbestätigung mit Vertrag senden' : 'Buchungsunterlagen an den Gast senden', - $inquiry => 'Buchungsbestätigung mit Vertrag prüfen und senden', - default => 'Buchungsunterlagen prüfen und senden', - }, $later($missing !== [] ? ActivityState::Waiting : $state), - match (true) { - $booking->confirmation_sent_at !== null => 'gesendet am '.$booking->confirmation_sent_at->format('d.m.Y'), - $state === ActivityState::Problem => 'Versand fehlgeschlagen', - $missing !== [] => 'wartet: '.implode(' ', $missing), - $toConfirm !== [] => 'vor dem Versand zu prüfen: '.implode(' ', $toConfirm), - default => null, - }, match (true) { - $state === ActivityState::Problem => 'resendConfirmation', - $binding && $missing === [] && $booking->confirmation_sent_at === null => 'sendDocuments', - default => null, - }); - } - - foreach (self::channelTasks($booking) as $task) { - $activities[] = new Activity('channel_block', ($task->action->value === 'block' ? 'In ' : 'Freigeben in ').$task->channel?->name.($task->action->value === 'block' ? ' sperren' : ''), $task->status === ChannelTaskStatus::Open ? ActivityState::Open : ActivityState::Done, $task->period().' · '.$task->proofLabel(), url: ChannelTaskResource::getUrl()); - } - - if ($profile->payments() === Responsibility::Portal) { - $portal = $booking->processChannel()?->name ?? 'das Portal'; - $viaPortal = $booking->paidViaPortal(); - $activities[] = new Activity('payment', 'Zahlung des Gastes an '.$portal, ActivityState::External, match (true) { - $booking->total === null => 'zieht das Portal ein', - $viaPortal > 0 => 'laut Portal bezahlt: '.Money::format($viaPortal).' von '.Money::format($booking->total).' (Angabe des Portals, kein Geld bei uns)', - default => 'zieht das Portal ein; noch keine Zahlungsangabe', - }); - $payout = CaseMoney::of($booking)->payout(); - $activities[] = new Activity('payout', 'Auszahlung von '.$portal.' auf unser Konto', $later(match (true) { - ! $binding => ActivityState::Later, - $payout['received'] > 0 && ($payout['outstanding'] ?? 0) === 0 && $payout['difference'] === 0 => ActivityState::Done, - default => ActivityState::Waiting, - }), trim(($payout['values'] !== [] ? 'angekündigt '.implode(' bzw. ', array_map(fn (int $value): string => Money::format($value), $payout['values'])).' · ' : '').'eingegangen '.Money::format($payout['received']).($payout['difference'] > 0 ? ' · Angaben weichen um '.Money::format($payout['difference']).' ab' : ''))); - } elseif ($booking->total === null) { - $activities[] = new Activity('payment', 'Zahlungen überwachen', $later(ActivityState::Waiting), 'erst möglich, wenn der Preis bekannt ist'); - } else { - $paid = $booking->paidAmount(); - $activities[] = new Activity('deposit', 'Anzahlung erhalten', $later(match (true) { - $binding && $paid >= (int) $booking->deposit => ActivityState::Done, - $binding => ActivityState::Waiting, - default => ActivityState::Later, - }), Money::format((int) $booking->deposit).($booking->deposit_due_on ? ', fällig '.$booking->deposit_due_on->format('d.m.Y') : '')); - $activities[] = new Activity('balance', 'Restzahlung erhalten', $later(match (true) { - $binding && $paid >= $booking->total => ActivityState::Done, - $binding && $paid >= (int) $booking->deposit => ActivityState::Waiting, - default => ActivityState::Later, - }), Money::format(max(0, $booking->total - (int) $booking->deposit)).($booking->balance_due_on ? ', fällig '.$booking->balance_due_on->format('d.m.Y') : '')); - } - - foreach (self::tasks($booking) as $task) { - $activities[] = self::task($task); - } - - foreach ($booking->changes()->where('status', ChangeStatus::Proposed)->get() as $change) { - $activities[] = new Activity('change_proposed', 'Änderungsvorschlag liegt beim Gast', ActivityState::Waiting, $change->summary().($change->expires_at ? ' · bis '.$change->expires_at->format('d.m.Y') : '')); - } - - $arrived = $binding && $booking->arrival <= $today; - $left = $binding && $booking->departure <= $today; - $missing = PrepareStays::missingArrivalDetails($booking); - $detailsTask = BookingTask::query()->where('booking_id', $booking->id)->where('kind', BookingTaskKind::ArrivalDetails)->where('status', BookingTaskStatus::Open)->exists(); - if ($binding && ! $detailsTask) { - $activities[] = new Activity('arrival_details', 'Anreisedaten', $later(match (true) { - $missing === [] => ActivityState::Done, - $left => ActivityState::NotApplicable, - default => ActivityState::Later, - }), $missing === [] ? implode(' · ', array_filter([$booking->guest?->phone ?: $booking->guest?->email, $booking->arrival_time ? 'Anreise '.$booking->arrival_time : null])) : 'es fehlt: '.implode(', ', $missing).' – wird rechtzeitig als Aufgabe gemeldet'); - } - $activities[] = $profile->guestMessages() === Responsibility::Portal - ? new Activity('arrival_info', 'Anreise-Informationen an den Gast', ActivityState::External, 'durch '.($booking->processChannel()?->name ?? 'das Portal').' (angekündigt) – eine Zustellung ist damit nicht nachgewiesen') - : new Activity('arrival_info', 'Anreise-Informationen an den Gast (automatisch)', $later($booking->arrival_info_sent_at !== null ? ActivityState::Done : ActivityState::Later), $booking->arrival_info_sent_at ? 'gesendet am '.$booking->arrival_info_sent_at->format('d.m.Y') : $profile->arrivalInfoDaysBefore().' Tage vor Anreise'); - // v0.11: a binding booking (also from a portal) stays binding; missing administrative details are asked for - // alongside, after the steps of the booking itself. - if ($binding && ($bookingRequest = $booking->openDataRequest()) !== null) { - $activities[] = new Activity('data_request', 'Fehlende Angaben beim Gast anfragen', $later($bookingRequest->status === DataRequest::OPEN ? ActivityState::Waiting : ActivityState::Open), - implode(', ', CaseRequirements::labels($bookingRequest->fields)).' · '.$bookingRequest->statusLabel(), $bookingRequest->status === DataRequest::OPEN ? null : 'approveDataRequest'); - } - $activities[] = new Activity('stay', 'Aufenthalt', $later(match (true) { - $left => ActivityState::Done, - $arrived => ActivityState::Waiting, - default => ActivityState::Later, - }), $booking->arrival->format('d.m.Y').' – '.$booking->departure->format('d.m.Y')); - if ($profile->guestMessages() === Responsibility::Landlord) { - $activities[] = new Activity('review', 'Bitte um eine Bewertung (automatisch)', $later($booking->review_requested_at !== null ? ActivityState::Done : ActivityState::Later)); - } - - return [...$activities, ...self::closing($booking, $closed)]; - } - - /** - * The two closings of a case (package 9): the stay, and the money. - * - * @return list - */ - private static function closing(Booking $booking, bool $closed): array - { - $today = CarbonImmutable::today(); - $completed = $booking->status === BookingStatus::Completed; - $activities = []; - - if (! $closed && ($booking->isBinding() || $completed)) { - $blockers = $booking->isBinding() && ! $completed ? CaseClosure::stayBlockers($booking) : collect(); - $activities[] = new Activity('closure', $booking->isInternal() && $booking->internal_kind === InternalKind::Block ? 'Sperrzeit abschließen' : 'Aufenthalt abschließen', match (true) { - $completed => ActivityState::Done, - ! $booking->isBinding() || $booking->departure > $today => ActivityState::Later, - default => ActivityState::Waiting, - }, match (true) { - $completed => 'abgeschlossen am '.($booking->completed_at ?? $booking->updated_at)?->format('d.m.Y'), - $blockers->isNotEmpty() => 'wartet auf: '.$blockers->map(fn (BookingTask $task): string => $task->label())->implode(', '), - $booking->isBinding() && $booking->departure <= $today => 'geschieht automatisch über Nacht – oder jetzt von Hand', - default => 'nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist', - }, $booking->isBinding() && ! $completed && $booking->departure <= $today ? 'closeStay' : null); - } - - $settlementApplies = $completed || $booking->status === BookingStatus::Cancelled; - if ($settlementApplies || ($booking->isBinding() && ! $booking->isInternal()) || ($booking->isInternal() && (int) $booking->total > 0)) { - $points = $settlementApplies && $booking->settled_at === null ? CaseClosure::commercialPoints($booking) : []; - $activities[] = new Activity('settlement', 'Kaufmännisch abschließen', match (true) { - $booking->settled_at !== null => ActivityState::Done, - ! $settlementApplies => ActivityState::Later, - default => ActivityState::Waiting, - }, match (true) { - $booking->settled_at !== null => 'abgeschlossen am '.$booking->settled_at->format('d.m.Y').($booking->settled_by && $booking->settled_by !== CaseClosure::AUTOMATIC ? ' von '.$booking->settled_by : '').($booking->settled_note ? ' · '.$booking->settled_note : ''), - ! $settlementApplies => 'nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind', - default => 'offen: '.implode(' ', $points), - }, $settlementApplies && $booking->settled_at === null && $points !== [] ? 'settle' : null); - } - - return $activities; - } - - /** - * The tasks shown on the case: every open one, and the done ones of the stay (services, issues, follow-ups) as its record. - * - * @return iterable - */ - private static function tasks(Booking $booking): iterable - { - return BookingTask::query()->where('booking_id', $booking->id) - ->where(fn ($query) => $query->where('status', BookingTaskStatus::Open) - ->orWhere(fn ($done) => $done->where('status', BookingTaskStatus::Done)->whereIn('kind', [BookingTaskKind::Service, BookingTaskKind::Issue, BookingTaskKind::FollowUp, BookingTaskKind::PayoutCheck, BookingTaskKind::OpenClaim]))) - ->orderByRaw('due_on is null')->orderBy('due_on')->orderBy('id')->get(); - } - - /** - * Own use, private stay or block (A6): only what such a case has – no contract, no reminders, no reviews. - * - * @param callable(ActivityState): ActivityState $later - * @return list - */ - private static function internal(Booking $booking, bool $closed, callable $later): array - { - $kind = $booking->internal_kind; - $activities = [new Activity('intake', ($kind?->getLabel() ?? 'Eigene Belegung').' eingetragen', ActivityState::Done, $booking->occasion)]; - - foreach (self::channelTasks($booking) as $task) { - $activities[] = new Activity('channel_block', ($task->action->value === 'block' ? 'In ' : 'Freigeben in ').$task->channel?->name.($task->action->value === 'block' ? ' sperren' : ''), $task->status === ChannelTaskStatus::Open ? ActivityState::Open : ActivityState::Done, $task->period().' · '.$task->proofLabel(), url: ChannelTaskResource::getUrl()); - } - - if ($kind !== InternalKind::Block && filled($booking->guest?->email)) { - $activities[] = new Activity('documents', 'Aufenthaltsbestätigung an die Gäste (optional)', $later($booking->confirmation_sent_at !== null ? ActivityState::Done : ActivityState::Later), - $booking->confirmation_sent_at ? 'gesendet am '.$booking->confirmation_sent_at->format('d.m.Y') : 'nur bei Bedarf', $booking->confirmation_sent_at === null && ! $closed ? 'sendDocuments' : null); - } - if ($booking->total !== null && $booking->total > 0) { - $paid = $booking->paidAmount(); - $activities[] = new Activity('payment', 'Zahlung (ohne Erinnerungen)', $later($paid >= $booking->total ? ActivityState::Done : ActivityState::Later), Money::format($paid).' von '.Money::format($booking->total).' bezahlt'); - } - foreach (self::tasks($booking) as $task) { - $activities[] = self::task($task); - } - $activities[] = new Activity('stay', $kind === InternalKind::Block ? 'Sperrzeit' : 'Aufenthalt', $closed ? ActivityState::NotApplicable : ($booking->departure <= CarbonImmutable::today() ? ActivityState::Done : ActivityState::Later), $booking->arrival->format('d.m.Y').' – '.$booking->departure->format('d.m.Y')); - - return [...$activities, ...self::closing($booking, $closed)]; - } - - /** - * An open task of the case and the action that settles it. - */ - private static function task(BookingTask $task): Activity - { - $action = match ($task->kind) { - BookingTaskKind::PortalCancellation, BookingTaskKind::PortalCancellationReported => 'confirmPortalCancellation', - BookingTaskKind::PortalChangeReported => 'change', - BookingTaskKind::BookingWish => 'decideWish', - BookingTaskKind::ArrivalDetails => 'arrivalDetails', - BookingTaskKind::CancellationRequest => 'end', - BookingTaskKind::FactConflict => 'provideContact', - default => $task->kind->isPayment() ? null : 'completeTask', - }; - $today = CarbonImmutable::today(); - $state = match (true) { - $task->status === BookingTaskStatus::Done => ActivityState::Done, - $task->kind === BookingTaskKind::PayoutCheck && $task->due_on?->isAfter($today) => ActivityState::Waiting, - $task->kind === BookingTaskKind::Service && $task->due_on?->isAfter($today) => ActivityState::Later, - $task->kind === BookingTaskKind::BookingWish && $task->booking !== null && ! app(AvailabilityChecker::class)->isAvailable($task->booking->property, $task->booking->arrival, $task->booking->departure, ignore: $task->booking) => ActivityState::Problem, - // v0.11 (B3): the binding confirmation waits for the missing details as well. - $task->kind === BookingTaskKind::BookingWish && $task->booking !== null && CaseRequirements::missing($task->booking, CaseRequirements::WISH_CONFIRMATION) !== [] => ActivityState::Waiting, - default => ActivityState::Open, - }; - $detail = $task->status === BookingTaskStatus::Done - ? 'erledigt am '.$task->completed_at?->format('d.m.Y').($task->completed_by ? ' von '.$task->completed_by : '').($task->note ? ' · '.$task->note : '') - : trim(($state === ActivityState::Problem ? 'Achtung: Der Zeitraum ist inzwischen belegt – bitte absagen. · ' : '').($task->due_on ? 'fällig '.$task->due_on->format('d.m.Y') : '').($task->responsible ? ' · zuständig: '.$task->responsible : '').($task->note ? ' · '.$task->note : ''), ' ·'); - - return new Activity('task_'.$task->kind->value, $task->label(), $state, $detail, $state === ActivityState::Done ? null : $action); + return app(ProcessRunner::class)->activities($booking); } /** @@ -439,21 +94,4 @@ public static function situation(Booking $booking): string return implode(' · ', array_filter([$kind, $state, $when])); } - - /** - * Portal tasks for the dates of this case (block when it starts occupying, unblock when it ends). - * - * @return iterable - */ - private static function channelTasks(Booking $booking): iterable - { - return ChannelTask::query() - ->with('channel') - ->whereHas('channel', fn ($query) => $query->where('property_id', $booking->property_id)) - ->whereDate('starts_on', $booking->arrival) - ->whereDate('ends_on', $booking->departure) - ->where('status', '!=', ChannelTaskStatus::Dismissed) - ->orderBy('id') - ->get(); - } } diff --git a/app/Process/CaseAutomation.php b/app/Process/CaseAutomation.php index fa7d3cc..5f50c52 100644 --- a/app/Process/CaseAutomation.php +++ b/app/Process/CaseAutomation.php @@ -2,61 +2,24 @@ namespace App\Process; -use App\Actions\AutoOffer; -use App\Actions\SendBookingDocuments; -use App\Enums\BookingStatus; -use App\Enums\IntakeKind; -use App\Enums\ProcessingMode; -use App\Enums\Responsibility; use App\Models\Booking; -use Throwable; /** - * Carries a case on by itself as far as its data allows – only when the case is handled automatically. What it may do - * is what the landlord would do next anyway: send the offer of a request, or send the documents of a binding booking - * once their composition is complete and needs no confirmation (template released and, for portal bookings, confirmed - * as the portal's terms). Whatever stops it is returned in plain - * words; the case then shows it as a task. Never touches a case whose profile was taken over from the old data (the - * automation did not exist for those cases before). + * Facade of the process core (ProcessRunner, trigger 'automation') for the places that carry a case on after new + * facts, portal amounts or the landlord's "continue automatically": only what the landlord would do next anyway and + * only when the case is handled automatically – the offer or information of a request, the documents of a binding + * booking (never for cases taken over from the old data). Whatever stops it is returned in plain words. */ class CaseAutomation { - public function __construct(private AutoOffer $autoOffer, private SendBookingDocuments $documents) {} + public function __construct(private ProcessRunner $runner) {} /** * @return list what keeps the case from going on automatically (empty: nothing to do or done) */ public function advance(Booking $booking): array { - $booking->loadMissing(['guest', 'property']); - - if ($booking->processingMode() !== ProcessingMode::Automatic) { - return []; - } - - try { - return CaseLog::context(fn (): array => $this->step($booking), actor: CaseLog::SYSTEM.' (automatisch)'); - } catch (Throwable $exception) { - report($exception); - - return ['Technischer Fehler beim automatischen Weiterbearbeiten – bitte von Hand fortsetzen.']; - } - } - - /** - * @return list - */ - private function step(Booking $booking): array - { - if ($booking->status === BookingStatus::Reserved && $booking->offer_version === 0 && $booking->information_version === 0 && $booking->intake !== IntakeKind::Booking) { - return $this->autoOffer->handle($booking); - } - - if ($booking->isBinding() && $booking->confirmation_sent_at === null && $booking->process()->documents() === Responsibility::Landlord && $booking->process()->origin !== 'migration') { - return $this->documents->automatically($booking); - } - - return []; + return $this->runner->advance($booking, ProcessRunner::AUTOMATION)->reasons(); } /** diff --git a/app/Process/CaseContext.php b/app/Process/CaseContext.php new file mode 100644 index 0000000..30b4930 --- /dev/null +++ b/app/Process/CaseContext.php @@ -0,0 +1,63 @@ +loadMissing(['guest', 'property', 'payments']); + $this->profile = $booking->process(); + $this->closed = in_array($booking->status, [BookingStatus::Cancelled, BookingStatus::Declined, BookingStatus::Expired], true); + $this->binding = $booking->isBinding(); + $this->inquiry = $booking->intake !== IntakeKind::Booking; + $this->today = CarbonImmutable::today(); + $this->over = $this->closed || $booking->status === BookingStatus::Completed || ($this->binding && $booking->departure->isBefore($this->today)); + } + + public static function of(Booking $booking): self + { + return new self($booking, ProcessPlan::of($booking)); + } + + /** + * The central rule of the case's end (package 9): after it, an open step is no longer to do – unless it is done + * (by us or externally). Modules apply it where the step belongs to the case's own course. + */ + public function later(ActivityState $state): ActivityState + { + return $this->over && ! in_array($state, [ActivityState::Done, ActivityState::External], true) ? ActivityState::NotApplicable : $state; + } + + /** + * A parameter of a module as frozen in the plan (null when the plan does not set it). + */ + public function parameter(string $module, string $name): mixed + { + return $this->plan->parameter($module, $name); + } +} diff --git a/app/Process/CaseRecorder.php b/app/Process/CaseRecorder.php index 5715cfd..b4a64c3 100644 --- a/app/Process/CaseRecorder.php +++ b/app/Process/CaseRecorder.php @@ -4,9 +4,12 @@ use App\Enums\BookingStatus; use App\Models\Booking; +use App\Models\Channel; use App\Models\Guest; +use App\Models\Property; use App\Models\Tenant; use App\Support\Settings; +use DomainException; /** * Model hooks of a case: freezes the process profile when the case comes in (and again when what defines it – intake @@ -30,10 +33,32 @@ public static function freeze(Booking $booking): void $booking->intake ??= ProcessSettings::intakeFor($booking); $profile = app(ProcessSettings::class)->forBooking($booking)->withOrigin($booking->exists ? 'changed' : 'intake'); - $booking->profile = $profile->toArray(); + // Architektur V2: the process plan (model, variant, module versions, step settings) is frozen with the profile. + try { + $plan = ProcessPlan::freeze($profile, ProcessPlan::configurationOf(self::configurationChannel($booking), $profile->intake)); + } catch (DomainException $exception) { + // Never lose an incoming case over its configuration (e.g. a tester-only variant): it follows the derived plan. + report($exception); + $plan = ProcessPlan::derive($profile); + } + $booking->profile = [...$profile->toArray(), 'plan' => $plan->toArray()]; $booking->case_type = $profile->caseType; } + /** + * The channel whose configuration (Kanal › Ablauf) applies to the case: its portal, or the own website's entry. + */ + private static function configurationChannel(Booking $booking): ?Channel + { + $channel = $booking->processChannel(); + if ($channel === null && $booking->source === 'website' && $booking->property_id !== null) { + $property = $booking->property ?? Property::withoutGlobalScope('tenant')->find($booking->property_id); + $channel = $property === null ? null : Channel::existingWebsiteOf($property); + } + + return $channel; + } + public static function created(Booking $booking): void { CaseLog::record($booking, 'created', 'Vorgang angelegt: '.$booking->caseType()->getLabel().' ('.$booking->bookingChannelLabel().')', data: [ diff --git a/app/Process/Models/A1InformationModel.php b/app/Process/Models/A1InformationModel.php new file mode 100644 index 0000000..c769cf9 --- /dev/null +++ b/app/Process/Models/A1InformationModel.php @@ -0,0 +1,41 @@ + false]; + } +} diff --git a/app/Process/Models/A1OfferModel.php b/app/Process/Models/A1OfferModel.php new file mode 100644 index 0000000..c67a786 --- /dev/null +++ b/app/Process/Models/A1OfferModel.php @@ -0,0 +1,52 @@ + true]; + } + + public function variants(): array + { + return [ + Variant::make('standard', 'Angebot mit Vorreservierung'), + Variant::make('loyalty', 'Angebot mit Stammgastrabatt (Architekturnachweis, nur im Prozess-Tester)') + ->testerOnly() + ->insert(Point::AfterGuestIdentified, 'guest.loyalty_status') + ->insert(Point::BeforePriceFixing, 'pricing.loyalty_discount'), + ]; + } +} diff --git a/app/Process/Models/A2InformationModel.php b/app/Process/Models/A2InformationModel.php new file mode 100644 index 0000000..31fa024 --- /dev/null +++ b/app/Process/Models/A2InformationModel.php @@ -0,0 +1,47 @@ + false]; + } + + protected static function guestMessageOptions(): array + { + return [Responsibility::Landlord, Responsibility::Portal]; + } +} diff --git a/app/Process/Models/A2OfferModel.php b/app/Process/Models/A2OfferModel.php new file mode 100644 index 0000000..52c5689 --- /dev/null +++ b/app/Process/Models/A2OfferModel.php @@ -0,0 +1,47 @@ + true]; + } + + protected static function guestMessageOptions(): array + { + return [Responsibility::Landlord, Responsibility::Portal]; + } +} diff --git a/app/Process/Models/A3PortalBookingModel.php b/app/Process/Models/A3PortalBookingModel.php new file mode 100644 index 0000000..d988301 --- /dev/null +++ b/app/Process/Models/A3PortalBookingModel.php @@ -0,0 +1,50 @@ + Responsibility::Portal, 'collection' => Responsibility::Landlord, 'contract_documents' => Responsibility::Landlord], + variable: ['guest_messages' => [Responsibility::Landlord], 'supplementary_documents' => [Responsibility::Landlord, Responsibility::Nobody], 'local_services' => [Responsibility::Landlord]], + ); + } + + public static function fixes(): array + { + return ['payments' => 'landlord', 'documents' => 'landlord']; + } +} diff --git a/app/Process/Models/A4PortalBookingModel.php b/app/Process/Models/A4PortalBookingModel.php new file mode 100644 index 0000000..ae42984 --- /dev/null +++ b/app/Process/Models/A4PortalBookingModel.php @@ -0,0 +1,50 @@ + Responsibility::Portal, 'collection' => Responsibility::Portal, 'contract_documents' => Responsibility::Landlord], + variable: ['guest_messages' => [Responsibility::Landlord, Responsibility::Portal], 'supplementary_documents' => [Responsibility::Landlord, Responsibility::Nobody], 'local_services' => [Responsibility::Landlord]], + ); + } + + public static function fixes(): array + { + return ['payments' => 'portal', 'documents' => 'landlord']; + } +} diff --git a/app/Process/Models/A5PortalBookingModel.php b/app/Process/Models/A5PortalBookingModel.php new file mode 100644 index 0000000..46ad106 --- /dev/null +++ b/app/Process/Models/A5PortalBookingModel.php @@ -0,0 +1,50 @@ + Responsibility::Portal, 'collection' => Responsibility::Portal, 'contract_documents' => Responsibility::Portal], + variable: ['guest_messages' => [Responsibility::Portal, Responsibility::Landlord], 'supplementary_documents' => [Responsibility::Nobody, Responsibility::Landlord], 'local_services' => [Responsibility::Landlord]], + ); + } + + public static function fixes(): array + { + return ['payments' => 'portal', 'documents' => 'portal']; + } +} diff --git a/app/Process/Models/A6InternalModel.php b/app/Process/Models/A6InternalModel.php new file mode 100644 index 0000000..a80ae84 --- /dev/null +++ b/app/Process/Models/A6InternalModel.php @@ -0,0 +1,62 @@ + Responsibility::Landlord, 'collection' => Responsibility::Landlord, 'contract_documents' => Responsibility::Landlord], + variable: [ + 'guest_messages' => static::guestMessageOptions(), + 'supplementary_documents' => [Responsibility::Landlord, Responsibility::Nobody], + 'local_services' => [Responsibility::Landlord], + ], + ); + } + + /** + * Who may write to the guest: ourselves; via an intermediary also its messaging. + * + * @return list + */ + protected static function guestMessageOptions(): array + { + return [Responsibility::Landlord]; + } + + public function steps(): array + { + return [ + Step::module('intake.record'), + Step::module('guest.details'), + Step::point(Point::AfterGuestIdentified), + Step::module('hold'), + Step::module('availability.check'), + Step::module('offer.information'), + Step::point(Point::BeforePriceFixing), + Step::module('offer.binding'), + Step::point(Point::BeforeBindingOffer), + Step::module('offer.acceptance'), + Step::point(Point::AfterBinding), + ...self::bindingCourse(), + ]; + } + + /** + * What follows once a case is binding – shared with the portal bookings. + * + * @return list + */ + public static function bindingCourse(): array + { + return [ + Step::module('documents.send'), + Step::module('channels.block'), + Step::module('payments.monitor'), + Step::module('portal.payout'), + Step::module('case.tasks'), + Step::module('change.proposal'), + Step::module('arrival.details'), + Step::module('arrival.info'), + Step::module('guest.data_request'), + Step::point(Point::BeforeStay), + Step::module('stay'), + Step::module('review.request'), + Step::point(Point::BeforeSettlement), + Step::module('case.closure'), + Step::module('case.settlement'), + ]; + } +} diff --git a/app/Process/Models/Point.php b/app/Process/Models/Point.php new file mode 100644 index 0000000..ac1a95b --- /dev/null +++ b/app/Process/Models/Point.php @@ -0,0 +1,30 @@ + 'nach der Identifikation des Gastes', + self::BeforePriceFixing => 'vor der Preisfestlegung', + self::BeforeBindingOffer => 'vor dem verbindlichen Angebot', + self::AfterBinding => 'nach der Verbindlichkeit', + self::BeforeStay => 'vor dem Aufenthalt', + self::BeforeSettlement => 'vor dem Abschluss', + }; + } +} diff --git a/app/Process/Models/PortalBookingModel.php b/app/Process/Models/PortalBookingModel.php new file mode 100644 index 0000000..ced270a --- /dev/null +++ b/app/Process/Models/PortalBookingModel.php @@ -0,0 +1,30 @@ + */ + abstract public static function caseTypes(): array; + + /** @return list */ + abstract public static function intakes(): array; + + abstract public static function responsibilities(): Responsibilities; + + /** @return list */ + abstract public function steps(): array; + + /** + * Settings the model fixes for its cases (e.g. the pre-reservation of the offer model). + * + * @return array + */ + public static function fixes(): array + { + return []; + } + + /** + * @return list + */ + public function variants(): array + { + return [Variant::make('standard', 'Standard')]; + } + + public function variant(string $key): ?Variant + { + foreach ($this->variants() as $variant) { + if ($variant->key === $key) { + return $variant; + } + } + + return null; + } + + /** + * The modules of the course in order, with the variant's modules at their points. + * + * @return list + */ + public function modules(?string $variant = 'standard'): array + { + $chosen = $this->variant($variant ?? 'standard'); + $modules = []; + foreach ($this->steps() as $step) { + if ($step->isPoint()) { + array_push($modules, ...($chosen?->modulesAt($step->point) ?? [])); + } else { + $modules[] = $step->module; + } + } + + return $modules; + } + + /** + * @return list + */ + public function points(): array + { + return array_values(array_map(fn (Step $step): Point => $step->point, array_filter($this->steps(), fn (Step $step): bool => $step->isPoint()))); + } + + public static function reference(): string + { + return static::key().'@'.static::version(); + } + + /** Whether the model fixes the setting (the configurator shows it, but not as a choice). */ + public static function fixesSetting(ProcessSetting $setting): bool + { + return array_key_exists($setting->value, static::fixes()); + } +} diff --git a/app/Process/Models/Responsibilities.php b/app/Process/Models/Responsibilities.php new file mode 100644 index 0000000..40e3277 --- /dev/null +++ b/app/Process/Models/Responsibilities.php @@ -0,0 +1,70 @@ + ProcessSetting::Payments, + 'contract_documents' => ProcessSetting::Documents, + 'guest_messages' => ProcessSetting::GuestMessages, + ]; + + public const LABELS = [ + 'contract' => 'Vertragsabschluss', + 'collection' => 'Inkasso (Geld des Gastes)', + 'contract_documents' => 'Vertragsdokumentation', + 'supplementary_documents' => 'Ergänzende Gastunterlagen', + 'guest_messages' => 'Gastkommunikation und Anreiseinformation', + 'local_services' => 'Lokale Leistungen', + ]; + + /** + * @param array $fixed + * @param array> $variable + */ + private function __construct(public readonly array $fixed, public readonly array $variable) {} + + /** + * @param array $fixed + * @param array> $variable + */ + public static function of(array $fixed, array $variable = []): self + { + return new self($fixed, $variable); + } + + public function isFixed(string $field): bool + { + return array_key_exists($field, $this->fixed); + } + + /** + * The values the configurator may offer for a field (one value when the model fixes it). + * + * @return list + */ + public function allowed(string $field): array + { + return $this->isFixed($field) ? [$this->fixed[$field]] : ($this->variable[$field] ?? []); + } + + /** + * Whether a setting value fits the model (used by the configurator and by the plausibility check of a plan). + */ + public function admits(ProcessSetting $setting, Responsibility $value): bool + { + $field = array_search($setting, self::SETTINGS, true); + + return $field === false || $this->allowed($field) === [] || in_array($value, $this->allowed($field), true); + } +} diff --git a/app/Process/Models/Step.php b/app/Process/Models/Step.php new file mode 100644 index 0000000..9bf065f --- /dev/null +++ b/app/Process/Models/Step.php @@ -0,0 +1,26 @@ +point !== null; + } +} diff --git a/app/Process/Models/Variant.php b/app/Process/Models/Variant.php new file mode 100644 index 0000000..0c06d33 --- /dev/null +++ b/app/Process/Models/Variant.php @@ -0,0 +1,57 @@ +> point value => module keys */ + private array $inserts = []; + + private bool $testerOnly = false; + + private function __construct(public readonly string $key, public readonly string $label) {} + + public static function make(string $key, string $label): self + { + return new self($key, $label); + } + + public function insert(Point $point, string $module): self + { + $this->inserts[$point->value][] = $module; + + return $this; + } + + public function testerOnly(): self + { + $this->testerOnly = true; + + return $this; + } + + public function isTesterOnly(): bool + { + return $this->testerOnly; + } + + /** + * @return list + */ + public function modulesAt(Point $point): array + { + return $this->inserts[$point->value] ?? []; + } + + /** + * @return array> + */ + public function inserts(): array + { + return $this->inserts; + } +} diff --git a/app/Process/Modules/ContributesToPrice.php b/app/Process/Modules/ContributesToPrice.php new file mode 100644 index 0000000..26951b0 --- /dev/null +++ b/app/Process/Modules/ContributesToPrice.php @@ -0,0 +1,19 @@ + lines to add (empty: no contribution) + */ + public function priceLines(CaseContext $case, PriceQuote $quote): array; +} diff --git a/app/Process/Modules/Dependency.php b/app/Process/Modules/Dependency.php new file mode 100644 index 0000000..7990e1f --- /dev/null +++ b/app/Process/Modules/Dependency.php @@ -0,0 +1,29 @@ +inquiry && ! $case->binding; + } + + public function activities(CaseContext $case): array + { + return []; + } + + public function state(CaseContext $case): ?StepState + { + $booking = $case->booking; + + return app(AvailabilityChecker::class)->isAvailable($booking->property, $booking->arrival, $booking->departure, ignore: $booking) ? StepState::Done : StepState::Problem; + } +} diff --git a/app/Process/Modules/Intake/ChannelBlocks.php b/app/Process/Modules/Intake/ChannelBlocks.php new file mode 100644 index 0000000..3967b8f --- /dev/null +++ b/app/Process/Modules/Intake/ChannelBlocks.php @@ -0,0 +1,60 @@ +booking; + + return ChannelTask::query() + ->with('channel') + ->whereHas('channel', fn ($query) => $query->where('property_id', $booking->property_id)) + ->whereDate('starts_on', $booking->arrival) + ->whereDate('ends_on', $booking->departure) + ->where('status', '!=', ChannelTaskStatus::Dismissed) + ->orderBy('id') + ->get() + ->map(fn (ChannelTask $task): Activity => new Activity('channel_block', ($task->action->value === 'block' ? 'In ' : 'Freigeben in ').$task->channel?->name.($task->action->value === 'block' ? ' sperren' : ''), $task->status === ChannelTaskStatus::Open ? ActivityState::Open : ActivityState::Done, $task->period().' · '.$task->proofLabel(), url: ChannelTaskResource::getUrl())) + ->all(); + } + + /** Listed on its own in the work list; it never holds another step back. */ + public function state(CaseContext $case): ?StepState + { + return null; + } +} diff --git a/app/Process/Modules/Intake/GuestDataRequest.php b/app/Process/Modules/Intake/GuestDataRequest.php new file mode 100644 index 0000000..38d52da --- /dev/null +++ b/app/Process/Modules/Intake/GuestDataRequest.php @@ -0,0 +1,95 @@ +binding ? $case->booking->openDataRequest() : null; + if ($request === null) { + return []; + } + + return [new Activity('data_request', 'Fehlende Angaben beim Gast anfragen', $case->later($request->status === DataRequest::OPEN ? ActivityState::Waiting : ActivityState::Open), + implode(', ', CaseRequirements::labels($request->fields)).' · '.$request->statusLabel(), $request->status === DataRequest::OPEN ? null : 'approveDataRequest')]; + } + + public function state(CaseContext $case): ?StepState + { + $request = $case->booking->openDataRequest(); + + return match (true) { + $request === null => RequestCaseData::needs($case->booking) === null ? StepState::Done : StepState::Open, + $request->status === DataRequest::OPEN => StepState::Waiting, + default => StepState::Open, + }; + } + + public function due(CaseContext $case): bool + { + return RequestCaseData::needs($case->booking) !== null && $case->booking->openDataRequest() === null; + } + + public function blockers(CaseContext $case): array + { + return CaseRequirements::isValid('guest.email', $case->booking->guest?->email) ? [] : ['Die E-Mail-Adresse des Gastes fehlt.']; + } + + public function run(CaseContext $case): StepResult + { + $request = app(RequestCaseData::class)->forNextStep($case->booking); + + return $request === null ? StepResult::blocked(['Nichts anzufragen.']) : StepResult::ran(); + } + + public function isOutward(): bool + { + return false; + } +} diff --git a/app/Process/Modules/Intake/GuestDetails.php b/app/Process/Modules/Intake/GuestDetails.php new file mode 100644 index 0000000..6f60963 --- /dev/null +++ b/app/Process/Modules/Intake/GuestDetails.php @@ -0,0 +1,84 @@ +profile; + + return $case->inquiry || $profile->documents() === Responsibility::Landlord || $profile->guestMessages() === Responsibility::Landlord || $profile->payments() === Responsibility::Landlord; + } + + public function activities(CaseContext $case): array + { + $booking = $case->booking; + $profile = $case->profile; + $hasEmail = filled($booking->guest?->email); + // v0.11 (G2a): before the own binding offer – or the binding confirmation of a wish – every required detail. + $action = $profile->preReservation() || $booking->offer_version > 0 ? CaseRequirements::OFFER : CaseRequirements::WISH_CONFIRMATION; + $needsDetails = $case->inquiry && ! $case->binding && $booking->offer_version === 0 && ($action === CaseRequirements::OFFER || $booking->wish_at !== null); + $missing = $hasEmail && $needsDetails ? CaseRequirements::missing($booking, $action) : []; + $request = $booking->openDataRequest(); + $asked = $booking->contact_requested_at !== null || $request?->status === DataRequest::OPEN; + $state = match (true) { + $hasEmail && $missing === [] => ActivityState::Done, + $asked => ActivityState::Waiting, + default => ActivityState::Open, + }; + $title = match (true) { + $booking->guest === null => 'Name und Kontaktdaten des Gastes eintragen', + ! $hasEmail => 'E-Mail-Adresse des Gastes eintragen', + $missing !== [] => $action === CaseRequirements::OFFER ? 'Angaben für das Angebot vervollständigen' : 'Angaben für die Bestätigung vervollständigen', + default => 'Kontaktdaten des Gastes', + }; + $detail = match (true) { + $state === ActivityState::Done => $booking->guestName(), + $missing !== [] => 'fehlt: '.implode(', ', CaseRequirements::labels($missing)).($request !== null ? ' · '.$request->statusLabel() : ($asked ? ' · beim Gast angefragt' : '')), + $booking->contact_requested_at !== null => 'beim Gast erfragt am '.$booking->contact_requested_at->format('d.m.Y'), + default => 'fehlt noch', + }; + // A prepared data request waits for the landlord's release: that is the next step, otherwise entering the details. + $draft = $needsDetails && $request?->status === DataRequest::DRAFT; + + return [new Activity('contact', $title, $case->later($draft ? ActivityState::Open : $state), $detail, $state === ActivityState::Done ? null : ($draft ? 'approveDataRequest' : 'provideContact'))]; + } +} diff --git a/app/Process/Modules/Intake/Hold.php b/app/Process/Modules/Intake/Hold.php new file mode 100644 index 0000000..d09f05b --- /dev/null +++ b/app/Process/Modules/Intake/Hold.php @@ -0,0 +1,63 @@ +inquiry && $case->profile->preReservation(); + } + + /** The hold has no line of its own: the offer step and the situation show it. */ + public function activities(CaseContext $case): array + { + return []; + } + + public function state(CaseContext $case): ?StepState + { + $booking = $case->booking; + + return match (true) { + $booking->isHoldActive() => StepState::Waiting, + $booking->hold_expires_at === null && $booking->hold_purpose === Booking::HOLD_CLARIFICATION => StepState::NotApplicable, + default => StepState::Done, + }; + } +} diff --git a/app/Process/Modules/Intake/IntakeRecord.php b/app/Process/Modules/Intake/IntakeRecord.php new file mode 100644 index 0000000..929ec62 --- /dev/null +++ b/app/Process/Modules/Intake/IntakeRecord.php @@ -0,0 +1,43 @@ +booking; + if ($booking->isInternal()) { + return [new Activity('intake', ($booking->internal_kind?->getLabel() ?? 'Eigene Belegung').' eingetragen', ActivityState::Done, $booking->occasion)]; + } + + return [new Activity('intake', $case->inquiry ? 'Anfrage eingegangen' : 'Buchung beim Portal eingegangen', ActivityState::Done, $booking->created_at?->format('d.m.Y').' · '.$booking->bookingChannelLabel())]; + } +} diff --git a/app/Process/Modules/Intake/PortalBinding.php b/app/Process/Modules/Intake/PortalBinding.php new file mode 100644 index 0000000..e46bd4b --- /dev/null +++ b/app/Process/Modules/Intake/PortalBinding.php @@ -0,0 +1,54 @@ +inquiry; + } + + public function activities(CaseContext $case): array + { + $booking = $case->booking; + + return [ + new Activity('binding', 'Beim Portal fest gebucht', $case->binding || $case->closed ? ActivityState::External : ActivityState::Open, $booking->portal_reference ? 'Buchungsnummer '.$booking->portal_reference : null, $case->binding ? null : 'confirm'), + new Activity('price', 'Gesamtpreis laut Portal eintragen', $case->later($booking->total === null ? ActivityState::Open : ActivityState::Done), $booking->total === null ? 'noch nicht bekannt' : Money::format($booking->total), $booking->total === null ? 'portalPrice' : null), + ]; + } +} diff --git a/app/Process/Modules/Loyalty/LoyaltyDiscount.php b/app/Process/Modules/Loyalty/LoyaltyDiscount.php new file mode 100644 index 0000000..9b0756c --- /dev/null +++ b/app/Process/Modules/Loyalty/LoyaltyDiscount.php @@ -0,0 +1,69 @@ +status($case); + if ($status['status'] !== LoyaltyStatusCheck::QUALIFIED || $quote->discount() > 0) { + return []; + } + + $percent = (int) ($case->parameter(self::key(), 'percent') ?? 5); + $max = (int) ($case->parameter(self::key(), 'max') ?? 10000); + $amount = min($max, (int) round($quote->rent() * $percent / 100)); + if ($amount <= 0) { + return []; + } + + return [new QuoteLine(QuoteLineType::Discount, 'Stammgastrabatt '.$percent.' % ('.count($status['stays']).' frühere Aufenthalte)', 1, -$amount, -$amount)]; + } + + public function activities(CaseContext $case): array + { + $line = collect((array) ($case->booking->quote['lines'] ?? []))->first(fn (array $line): bool => str_starts_with((string) ($line['label'] ?? ''), 'Stammgastrabatt')); + + return [new Activity('loyalty_discount', 'Stammgastrabatt', ActivityState::Done, $line !== null ? Money::format(-(int) $line['amount']).' im Angebot' : 'kein Rabatt im Angebot')]; + } +} diff --git a/app/Process/Modules/Loyalty/LoyaltyStatusCheck.php b/app/Process/Modules/Loyalty/LoyaltyStatusCheck.php new file mode 100644 index 0000000..c59ae63 --- /dev/null +++ b/app/Process/Modules/Loyalty/LoyaltyStatusCheck.php @@ -0,0 +1,90 @@ +} + */ + public function status(CaseContext $case): array + { + $email = mb_strtolower(trim((string) $case->booking->guest?->email)); + if ($email === '') { + return ['status' => self::UNKNOWN, 'stays' => []]; + } + + $years = (int) ($case->parameter(self::key(), 'lookback_years') ?? 5); + $minimum = (int) ($case->parameter(self::key(), 'min_stays') ?? 1); + $stays = Booking::query() + ->whereKeyNot($case->booking->id) + ->where('status', BookingStatus::Completed) + ->whereDate('departure', '>=', $case->today->subYears($years)) + ->whereHas('guest', fn ($query) => $query->whereRaw('lower(email) = ?', [$email])) + ->orderBy('arrival') + ->get() + ->map(fn (Booking $stay): string => (string) $stay->reference) + ->all(); + + return ['status' => count($stays) >= $minimum ? self::QUALIFIED : self::NOT_QUALIFIED, 'stays' => $stays]; + } + + public function activities(CaseContext $case): array + { + $status = $this->status($case); + + return [new Activity('loyalty_status', 'Stammgaststatus feststellen', ActivityState::Done, match ($status['status']) { + self::QUALIFIED => 'Stammgast: '.count($status['stays']).' frühere Aufenthalte ('.implode(', ', $status['stays']).')', + self::NOT_QUALIFIED => 'kein Stammgast', + default => 'Status nicht feststellbar (keine E-Mail-Adresse) – kein Rabatt', + })]; + } + + public function state(CaseContext $case): ?StepState + { + return StepState::Done; + } +} diff --git a/app/Process/Modules/Module.php b/app/Process/Modules/Module.php new file mode 100644 index 0000000..56dfa9b --- /dev/null +++ b/app/Process/Modules/Module.php @@ -0,0 +1,28 @@ +activities($case)[0] ?? null; + + return $activity === null ? null : StepState::fromActivity($activity->state); + } +} diff --git a/app/Process/Modules/ModuleDefinition.php b/app/Process/Modules/ModuleDefinition.php new file mode 100644 index 0000000..62bb629 --- /dev/null +++ b/app/Process/Modules/ModuleDefinition.php @@ -0,0 +1,72 @@ + $requires dependencies for readiness (checked: every module exists, no cycle) + * @param list $effects kinds of effects the step may cause: case_write, guest_mail, landlord_mail, document, calendar_hold, channel_task, network (checked by the contract test) + * @param list $waits whom or what the step can wait for: guest, portal, landlord, time (describes) + * @param list $triggers events after which the step is evaluated again (describes; listed in process:check) + * @param list $parameters settings or module parameters that shape the step (checked: known) + * @param string $toggle mandatory / optional / conditional / event_driven (checked: mandatory cannot be switched off) + * @param list $performers who may carry the step out (checked against the models' responsibilities) + * @param list $modes automatic / approval / manual (checked in the configurator) + * @param list $events history types that belong to the step (shown behind the step) + * @param list $points extension points the module may be inserted at (checked; empty = fixed place in a model) + * @param bool $readsContractData evaluates frozen contract data – needs an ongoing-case test (checked) + */ + public function __construct( + public string $label, + public string $purpose, + public string $phase, + public array $requires = [], + public array $effects = [], + public array $waits = [], + public array $triggers = [], + public array $parameters = [], + public string $toggle = self::TOGGLE_MANDATORY, + public array $performers = ['system'], + public array $modes = [], + public array $events = [], + public array $points = [], + public bool $readsContractData = false, + public string $availability = self::AVAILABILITY_PRODUCTION, + ) {} + + public function isOptional(): bool + { + return $this->toggle === self::TOGGLE_OPTIONAL; + } + + public function isTesterOnly(): bool + { + return $this->availability === self::AVAILABILITY_TESTER_ONLY; + } +} diff --git a/app/Process/Modules/Money/InternalPayment.php b/app/Process/Modules/Money/InternalPayment.php new file mode 100644 index 0000000..cef9925 --- /dev/null +++ b/app/Process/Modules/Money/InternalPayment.php @@ -0,0 +1,47 @@ +booking->total !== null && $case->booking->total > 0; + } + + public function activities(CaseContext $case): array + { + $booking = $case->booking; + $paid = $booking->paidAmount(); + + return [new Activity('payment', 'Zahlung (ohne Erinnerungen)', $case->later($paid >= $booking->total ? ActivityState::Done : ActivityState::Later), Money::format($paid).' von '.Money::format($booking->total).' bezahlt')]; + } +} diff --git a/app/Process/Modules/Money/PaymentMonitoring.php b/app/Process/Modules/Money/PaymentMonitoring.php new file mode 100644 index 0000000..89f6785 --- /dev/null +++ b/app/Process/Modules/Money/PaymentMonitoring.php @@ -0,0 +1,81 @@ +booking->isInternal(); + } + + public function activities(CaseContext $case): array + { + $booking = $case->booking; + $binding = $case->binding; + + if ($case->profile->payments() === Responsibility::Portal) { + $portal = $booking->processChannel()?->name ?? 'das Portal'; + $viaPortal = $booking->paidViaPortal(); + + return [new Activity('payment', 'Zahlung des Gastes an '.$portal, ActivityState::External, match (true) { + $booking->total === null => 'zieht das Portal ein', + $viaPortal > 0 => 'laut Portal bezahlt: '.Money::format($viaPortal).' von '.Money::format($booking->total).' (Angabe des Portals, kein Geld bei uns)', + default => 'zieht das Portal ein; noch keine Zahlungsangabe', + })]; + } + + if ($booking->total === null) { + return [new Activity('payment', 'Zahlungen überwachen', $case->later(ActivityState::Waiting), 'erst möglich, wenn der Preis bekannt ist')]; + } + + $paid = $booking->paidAmount(); + + return [ + new Activity('deposit', 'Anzahlung erhalten', $case->later(match (true) { + $binding && $paid >= (int) $booking->deposit => ActivityState::Done, + $binding => ActivityState::Waiting, + default => ActivityState::Later, + }), Money::format((int) $booking->deposit).($booking->deposit_due_on ? ', fällig '.$booking->deposit_due_on->format('d.m.Y') : '')), + new Activity('balance', 'Restzahlung erhalten', $case->later(match (true) { + $binding && $paid >= $booking->total => ActivityState::Done, + $binding && $paid >= (int) $booking->deposit => ActivityState::Waiting, + default => ActivityState::Later, + }), Money::format(max(0, $booking->total - (int) $booking->deposit)).($booking->balance_due_on ? ', fällig '.$booking->balance_due_on->format('d.m.Y') : '')), + ]; + } +} diff --git a/app/Process/Modules/Money/PortalPayout.php b/app/Process/Modules/Money/PortalPayout.php new file mode 100644 index 0000000..a2682d4 --- /dev/null +++ b/app/Process/Modules/Money/PortalPayout.php @@ -0,0 +1,57 @@ +booking->isInternal() && $case->profile->payments() === Responsibility::Portal; + } + + public function activities(CaseContext $case): array + { + $booking = $case->booking; + $portal = $booking->processChannel()?->name ?? 'das Portal'; + $payout = CaseMoney::of($booking)->payout(); + + return [new Activity('payout', 'Auszahlung von '.$portal.' auf unser Konto', $case->later(match (true) { + ! $case->binding => ActivityState::Later, + $payout['received'] > 0 && ($payout['outstanding'] ?? 0) === 0 && $payout['difference'] === 0 => ActivityState::Done, + default => ActivityState::Waiting, + }), trim(($payout['values'] !== [] ? 'angekündigt '.implode(' bzw. ', array_map(fn (int $value): string => Money::format($value), $payout['values'])).' · ' : '').'eingegangen '.Money::format($payout['received']).($payout['difference'] > 0 ? ' · Angaben weichen um '.Money::format($payout['difference']).' ab' : '')))]; + } +} diff --git a/app/Process/Modules/Offer/AnswersRequest.php b/app/Process/Modules/Offer/AnswersRequest.php new file mode 100644 index 0000000..72d5514 --- /dev/null +++ b/app/Process/Modules/Offer/AnswersRequest.php @@ -0,0 +1,44 @@ +booking; + + return $booking->processingMode() === ProcessingMode::Automatic + && $booking->status === BookingStatus::Reserved && $booking->offer_version === 0 && $booking->information_version === 0 + && $booking->intake !== IntakeKind::Booking; + } + + public function blockers(CaseContext $case): array + { + return app(AutoOffer::class)->blockers($case->booking); + } + + public function run(CaseContext $case): StepResult + { + $reasons = app(AutoOffer::class)->handle($case->booking); + + return $reasons === [] ? StepResult::ran() : StepResult::blocked($reasons); + } + + public function isOutward(): bool + { + return true; + } +} diff --git a/app/Process/Modules/Offer/BindingOffer.php b/app/Process/Modules/Offer/BindingOffer.php new file mode 100644 index 0000000..f621e6d --- /dev/null +++ b/app/Process/Modules/Offer/BindingOffer.php @@ -0,0 +1,86 @@ +inquiry && ! ($case->profile->preReservation() === false && $case->booking->offer_version === 0); + } + + public function activities(CaseContext $case): array + { + $booking = $case->booking; + $offerDone = $booking->offer_version > 0 || $case->binding; + // G2a (v0.11): without every required detail there is no offer – the step waits for the guest's answer + // (mail, link or the landlord's entry) instead of being offered as the next step. + $offerMissing = $offerDone ? [] : CaseRequirements::missing($booking, CaseRequirements::OFFER); + $open = ! $offerDone && $offerMissing === [] && $booking->status === BookingStatus::Reserved && filled($booking->guest?->email); + $taken = $open && ! app(AvailabilityChecker::class)->isAvailable($booking->property, $booking->arrival, $booking->departure, ignore: $booking); + + return [new Activity('offer', $booking->processingMode() === ProcessingMode::Automatic ? 'Angebot senden (automatisch)' : 'Angebot prüfen und senden', $case->later(match (true) { + $offerDone => ActivityState::Done, + $offerMissing !== [] => ActivityState::Later, + $taken => ActivityState::Problem, + $open => ActivityState::Open, + default => ActivityState::Later, + }), match (true) { + $booking->offer_version > 0 => 'Version '.$booking->offer_version.' vom '.$booking->offer_sent_at?->format('d.m.Y'), + $offerMissing !== [] => 'erst wenn alle Angaben da sind', + $taken => 'Der Zeitraum ist inzwischen belegt.', + $booking->isHoldActive() => 'Zeitraum reserviert bis '.$booking->hold_expires_at->format('d.m.Y, H:i').' Uhr', + $booking->hold_expires_at !== null => 'Reservierung abgelaufen am '.$booking->hold_expires_at->format('d.m.Y, H:i').' Uhr – Zeitraum nicht reserviert', + default => null, + }, $offerDone || $offerMissing !== [] || $taken ? null : 'sendOffer')]; + } +} diff --git a/app/Process/Modules/Offer/Information.php b/app/Process/Modules/Offer/Information.php new file mode 100644 index 0000000..d77861e --- /dev/null +++ b/app/Process/Modules/Offer/Information.php @@ -0,0 +1,86 @@ +inquiry && ! $case->profile->preReservation() && $case->booking->offer_version === 0; + } + + public function activities(CaseContext $case): array + { + $booking = $case->booking; + $binding = $case->binding; + $informed = $booking->information_version > 0 || $binding; + + return [ + new Activity('information', $booking->processingMode() === ProcessingMode::Automatic ? 'Unverbindliche Auskunft senden (automatisch)' : 'Unverbindliche Auskunft prüfen und senden', $case->later(match (true) { + $booking->information_version > 0 => ActivityState::Done, + $binding => ActivityState::NotApplicable, + $booking->status === BookingStatus::Reserved && filled($booking->guest?->email) => ActivityState::Open, + default => ActivityState::Later, + }), $booking->information_version > 0 ? 'Version '.$booking->information_version.' vom '.$booking->information_sent_at?->format('d.m.Y').' · ohne Reservierung' : 'der Zeitraum wird nicht reserviert', $informed ? null : 'sendInformation'), + new Activity('wish', 'Gast fragt die Buchung an', $case->later(match (true) { + $booking->wish_at !== null => ActivityState::Done, + $binding => ActivityState::NotApplicable, + $booking->information_version > 0 && $booking->information_valid_until?->isFuture() => ActivityState::Waiting, + default => ActivityState::Later, + }), match (true) { + $booking->wish_at !== null => 'angefragt am '.$booking->wish_at->format('d.m.Y, H:i').' Uhr', + $booking->information_version > 0 => 'möglich bis '.$booking->information_valid_until?->format('d.m.Y, H:i').' Uhr', + default => null, + }), + new Activity('wish_check', 'Erneut prüfen und verbindlich bestätigen', $case->later(match (true) { + $binding => ActivityState::Done, + $booking->wish_at !== null && $booking->status === BookingStatus::Reserved => ActivityState::Waiting, + default => ActivityState::Later, + }), match (true) { + $booking->accepted_at !== null && ($booking->acceptance['via'] ?? null) === 'booking_wish' => 'bestätigt am '.$booking->confirmed_at?->format('d.m.Y').' ('.($booking->acceptance['confirmed_by'] ?? '').')', + $booking->wish_at !== null && $booking->status === BookingStatus::Reserved => 'siehe Aufgabe „Buchungswunsch bestätigen?“', + $binding => 'direkt verbindlich bestätigt (ohne Buchungswunsch)', + default => $booking->processingMode() === ProcessingMode::Automatic ? 'automatisch, wenn alles passt' : 'durch Sie', + }), + ]; + } +} diff --git a/app/Process/Modules/Offer/OfferAcceptance.php b/app/Process/Modules/Offer/OfferAcceptance.php new file mode 100644 index 0000000..09ec2dd --- /dev/null +++ b/app/Process/Modules/Offer/OfferAcceptance.php @@ -0,0 +1,59 @@ +applies($case); + } + + public function activities(CaseContext $case): array + { + $booking = $case->booking; + + return [new Activity('acceptance', 'Gast nimmt das Angebot an', $case->later(match (true) { + $case->binding => ActivityState::Done, + $booking->status === BookingStatus::OfferSent => ActivityState::Waiting, + default => ActivityState::Later, + }), match (true) { + $booking->accepted_at !== null => 'angenommen am '.$booking->accepted_at->format('d.m.Y'), + $case->binding => 'direkt bestätigt', + $booking->status === BookingStatus::OfferSent => 'Angebot gültig bis '.$booking->hold_expires_at?->format('d.m.Y, H:i').' Uhr', + default => null, + })]; + } +} diff --git a/app/Process/Modules/ProcessModule.php b/app/Process/Modules/ProcessModule.php new file mode 100644 index 0000000..1e373ba --- /dev/null +++ b/app/Process/Modules/ProcessModule.php @@ -0,0 +1,37 @@ + + */ + public function activities(CaseContext $case): array; + + /** The state the runner uses for dependencies (null: the step has no state of its own and never blocks). */ + public function state(CaseContext $case): ?StepState; +} diff --git a/app/Process/Modules/RunsAutomatically.php b/app/Process/Modules/RunsAutomatically.php new file mode 100644 index 0000000..5dea6c2 --- /dev/null +++ b/app/Process/Modules/RunsAutomatically.php @@ -0,0 +1,30 @@ + + */ + public function blockers(CaseContext $case): array; + + /** Carries the step out by calling the existing action(s). */ + public function run(CaseContext $case): StepResult; + + /** Whether the step speaks to the guest or a third party (suspended while a portal report is open, decision O4). */ + public function isOutward(): bool; +} diff --git a/app/Process/Modules/Settlement/BookingDocuments.php b/app/Process/Modules/Settlement/BookingDocuments.php new file mode 100644 index 0000000..25f3a22 --- /dev/null +++ b/app/Process/Modules/Settlement/BookingDocuments.php @@ -0,0 +1,116 @@ +booking->isInternal(); + } + + public function activities(CaseContext $case): array + { + $booking = $case->booking; + if ($case->profile->documents() === Responsibility::Portal) { + return [new Activity('documents', 'Buchungsunterlagen an den Gast', ActivityState::External)]; + } + + $binding = $case->binding; + $state = match (true) { + $booking->confirmation_sent_at !== null => ActivityState::Done, + ! $binding => ActivityState::Later, + $booking->confirmation_failed_at !== null => ActivityState::Problem, + default => ActivityState::Open, + }; + $missing = $binding && $state === ActivityState::Open ? app(CaseAutomation::class)->documentBlockers($booking) : []; + // What the landlord still has to confirm (unreleased texts, terms not shown to be agreed on the portal). + $toConfirm = $binding && $state === ActivityState::Open && $missing === [] ? app(SendBookingDocuments::class)->compose($booking)->toConfirm() : []; + + return [new Activity('documents', match (true) { + $state !== ActivityState::Open => $case->inquiry ? 'Buchungsbestätigung mit Vertrag senden' : 'Buchungsunterlagen an den Gast senden', + $case->inquiry => 'Buchungsbestätigung mit Vertrag prüfen und senden', + default => 'Buchungsunterlagen prüfen und senden', + }, $case->later($missing !== [] ? ActivityState::Waiting : $state), + match (true) { + $booking->confirmation_sent_at !== null => 'gesendet am '.$booking->confirmation_sent_at->format('d.m.Y'), + $state === ActivityState::Problem => 'Versand fehlgeschlagen', + $missing !== [] => 'wartet: '.implode(' ', $missing), + $toConfirm !== [] => 'vor dem Versand zu prüfen: '.implode(' ', $toConfirm), + default => null, + }, match (true) { + $state === ActivityState::Problem => 'resendConfirmation', + $binding && $missing === [] && $booking->confirmation_sent_at === null => 'sendDocuments', + default => null, + })]; + } + + /** The guest's e-mail and the price are what the documents need – not every detail of a request. */ + public function due(CaseContext $case): bool + { + $booking = $case->booking; + + return $booking->processingMode() === ProcessingMode::Automatic + && $case->binding && $booking->confirmation_sent_at === null + && $case->profile->documents() === Responsibility::Landlord && $case->profile->origin !== 'migration'; + } + + public function blockers(CaseContext $case): array + { + return app(CaseAutomation::class)->documentBlockers($case->booking); + } + + public function run(CaseContext $case): StepResult + { + $reasons = app(SendBookingDocuments::class)->automatically($case->booking); + + return $reasons === [] ? StepResult::ran() : StepResult::blocked($reasons); + } + + public function isOutward(): bool + { + return true; + } +} diff --git a/app/Process/Modules/Settlement/CaseTasks.php b/app/Process/Modules/Settlement/CaseTasks.php new file mode 100644 index 0000000..6ab65fd --- /dev/null +++ b/app/Process/Modules/Settlement/CaseTasks.php @@ -0,0 +1,90 @@ +where('booking_id', $case->booking->id) + ->where(fn ($query) => $query->where('status', BookingTaskStatus::Open) + ->orWhere(fn ($done) => $done->where('status', BookingTaskStatus::Done)->whereIn('kind', [BookingTaskKind::Service, BookingTaskKind::Issue, BookingTaskKind::FollowUp, BookingTaskKind::PayoutCheck, BookingTaskKind::OpenClaim]))) + ->orderByRaw('due_on is null')->orderBy('due_on')->orderBy('id')->get() + ->map(fn (BookingTask $task): Activity => self::task($task)) + ->all(); + } + + public function state(CaseContext $case): ?StepState + { + return null; + } + + /** + * An open task of the case and the action that settles it. + */ + public static function task(BookingTask $task): Activity + { + $action = match ($task->kind) { + BookingTaskKind::PortalCancellation, BookingTaskKind::PortalCancellationReported => 'confirmPortalCancellation', + BookingTaskKind::PortalChangeReported => 'change', + BookingTaskKind::BookingWish => 'decideWish', + BookingTaskKind::ArrivalDetails => 'arrivalDetails', + BookingTaskKind::CancellationRequest => 'end', + BookingTaskKind::FactConflict => 'provideContact', + default => $task->kind->isPayment() ? null : 'completeTask', + }; + $today = CarbonImmutable::today(); + $state = match (true) { + $task->status === BookingTaskStatus::Done => ActivityState::Done, + $task->kind === BookingTaskKind::PayoutCheck && $task->due_on?->isAfter($today) => ActivityState::Waiting, + $task->kind === BookingTaskKind::Service && $task->due_on?->isAfter($today) => ActivityState::Later, + $task->kind === BookingTaskKind::BookingWish && $task->booking !== null && ! app(AvailabilityChecker::class)->isAvailable($task->booking->property, $task->booking->arrival, $task->booking->departure, ignore: $task->booking) => ActivityState::Problem, + // v0.11 (B3): the binding confirmation waits for the missing details as well. + $task->kind === BookingTaskKind::BookingWish && $task->booking !== null && CaseRequirements::missing($task->booking, CaseRequirements::WISH_CONFIRMATION) !== [] => ActivityState::Waiting, + default => ActivityState::Open, + }; + $detail = $task->status === BookingTaskStatus::Done + ? 'erledigt am '.$task->completed_at?->format('d.m.Y').($task->completed_by ? ' von '.$task->completed_by : '').($task->note ? ' · '.$task->note : '') + : trim(($state === ActivityState::Problem ? 'Achtung: Der Zeitraum ist inzwischen belegt – bitte absagen. · ' : '').($task->due_on ? 'fällig '.$task->due_on->format('d.m.Y') : '').($task->responsible ? ' · zuständig: '.$task->responsible : '').($task->note ? ' · '.$task->note : ''), ' ·'); + + return new Activity('task_'.$task->kind->value, $task->label(), $state, $detail, $state === ActivityState::Done ? null : $action); + } +} diff --git a/app/Process/Modules/Settlement/ChangeProposal.php b/app/Process/Modules/Settlement/ChangeProposal.php new file mode 100644 index 0000000..717fcf7 --- /dev/null +++ b/app/Process/Modules/Settlement/ChangeProposal.php @@ -0,0 +1,53 @@ +booking->changes()->where('status', ChangeStatus::Proposed)->get() as $change) { + $activities[] = new Activity('change_proposed', 'Änderungsvorschlag liegt beim Gast', ActivityState::Waiting, $change->summary().($change->expires_at ? ' · bis '.$change->expires_at->format('d.m.Y') : '')); + } + + return $activities; + } + + public function state(CaseContext $case): ?StepState + { + return null; + } +} diff --git a/app/Process/Modules/Settlement/CommercialSettlement.php b/app/Process/Modules/Settlement/CommercialSettlement.php new file mode 100644 index 0000000..bb81249 --- /dev/null +++ b/app/Process/Modules/Settlement/CommercialSettlement.php @@ -0,0 +1,65 @@ +booking; + $settlementApplies = $booking->status === BookingStatus::Completed || $booking->status === BookingStatus::Cancelled; + + return $settlementApplies || ($booking->isBinding() && ! $booking->isInternal()) || ($booking->isInternal() && (int) $booking->total > 0); + } + + public function activities(CaseContext $case): array + { + $booking = $case->booking; + $settlementApplies = $booking->status === BookingStatus::Completed || $booking->status === BookingStatus::Cancelled; + $points = $settlementApplies && $booking->settled_at === null ? CaseClosure::commercialPoints($booking) : []; + + return [new Activity('settlement', 'Kaufmännisch abschließen', match (true) { + $booking->settled_at !== null => ActivityState::Done, + ! $settlementApplies => ActivityState::Later, + default => ActivityState::Waiting, + }, match (true) { + $booking->settled_at !== null => 'abgeschlossen am '.$booking->settled_at->format('d.m.Y').($booking->settled_by && $booking->settled_by !== CaseClosure::AUTOMATIC ? ' von '.$booking->settled_by : '').($booking->settled_note ? ' · '.$booking->settled_note : ''), + ! $settlementApplies => 'nach dem Aufenthalt, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind', + default => 'offen: '.implode(' ', $points), + }, $settlementApplies && $booking->settled_at === null && $points !== [] ? 'settle' : null)]; + } +} diff --git a/app/Process/Modules/Settlement/StayClosure.php b/app/Process/Modules/Settlement/StayClosure.php new file mode 100644 index 0000000..3a6ec89 --- /dev/null +++ b/app/Process/Modules/Settlement/StayClosure.php @@ -0,0 +1,62 @@ +closed && ($case->booking->isBinding() || $case->booking->status === BookingStatus::Completed); + } + + public function activities(CaseContext $case): array + { + $booking = $case->booking; + $today = $case->today; + $completed = $booking->status === BookingStatus::Completed; + $blockers = $booking->isBinding() && ! $completed ? CaseClosure::stayBlockers($booking) : collect(); + + return [new Activity('closure', $booking->isInternal() && $booking->internal_kind === InternalKind::Block ? 'Sperrzeit abschließen' : 'Aufenthalt abschließen', match (true) { + $completed => ActivityState::Done, + ! $booking->isBinding() || $booking->departure > $today => ActivityState::Later, + default => ActivityState::Waiting, + }, match (true) { + $completed => 'abgeschlossen am '.($booking->completed_at ?? $booking->updated_at)?->format('d.m.Y'), + $blockers->isNotEmpty() => 'wartet auf: '.$blockers->map(fn (BookingTask $task): string => $task->label())->implode(', '), + $booking->isBinding() && $booking->departure <= $today => 'geschieht automatisch über Nacht – oder jetzt von Hand', + default => 'nach der Abreise, sobald nichts mehr für den Aufenthalt offen ist', + }, $booking->isBinding() && ! $completed && $booking->departure <= $today ? 'closeStay' : null)]; + } +} diff --git a/app/Process/Modules/Settlement/StayConfirmation.php b/app/Process/Modules/Settlement/StayConfirmation.php new file mode 100644 index 0000000..23eae1c --- /dev/null +++ b/app/Process/Modules/Settlement/StayConfirmation.php @@ -0,0 +1,47 @@ +booking->internal_kind !== InternalKind::Block && filled($case->booking->guest?->email); + } + + public function activities(CaseContext $case): array + { + $booking = $case->booking; + + return [new Activity('documents', 'Aufenthaltsbestätigung an die Gäste (optional)', $case->later($booking->confirmation_sent_at !== null ? ActivityState::Done : ActivityState::Later), + $booking->confirmation_sent_at ? 'gesendet am '.$booking->confirmation_sent_at->format('d.m.Y') : 'nur bei Bedarf', $booking->confirmation_sent_at === null && ! $case->closed ? 'sendDocuments' : null)]; + } +} diff --git a/app/Process/Modules/Stay/ArrivalDetails.php b/app/Process/Modules/Stay/ArrivalDetails.php new file mode 100644 index 0000000..18cfc73 --- /dev/null +++ b/app/Process/Modules/Stay/ArrivalDetails.php @@ -0,0 +1,57 @@ +binding && ! BookingTask::query()->where('booking_id', $case->booking->id)->where('kind', BookingTaskKind::ArrivalDetails)->where('status', BookingTaskStatus::Open)->exists(); + } + + public function activities(CaseContext $case): array + { + $booking = $case->booking; + $missing = PrepareStays::missingArrivalDetails($booking); + $left = $case->binding && $booking->departure <= $case->today; + + return [new Activity('arrival_details', 'Anreisedaten', $case->later(match (true) { + $missing === [] => ActivityState::Done, + $left => ActivityState::NotApplicable, + default => ActivityState::Later, + }), $missing === [] ? implode(' · ', array_filter([$booking->guest?->phone ?: $booking->guest?->email, $booking->arrival_time ? 'Anreise '.$booking->arrival_time : null])) : 'es fehlt: '.implode(', ', $missing).' – wird rechtzeitig als Aufgabe gemeldet')]; + } +} diff --git a/app/Process/Modules/Stay/ArrivalInformation.php b/app/Process/Modules/Stay/ArrivalInformation.php new file mode 100644 index 0000000..2a25837 --- /dev/null +++ b/app/Process/Modules/Stay/ArrivalInformation.php @@ -0,0 +1,48 @@ +booking; + $profile = $case->profile; + + return [$profile->guestMessages() === Responsibility::Portal + ? new Activity('arrival_info', 'Anreise-Informationen an den Gast', ActivityState::External, 'durch '.($booking->processChannel()?->name ?? 'das Portal').' (angekündigt) – eine Zustellung ist damit nicht nachgewiesen') + : new Activity('arrival_info', 'Anreise-Informationen an den Gast (automatisch)', $case->later($booking->arrival_info_sent_at !== null ? ActivityState::Done : ActivityState::Later), $booking->arrival_info_sent_at ? 'gesendet am '.$booking->arrival_info_sent_at->format('d.m.Y') : $profile->arrivalInfoDaysBefore().' Tage vor Anreise')]; + } +} diff --git a/app/Process/Modules/Stay/ReviewRequest.php b/app/Process/Modules/Stay/ReviewRequest.php new file mode 100644 index 0000000..9f84ae5 --- /dev/null +++ b/app/Process/Modules/Stay/ReviewRequest.php @@ -0,0 +1,49 @@ +profile->guestMessages() === Responsibility::Landlord && ! $case->booking->isInternal(); + } + + public function activities(CaseContext $case): array + { + return [new Activity('review', 'Bitte um eine Bewertung (automatisch)', $case->later($case->booking->review_requested_at !== null ? ActivityState::Done : ActivityState::Later))]; + } +} diff --git a/app/Process/Modules/Stay/Stay.php b/app/Process/Modules/Stay/Stay.php new file mode 100644 index 0000000..3b6b56e --- /dev/null +++ b/app/Process/Modules/Stay/Stay.php @@ -0,0 +1,53 @@ +booking; + if ($booking->isInternal()) { + $kind = $booking->internal_kind; + + return [new Activity('stay', $kind === InternalKind::Block ? 'Sperrzeit' : 'Aufenthalt', $case->closed ? ActivityState::NotApplicable : ($booking->departure <= $case->today ? ActivityState::Done : ActivityState::Later), $booking->arrival->format('d.m.Y').' – '.$booking->departure->format('d.m.Y'))]; + } + + $arrived = $case->binding && $booking->arrival <= $case->today; + $left = $case->binding && $booking->departure <= $case->today; + + return [new Activity('stay', 'Aufenthalt', $case->later(match (true) { + $left => ActivityState::Done, + $arrived => ActivityState::Waiting, + default => ActivityState::Later, + }), $booking->arrival->format('d.m.Y').' – '.$booking->departure->format('d.m.Y'))]; + } +} diff --git a/app/Process/Modules/StepState.php b/app/Process/Modules/StepState.php new file mode 100644 index 0000000..4117797 --- /dev/null +++ b/app/Process/Modules/StepState.php @@ -0,0 +1,48 @@ + self::Done, + ActivityState::Open => self::Open, + ActivityState::Waiting => self::Waiting, + ActivityState::Problem => self::Problem, + ActivityState::Later => self::Later, + ActivityState::NotApplicable => self::NotApplicable, + }; + } + + /** Whether a hard dependency on a step in this state is fulfilled. */ + public function fulfils(): bool + { + return $this === self::Done; + } +} diff --git a/app/Process/OutwardSuspension.php b/app/Process/OutwardSuspension.php new file mode 100644 index 0000000..3a7ca83 --- /dev/null +++ b/app/Process/OutwardSuspension.php @@ -0,0 +1,32 @@ +where('booking_id', $booking->id)->whereIn('kind', self::KINDS)->where('status', BookingTaskStatus::Open)->first(); + + return $task === null ? null : 'Automatische Nachrichten an den Gast warten, bis die Meldung „'.$task->label().'“ geklärt ist.'; + } +} diff --git a/app/Process/ProcessCatalogue.php b/app/Process/ProcessCatalogue.php new file mode 100644 index 0000000..32bf0dc --- /dev/null +++ b/app/Process/ProcessCatalogue.php @@ -0,0 +1,214 @@ +>|null */ + private ?array $modules = null; + + /** + * @return array> key => class + */ + public function modules(): array + { + if ($this->modules === null) { + $this->modules = []; + foreach ((array) config('process.modules', []) as $class) { + $this->modules[$class::key()] = $class; + } + } + + return $this->modules; + } + + public function hasModule(string $key): bool + { + return array_key_exists($key, $this->modules()); + } + + public function module(string $key): ProcessModule + { + $class = $this->modules()[$key] ?? throw new InvalidArgumentException("Unknown process module [{$key}]."); + + return app($class); + } + + /** + * Whether the registered class can serve a plan that froze the module in the given version. + */ + public function serves(string $key, int $version): bool + { + $class = $this->modules()[$key] ?? null; + + return $class !== null && ($class::version() === $version || in_array($version, (array) config("process.compatible.{$key}", []), true)); + } + + /** + * @return array>> + */ + public function modelVersions(): array + { + return (array) config('process.models', []); + } + + public function hasModel(string $key, ?int $version = null): bool + { + $versions = $this->modelVersions()[$key] ?? []; + + return $version === null ? $versions !== [] : array_key_exists($version, $versions); + } + + /** + * A model in a version (null: the latest). + */ + public function model(string $key, ?int $version = null): ProcessModel + { + $versions = $this->modelVersions()[$key] ?? throw new InvalidArgumentException("Unknown process model [{$key}]."); + $version ??= max(array_keys($versions)); + $class = $versions[$version] ?? throw new InvalidArgumentException("Process model [{$key}] has no version {$version}."); + + return app($class); + } + + /** + * The latest version of every model. + * + * @return array + */ + public function models(): array + { + $models = []; + foreach (array_keys($this->modelVersions()) as $key) { + $models[$key] = $this->model($key); + } + + return $models; + } + + /** + * The model a case follows when nobody chose one: derived from its frozen profile exactly as the v0.11 course + * branched (legacy mapping, docs/Prozessarchitektur/Architektur/06 §4). + */ + public function derivedModel(ProcessProfile $profile): string + { + return match ($profile->intake) { + IntakeKind::Internal => 'a6.internal', + IntakeKind::Inquiry => ($profile->caseType === CaseType::A2 ? 'a2' : 'a1').($profile->preReservation() ? '.offer' : '.information'), + IntakeKind::Booking => match ($profile->caseType) { + CaseType::A5 => 'a5.portal_booking', + CaseType::A4 => 'a4.portal_booking', + default => 'a3.portal_booking', + }, + }; + } + + /** + * The models admissible for a case type and intake kind. + * + * @return array + */ + public function admissible(IntakeKind $intake, ?CaseType $caseType = null): array + { + return array_filter($this->models(), fn (ProcessModel $model): bool => in_array($intake, $model::intakes(), true) + && ($caseType === null || in_array($caseType, $model::caseTypes(), true))); + } + + /** + * Everything that is inconsistent in the catalogue (empty = consistent). + * + * @return list + */ + public function problems(): array + { + $problems = []; + foreach ($this->modules() as $key => $class) { + $definition = $class::definition(); + foreach ($definition->requires as $dependency) { + if (! $this->hasModule($dependency->module)) { + $problems[] = "Modul {$key}: Abhängigkeit {$dependency->module} ist nicht registriert."; + } + } + if (! in_array($definition->phase, ['P01', 'P02', 'P03', 'P04', 'P05'], true)) { + $problems[] = "Modul {$key}: unbekannte Phase {$definition->phase}."; + } + if (is_subclass_of($class, RunsAutomatically::class) && $definition->modes === []) { + $problems[] = "Modul {$key}: läuft automatisch, nennt aber keine Ausführungsart."; + } + } + foreach ($this->cycles() as $cycle) { + $problems[] = 'Zyklische harte Abhängigkeit: '.implode(' → ', $cycle); + } + + foreach ($this->modelVersions() as $key => $versions) { + foreach ($versions as $version => $class) { + if ($class::key() !== $key || $class::version() !== $version) { + $problems[] = "Modell {$key}@{$version}: Klasse {$class} meldet ".$class::key().'@'.$class::version().'.'; + } + $model = app($class); + foreach ($model->variants() as $variant) { + foreach ($model->modules($variant->key) as $module) { + if (! $this->hasModule($module)) { + $problems[] = "Modell {$key}@{$version}, Variante {$variant->key}: Modul {$module} ist nicht registriert."; + } + } + foreach ($variant->inserts() as $point => $modules) { + if (! in_array($point, array_map(fn ($p) => $p->value, $model->points()), true)) { + $problems[] = "Modell {$key}@{$version}, Variante {$variant->key}: Erweiterungspunkt {$point} gibt es im Modell nicht."; + } + foreach ($modules as $module) { + $points = $this->hasModule($module) ? $this->modules()[$module]::definition()->points : []; + if ($points !== [] && ! in_array($point, $points, true)) { + $problems[] = "Modell {$key}@{$version}: Modul {$module} darf nicht an {$point} stehen."; + } + if ($this->hasModule($module) && $this->modules()[$module]::definition()->isTesterOnly() && ! $variant->isTesterOnly()) { + $problems[] = "Modell {$key}@{$version}: Modul {$module} ist nur für den Prozess-Tester, Variante {$variant->key} aber nicht."; + } + } + } + } + } + } + + return $problems; + } + + /** + * @return list> + */ + private function cycles(): array + { + $edges = []; + foreach ($this->modules() as $key => $class) { + $edges[$key] = array_values(array_map(fn ($dependency): string => $dependency->module, array_filter($class::definition()->requires, fn ($dependency): bool => $dependency->hard))); + } + + $cycles = []; + $visit = function (string $node, array $path) use (&$visit, &$cycles, $edges): void { + if (in_array($node, $path, true)) { + $cycles[] = [...array_slice($path, (int) array_search($node, $path, true)), $node]; + + return; + } + foreach ($edges[$node] ?? [] as $next) { + $visit($next, [...$path, $node]); + } + }; + foreach (array_keys($edges) as $node) { + $visit($node, []); + } + + return array_values(array_unique($cycles, SORT_REGULAR)); + } +} diff --git a/app/Process/ProcessPlan.php b/app/Process/ProcessPlan.php new file mode 100644 index 0000000..76c00d7 --- /dev/null +++ b/app/Process/ProcessPlan.php @@ -0,0 +1,224 @@ + $modules module key => frozen version + * @param array}> $steps + * @param array $labels module key => label at the time of freezing + */ + public function __construct( + public readonly string $model, + public readonly int $modelVersion, + public readonly string $variant, + public readonly array $modules, + public readonly array $steps = [], + public readonly string $source = self::DERIVED, + public readonly array $labels = [], + public readonly ?string $notice = null, + ) {} + + /** + * The plan of a case: frozen with it, or derived from its profile (never stored by reading). + */ + public static function of(Booking $booking): self + { + $data = (array) (($booking->profile ?? [])['plan'] ?? []); + + return $data !== [] ? self::fromArray($data) : self::derive($booking->process()); + } + + /** + * The plan a case gets from its profile when no model was chosen for its channel. + */ + public static function derive(ProcessProfile $profile): self + { + $catalogue = app(ProcessCatalogue::class); + + return self::build($catalogue->model($catalogue->derivedModel($profile)), 'standard', [], self::DERIVED); + } + + /** + * The plan frozen for a new case: the model and step settings chosen for its channel and intake kind (Kanal › + * Ablauf), when admissible for the case's type; otherwise the derived one with a notice. Tester-only variants or + * modules are refused outside the process tester (decision E7). + * + * @param array $configuration model, variant, steps of channels.process_overrides[intake] + */ + public static function freeze(ProcessProfile $profile, array $configuration, bool $sandbox = false): self + { + $catalogue = app(ProcessCatalogue::class); + $chosen = (string) ($configuration['model'] ?? ''); + if ($chosen === '') { + return self::build($catalogue->model($catalogue->derivedModel($profile)), 'standard', (array) ($configuration['steps'] ?? []), self::DERIVED); + } + + if (! $catalogue->hasModel($chosen)) { + return self::derive($profile)->withNotice("Gewähltes Modell {$chosen} ist nicht registriert – abgeleitetes Modell verwendet."); + } + + $model = $catalogue->model($chosen); + if (! in_array($profile->caseType, $model::caseTypes(), true) || ! in_array($profile->intake, $model::intakes(), true)) { + return self::derive($profile)->withNotice("Gewähltes Modell {$chosen} passt nicht zu Vorgangsart {$profile->caseType->value} – abgeleitetes Modell verwendet."); + } + + $variant = (string) ($configuration['variant'] ?? 'standard'); + $chosenVariant = $model->variant($variant) ?? throw new DomainException("Modell {$chosen} hat keine Variante {$variant}."); + if (! $sandbox && $chosenVariant->isTesterOnly()) { + throw new DomainException("Die Variante „{$chosenVariant->label}“ ist nur im Prozess-Tester verwendbar."); + } + foreach ($model->modules($variant) as $module) { + if (! $sandbox && $catalogue->module($module)::definition()->isTesterOnly()) { + throw new DomainException("Das Modul {$module} ist nur im Prozess-Tester verwendbar."); + } + } + + return self::build($model, $variant, (array) ($configuration['steps'] ?? []), $sandbox ? self::TESTER : self::CONFIGURED); + } + + /** + * The configuration of a channel for one intake kind as the plan reads it (model, variant, steps). + * + * @return array + */ + public static function configurationOf(?Channel $channel, IntakeKind $intake): array + { + if ($channel === null || $intake === IntakeKind::Internal) { + return []; + } + + return array_intersect_key((array) (($channel->process_overrides ?? [])[$intake->value] ?? []), array_flip(['model', 'variant', 'steps'])); + } + + /** + * @param array $steps + */ + private static function build(ProcessModel $model, string $variant, array $steps, string $source): self + { + $catalogue = app(ProcessCatalogue::class); + $modules = []; + $labels = []; + foreach ($model->modules($variant) as $key) { + $class = $catalogue->modules()[$key]; + $modules[$key] = $class::version(); + $labels[$key] = $class::definition()->label; + } + + return new self($model::key(), $model::version(), $variant, $modules, array_intersect_key($steps, $modules), $source, $labels); + } + + private function withNotice(string $notice): self + { + return new self($this->model, $this->modelVersion, $this->variant, $this->modules, $this->steps, $this->source, $this->labels, $notice); + } + + public function modelDefinition(): ProcessModel + { + $catalogue = app(ProcessCatalogue::class); + + // A retired version (T3): its cases stay readable through the latest definition of the same model. + return $catalogue->hasModel($this->model, $this->modelVersion) ? $catalogue->model($this->model, $this->modelVersion) : $catalogue->model($this->model); + } + + public function isHistoric(): bool + { + return ! app(ProcessCatalogue::class)->hasModel($this->model, $this->modelVersion); + } + + /** + * The module keys of the case's course, in order. + * + * @return list + */ + public function moduleKeys(): array + { + return array_keys($this->modules); + } + + /** Whether a step is switched on (only optional steps can be switched off; mandatory ones are always on). */ + public function enabled(string $module): bool + { + if (($this->steps[$module]['on'] ?? true) !== false) { + return true; + } + + $catalogue = app(ProcessCatalogue::class); + + return $catalogue->hasModule($module) && ! $catalogue->module($module)::definition()->isOptional(); + } + + public function mode(string $module): ?string + { + return $this->steps[$module]['mode'] ?? null; + } + + public function performer(string $module): ?string + { + return $this->steps[$module]['performer'] ?? null; + } + + public function parameter(string $module, string $name): mixed + { + return $this->steps[$module]['params'][$name] ?? null; + } + + public function reference(): string + { + return $this->model.'@'.$this->modelVersion.($this->variant !== 'standard' ? ':'.$this->variant : ''); + } + + /** + * @return array + */ + public function toArray(): array + { + return array_filter([ + 'model' => $this->model, + 'model_version' => $this->modelVersion, + 'variant' => $this->variant, + 'modules' => $this->modules, + 'steps' => $this->steps, + 'source' => $this->source, + 'labels' => $this->labels, + 'notice' => $this->notice, + ], fn (mixed $value): bool => $value !== null); + } + + /** + * @param array $data + */ + public static function fromArray(array $data): self + { + return new self( + (string) $data['model'], + (int) $data['model_version'], + (string) ($data['variant'] ?? 'standard'), + array_map('intval', (array) ($data['modules'] ?? [])), + (array) ($data['steps'] ?? []), + (string) ($data['source'] ?? self::DERIVED), + (array) ($data['labels'] ?? []), + isset($data['notice']) ? (string) $data['notice'] : null, + ); + } +} diff --git a/app/Process/ProcessRunner.php b/app/Process/ProcessRunner.php new file mode 100644 index 0000000..d6a547a --- /dev/null +++ b/app/Process/ProcessRunner.php @@ -0,0 +1,197 @@ + cases being advanced in this process (a nested call returns at once) */ + private static array $running = []; + + public function __construct(private ProcessCatalogue $catalogue) {} + + /** + * The activities of a case in the order of its plan, as the landlord sees them. + * + * @return list + */ + public function activities(Booking $booking): array + { + $context = CaseContext::of($booking); + $activities = []; + + foreach ($context->plan->moduleKeys() as $key) { + if (! $this->catalogue->hasModule($key)) { + // A step whose module was retired (T3): the finished case stays readable with the frozen label. + $activities[] = new Activity($key, ($context->plan->labels[$key] ?? $key).' (frühere Fassung)', ActivityState::NotApplicable); + + continue; + } + $module = $this->catalogue->module($key); + if (! $context->plan->enabled($key) || ! $module->applies($context)) { + continue; + } + array_push($activities, ...$module->activities($context)); + } + + return $activities; + } + + /** + * Carries a case on by itself as far as its data allows (only steps whose mode is automatic). + * + * @param string $trigger what happened (a trigger the modules declare, e.g. 'request.created') + */ + public function advance(Booking $booking, string $trigger = self::AUTOMATION): AdvanceResult + { + $result = new AdvanceResult; + if (isset(self::$running[$booking->id])) { + return $result; + } + + $lock = Cache::lock('case-advance:'.$booking->id, 60); + if (! $lock->get()) { + // Another process is advancing this case right now and evaluates it again after each step. + return $result; + } + + self::$running[$booking->id] = true; + try { + $this->rounds($booking, $trigger, $result); + } finally { + unset(self::$running[$booking->id]); + $lock->release(); + } + + return $result; + } + + private function rounds(Booking $booking, string $trigger, AdvanceResult $result): void + { + $attempted = []; + $plan = ProcessPlan::of($booking); + $limit = count($plan->modules) + 1; + + for ($round = 0; $round < $limit; $round++) { + $context = new CaseContext($booking->fresh() ?? $booking, $plan); + $ready = $this->ready($context, $trigger, $attempted, $result); + if ($ready === null) { + return; + } + + $key = $ready::key(); + $attempted[$key] = true; + /** @var ProcessModule&RunsAutomatically $ready */ + try { + $step = CaseLog::context(fn (): StepResult => $ready->run($context), actor: CaseLog::SYSTEM.' (automatisch)'); + } catch (Throwable $exception) { + report($exception); + $step = StepResult::failed('Technischer Fehler beim automatischen Weiterbearbeiten – bitte von Hand fortsetzen.'); + } + + if ($step->didRun()) { + $result->ran[] = $key; + } else { + $result->held[$key] = $step->reasons; + } + } + } + + /** + * The next step to carry out, determined anew from the case's current data; steps that are due but cannot run are + * recorded with their reasons. + * + * @param array $attempted + */ + private function ready(CaseContext $context, string $trigger, array $attempted, AdvanceResult $result): ?ProcessModule + { + $candidates = []; + foreach ($context->plan->moduleKeys() as $key) { + if (isset($attempted[$key]) || ! $this->catalogue->hasModule($key)) { + continue; + } + $module = $this->catalogue->module($key); + if (! $module instanceof RunsAutomatically || ! in_array($trigger, $module::definition()->triggers, true)) { + continue; + } + if (! $context->plan->enabled($key) || ! $module->applies($context) || ! $module->due($context)) { + continue; + } + + $unmet = $this->unmetHardDependencies($module, $context); + if ($unmet !== []) { + // Not ready: a hard requirement is missing. Its own blockers say what (e.g. the missing details). + $result->held[$key] = $module->blockers($context) ?: array_map(fn (string $label): string => 'Wartet auf: '.$label.'.', $unmet); + + continue; + } + if ($module->isOutward() && ($reason = OutwardSuspension::reason($context->booking)) !== null) { + $result->held[$key] = [$reason]; + + continue; + } + + $candidates[$key] = $module; + } + + foreach ($candidates as $key => $module) { + // A soft dependency that is ready in the same round goes first. + $before = array_filter($module::definition()->requires, fn ($dependency): bool => ! $dependency->hard && isset($candidates[$dependency->module])); + if ($before === []) { + return $module; + } + } + + return $candidates === [] ? null : reset($candidates); + } + + /** + * Labels of the hard dependencies that are not done. A dependency on a step that is not part of the plan or does + * not apply to the case is fulfilled (the condition does not concern this case). + * + * @return list + */ + public function unmetHardDependencies(ProcessModule $module, CaseContext $context): array + { + $unmet = []; + foreach ($module::definition()->requires as $dependency) { + if (! $dependency->hard || ! array_key_exists($dependency->module, $context->plan->modules) || ! $this->catalogue->hasModule($dependency->module)) { + continue; + } + $required = $this->catalogue->module($dependency->module); + if (! $context->plan->enabled($dependency->module) || ! $required->applies($context)) { + continue; + } + $state = $required->state($context); + if ($state !== null && ! $state->fulfils() && $state !== StepState::NotApplicable) { + $unmet[] = $required::definition()->label; + } + } + + return $unmet; + } +} diff --git a/app/Process/StepResult.php b/app/Process/StepResult.php new file mode 100644 index 0000000..7f77eb8 --- /dev/null +++ b/app/Process/StepResult.php @@ -0,0 +1,44 @@ + $reasons + */ + private function __construct(public string $outcome, public array $reasons = []) {} + + public static function ran(): self + { + return new self(self::RAN); + } + + /** + * @param list $reasons + */ + public static function blocked(array $reasons): self + { + return new self(self::BLOCKED, array_values($reasons)); + } + + public static function failed(string $reason): self + { + return new self(self::FAILED, [$reason]); + } + + public function didRun(): bool + { + return $this->outcome === self::RAN; + } +} diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 0ff9e98..b18c48f 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,6 +2,7 @@ namespace App\Providers; +use App\Process\ProcessCatalogue; use App\Support\StripImageMetadata; use App\Support\SystemSettings; use App\Tenancy\TenantConfig; @@ -21,6 +22,7 @@ public function register(): void { $this->app->singleton(TenantContext::class); $this->app->singleton(TenantConfig::class); + $this->app->singleton(ProcessCatalogue::class); } /** diff --git a/config/process.php b/config/process.php new file mode 100644 index 0000000..4bfefaa --- /dev/null +++ b/config/process.php @@ -0,0 +1,70 @@ + [ + Intake\IntakeRecord::class, + Intake\GuestDetails::class, + Intake\GuestDataRequest::class, + Intake\Hold::class, + Intake\AvailabilityCheck::class, + Intake\PortalBinding::class, + Intake\ChannelBlocks::class, + Offer\Information::class, + Offer\BindingOffer::class, + Offer\OfferAcceptance::class, + Settlement\BookingDocuments::class, + Settlement\StayConfirmation::class, + Settlement\CaseTasks::class, + Settlement\ChangeProposal::class, + Settlement\StayClosure::class, + Settlement\CommercialSettlement::class, + Money\PaymentMonitoring::class, + Money\PortalPayout::class, + Money\InternalPayment::class, + Stay\ArrivalDetails::class, + Stay\ArrivalInformation::class, + Stay\Stay::class, + Stay\ReviewRequest::class, + // Architecture proof, tester only (decision E7). + Loyalty\LoyaltyStatusCheck::class, + Loyalty\LoyaltyDiscount::class, + ], + + /* + | Module versions an older plan may name although the module has moved on: the current class serves them because the + | change was declared compatible (rule R2/R4 – e.g. a correction that rightly applies to running cases). + */ + 'compatible' => [ + 'offer.binding' => [1], + ], + + 'models' => [ + 'a1.offer' => [1 => Models\A1OfferModel::class], + 'a1.information' => [1 => Models\A1InformationModel::class], + 'a2.offer' => [1 => Models\A2OfferModel::class], + 'a2.information' => [1 => Models\A2InformationModel::class], + 'a3.portal_booking' => [1 => Models\A3PortalBookingModel::class], + 'a4.portal_booking' => [1 => Models\A4PortalBookingModel::class], + 'a5.portal_booking' => [1 => Models\A5PortalBookingModel::class], + 'a6.internal' => [1 => Models\A6InternalModel::class], + ], +]; diff --git a/tests/Feature/Process/LoyaltyArchitectureProofTest.php b/tests/Feature/Process/LoyaltyArchitectureProofTest.php new file mode 100644 index 0000000..0d2d065 --- /dev/null +++ b/tests/Feature/Process/LoyaltyArchitectureProofTest.php @@ -0,0 +1,155 @@ +travelTo(CarbonImmutable::parse('2026-10-23 18:00')); + $this->seed([PropertySeeder::class, SiteSeeder::class]); + $this->property = Property::sole(); + Storage::fake('local'); + Content::save(['contract.terms' => '

Echte Bedingungen

', 'stay.cancellation' => '

Echtes Storno

']); + config(['mail.default' => 'array']); + Mail::swap(new MailManager($this->app)); + Settings::tenant()->update(['bank_iban' => 'DE02120300000000202051', 'test_recipient' => 'test@example.org']); + Http::preventStrayRequests(); + } + + public function test_without_contributing_modules_the_case_price_is_exactly_the_calculator_price(): void + { + $booking = $this->request('neu@example.org'); + $stay = $this->stay(); + + $this->assertEquals(app(PriceCalculator::class)->calculate($this->property, $stay), app(CasePricing::class)->quote($booking, $stay)); + } + + public function test_a_returning_guest_gets_the_discount_line_after_the_status_check_and_before_the_price_is_fixed(): void + { + $this->formerStay('stamm@example.org'); + $booking = $this->loyaltyCase($this->request('stamm@example.org')); + + $quote = app(CasePricing::class)->quote($booking, $this->stay()); + $plain = app(PriceCalculator::class)->calculate($this->property, $this->stay()); + $discount = collect($quote->lines)->first(fn ($line): bool => $line->type === QuoteLineType::Discount); + + $this->assertNotNull($discount, 'the discount reads the status of the check before it'); + $this->assertSame(-(int) round($plain->rent() * 5 / 100), $discount->amount); + $this->assertStringContainsString('1 frühere Aufenthalte', $discount->label); + + // The offer fixes the price: the line is in the frozen quote, and the binding case gets no contribution any more. + app(SendOffer::class)->handle($booking->fresh()); + $booking->refresh(); + $this->assertSame($quote->total(), $booking->total); + $this->assertContains('discount', array_column($booking->quote['lines'], 'type')); + app(AcceptOffer::class)->handle($booking->fresh(), $booking->offer_version); + $this->assertSame(BookingStatus::Confirmed, $booking->fresh()->status); + $this->assertEquals($plain, app(CasePricing::class)->quote($booking->fresh(), $this->stay()), 'no contribution after binding (R5)'); + $this->assertSame('loyalty_status', collect(CaseActivities::for($booking->fresh()))->firstWhere('key', 'loyalty_status')?->key); + } + + public function test_a_new_guest_and_an_unknown_status_get_no_discount_and_the_offer_is_never_held_back(): void + { + $new = $this->loyaltyCase($this->request('neu@example.org')); + $this->assertSame(app(PriceCalculator::class)->calculate($this->property, $this->stay())->total(), app(CasePricing::class)->quote($new, $this->stay())->total()); + + $unknown = $this->loyaltyCase($this->request('ohne@example.org', '2026-11-20', '2026-11-23')); + $unknown->guest->forceFill(['email' => null])->saveQuietly(); + $activity = collect(CaseActivities::for($unknown->fresh()))->firstWhere('key', 'loyalty_status'); + $this->assertStringContainsString('nicht feststellbar', $activity->detail); + } + + public function test_the_discount_is_not_combined_with_a_special_offer_discount(): void + { + $this->formerStay('stamm@example.org'); + $booking = $this->loyaltyCase($this->request('stamm@example.org')); + $quote = app(PriceCalculator::class)->calculate($this->property, $this->stay()) + ->withLine(new QuoteLine(QuoteLineType::Discount, 'Sonderangebot', 1, -1000, -1000)); + + $this->assertSame([], app(LoyaltyDiscount::class)->priceLines(CaseContext::of($booking), $quote)); + } + + public function test_loyalty_cannot_reach_a_real_case_and_leaves_the_other_models_unchanged(): void + { + $catalogue = app(ProcessCatalogue::class); + $using = array_keys(array_filter($catalogue->models(), fn ($model): bool => collect($model->variants())->contains(fn ($variant): bool => in_array('pricing.loyalty_discount', $model->modules($variant->key), true)))); + + $this->assertSame(['a1.offer'], $using, 'only the A1 offer model has the variant'); + $this->assertSame([], $catalogue->problems()); + foreach ($catalogue->models() as $key => $model) { + $this->assertNotContains('guest.loyalty_status', $model->modules('standard'), "{$key}: standard course unchanged"); + } + $this->expectExceptionMessage('nur im Prozess-Tester'); + ProcessPlan::freeze($this->request('neu@example.org')->process(), ['model' => 'a1.offer', 'variant' => 'loyalty']); + } + + private function loyaltyCase(Booking $booking): Booking + { + $plan = ProcessPlan::freeze($booking->process(), ['model' => 'a1.offer', 'variant' => 'loyalty'], sandbox: true); + $booking->forceFill(['profile' => [...$booking->profile, 'plan' => $plan->toArray()]])->saveQuietly(); + + return $booking->fresh(); + } + + private function formerStay(string $email): void + { + $guest = Guest::query()->create(['tenant_id' => $this->property->tenant_id, 'first_name' => 'Stamm', 'last_name' => 'Gast', 'email' => 'alt-'.$email]); + Booking::factory()->for($this->property)->create(['guest_id' => $guest->id, 'status' => BookingStatus::Completed, 'arrival' => '2025-08-01', 'departure' => '2025-08-08']); + $guest->forceFill(['email' => $email])->saveQuietly(); + } + + private function request(string $email, string $arrival = '2026-11-07', string $departure = '2026-11-10'): Booking + { + return app(CreateReservation::class)->handle($this->property, new StayRequest(CarbonImmutable::parse($arrival), CarbonImmutable::parse($departure), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => $email, 'street' => 'Weg 1', 'postal_code' => '10115', 'city' => 'Berlin', 'country' => 'DE']); + } + + private function stay(): StayRequest + { + return new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2); + } +} diff --git a/tests/Feature/Process/ProcessCoreTest.php b/tests/Feature/Process/ProcessCoreTest.php new file mode 100644 index 0000000..810f939 --- /dev/null +++ b/tests/Feature/Process/ProcessCoreTest.php @@ -0,0 +1,167 @@ +travelTo(CarbonImmutable::parse('2026-10-23 18:00')); + $this->seed([PropertySeeder::class, SiteSeeder::class]); + $this->property = Property::sole(); + Storage::fake('local'); + Content::save(['contract.terms' => '

Echte Bedingungen

', 'stay.cancellation' => '

Echtes Storno

']); + config(['mail.default' => 'array']); + Mail::swap(new MailManager($this->app)); + Settings::tenant()->update(['bank_iban' => 'DE02120300000000202051', 'test_recipient' => 'test@example.org', + 'process_defaults' => ['processing' => 'automatic', 'clarification_hold_auto_minutes' => 120, 'data_request_mode' => 'automatic']]); + Http::preventStrayRequests(); + } + + public function test_the_catalogue_is_consistent(): void + { + $this->assertSame([], app(ProcessCatalogue::class)->problems()); + } + + public function test_a_new_case_freezes_its_plan(): void + { + $booking = $this->request(['street' => 'Weg 1', 'postal_code' => '10115', 'city' => 'Berlin', 'country' => 'DE']); + + $plan = $booking->fresh()->profile['plan']; + $this->assertSame(['a1.offer', 1, 'standard', ProcessPlan::DERIVED], [$plan['model'], $plan['model_version'], $plan['variant'], $plan['source']]); + $this->assertSame(2, $plan['modules']['offer.binding']); + $this->assertSame('Verbindliches Angebot', $plan['labels']['offer.binding']); + $this->assertArrayNotHasKey('guest.loyalty_status', $plan['modules'], 'tester-only modules never enter a real plan'); + } + + public function test_clarification_hold_runs_on_while_the_data_request_waits_and_the_late_answer_brings_the_offer(): void + { + $booking = $this->request([]); + + // The data request went out, the offer waits for the address, the clarification hold runs independently. + $context = CaseContext::of($booking->fresh()); + $this->assertSame([BookingStatus::Reserved, Booking::HOLD_CLARIFICATION], [$booking->status, $booking->hold_purpose]); + $this->assertSame(StepState::Waiting, app(Hold::class)->state($context)); + $this->assertSame(DataRequest::OPEN, $booking->openDataRequest()->status); + $this->assertSame(ActivityState::Later, $this->activity($booking, 'offer')->state); + $this->assertSame(ActivityState::Waiting, $this->activity($booking, 'contact')->state); + + // The hold expires; the request stays open for its details (only offer holds expire). + $this->travel(125)->minutes(); + $this->artisan('bookings:expire-holds')->assertSuccessful(); + $this->assertSame(BookingStatus::Reserved, $booking->fresh()->status); + $this->assertSame(StepState::Done, app(Hold::class)->state(CaseContext::of($booking->fresh()))); + + // The guest answers later; the offer becomes ready and goes out with a new offer hold. + app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.street' => 'Lindenallee 12', 'guest.postal_code' => '10115', 'guest.city' => 'Berlin', 'guest.country' => 'DE'], FactSource::GuestLink); + $booking->refresh(); + $this->assertSame([BookingStatus::OfferSent, Booking::HOLD_OFFER], [$booking->status, $booking->hold_purpose]); + $this->assertSame(DataRequest::COMPLETED, $booking->dataRequests()->sole()->status); + } + + public function test_an_external_address_check_waits_without_holding_back_the_offer(): void + { + config([ + 'process.modules' => [...config('process.modules'), AddressVerification::class], + 'process.models' => [...config('process.models'), 'a1.offer_address' => [1 => A1WithAddressCheck::class]], + ]); + $this->app->forgetInstance(ProcessCatalogue::class); + AddressVerification::$serviceAvailable = false; + $booking = $this->request(['street' => 'Weg 1', 'postal_code' => '10115', 'city' => 'Berlin', 'country' => 'DE'], automatic: false); + $plan = ProcessPlan::freeze($booking->process(), ['model' => 'a1.offer_address', 'variant' => 'address_check']); + $booking->forceFill(['profile' => [...$booking->profile, 'plan' => $plan->toArray()], 'processing_mode' => 'automatic'])->saveQuietly(); + + $result = app(ProcessRunner::class)->advance($booking->fresh()); + + $this->assertTrue($result->ran('offer.binding'), 'the offer does not depend on the address check'); + $this->assertSame(ActivityState::Waiting, $this->activity($booking, 'address_check')->state); + $this->assertSame([], app(ProcessCatalogue::class)->problems(), 'a new module and a variant fit without changing other models'); + } + + public function test_a_finished_case_of_a_retired_version_stays_readable(): void + { + $booking = $this->request(['street' => 'Weg 1', 'postal_code' => '10115', 'city' => 'Berlin', 'country' => 'DE']); + $plan = $booking->profile['plan']; + // An older release: model version 0 and a module that no longer exists. + $plan['model_version'] = 0; + $plan['modules'] = ['intake.record' => 1, 'old.welcome_call' => 1, ...$plan['modules']]; + $plan['labels']['old.welcome_call'] = 'Begrüßungsanruf'; + $booking->forceFill(['status' => BookingStatus::Declined, 'profile' => [...$booking->profile, 'plan' => $plan]])->saveQuietly(); + + $activities = CaseActivities::for($booking->fresh()); + + $this->assertTrue(ProcessPlan::of($booking->fresh())->isHistoric()); + $this->assertSame('Begrüßungsanruf (frühere Fassung)', collect($activities)->firstWhere('key', 'old.welcome_call')->label); + $this->assertSame('done', collect($activities)->firstWhere('key', 'offer')->state->value); + $this->assertNotNull(CaseActivities::situation($booking->fresh())); + } + + public function test_a_tester_only_variant_is_refused_for_real_cases(): void + { + $booking = $this->request(['street' => 'Weg 1', 'postal_code' => '10115', 'city' => 'Berlin', 'country' => 'DE']); + + $this->expectExceptionMessage('nur im Prozess-Tester'); + ProcessPlan::freeze($booking->process(), ['model' => 'a1.offer', 'variant' => 'loyalty']); + } + + /** + * @param array $address + */ + private function request(array $address, bool $automatic = true): Booking + { + if (! $automatic) { + Settings::tenant()->update(['process_defaults' => ['processing' => 'manual']]); + } + + return app(CreateReservation::class)->handle($this->property, new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org', ...$address]); + } + + private function activity(Booking $booking, string $key): Activity + { + return collect(CaseActivities::for($booking->fresh()))->firstWhere('key', $key) ?? $this->fail("No activity {$key}"); + } +} diff --git a/tests/Feature/Process/ProcessRunnerTest.php b/tests/Feature/Process/ProcessRunnerTest.php new file mode 100644 index 0000000..56d37fa --- /dev/null +++ b/tests/Feature/Process/ProcessRunnerTest.php @@ -0,0 +1,207 @@ +seed(PropertySeeder::class); + FakeModule::reset(); + config([ + 'process.modules' => [...config('process.modules'), FakeModuleA::class, FakeModuleB::class, FakeModuleC::class, FakeModuleD::class], + 'process.models' => [...config('process.models'), 'test.model' => [1 => FakeModel::class]], + ]); + $this->app->forgetInstance(ProcessCatalogue::class); + $this->booking = Booking::factory()->for(Property::sole())->reserved()->create(['intake' => 'inquiry']); + $this->plan('standard'); + } + + public function test_a_hard_dependency_holds_the_step_back_while_an_independent_step_goes_on(): void + { + FakeModule::$script = [ + 'test.a' => ['state' => StepState::Waiting, 'due' => false], + 'test.b' => ['requires' => [Dependency::hard('test.a')]], + 'test.c' => [], + ]; + + $result = $this->advance(); + + $this->assertSame(['test.c'], FakeModule::$runs, 'the waiting step holds back only what depends on it hard'); + $this->assertSame(['Wartet auf: Testschritt test.a.'], $result->reasons('test.b')); + } + + public function test_a_hard_dependency_cannot_be_lifted_by_the_waiting_step(): void + { + // Whatever the waiting step declares, the dependent decides: hard is hard. + FakeModule::$script = [ + 'test.a' => ['state' => StepState::Problem, 'due' => false], + 'test.b' => ['requires' => [Dependency::hard('test.a')]], + ]; + + $this->advance(); + + $this->assertNotContains('test.b', FakeModule::$runs); + } + + public function test_a_soft_dependency_orders_steps_but_does_not_wait(): void + { + FakeModule::$script = [ + 'test.a' => ['requires' => [Dependency::soft('test.c')]], + 'test.c' => [], + ]; + $this->advance(); + $this->assertSame(['test.c', 'test.a'], FakeModule::$runs, 'both due: the soft dependency goes first'); + + FakeModule::reset(); + FakeModule::$script = [ + 'test.a' => ['requires' => [Dependency::soft('test.c')]], + 'test.c' => ['state' => StepState::Waiting, 'due' => false], + ]; + $this->advance(); + $this->assertSame(['test.a'], FakeModule::$runs, 'the soft dependency waits: the step goes on'); + } + + public function test_readiness_is_determined_anew_after_every_state_change(): void + { + FakeModule::$script = [ + // A's run completes what B needs and makes C superfluous. + 'test.a' => ['run' => function (): ?StepResult { + FakeModule::$script['test.b']['state'] = StepState::Open; + FakeModule::$script['test.c']['due'] = false; + + return null; + }], + 'test.b' => ['state' => StepState::Later, 'due' => true, 'requires' => [Dependency::hard('test.a')]], + 'test.c' => [], + ]; + + $this->advance(); + + $this->assertSame(['test.a', 'test.b'], FakeModule::$runs, 'B became ready after A; C was ready before A ran, but no longer afterwards'); + } + + public function test_conditional_steps_and_switched_off_optional_steps_are_skipped(): void + { + FakeModule::$script = ['test.a' => ['applies' => false], 'test.b' => [], 'test.c' => []]; + $this->plan('standard', ['test.c' => ['on' => false]]); + + $this->advance(); + + // test.c is a fake module without the optional toggle: a mandatory step cannot be switched off. + $this->assertSame(['test.b', 'test.c'], FakeModule::$runs); + } + + public function test_a_failing_step_is_reported_and_independent_steps_go_on(): void + { + FakeModule::$script = ['test.a' => ['run' => fn () => FakeModule::fail()], 'test.b' => []]; + + $result = $this->advance(); + + $this->assertSame(['test.a', 'test.b'], FakeModule::$runs); + $this->assertSame(['Technischer Fehler beim automatischen Weiterbearbeiten – bitte von Hand fortsetzen.'], $result->reasons('test.a')); + $this->assertTrue($result->ran('test.b')); + } + + public function test_a_second_advance_has_no_effect(): void + { + FakeModule::$script = ['test.a' => [], 'test.b' => []]; + $this->advance(); + FakeModule::$runs = []; + + $this->advance(); + + $this->assertSame([], FakeModule::$runs, 'every step is done; nothing is due'); + } + + public function test_a_step_runs_once_per_advance_even_if_it_stays_due(): void + { + FakeModule::$script = ['test.a' => ['run' => fn (): StepResult => StepResult::blocked(['noch nicht'])]]; + + $result = $this->advance(); + + $this->assertSame(['test.a'], FakeModule::$runs); + $this->assertSame(['noch nicht'], $result->reasons('test.a')); + } + + public function test_only_steps_that_declare_the_trigger_are_considered(): void + { + FakeModule::$script = ['test.a' => []]; + + app(ProcessRunner::class)->advance($this->booking, 'request.created'); + + $this->assertSame([], FakeModule::$runs); + } + + public function test_a_variant_inserts_its_module_at_the_extension_point(): void + { + FakeModule::$script = ['test.a' => [], 'test.b' => [], 'test.c' => [], 'test.d' => []]; + $this->plan('extra'); + + $this->advance(); + + $this->assertSame(['test.a', 'test.b', 'test.d', 'test.c'], FakeModule::$runs); + } + + public function test_an_open_portal_report_suspends_outward_steps_only(): void + { + FakeModule::$script = ['test.a' => ['outward' => true], 'test.b' => []]; + BookingTask::query()->create(['tenant_id' => $this->booking->tenant_id, 'booking_id' => $this->booking->id, 'kind' => BookingTaskKind::PortalCancellationReported, 'status' => BookingTaskStatus::Open, 'title' => 'Portal meldet Stornierung']); + + $result = $this->advance(); + + $this->assertSame(['test.b'], FakeModule::$runs, 'internal steps go on (decision O4)'); + $this->assertStringContainsString('warten, bis die Meldung', $result->reasons('test.a')[0]); + } + + /** + * @param array> $steps + */ + private function plan(string $variant, array $steps = []): void + { + $model = app(ProcessCatalogue::class)->model('test.model'); + $modules = array_fill_keys($model->modules($variant), 1); + $plan = new ProcessPlan('test.model', 1, $variant, $modules, $steps, ProcessPlan::CONFIGURED); + $this->booking->forceFill(['profile' => [...(array) $this->booking->profile, 'plan' => $plan->toArray()]])->saveQuietly(); + } + + private function advance(): AdvanceResult + { + return app(ProcessRunner::class)->advance($this->booking->fresh(), 'test'); + } +} diff --git a/tests/Fixtures/process/behaviour/a1_dates_taken.json b/tests/Fixtures/process/behaviour/a1_dates_taken.json index ef300e0..3bcf040 100644 --- a/tests/Fixtures/process/behaviour/a1_dates_taken.json +++ b/tests/Fixtures/process/behaviour/a1_dates_taken.json @@ -323,9 +323,9 @@ { "key": "offer", "label": "Angebot senden (automatisch)", - "state": "open", - "detail": "Zeitraum reserviert bis 23.10.2026, 18:30 Uhr", - "action": "sendOffer" + "state": "problem", + "detail": "Der Zeitraum ist inzwischen belegt.", + "action": null }, { "key": "acceptance", diff --git a/tests/Fixtures/process/intended.md b/tests/Fixtures/process/intended.md index aa3e595..eb43011 100644 --- a/tests/Fixtures/process/intended.md +++ b/tests/Fixtures/process/intended.md @@ -6,6 +6,7 @@ # Beabsichtigte Abweichungen von der v0.11-Referenz |---|---|---|---|---| | I-001 | Ereignistypen der Schrittdetails kommen aus der Moduldefinition statt aus `ActivityDetails::EVENT_TYPES` | eine Quelle (Architektur `02` §7.7) | `ActivityDetailsTest` unverändert grün | keine (gleiches Ergebnis) | | I-002 | Offene, einem Vorgang zugeordnete Portalmeldung (Storno/Änderung) setzt automatische **Außenwirkungen** aus: Unterlagen, Erinnerungen, Anreiseinformation | Entscheidung O4 | `PortalReportSuspendsAutomationTest` | `portal_mail_cancellation` (nur wenn Außenwirkungen anstanden) | -| I-003 | Zeit-Actions (`ExpireReservations`, `RequestCaseData::handOver`) rufen danach `ProcessRunner::advance` für den Vorgang | K1: Wiederaufnahme ohne neuen Auslöser | `RunnerResumesAfterDeadlineTest` | keine erwartet | -| I-004 | Angebotsschritt bei belegtem Zeitraum = `problem` | Fehler F-001 | `OfferModuleTest::taken_dates_are_a_problem` | `a1_dates_taken.answer_dates_taken` | -| I-005 | Detail des Angebotsschritts zeigt den tatsächlichen Reservierungszustand | Fehler F-002 | `OfferModuleTest::expired_hold_is_not_shown_as_reserved` | `a1_dates_taken.*`, `a1_missing_address.clarification_expired`, `a1_missing_address.first_reminder` | +| I-003 | ~~Zeit-Actions rufen danach `advance`~~ – **entfällt**: `bookings:auto-offers` bewertet offene Anfragen alle 5 Minuten über den Runner neu; `ExpireReservations` und `handOver` machen keinen Schritt bereit | – | – | – | +| I-004 | Angebotsschritt bei belegtem Zeitraum = `problem`, ohne Senden-Aktion | Fehler F-001 | `BehaviourComparisonTest` (`a1_dates_taken`, neu aufgenommen) | `a1_dates_taken.answer_dates_taken` | +| I-005 | Detail des Angebotsschritts zeigt den tatsächlichen Reservierungszustand | Fehler F-002 | `BehaviourComparisonTest` (`a1_dates_taken`), `OngoingCaseRegressionTest` (`legacy_migration_offer`) | `a1_dates_taken.answer_dates_taken`; Bestandsfall `legacy_migration_offer` | +| I-006 | Technischer Fehler eines automatischen Schritts: einheitlicher Text „Technischer Fehler beim automatischen Weiterbearbeiten – bitte von Hand fortsetzen.“ je Schritt (vorher je Aufrufer eigener Text); `CreateReservation` behält seinen Text, wenn der Runner selbst scheitert | ein Ablaufkern | `ProcessRunnerTest::test_a_failing_step_is_reported_and_independent_steps_go_on` | keine (kein Fehlerfall in der Referenz) | diff --git a/tests/Fixtures/process/ongoing/cases.json b/tests/Fixtures/process/ongoing/cases.json index 18618a8..3b42681 100644 --- a/tests/Fixtures/process/ongoing/cases.json +++ b/tests/Fixtures/process/ongoing/cases.json @@ -2356,7 +2356,7 @@ [ "offer", "open", - "Zeitraum reserviert bis 25.10.2026, 17:00 Uhr", + "Reservierung abgelaufen am 25.10.2026, 17:00 Uhr – Zeitraum nicht reserviert", "sendOffer" ], [ diff --git a/tests/Support/Process/A1WithAddressCheck.php b/tests/Support/Process/A1WithAddressCheck.php new file mode 100644 index 0000000..a30cbbc --- /dev/null +++ b/tests/Support/Process/A1WithAddressCheck.php @@ -0,0 +1,49 @@ + true]; + } + + public function variants(): array + { + return [Variant::make('standard', 'Standard'), Variant::make('address_check', 'Mit Adressprüfung')->insert(Point::AfterGuestIdentified, 'guest.address_verification')]; + } +} diff --git a/tests/Support/Process/AddressVerification.php b/tests/Support/Process/AddressVerification.php new file mode 100644 index 0000000..5c0674d --- /dev/null +++ b/tests/Support/Process/AddressVerification.php @@ -0,0 +1,77 @@ +state($case); + + return [new Activity('address_check', 'Anschrift extern prüfen', $state === StepState::Done ? ActivityState::Done : ActivityState::Waiting, self::$serviceAvailable ? null : 'Adressdienst nicht erreichbar – neuer Versuch später')]; + } + + public function state(CaseContext $case): ?StepState + { + return self::$serviceAvailable ? StepState::Done : StepState::Waiting; + } + + public function due(CaseContext $case): bool + { + return ! self::$serviceAvailable; + } + + public function blockers(CaseContext $case): array + { + return []; + } + + public function run(CaseContext $case): StepResult + { + return StepResult::blocked(['Adressdienst nicht erreichbar.']); + } + + public function isOutward(): bool + { + return false; + } +} diff --git a/tests/Support/Process/FakeModel.php b/tests/Support/Process/FakeModel.php new file mode 100644 index 0000000..9203c21 --- /dev/null +++ b/tests/Support/Process/FakeModel.php @@ -0,0 +1,62 @@ +insert(Point::BeforePriceFixing, 'test.d')]; + } +} diff --git a/tests/Support/Process/FakeModule.php b/tests/Support/Process/FakeModule.php new file mode 100644 index 0000000..ef706fd --- /dev/null +++ b/tests/Support/Process/FakeModule.php @@ -0,0 +1,101 @@ +, run?: callable(): ?StepResult, outward?: bool, applies?: bool}> + */ + public static array $script = []; + + /** @var list */ + public static array $runs = []; + + public static function reset(): void + { + self::$script = []; + self::$runs = []; + } + + public static function version(): int + { + return 1; + } + + public static function definition(): ModuleDefinition + { + return new ModuleDefinition( + label: 'Testschritt '.static::key(), + purpose: 'Test', + phase: 'P01', + requires: self::$script[static::key()]['requires'] ?? [], + triggers: ['automation', 'test'], + modes: ['automatic'], + ); + } + + public function applies(CaseContext $case): bool + { + return array_key_exists(static::key(), self::$script) && (self::$script[static::key()]['applies'] ?? true); + } + + public function activities(CaseContext $case): array + { + $state = $this->state($case) ?? StepState::Open; + + return [new Activity(static::key(), static::key(), ActivityState::from($state->value))]; + } + + public function state(CaseContext $case): ?StepState + { + return self::$script[static::key()]['state'] ?? StepState::Open; + } + + public function due(CaseContext $case): bool + { + return self::$script[static::key()]['due'] ?? ($this->state($case) === StepState::Open); + } + + public function blockers(CaseContext $case): array + { + return []; + } + + public function run(CaseContext $case): StepResult + { + self::$runs[] = static::key(); + $run = self::$script[static::key()]['run'] ?? null; + $result = $run === null ? null : $run(); + if ($result === null) { + self::$script[static::key()]['state'] = StepState::Done; + } + + return $result ?? StepResult::ran(); + } + + public function isOutward(): bool + { + return self::$script[static::key()]['outward'] ?? false; + } + + public static function fail(): never + { + throw new RuntimeException('Testfehler'); + } +} diff --git a/tests/Support/Process/FakeModuleA.php b/tests/Support/Process/FakeModuleA.php new file mode 100644 index 0000000..ba22f9c --- /dev/null +++ b/tests/Support/Process/FakeModuleA.php @@ -0,0 +1,11 @@ + Date: Wed, 4 Nov 2026 14:53:08 +0100 Subject: [PATCH 6/9] =?UTF-8?q?U-A:=20process:check/impact/fingerprint,=20?= =?UTF-8?q?Modulmatrix,=20Modul-Vertragstest,=20O4-Aussetzung=20der=20Au?= =?UTF-8?q?=C3=9Fenwirkungen=20(I-002),=20Bewertungsbitte=20je=20Kanal=20a?= =?UTF-8?q?bschaltbar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- app/Actions/RequestReviews.php | 7 +- app/Actions/SendBookingReminders.php | 5 +- app/Console/Commands/ProcessCheck.php | 104 ++++++++++++++++ app/Console/Commands/ProcessFingerprint.php | 34 ++++++ app/Console/Commands/ProcessImpact.php | 62 ++++++++++ .../Architektur/MODULMATRIX.md | 31 +++++ pipeline.toml | 5 +- tests/Feature/Process/ModuleContractTest.php | 109 +++++++++++++++++ .../PortalReportSuspendsAutomationTest.php | 112 ++++++++++++++++++ 9 files changed, 466 insertions(+), 3 deletions(-) create mode 100644 app/Console/Commands/ProcessCheck.php create mode 100644 app/Console/Commands/ProcessFingerprint.php create mode 100644 app/Console/Commands/ProcessImpact.php create mode 100644 docs/Prozessarchitektur/Architektur/MODULMATRIX.md create mode 100644 tests/Feature/Process/ModuleContractTest.php create mode 100644 tests/Feature/Process/PortalReportSuspendsAutomationTest.php diff --git a/app/Actions/RequestReviews.php b/app/Actions/RequestReviews.php index 399d200..77b4f0c 100644 --- a/app/Actions/RequestReviews.php +++ b/app/Actions/RequestReviews.php @@ -6,6 +6,8 @@ use App\Enums\Responsibility; use App\Mail\ReviewRequest; use App\Models\Booking; +use App\Process\OutwardSuspension; +use App\Process\ProcessPlan; use Illuminate\Support\Facades\Mail; /** @@ -27,7 +29,10 @@ public function handle(): int ->whereHas('guest', fn ($query) => $query->whereNull('anonymized_at')->whereNotNull('email')->where('email', '!=', '')) ->with('guest') ->get() - ->filter(fn (Booking $booking): bool => $booking->process()->guestMessages() === Responsibility::Landlord); + ->filter(fn (Booking $booking): bool => $booking->process()->guestMessages() === Responsibility::Landlord + // The step can be switched off per channel (Kanal › Ablauf); an open portal report holds it back (O4). + && ProcessPlan::of($booking)->enabled('review.request') + && OutwardSuspension::reason($booking) === null); foreach ($bookings as $booking) { Mail::to($booking->guest->email, $booking->guest->full_name)->send(new ReviewRequest($booking)); diff --git a/app/Actions/SendBookingReminders.php b/app/Actions/SendBookingReminders.php index e5a717d..a6ca912 100644 --- a/app/Actions/SendBookingReminders.php +++ b/app/Actions/SendBookingReminders.php @@ -9,6 +9,7 @@ use App\Mail\ArrivalInformation; use App\Models\Booking; use App\Models\BookingTask; +use App\Process\OutwardSuspension; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Mail; @@ -63,7 +64,9 @@ public function handle(): array ->whereDate('arrival', '>=', $today) ->whereDate('arrival', '<=', $today->copy()->addDays(self::ARRIVAL_INFO_MAX_DAYS_BEFORE))) ->filter(fn (Booking $booking): bool => $booking->process()->guestMessages() === Responsibility::Landlord - && $booking->arrival->lessThanOrEqualTo($today->copy()->addDays($booking->process()->arrivalInfoDaysBefore()))); + && $booking->arrival->lessThanOrEqualTo($today->copy()->addDays($booking->process()->arrivalInfoDaysBefore())) + // Decision O4: an open portal report of a cancellation or change holds the message back until clarified. + && OutwardSuspension::reason($booking) === null); foreach ($arrivals as $booking) { Mail::to($booking->guest->email, $booking->guest->full_name)->send(new ArrivalInformation($booking)); $booking->update(['arrival_info_sent_at' => now()]); diff --git a/app/Console/Commands/ProcessCheck.php b/app/Console/Commands/ProcessCheck.php new file mode 100644 index 0000000..0d1fb3e --- /dev/null +++ b/app/Console/Commands/ProcessCheck.php @@ -0,0 +1,104 @@ +problems(); + + if ($this->option('cases')) { + $problems = [...$problems, ...$this->cases($catalogue)]; + } + + if ($this->option('matrix')) { + $path = base_path('docs/Prozessarchitektur/Architektur/MODULMATRIX.md'); + file_put_contents($path, $this->matrix($catalogue)); + $this->info('Modulmatrix geschrieben: '.$path); + } + + foreach ($problems as $problem) { + $this->error($problem); + } + if ($problems === []) { + $this->info(count($catalogue->modules()).' Module, '.count($catalogue->modelVersions()).' Modelle: ohne Befund.'); + } + + return $problems === [] ? self::SUCCESS : self::FAILURE; + } + + /** + * @return list + */ + private function cases(ProcessCatalogue $catalogue): array + { + $problems = []; + Booking::withoutGlobalScopes()->select(['id', 'reference', 'profile', 'status'])->whereNotNull('profile')->lazyById()->each(function (Booking $booking) use ($catalogue, &$problems): void { + $plan = (array) (($booking->profile ?? [])['plan'] ?? []); + if ($plan === []) { + return; + } + $frozen = ProcessPlan::fromArray($plan); + if (! $catalogue->hasModel($frozen->model)) { + $problems[] = "Vorgang {$booking->reference}: Modell {$frozen->model} ist nicht mehr registriert."; + } elseif (! $catalogue->hasModel($frozen->model, $frozen->modelVersion)) { + $problems[] = "Vorgang {$booking->reference}: Modellversion {$frozen->reference()} fehlt im Register (T3: Versionen nicht entfernen, solange Vorgänge sie tragen)."; + } + foreach ($frozen->modules as $key => $version) { + if (! $catalogue->serves($key, $version) && ! in_array($booking->status, [BookingStatus::Cancelled, BookingStatus::Declined, BookingStatus::Expired, BookingStatus::Completed], true)) { + $problems[] = "Offener Vorgang {$booking->reference}: Modul {$key}@{$version} wird nicht mehr bedient."; + } + } + }); + + return $problems; + } + + private function matrix(ProcessCatalogue $catalogue): string + { + $models = $catalogue->models(); + $lines = [ + '# Modulmatrix (erzeugt)', + '', + 'Erzeugt von `php artisan process:check --matrix` aus `config/process.php` – nicht von Hand ändern. Spalten: Modelle (Standardablauf; `V` = nur in einer Variante).', + '', + '| Modul | Version | Phase | Aktivierung | Verfügbarkeit | hart abhängig von | '.implode(' | ', array_keys($models)).' | Testgruppe |', + '|'.str_repeat('---|', 7 + count($models)), + ]; + foreach ($catalogue->modules() as $key => $class) { + $definition = $class::definition(); + $cells = array_map(function ($model) use ($key): string { + if (in_array($key, $model->modules('standard'), true)) { + return '●'; + } + foreach ($model->variants() as $variant) { + if (in_array($key, $model->modules($variant->key), true)) { + return 'V'; + } + } + + return ''; + }, $models); + $hard = implode(', ', array_map(fn ($dependency): string => $dependency->module, array_filter($definition->requires, fn ($dependency): bool => $dependency->hard))); + $lines[] = "| `{$key}` | {$class::version()} | {$definition->phase} | {$definition->toggle} | {$definition->availability} | {$hard} | ".implode(' | ', $cells)." | `module:{$key}` |"; + } + + return implode("\n", $lines)."\n"; + } +} diff --git a/app/Console/Commands/ProcessFingerprint.php b/app/Console/Commands/ProcessFingerprint.php new file mode 100644 index 0000000..7b4cc93 --- /dev/null +++ b/app/Console/Commands/ProcessFingerprint.php @@ -0,0 +1,34 @@ + md5($query->get()->map(fn (object $row): string => (string) json_encode($row))->implode("\n")); + + $this->line((string) json_encode([ + 'bookings' => DB::table('bookings')->count(), + 'channels' => DB::table('channels')->count(), + 'blocked_periods' => DB::table('blocked_periods')->count(), + 'h_bookings' => $hash(DB::table('bookings')->orderBy('id')->select('id', 'status', 'profile', 'total', 'quote', 'offer_terms', 'acceptance', 'arrival', 'departure', 'hold_expires_at', 'deposit_due_on', 'balance_due_on')), + 'h_overrides' => $hash(DB::table('channels')->orderBy('id')->select('id', 'process_overrides', 'booking_model', 'case_intake')), + 'h_blocks' => $hash(DB::table('blocked_periods')->orderBy('id')->select('id', 'starts_on', 'ends_on', 'source', 'channel_id', 'linked_booking_id', 'deleted_at')), + ], JSON_PRETTY_PRINT)); + + return self::SUCCESS; + } +} diff --git a/app/Console/Commands/ProcessImpact.php b/app/Console/Commands/ProcessImpact.php new file mode 100644 index 0000000..eff6797 --- /dev/null +++ b/app/Console/Commands/ProcessImpact.php @@ -0,0 +1,62 @@ +argument('module'); + if (! $catalogue->hasModule($key)) { + $this->error("Unbekanntes Modul {$key}. Registriert: ".implode(', ', array_keys($catalogue->modules()))); + + return self::FAILURE; + } + + $class = $catalogue->modules()[$key]; + $definition = $class::definition(); + $uses = []; + foreach ($catalogue->models() as $modelKey => $model) { + foreach ($model->variants() as $variant) { + if (in_array($key, $model->modules($variant->key), true)) { + $uses[] = $modelKey.($variant->key === 'standard' ? '' : ':'.$variant->key).' ('.implode('/', array_map(fn ($type): string => strtoupper($type->value), $model::caseTypes())).')'; + } + } + } + $dependents = array_keys(array_filter($catalogue->modules(), fn (string $other): bool => collect($other::definition()->requires)->contains(fn ($dependency): bool => $dependency->module === $key))); + $modelKeys = array_map(fn (string $use): string => explode(' ', explode(':', $use)[0])[0], $uses); + $channels = Channel::withoutGlobalScopes()->get(['process_overrides'])->filter(fn (Channel $channel): bool => collect((array) $channel->process_overrides)->contains(fn ($config): bool => in_array($config['model'] ?? null, $modelKeys, true)))->count(); + + $this->table(['', $key.' v'.$class::version()], [ + ['Aufgabe', $definition->purpose], + ['Phase / Aktivierung', $definition->phase.' / '.$definition->toggle.' / '.$definition->availability], + ['Modelle', implode(', ', $uses) ?: '–'], + ['Erweiterungspunkte', implode(', ', $definition->points) ?: 'fester Platz im Modell'], + ['Benötigt', implode(', ', array_map(fn ($dependency): string => $dependency->module.($dependency->hard ? ' (hart)' : ' (weich)'), $definition->requires)) ?: '–'], + ['Benötigt von', implode(', ', $dependents) ?: '–'], + ['Läuft automatisch', is_subclass_of($class, RunsAutomatically::class) ? 'ja, Auslöser: '.implode(', ', $definition->triggers) : 'nein'], + ['Preisbeitrag', is_subclass_of($class, ContributesToPrice::class) ? 'ja (CasePricing, nur vor Verbindlichkeit)' : 'nein'], + ['Wertet Vertragsdaten aus', $definition->readsContractData ? 'ja – Bestandsfall-Test Pflicht (--group=ongoing)' : 'nein'], + ['Parameter', implode(', ', array_map(fn ($parameter): string => is_string($parameter) ? $parameter : $parameter->value, $definition->parameters)) ?: '–'], + ['Kanäle mit gewähltem Modell', (string) $channels], + ['Tests', "--group=module:{$key} --group=golden --group=ongoing --group=runner"], + ]); + + return self::SUCCESS; + } +} diff --git a/docs/Prozessarchitektur/Architektur/MODULMATRIX.md b/docs/Prozessarchitektur/Architektur/MODULMATRIX.md new file mode 100644 index 0000000..c243b02 --- /dev/null +++ b/docs/Prozessarchitektur/Architektur/MODULMATRIX.md @@ -0,0 +1,31 @@ +# Modulmatrix (erzeugt) + +Erzeugt von `php artisan process:check --matrix` aus `config/process.php` – nicht von Hand ändern. Spalten: Modelle (Standardablauf; `V` = nur in einer Variante). + +| Modul | Version | Phase | Aktivierung | Verfügbarkeit | hart abhängig von | a1.offer | a1.information | a2.offer | a2.information | a3.portal_booking | a4.portal_booking | a5.portal_booking | a6.internal | Testgruppe | +|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| +| `intake.record` | 1 | P01 | mandatory | production | | ● | ● | ● | ● | ● | ● | ● | ● | `module:intake.record` | +| `guest.details` | 1 | P01 | mandatory | production | intake.record | ● | ● | ● | ● | ● | ● | ● | | `module:guest.details` | +| `guest.data_request` | 1 | P01 | optional | production | intake.record | ● | ● | ● | ● | ● | ● | ● | | `module:guest.data_request` | +| `hold` | 1 | P01 | conditional | production | intake.record | ● | ● | ● | ● | | | | | `module:hold` | +| `availability.check` | 1 | P01 | mandatory | production | | ● | ● | ● | ● | | | | | `module:availability.check` | +| `binding.portal` | 1 | P02 | mandatory | production | intake.record | | | | | ● | ● | ● | | `module:binding.portal` | +| `channels.block` | 1 | P02 | mandatory | production | | ● | ● | ● | ● | ● | ● | ● | ● | `module:channels.block` | +| `offer.information` | 1 | P02 | mandatory | production | intake.record | ● | ● | ● | ● | | | | | `module:offer.information` | +| `offer.binding` | 2 | P02 | mandatory | production | guest.details, availability.check | ● | ● | ● | ● | | | | | `module:offer.binding` | +| `offer.acceptance` | 1 | P02 | mandatory | production | offer.binding | ● | ● | ● | ● | | | | | `module:offer.acceptance` | +| `documents.send` | 1 | P03 | mandatory | production | guest.details | ● | ● | ● | ● | ● | ● | ● | | `module:documents.send` | +| `documents.stay_confirmation` | 1 | P03 | optional | production | | | | | | | | | ● | `module:documents.stay_confirmation` | +| `case.tasks` | 1 | P03 | event_driven | production | | ● | ● | ● | ● | ● | ● | ● | ● | `module:case.tasks` | +| `change.proposal` | 1 | P03 | event_driven | production | | ● | ● | ● | ● | ● | ● | ● | | `module:change.proposal` | +| `case.closure` | 1 | P05 | mandatory | production | | ● | ● | ● | ● | ● | ● | ● | ● | `module:case.closure` | +| `case.settlement` | 1 | P05 | mandatory | production | | ● | ● | ● | ● | ● | ● | ● | ● | `module:case.settlement` | +| `payments.monitor` | 1 | P03 | mandatory | production | | ● | ● | ● | ● | ● | ● | ● | | `module:payments.monitor` | +| `portal.payout` | 1 | P03 | mandatory | production | | ● | ● | ● | ● | ● | ● | ● | | `module:portal.payout` | +| `payments.internal` | 1 | P03 | conditional | production | | | | | | | | | ● | `module:payments.internal` | +| `arrival.details` | 1 | P04 | optional | production | | ● | ● | ● | ● | ● | ● | ● | | `module:arrival.details` | +| `arrival.info` | 1 | P04 | mandatory | production | | ● | ● | ● | ● | ● | ● | ● | | `module:arrival.info` | +| `stay` | 1 | P04 | mandatory | production | | ● | ● | ● | ● | ● | ● | ● | ● | `module:stay` | +| `review.request` | 1 | P05 | optional | production | stay | ● | ● | ● | ● | ● | ● | ● | | `module:review.request` | +| `guest.loyalty_status` | 1 | P01 | optional | tester_only | guest.details | V | | | | | | | | `module:guest.loyalty_status` | +| `pricing.loyalty_discount` | 1 | P02 | optional | tester_only | guest.loyalty_status | V | | | | | | | | `module:pricing.loyalty_discount` | diff --git a/pipeline.toml b/pipeline.toml index 1a44a3c..60dfe37 100644 --- a/pipeline.toml +++ b/pipeline.toml @@ -10,7 +10,10 @@ prepare = [ ["php", "-r", "copy('.env.example', '.env');"], ["php", "artisan", "key:generate", "--no-interaction"], ] -test = [["php", "-d", "memory_limit=512M", "vendor/bin/phpunit", "--testsuite=Feature", "--no-progress"]] +test = [ + ["php", "artisan", "process:check", "--no-interaction"], + ["php", "-d", "memory_limit=512M", "vendor/bin/phpunit", "--testsuite=Feature", "--no-progress"], +] finalize = [ ["composer", "install", "--no-dev", "--prefer-dist", "--optimize-autoloader", "--no-interaction", "--no-progress"], ["php", "artisan", "optimize:clear", "--no-interaction"], diff --git a/tests/Feature/Process/ModuleContractTest.php b/tests/Feature/Process/ModuleContractTest.php new file mode 100644 index 0000000..e81454e --- /dev/null +++ b/tests/Feature/Process/ModuleContractTest.php @@ -0,0 +1,109 @@ +modules() as $key => $class) { + $definition = $class::definition(); + $this->assertMatchesRegularExpression('/^[a-z0-9_]+(\.[a-z0-9_]+)*$/', $key); + $this->assertNotSame('', trim($definition->label), "{$key}: label"); + $this->assertNotSame('', trim($definition->purpose), "{$key}: purpose"); + $this->assertContains($definition->phase, $phases, "{$key}: phase"); + $this->assertContains($definition->toggle, $toggles, "{$key}: toggle"); + $this->assertSame([], array_diff($definition->effects, $effects), "{$key}: unknown effect kinds"); + $this->assertGreaterThanOrEqual(1, $class::version()); + foreach ($definition->parameters as $parameter) { + $this->assertTrue($parameter instanceof ProcessSetting || (is_string($parameter) && $parameter !== ''), "{$key}: parameter"); + } + if (is_subclass_of($class, RunsAutomatically::class)) { + $this->assertNotSame([], $definition->modes, "{$key}: an automatic module names its modes"); + $this->assertNotSame([], $definition->triggers, "{$key}: an automatic module names its triggers"); + } + if ($definition->isTesterOnly()) { + $this->assertNotSame([], $definition->points, "{$key}: a tester-only module sits at an extension point"); + } + } + } + + public function test_reading_methods_never_write(): void + { + $this->travelTo(CarbonImmutable::parse('2026-10-23 10:00')); + $this->seed(PropertySeeder::class); + $property = Property::sole(); + $portal = Channel::factory()->for($property)->create(['booking_model' => 'portal_booking', 'process_overrides' => ['booking' => ['payments' => 'portal']]]); + $cases = []; + foreach ([BookingStatus::Reserved, BookingStatus::OfferSent, BookingStatus::Confirmed, BookingStatus::Completed, BookingStatus::Cancelled] as $index => $status) { + $cases[] = Booking::factory()->for($property)->create(['status' => $status, 'intake' => 'inquiry', 'arrival' => now()->addDays(40 + $index * 10)->toDateString(), 'departure' => now()->addDays(44 + $index * 10)->toDateString(), 'hold_expires_at' => now()->addDay()]); + $cases[] = Booking::factory()->for($property)->create(['status' => $status === BookingStatus::Reserved ? BookingStatus::Confirmed : $status, 'intake' => 'booking', 'import_channel_id' => $portal->id, 'origin_channel_id' => $portal->id, 'arrival' => now()->addDays(100 + $index * 10)->toDateString(), 'departure' => now()->addDays(104 + $index * 10)->toDateString()]); + } + $catalogue = app(ProcessCatalogue::class); + + $writes = []; + DB::listen(function (QueryExecuted $query) use (&$writes): void { + if (preg_match('/^\s*(insert|update|delete|replace)\b/i', $query->sql) === 1) { + $writes[] = $query->sql; + } + }); + + foreach ($cases as $booking) { + $booking = $booking->fresh(); + // Every module against every case: also modules of other models must read without side effects. + $plan = new ProcessPlan('a1.offer', 1, 'loyalty', array_map(fn (string $class): int => $class::version(), $catalogue->modules()), [], ProcessPlan::TESTER); + $context = new CaseContext($booking, $plan); + foreach (array_keys($catalogue->modules()) as $key) { + $module = $catalogue->module($key); + $module->applies($context); + $module->activities($context); + $module->state($context); + if ($module instanceof RunsAutomatically) { + $module->due($context); + $module->blockers($context); + $module->isOutward(); + } + if ($module instanceof ContributesToPrice && $booking->arrival->lessThan(now()->addDays(55))) { + $module->priceLines($context, app(PriceCalculator::class)->calculate($property, new StayRequest($booking->arrival, $booking->departure, 2))); + } + } + } + + $this->assertSame([], $writes, 'reading methods of modules must not write'); + } +} diff --git a/tests/Feature/Process/PortalReportSuspendsAutomationTest.php b/tests/Feature/Process/PortalReportSuspendsAutomationTest.php new file mode 100644 index 0000000..ade5b6f --- /dev/null +++ b/tests/Feature/Process/PortalReportSuspendsAutomationTest.php @@ -0,0 +1,112 @@ +travelTo(CarbonImmutable::parse('2026-10-23 18:00')); + $this->seed([PropertySeeder::class, SiteSeeder::class]); + $this->property = Property::sole(); + Storage::fake('local'); + Content::save(['contract.terms' => '

Echte Bedingungen

', 'stay.cancellation' => '

Echtes Storno

']); + config(['mail.default' => 'array']); + Mail::swap(new MailManager($this->app)); + Settings::tenant()->update(['bank_iban' => 'DE02120300000000202051', 'test_recipient' => 'test@example.org', 'process_defaults' => ['processing' => 'automatic']]); + Http::preventStrayRequests(); + $this->portal = Channel::factory()->for($this->property)->create(['name' => 'Destination Solutions', 'booking_model' => 'portal_booking', 'import_enabled' => false, 'settings' => ['import_url' => 'https://ds.example/a.ics', 'email_senders' => 'ds.example']]); + } + + public function test_documents_wait_while_a_cancellation_report_is_open_and_go_after_clarification(): void + { + $booking = app(TakeOverExternalBooking::class)->handle($this->property, $this->portal, CarbonImmutable::parse('2026-12-05'), CarbonImmutable::parse('2026-12-12'), ['portal_reference' => 'DS-9', 'portal_total' => 98000, 'guests' => 2]); + $task = $this->report($booking); + + app(ContributeCaseFacts::class)->handle($booking->fresh(), ['guest.first_name' => 'Dora', 'guest.last_name' => 'Gast', 'guest.email' => 'dora@example.org'], FactSource::PortalMail); + + $booking->refresh(); + $this->assertNull($booking->confirmation_sent_at, 'no documents while the report is open'); + $this->assertSame(BookingStatus::Confirmed, $booking->status, 'the report never changes the booking'); + $held = app(CaseAutomation::class)->advance($booking->fresh()); + $this->assertSame([OutwardSuspension::reason($booking)], $held, 'the documents wait only for the clarification'); + + $task->update(['status' => BookingTaskStatus::Done, 'completed_at' => now(), 'note' => 'Portal bestätigt: keine Stornierung']); + $held = app(CaseAutomation::class)->advance($booking->fresh()); + + // After clarification the step is evaluated from the case's current state again: here the documents' own + // release rules (portal template, released texts) decide, no longer the report. + $this->assertNotContains(OutwardSuspension::reason($booking), $held); + $this->assertStringContainsString('Arbeitsfassung', implode(' ', $held)); + } + + public function test_arrival_information_waits_but_internal_tasks_go_on(): void + { + $booking = Booking::factory()->for($this->property)->create(['status' => BookingStatus::Confirmed, 'arrival' => now()->addDays(2)->toDateString(), 'departure' => now()->addDays(6)->toDateString(), 'deposit_due_on' => now()->subDay()->toDateString(), 'confirmed_at' => now()]); + $this->report($booking); + + app(SendBookingReminders::class)->handle(); + + $this->assertNull($booking->fresh()->arrival_info_sent_at); + $this->assertTrue(BookingTask::query()->where('booking_id', $booking->id)->where('kind', BookingTaskKind::DepositReminder)->exists(), 'internal tasks are not blocked'); + } + + public function test_an_unassigned_portal_mail_suspends_nothing(): void + { + $booking = Booking::factory()->for($this->property)->create(['status' => BookingStatus::Confirmed, 'arrival' => now()->addDays(2)->toDateString(), 'departure' => now()->addDays(6)->toDateString(), 'confirmed_at' => now()]); + + app(ProcessPortalMail::class)->handle(new PortalMail('', 'noreply@ds.example', 'Buchung storniert: UNBEKANNT-1', 'Die Buchung vom 01.03.2027 bis 05.03.2027 wurde storniert.', CarbonImmutable::now())); + app(SendBookingReminders::class)->handle(); + + $this->assertNull(OutwardSuspension::reason($booking)); + $this->assertNotNull($booking->fresh()->arrival_info_sent_at); + } + + private function report(Booking $booking): BookingTask + { + return BookingTask::query()->create(['booking_id' => $booking->id, 'kind' => BookingTaskKind::PortalCancellationReported, 'status' => BookingTaskStatus::Open, 'title' => 'Portal meldet Stornierung']); + } +} From c255783cec8c70d75d2c5d2454e6aa6a9f891df1 Mon Sep 17 00:00:00 2001 From: Lars Date: Wed, 4 Nov 2026 15:04:28 +0100 Subject: [PATCH 7/9] =?UTF-8?q?U-C:=20Kanalkonfigurator=20(Kanal=20?= =?UTF-8?q?=E2=80=BA=20Ablauf):=20Modellwahl=20nach=20Kanalprofil=20(E2/O2?= =?UTF-8?q?),=20Schritte=20mit=20Schalter,=20Ausf=C3=BChrung,=20Ausf=C3=BC?= =?UTF-8?q?hrenden=20und=20Fristen,=20Herkunft=20der=20Werte,=20Vorschau;?= =?UTF-8?q?=20ConfigureChannelProcess;=20Modell=20legt=20Einstellungen=20f?= =?UTF-8?q?est?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flache Prozessfelder im Kanalformular entfallen als Hauptansicht. Volle Suite 820/820. Co-Authored-By: Claude Opus 5.5 --- app/Actions/ConfigureChannelProcess.php | 68 +++++ .../Resources/Channels/ChannelResource.php | 2 + .../Channels/Pages/ChannelProcess.php | 231 ++++++++++++++++ .../Resources/Channels/Pages/EditChannel.php | 5 +- .../Channels/Schemas/ChannelForm.php | 59 ++-- app/Process/ChannelProcessConfiguration.php | 256 ++++++++++++++++++ app/Process/ProcessProfile.php | 4 + app/Process/ProcessSettings.php | 27 ++ config/channels.php | 14 + .../pages/effective-settings.blade.php | 2 +- .../channels/channel-process.blade.php | 138 ++++++++++ tests/Feature/ChannelManagerTest.php | 11 +- .../ChannelProcessConfiguratorTest.php | 214 +++++++++++++++ 13 files changed, 981 insertions(+), 50 deletions(-) create mode 100644 app/Actions/ConfigureChannelProcess.php create mode 100644 app/Filament/Resources/Channels/Pages/ChannelProcess.php create mode 100644 app/Process/ChannelProcessConfiguration.php create mode 100644 resources/views/filament/resources/channels/channel-process.blade.php create mode 100644 tests/Feature/Process/ChannelProcessConfiguratorTest.php diff --git a/app/Actions/ConfigureChannelProcess.php b/app/Actions/ConfigureChannelProcess.php new file mode 100644 index 0000000..b4930d5 --- /dev/null +++ b/app/Actions/ConfigureChannelProcess.php @@ -0,0 +1,68 @@ +, settings?: array} $draft + * + * @throws ValidationException + */ + public function handle(Channel $channel, IntakeKind $intake, array $draft, ?string $by = null): Channel + { + $problems = $this->configuration->problems($channel, $intake, $draft); + if ($problems !== []) { + throw ValidationException::withMessages(['process' => $problems]); + } + + return DB::transaction(function () use ($channel, $intake, $draft, $by): Channel { + $channel = Channel::query()->lockForUpdate()->findOrFail($channel->id); + $overrides = (array) ($channel->process_overrides ?? []); + $current = (array) ($overrides[$intake->value] ?? []); + + $settings = []; + foreach (ProcessSetting::cases() as $setting) { + $value = array_key_exists($setting->value, (array) ($draft['settings'] ?? [])) ? $setting->normalize($draft['settings'][$setting->value]) : $setting->normalize($current[$setting->value] ?? null); + if ($value !== null && in_array($intake, $setting->channelIntakes(), true)) { + $settings[$setting->value] = $value; + } + } + + $steps = []; + foreach ((array) ($draft['steps'] ?? []) as $module => $step) { + if (array_key_exists('on', $step) && $step['on'] === false) { + $steps[$module] = ['on' => false]; + } + } + + $overrides[$intake->value] = [ + ...$settings, + 'model' => $draft['model'], + 'variant' => $draft['variant'] ?? 'standard', + 'steps' => $steps, + 'configured_at' => now()->toIso8601String(), + 'configured_by' => $by ?? auth()->user()?->name, + ]; + $channel->update(['process_overrides' => $overrides]); + + return $channel; + }); + } +} diff --git a/app/Filament/Resources/Channels/ChannelResource.php b/app/Filament/Resources/Channels/ChannelResource.php index 48b9725..a8f3645 100644 --- a/app/Filament/Resources/Channels/ChannelResource.php +++ b/app/Filament/Resources/Channels/ChannelResource.php @@ -4,6 +4,7 @@ use App\Filament\Concerns\FollowsAdminMode; use App\Filament\Concerns\SelectsRecordProperty; +use App\Filament\Resources\Channels\Pages\ChannelProcess; use App\Filament\Resources\Channels\Pages\ChannelRules; use App\Filament\Resources\Channels\Pages\CreateChannel; use App\Filament\Resources\Channels\Pages\EditChannel; @@ -61,6 +62,7 @@ public static function getPages(): array 'create' => CreateChannel::route('/create'), 'edit' => EditChannel::route('/{record}/edit'), 'rules' => ChannelRules::route('/{record}/rules'), + 'process' => ChannelProcess::route('/{record}/process'), ]; } } diff --git a/app/Filament/Resources/Channels/Pages/ChannelProcess.php b/app/Filament/Resources/Channels/Pages/ChannelProcess.php new file mode 100644 index 0000000..5470513 --- /dev/null +++ b/app/Filament/Resources/Channels/Pages/ChannelProcess.php @@ -0,0 +1,231 @@ +, settings: array}> */ + public array $drafts = []; + + public function mount(int|string $record): void + { + $this->record = $this->resolveRecord($record); + $configuration = app(ChannelProcessConfiguration::class); + foreach ($configuration->intakes($this->record) as $intake) { + $current = $configuration->current($this->record, $intake); + $stored = (array) (($this->record->process_overrides ?? [])[$intake->value] ?? []); + $models = $configuration->admissibleModels($this->record, $intake); + $model = array_key_exists($current['model'], $models) || $models === [] ? $current['model'] : (string) array_key_first($models); + $this->drafts[$intake->value] = [ + 'model' => $model, + 'variant' => $current['variant'], + 'steps' => (array) ($stored['steps'] ?? []), + 'settings' => array_map(fn (mixed $value): mixed => is_bool($value) ? ($value ? '1' : '0') : $value, array_intersect_key($stored, array_flip(array_map(fn (ProcessSetting $setting): string => $setting->value, ProcessSetting::cases())))), + 'derived' => $current['derived'], + ]; + } + $this->intake = (string) array_key_first($this->drafts); + } + + public function getTitle(): string + { + return 'Ablauf: '.$this->record->name; + } + + public function expert(): bool + { + $user = auth()->user(); + + return ! $user instanceof User || $user->adminMode() === AdminMode::Expert; + } + + /** + * @return array intake value => tab label + */ + public function tabs(): array + { + return collect(array_keys($this->drafts))->mapWithKeys(fn (string $intake): array => [$intake => $intake === IntakeKind::Booking->value ? 'Feste Buchungen' : 'Anfragen'])->all(); + } + + public function question(): string + { + return $this->intake === IntakeKind::Booking->value + ? 'Wie wird eine feste Buchung über '.$this->record->name.' abgewickelt?' + : 'Wie wird eine Anfrage über '.$this->record->name.' abgewickelt?'; + } + + /** + * @return array + */ + public function models(): array + { + return app(ChannelProcessConfiguration::class)->admissibleModels($this->record, IntakeKind::from($this->intake)); + } + + public function chooseModel(string $model): void + { + $this->drafts[$this->intake]['model'] = $model; + $this->drafts[$this->intake]['variant'] = 'standard'; + $this->drafts[$this->intake]['steps'] = []; + } + + public function model(): ProcessModel + { + return app(ProcessCatalogue::class)->model($this->drafts[$this->intake]['model']); + } + + public function profile(): ProcessProfile + { + return app(ChannelProcessConfiguration::class)->profileWith($this->record, IntakeKind::from($this->intake), $this->drafts[$this->intake]); + } + + /** + * The step cards: preview row + controls of each step. + * + * @return list> + */ + public function steps(): array + { + $configuration = app(ChannelProcessConfiguration::class); + $catalogue = app(ProcessCatalogue::class); + $model = $this->model(); + $profile = $this->profile(); + $draft = $this->drafts[$this->intake]; + + return array_map(function (array $row) use ($configuration, $catalogue, $model, $profile): array { + $definition = $catalogue->modules()[$row['module']]::definition(); + $controls = ChannelProcessConfiguration::STEP_CONTROLS[$row['module']] ?? []; + $parameters = array_values(array_filter($controls['parameters'] ?? [], fn (ProcessSetting $setting): bool => in_array(IntakeKind::from($this->intake), $setting->channelIntakes(), true) && ! $model::fixesSetting($setting) && ($this->expert() || in_array($setting, [ProcessSetting::HoldHours, ProcessSetting::DataRequestReminderHours, ProcessSetting::ArrivalInfoDaysBefore, ProcessSetting::ClarificationHoldAutoMinutes], true)))); + + return [...$row, + 'purpose' => $definition->purpose, + 'waits' => $definition->waits, + 'optional' => $definition->isOptional(), + 'version' => $catalogue->modules()[$row['module']]::version(), + 'mode_setting' => isset($controls['mode']) && ! $model::fixesSetting($controls['mode']) ? $controls['mode'] : null, + 'mode_options' => $configuration->modeOptions($row['module']), + 'performer_setting' => isset($controls['performer']) ? $controls['performer']['setting'] : null, + 'performer_options' => $configuration->performerOptions($model, $row['module']), + 'parameters' => array_map(fn (ProcessSetting $setting): array => $this->setting($setting, $profile), $parameters), + ]; + }, $configuration->preview($this->record, IntakeKind::from($this->intake), $draft)); + } + + /** + * One setting with its effective value and origin (set here, by the model, inherited from where). + * + * @return array{key: string, question: string, value: string, source: string, set: bool} + */ + public function setting(ProcessSetting $setting, ProcessProfile $profile): array + { + $source = $profile->source($setting); + + return [ + 'key' => $setting->value, + 'question' => $setting->question(), + 'value' => $setting === ProcessSetting::ContractTemplate ? (string) ($profile->value($setting) ?? 'Vorlage der Wohnung') : $setting->describe($profile->value($setting)), + 'source' => in_array($source, [ProcessProfile::CHANNEL, ProcessProfile::WEBSITE], true) ? 'hier gesetzt' : 'geerbt: '.ProcessProfile::sourceLabel($source), + 'set' => array_key_exists($setting->value, $this->drafts[$this->intake]['settings']) && filled($this->drafts[$this->intake]['settings'][$setting->value]), + ]; + } + + public function inherit(string $setting): void + { + unset($this->drafts[$this->intake]['settings'][$setting]); + } + + public function toggleStep(string $module): void + { + $on = ($this->drafts[$this->intake]['steps'][$module]['on'] ?? true) !== false; + $this->drafts[$this->intake]['steps'][$module] = ['on' => ! $on]; + } + + /** + * @return list + */ + public function problems(): array + { + return app(ChannelProcessConfiguration::class)->problems($this->record, IntakeKind::from($this->intake), $this->drafts[$this->intake]); + } + + /** + * Running cases of this channel and intake kind (they keep their frozen plan). + */ + public function runningCases(): int + { + return Booking::query() + ->where(fn ($query) => $query->where('origin_channel_id', $this->record->id)->orWhere('import_channel_id', $this->record->id)) + ->where('intake', $this->intake) + ->whereNotIn('status', ['cancelled', 'declined', 'expired', 'completed']) + ->count(); + } + + public function save(): void + { + try { + $this->record = app(ConfigureChannelProcess::class)->handle($this->record, IntakeKind::from($this->intake), $this->drafts[$this->intake]); + } catch (ValidationException $exception) { + Notification::make()->title('Nicht gespeichert')->body(collect($exception->errors())->flatten()->implode(' '))->danger()->persistent()->send(); + + return; + } + $this->drafts[$this->intake]['derived'] = false; + $running = $this->runningCases(); + Notification::make()->title('Ablauf gespeichert')->body('Gilt für neue Vorgänge.'.($running > 0 ? ' '.$running.' laufende Vorgänge behalten ihren bisherigen Ablauf.' : ''))->success()->send(); + } + + /** + * The effective value a new case would get, for the landlord's comparison (expert view). + */ + public function standard(ProcessSetting $setting): string + { + $profile = app(ProcessSettings::class)->resolve($this->record->property, null, IntakeKind::from($this->intake)); + + return $setting->describe($profile->value($setting)); + } + + protected function getHeaderActions(): array + { + return [ + Action::make('save')->label('Speichern')->action(fn () => $this->save()), + Action::make('connection')->label('Kanaldaten')->color('gray')->url(fn (): string => ChannelResource::getUrl('edit', ['record' => $this->record])), + ]; + } +} diff --git a/app/Filament/Resources/Channels/Pages/EditChannel.php b/app/Filament/Resources/Channels/Pages/EditChannel.php index 7d8e91e..95553f7 100644 --- a/app/Filament/Resources/Channels/Pages/EditChannel.php +++ b/app/Filament/Resources/Channels/Pages/EditChannel.php @@ -19,6 +19,7 @@ class EditChannel extends EditRecord protected function getHeaderActions(): array { return [ + Action::make('process')->label('Ablauf')->url(fn (): string => ChannelResource::getUrl('process', ['record' => $this->record])), Action::make('rules')->label('Regeln & Exportfelder')->url(fn (): string => ChannelResource::getUrl('rules', ['record' => $this->record]))->visible(fn (): bool => $this->record->isPortal()), Action::make('analyze')->label('Kalender analysieren')->visible(fn (): bool => $this->record->isPortal())->action(function (AnalyzeChannelCalendar $analyze): void { try { @@ -38,10 +39,8 @@ protected function mutateFormDataBeforeFill(array $data): array protected function handleRecordUpdate(Model $record, array $data): Model { - // The own website's entry only keeps its settings; there is no connection to configure. + // The own website's entry has no connection to configure; its process is set up under "Ablauf" (ChannelProcess). if ($record instanceof Channel && $record->isWebsite()) { - $record->update(['process_overrides' => $data['process_overrides'] ?? []]); - return $record; } diff --git a/app/Filament/Resources/Channels/Schemas/ChannelForm.php b/app/Filament/Resources/Channels/Schemas/ChannelForm.php index 849d993..f2b8091 100644 --- a/app/Filament/Resources/Channels/Schemas/ChannelForm.php +++ b/app/Filament/Resources/Channels/Schemas/ChannelForm.php @@ -8,9 +8,7 @@ use App\Enums\ChannelEchoBehavior; use App\Enums\ChannelExportMode; use App\Enums\ChannelStatus; -use App\Enums\IntakeKind; -use App\Enums\ProcessSetting; -use App\Filament\Forms\ProcessSettingFields; +use App\Filament\Resources\Channels\ChannelResource; use App\Models\Channel; use App\Models\Property; use App\Support\CurrentProperty; @@ -21,6 +19,7 @@ use Filament\Forms\Components\TextInput; use Filament\Forms\Components\Toggle; use Filament\Infolists\Components\TextEntry; +use Filament\Schemas\Components\Component; use Filament\Schemas\Components\Group; use Filament\Schemas\Components\Section; use Filament\Schemas\Components\Utilities\Get; @@ -68,7 +67,12 @@ public static function configure(Schema $schema, bool $selectProperty = false): ->required() ->helperText('Zuerst „Beobachten“: Dann entsteht nichts, aber das Eingangsprotokoll (Expertenansicht) zeigt, welche Vorgänge entstanden wären. Unklare Belegungen und Meldungen zu gebuchten Vorgängen erscheinen unter „Zu erledigen“. Unterlagen gehen nie ohne Ihre Freigabe hinaus.') ->columnSpanFull(), - ...self::processSections(), + Select::make('settings.portal_profile')->label('Art des Portals (Kanalprofil)') + ->options(fn (): array => collect(config('channels.portal_profiles'))->except('website')->map(fn (array $profile): string => $profile['label'])->all()) + ->placeholder('am Namen erkennen') + ->helperText('Legt fest, welche Ablaufmodelle für Anfragen und feste Buchungen dieses Portals wählbar sind (Kanal › Ablauf). Weitere Modelle werden nach fachlicher Prüfung im Kanalprofil freigegeben.') + ->columnSpanFull(), + ...self::processLink('Ablauf dieses Portals'), Select::make('connector') ->label('Kalenderanbindung') ->helperText('Diese Verbindung gleicht Belegungszeiträume über iCal ab. Weitere Portalfunktionen benötigen eine eigene Anbindung.') @@ -125,56 +129,27 @@ public static function configure(Schema $schema, bool $selectProperty = false): */ private static function websiteSections(): array { - $defaults = (array) (Settings::tenant()?->process_defaults ?? []); - $inherited = function (ProcessSetting $setting) use ($defaults): string { - $value = $setting->normalize($defaults[$setting->value] ?? null) ?? $setting->default(); - - return $setting === ProcessSetting::ContractTemplate ? 'Vorlage der Wohnung' : $setting->describe($value); - }; - $settings = array_values(array_filter(ProcessSetting::cases(), fn (ProcessSetting $setting): bool => in_array(IntakeKind::Inquiry, $setting->channelIntakes(), true))); - return [ Section::make('Anfragen über die eigene Webseite') - ->description('Nur ausfüllen, was für Anfragen über Ihre Webseite anders sein soll als in Ihren Standardeinstellungen (System › So arbeite ich). Telefon- und E-Mail-Anfragen folgen weiter den Standardeinstellungen.') - ->columns(2) + ->description('Wie Anfragen über Ihre Webseite abgewickelt werden – Ablaufmodell, Schritte, Fristen –, stellen Sie unter „Ablauf“ ein. Telefon- und E-Mail-Anfragen folgen Ihren Standardeinstellungen (System › So arbeite ich).') ->columnSpanFull() ->visible(fn (?Channel $record): bool => $record?->isWebsite() ?? false) - ->schema(ProcessSettingFields::make('process_overrides.inquiry.', $settings, $inherited)), + ->schema(self::processLink('Ablauf der Webseite')), ]; } /** - * What a contract template brings along, shown under the template choice. - */ - /** - * Deviations of this portal from the landlord's defaults, separately for requests and for bookings that are already - * binding when they arrive. Empty fields follow the defaults (System › So arbeite ich). + * The process of a channel is set up step by step on its own page (Kanal › Ablauf), no longer as a flat list here. * - * @return list
+ * @return list */ - private static function processSections(): array + private static function processLink(string $label): array { - $defaults = (array) (Settings::tenant()?->process_defaults ?? []); - $inherited = function (ProcessSetting $setting) use ($defaults): string { - $value = $setting->normalize($defaults[$setting->value] ?? null) ?? $setting->default(); - - return $setting === ProcessSetting::ContractTemplate ? 'Vorlage der Wohnung' : $setting->describe($value); - }; - $settingsFor = fn (IntakeKind $intake): array => array_values(array_filter(ProcessSetting::cases(), fn (ProcessSetting $setting): bool => $setting !== ProcessSetting::FormRequiresAddress && in_array($intake, $setting->channelIntakes(), true))); - return [ - Section::make('Anfragen über dieses Portal') - ->description('Nur ausfüllen, was bei diesem Portal anders ist als in Ihren Standardeinstellungen.') - ->columns(2) - ->columnSpanFull() - ->collapsible() - ->schema(ProcessSettingFields::make('process_overrides.inquiry.', $settingsFor(IntakeKind::Inquiry), $inherited)), - Section::make('Feste Buchungen über dieses Portal') - ->description('Buchungen, die beim Portal schon verbindlich sind. Die Vertragsvorlage bringt Vertragstext, Stornoregel und Anlagen mit.') - ->columns(2) - ->columnSpanFull() - ->collapsible() - ->schema(ProcessSettingFields::make('process_overrides.booking.', $settingsFor(IntakeKind::Booking), $inherited)), + TextEntry::make('process_link')->hiddenLabel()->columnSpanFull() + ->state(fn (?Channel $record): string => $record === null ? 'Den Ablauf richten Sie nach dem Anlegen unter „Ablauf“ ein.' : $label.': Ablaufmodell wählen und Schritte einstellen.') + ->url(fn (?Channel $record): ?string => $record === null ? null : ChannelResource::getUrl('process', ['record' => $record])) + ->color('primary'), ]; } } diff --git a/app/Process/ChannelProcessConfiguration.php b/app/Process/ChannelProcessConfiguration.php new file mode 100644 index 0000000..89b8f45 --- /dev/null +++ b/app/Process/ChannelProcessConfiguration.php @@ -0,0 +1,256 @@ +}> + */ + public const STEP_CONTROLS = [ + 'guest.details' => ['parameters' => [ProcessSetting::FormRequiresAddress]], + 'guest.data_request' => ['mode' => ProcessSetting::DataRequest, 'parameters' => [ProcessSetting::DataRequestReminderHours, ProcessSetting::DataRequestRemindersMax, ProcessSetting::DataRequestFollowupsMax, ProcessSetting::GuestLinkValidDays]], + 'hold' => ['parameters' => [ProcessSetting::ClarificationHoldAutoMinutes, ProcessSetting::ClarificationHoldManualMinutes]], + 'offer.binding' => ['mode' => ProcessSetting::Processing, 'parameters' => [ProcessSetting::HoldHours, ProcessSetting::ContractTemplate]], + 'offer.information' => ['mode' => ProcessSetting::Processing, 'parameters' => [ProcessSetting::GuestLinkValidDays]], + 'documents.send' => ['mode' => ProcessSetting::Processing, 'parameters' => [ProcessSetting::ContractTemplate]], + 'arrival.info' => ['performer' => ['field' => 'guest_messages', 'setting' => ProcessSetting::GuestMessages], 'parameters' => [ProcessSetting::ArrivalInfoDaysBefore]], + ]; + + public function __construct(private ProcessCatalogue $catalogue) {} + + /** + * The intake kinds the channel delivers. + * + * @return list + */ + public function intakes(Channel $channel): array + { + if ($channel->isWebsite()) { + return [IntakeKind::Inquiry]; + } + + return match ($channel->booking_model) { + ChannelBookingModel::Inquiry => [IntakeKind::Inquiry], + ChannelBookingModel::PortalBooking => [IntakeKind::Booking], + default => [IntakeKind::Inquiry, IntakeKind::Booking], + }; + } + + public function profileKey(Channel $channel): string + { + if ($channel->isWebsite()) { + return 'website'; + } + $chosen = (string) (($channel->settings ?? [])['portal_profile'] ?? ''); + $profiles = (array) config('channels.portal_profiles'); + if ($chosen !== '' && array_key_exists($chosen, $profiles)) { + return $chosen; + } + + $name = mb_strtolower((string) $channel->name); + foreach ($profiles as $key => $profile) { + foreach ((array) ($profile['match'] ?? []) as $needle) { + if (str_contains($name, $needle)) { + return $key; + } + } + } + + return 'generic'; + } + + /** + * The models the landlord may choose for this channel and intake kind. + * + * @return array + */ + public function admissibleModels(Channel $channel, IntakeKind $intake): array + { + $allowed = (array) (config('channels.portal_profiles.'.$this->profileKey($channel))[$intake->value] ?? []); + + return array_filter($this->catalogue->admissible($intake), fn (ProcessModel $model): bool => in_array($model::key(), $allowed, true)); + } + + /** + * The model a new case of this channel and intake would follow now: the chosen one, or the one derived from the + * settings as before (marked as derived). + * + * @return array{model: string, variant: string, derived: bool} + */ + public function current(Channel $channel, IntakeKind $intake): array + { + $config = ProcessPlan::configurationOf($channel, $intake); + if (filled($config['model'] ?? null) && $this->catalogue->hasModel((string) $config['model'])) { + return ['model' => (string) $config['model'], 'variant' => (string) ($config['variant'] ?? 'standard'), 'derived' => false]; + } + + $property = $channel->property; + $profile = app(ProcessSettings::class)->resolve($property, $channel, $intake); + + return ['model' => $this->catalogue->derivedModel($profile), 'variant' => 'standard', 'derived' => true]; + } + + /** + * Allowed values of the performer of a step under the model (variable responsibility), as setting values. + * + * @return array value => label + */ + public function performerOptions(ProcessModel $model, string $module): array + { + $control = self::STEP_CONTROLS[$module]['performer'] ?? null; + if ($control === null) { + return []; + } + + return collect($model::responsibilities()->allowed($control['field'])) + ->mapWithKeys(fn (Responsibility $value): array => [$value->value => $value === Responsibility::Portal ? 'Portal' : ($value === Responsibility::Landlord ? 'wir (automatisch)' : $value->getLabel())]) + ->all(); + } + + /** + * Allowed modes of a step (as values of its setting). + * + * @return array + */ + public function modeOptions(string $module): array + { + return match (self::STEP_CONTROLS[$module]['mode'] ?? null) { + ProcessSetting::Processing => collect(ProcessingMode::cases())->mapWithKeys(fn (ProcessingMode $mode): array => [$mode->value => $mode->getLabel()])->all(), + ProcessSetting::DataRequest => collect(DataRequestMode::cases())->mapWithKeys(fn (DataRequestMode $mode): array => [$mode->value => $mode->getLabel()])->all(), + default => [], + }; + } + + /** + * The course a typical new case would take with the given (possibly unsaved) configuration: every step of the model + * with whether it takes part and why not, who carries it out and how. + * + * @param array $draft model, variant, steps, settings of channels.process_overrides[intake] + * @return list + */ + public function preview(Channel $channel, IntakeKind $intake, array $draft): array + { + $model = $this->catalogue->model((string) ($draft['model'] ?? $this->current($channel, $intake)['model'])); + $variant = (string) ($draft['variant'] ?? 'standard'); + $profile = $this->profileWith($channel, $intake, $draft); + $standard = $model->modules('standard'); + $rows = []; + foreach ($model->modules($variant) as $key) { + $class = $this->catalogue->modules()[$key]; + $definition = $class::definition(); + $on = ($draft['steps'][$key]['on'] ?? true) !== false || ! $definition->isOptional(); + $reason = match (true) { + ! $on => 'im Kanal abgeschaltet', + $key === 'hold' && ! $profile->preReservation() => 'keine Vorreservierung in diesem Modell', + $key === 'offer.information' && $profile->preReservation() => 'nicht in diesem Modell (verbindliches Angebot)', + $key === 'offer.binding' && ! $profile->preReservation() => 'erst, wenn ein Angebot von Hand gesendet wird', + $key === 'portal.payout' && $profile->payments() !== Responsibility::Portal => 'wir kassieren selbst', + $key === 'review.request' && $profile->guestMessages() !== Responsibility::Landlord => 'das Portal schreibt dem Gast', + $key === 'guest.details' && $intake === IntakeKind::Booking && $profile->documents() === Responsibility::Portal && $profile->payments() === Responsibility::Portal && $profile->guestMessages() === Responsibility::Portal => 'wir schreiben dem Gast nicht', + default => null, + }; + $mode = isset(self::STEP_CONTROLS[$key]['mode']) ? (string) $profile->value(self::STEP_CONTROLS[$key]['mode']) : (in_array('automatic', $definition->modes, true) ? 'automatic' : null); + $performer = match ($key) { + 'documents.send' => $profile->documents()->value, + 'payments.monitor' => $profile->payments()->value, + 'arrival.info' => $profile->guestMessages()->value, + default => $definition->performers[0] ?? null, + }; + $rows[] = ['module' => $key, 'label' => $definition->label, 'phase' => $definition->phase, 'on' => $on && $reason === null, 'reason' => $reason, + 'performer' => $performer, 'mode' => $mode, 'toggle' => $definition->toggle, 'tester_only' => $definition->isTesterOnly(), 'inserted' => ! in_array($key, $standard, true)]; + } + + return $rows; + } + + /** + * Everything that is not admissible in a draft (empty = it may be saved). + * + * @param array $draft + * @return list + */ + public function problems(Channel $channel, IntakeKind $intake, array $draft, bool $sandbox = false): array + { + $problems = []; + if (! in_array($intake, $this->intakes($channel), true)) { + $problems[] = 'Dieser Kanal liefert keine '.($intake === IntakeKind::Booking ? 'festen Buchungen' : 'Anfragen').'.'; + } + $key = (string) ($draft['model'] ?? ''); + $models = $this->admissibleModels($channel, $intake); + if ($key === '' || ! array_key_exists($key, $models)) { + return [...$problems, 'Das Ablaufmodell „'.$key.'“ ist für diesen Kanal nicht zulässig. Zulässig: '.(implode(', ', array_map(fn (ProcessModel $model): string => $model::label(), $models)) ?: 'keines').'.']; + } + $model = $models[$key]; + $variant = $model->variant((string) ($draft['variant'] ?? 'standard')); + if ($variant === null) { + return [...$problems, 'Das Modell hat diese Variante nicht.']; + } + if ($variant->isTesterOnly() && ! $sandbox) { + $problems[] = 'Die Variante „'.$variant->label.'“ ist nur im Prozess-Tester verwendbar und kann nicht gespeichert werden.'; + } + + foreach ((array) ($draft['steps'] ?? []) as $module => $step) { + if (! $this->catalogue->hasModule($module) || ! in_array($module, $model->modules($variant->key), true)) { + $problems[] = "Der Schritt {$module} gehört nicht zu diesem Modell."; + + continue; + } + $definition = $this->catalogue->modules()[$module]::definition(); + if (($step['on'] ?? true) === false && ! $definition->isOptional()) { + $problems[] = 'Der Schritt „'.$definition->label.'“ ist Pflicht und kann nicht abgeschaltet werden.'; + } + if ($definition->isTesterOnly() && ! $sandbox && ($step['on'] ?? true) !== false && $variant->isTesterOnly()) { + $problems[] = 'Der Schritt „'.$definition->label.'“ ist nur im Prozess-Tester verwendbar.'; + } + } + + // Responsibilities: fixed ones are set by the model; variable ones only to the values the model allows. + $responsibilities = $model::responsibilities(); + foreach (Responsibilities::SETTINGS as $field => $setting) { + $value = $draft['settings'][$setting->value] ?? null; + if ($value === null || $value === '') { + continue; + } + $responsibility = Responsibility::tryFrom((string) $value); + if ($responsibility === null || ! $responsibilities->admits($setting, $responsibility)) { + $problems[] = Responsibilities::LABELS[$field].': „'.($responsibility?->getLabel() ?? $value).'“ ist in diesem Modell nicht zulässig.'; + } + } + + return array_values(array_unique($problems)); + } + + /** + * The profile a new case would get with the draft (model fixes and setting values applied). + * + * @param array $draft + */ + public function profileWith(Channel $channel, IntakeKind $intake, array $draft): ProcessProfile + { + $preview = clone $channel; + $overrides = (array) ($channel->process_overrides ?? []); + $overrides[$intake->value] = [...array_filter((array) ($draft['settings'] ?? []), fn (mixed $value): bool => $value !== null && $value !== ''), 'model' => $draft['model'] ?? null, 'variant' => $draft['variant'] ?? 'standard', 'steps' => (array) ($draft['steps'] ?? [])]; + $preview->setAttribute('process_overrides', $overrides); + + return app(ProcessSettings::class)->resolve($channel->property, $preview, $intake); + } +} diff --git a/app/Process/ProcessProfile.php b/app/Process/ProcessProfile.php index 2149157..9442b03 100644 --- a/app/Process/ProcessProfile.php +++ b/app/Process/ProcessProfile.php @@ -27,6 +27,9 @@ final class ProcessProfile /** The own website's entry of the channel manager (v0.11). */ public const WEBSITE = 'website'; + /** Fixed by the process model chosen for the channel (Architektur V2). */ + public const MODEL = 'model'; + /** Fixed by the case type (A6), not settable. */ public const CASE_TYPE = 'case_type'; @@ -167,6 +170,7 @@ public static function sourceLabel(string $source): string self::CHANNEL => 'Abweichung des Portals', self::WEBSITE => 'Einstellung der eigenen Webseite', self::CASE_TYPE => 'fest für diese Vorgangsart', + self::MODEL => 'festgelegt durch das gewählte Ablaufmodell', 'migration' => 'aus dem bisherigen Stand übernommen', default => 'Grundeinstellung', }; diff --git a/app/Process/ProcessSettings.php b/app/Process/ProcessSettings.php index ed6c719..97b447c 100644 --- a/app/Process/ProcessSettings.php +++ b/app/Process/ProcessSettings.php @@ -10,6 +10,7 @@ use App\Models\Channel; use App\Models\Property; use App\Models\Tenant; +use App\Process\Models\ProcessModel; /** * Resolves the effective process settings: built-in default → landlord default (tenant) → deviation of the property @@ -49,6 +50,17 @@ public function resolve(Property $property, ?Channel $channel, IntakeKind $intak } } + // Architektur V2: the process model chosen for the channel and intake kind fixes some settings (e.g. the + // pre-reservation of the offer model, the responsibilities of A3–A5); these win over every level. + $model = $this->chosenModel($channel, $intake); + foreach ($model === null ? [] : $model::fixes() as $key => $fixed) { + $setting = ProcessSetting::tryFrom($key); + if ($setting !== null) { + $values[$key] = $setting->normalize($fixed) ?? $fixed; + $sources[$key] = ProcessProfile::MODEL; + } + } + if ($intake === IntakeKind::Internal) { // Own use, private stays and blocks (A6): no rental documents, no payment reminders, no guest mails – fixed by // the case type, not by a setting. @@ -68,6 +80,21 @@ public function resolve(Property $property, ?Channel $channel, IntakeKind $intak return new ProcessProfile($intake, ProcessProfile::caseTypeFor($intake, $channel?->isPortal() ?? false, $documents, $payments), $values, $sources); } + /** + * The model chosen for the channel and intake kind (Kanal › Ablauf), when it is registered and fits the intake. + */ + private function chosenModel(?Channel $channel, IntakeKind $intake): ?ProcessModel + { + $key = (string) (ProcessPlan::configurationOf($channel, $intake)['model'] ?? ''); + $catalogue = app(ProcessCatalogue::class); + if ($key === '' || ! $catalogue->hasModel($key)) { + return null; + } + $model = $catalogue->model($key); + + return in_array($intake, $model::intakes(), true) ? $model : null; + } + /** * Settings of a request from the own website: the website's entry of the channel manager is its channel level * (the case itself stays direct, without a channel). diff --git a/config/channels.php b/config/channels.php index 2a7c054..63eeaa5 100644 --- a/config/channels.php +++ b/config/channels.php @@ -25,6 +25,20 @@ */ 'uid_suffix' => '@fewo-stommer', + /* + | Business and integration capabilities per kind of channel (decision E2/O2): which process models may be chosen for + | requests and for bookings that are binding at the portal. A channel names its profile in settings.portal_profile + | (Kanal › Ablauf); without one it is recognised by its name, else "generic". Further models are released here after + | a business review – never as a special rule in the process core. + */ + 'portal_profiles' => [ + 'website' => ['label' => 'Eigene Webseite', 'inquiry' => ['a1.offer', 'a1.information'], 'booking' => []], + 'fewo_direkt' => ['label' => 'FeWo-direkt (Vrbo)', 'match' => ['fewo-direkt', 'fewo direkt', 'vrbo'], 'inquiry' => ['a2.offer', 'a2.information'], 'booking' => ['a4.portal_booking']], + 'destination_solutions' => ['label' => 'Destination Solutions', 'match' => ['destination solution'], 'inquiry' => [], 'booking' => ['a3.portal_booking']], + 'inquiry_listing' => ['label' => 'Inserat mit Anfragen (z. B. ferienundwohnen.de, Ostseeklar)', 'match' => ['ferienundwohnen', 'ostseeklar', 'strandurlaub', 'ferienunterkunft'], 'inquiry' => ['a2.offer', 'a2.information'], 'booking' => []], + 'generic' => ['label' => 'Sonstiges Portal', 'inquiry' => ['a2.offer', 'a2.information'], 'booking' => ['a3.portal_booking', 'a4.portal_booking', 'a5.portal_booking']], + ], + 'removal_confirmation_runs' => 2, 'max_automatic_removals' => 5, 'export_request_history_limit' => 100, diff --git a/resources/views/filament/pages/effective-settings.blade.php b/resources/views/filament/pages/effective-settings.blade.php index e91f3d3..fd8c652 100644 --- a/resources/views/filament/pages/effective-settings.blade.php +++ b/resources/views/filament/pages/effective-settings.blade.php @@ -2,7 +2,7 @@ @php $cell = 'padding:.4rem .5rem;border-bottom:1px solid rgba(128,128,128,.2);vertical-align:top'; $muted = 'color:#6b7280;font-size:.8rem'; - $levels = [\App\Process\ProcessProfile::SYSTEM => 'Grundeinstellung', \App\Process\ProcessProfile::TENANT => 'Ihr Standard', \App\Process\ProcessProfile::PROPERTY => 'Wohnung', \App\Process\ProcessProfile::CHANNEL => 'Portal', \App\Process\ProcessProfile::WEBSITE => 'Webseite', \App\Process\ProcessProfile::CASE_TYPE => 'fest (A6)']; + $levels = [\App\Process\ProcessProfile::SYSTEM => 'Grundeinstellung', \App\Process\ProcessProfile::TENANT => 'Ihr Standard', \App\Process\ProcessProfile::PROPERTY => 'Wohnung', \App\Process\ProcessProfile::CHANNEL => 'Portal', \App\Process\ProcessProfile::WEBSITE => 'Webseite', \App\Process\ProcessProfile::CASE_TYPE => 'fest (A6)', \App\Process\ProcessProfile::MODEL => 'Ablaufmodell']; @endphp diff --git a/resources/views/filament/resources/channels/channel-process.blade.php b/resources/views/filament/resources/channels/channel-process.blade.php new file mode 100644 index 0000000..41d2458 --- /dev/null +++ b/resources/views/filament/resources/channels/channel-process.blade.php @@ -0,0 +1,138 @@ + + @php + $muted = 'color:#6b7280;font-size:.8rem'; + $card = 'border:1px solid rgba(128,128,128,.3);border-radius:.5rem;padding:.75rem 1rem;margin-bottom:.6rem'; + $input = 'border:1px solid rgba(128,128,128,.4);border-radius:.375rem;padding:.3rem .45rem;background:transparent'; + $phases = ['P01' => 'Eingang und Daten', 'P02' => 'Angebot und Verbindlichkeit', 'P03' => 'Abwicklung', 'P04' => 'Aufenthalt', 'P05' => 'Abschluss']; + $performers = ['system' => 'System', 'landlord' => 'Sie', 'guest' => 'Gast', 'portal' => 'Portal', 'service_provider' => 'Dienstleister', 'none' => 'niemand']; + $draft = $this->drafts[$this->intake]; + $models = $this->models(); + $model = $this->model(); + $steps = $this->steps(); + $problems = $this->problems(); + @endphp + + @if (count($this->tabs()) > 1) +
+ @foreach ($this->tabs() as $key => $label) + {{ $label }} + @endforeach +
+ @endif + + + @if ($models === []) +

Für diesen Kanal ist für diese Eingangsart kein Ablaufmodell freigegeben (Kanalprofil). Vorgänge folgen weiter dem aus den Einstellungen abgeleiteten Ablauf.

+ @endif +
+ @foreach ($models as $key => $candidate) + + @endforeach +
+ + @if (count($model->variants()) > 1) +
+ + @if ($model->variant($draft['variant'])?->isTesterOnly()) +

Nur im Prozess-Tester verwendbar (Architekturnachweis). Sie können diese Variante mit „Ablauf testen“ durchspielen, aber nicht speichern.

+ @endif +
+ @endif +
+ + @if ($problems !== []) + +
    + @foreach ($problems as $problem)
  • {{ $problem }}
  • @endforeach +
+
+ @endif + +
+
+ @foreach (collect($steps)->groupBy('phase') as $phase => $group) +

{{ $phases[$phase] ?? $phase }}

+ @foreach ($group as $index => $step) +
+
+ {{ $step['label'] }} + @if ($step['tester_only']) · nur im Prozess-Tester@endif + @if ($step['inserted']) · Zusatzschritt der Variante@endif + + @if ($step['optional']) + + {{ ($draft['steps'][$step['module']]['on'] ?? true) === false ? 'aus' : 'an' }} + + @else + 🔒 Pflicht + @endif +
+
{{ $step['purpose'] }}
+
+ Wer: {{ $performers[$step['performer']] ?? $step['performer'] ?? '–' }} + @if ($step['waits'] !== []) · kann warten auf: {{ implode(', ', array_map(fn ($wait) => ['guest' => 'Gast', 'portal' => 'Portal', 'landlord' => 'Sie', 'time' => 'Frist'][$wait] ?? $wait, $step['waits'])) }}@endif + @if (! $step['on'] && $step['reason']) · übersprungen: {{ $step['reason'] }}@endif + @if ($this->expert()) · {{ $step['module'] }} v{{ $step['version'] }}@endif +
+ + @if ($step['mode_setting'] && $step['mode_options'] !== []) + + @endif + + @if ($step['performer_setting'] && count($step['performer_options']) > 1) + + @endif + + @foreach ($step['parameters'] as $parameter) + + @endforeach +
+ @endforeach + @endforeach +
+ + +
    + @foreach ($steps as $step) +
  1. + {{ $step['label'] }} + – {{ $step['on'] ? ($performers[$step['performer']] ?? $step['performer'] ?? '').($step['mode'] ? ', '.(\App\Enums\ProcessingMode::tryFrom($step['mode'])?->getLabel() ?? \App\Enums\DataRequestMode::tryFrom($step['mode'])?->getLabel() ?? $step['mode']) : '') : 'übersprungen: '.$step['reason'] }} +
  2. + @endforeach +
+

Gilt für neue Vorgänge. Laufende Vorgänge dieses Kanals ({{ $this->runningCases() }}) behalten ihren bisherigen Ablauf.

+ @if (\Illuminate\Support\Facades\Route::has('filament.admin.resources.channels.test')) + Ablauf testen + @endif +
+
+
diff --git a/tests/Feature/ChannelManagerTest.php b/tests/Feature/ChannelManagerTest.php index ca56780..4bb1540 100644 --- a/tests/Feature/ChannelManagerTest.php +++ b/tests/Feature/ChannelManagerTest.php @@ -8,6 +8,7 @@ use App\Enums\IntakeKind; use App\Enums\ProcessSetting; use App\Filament\Pages\EffectiveSettings; +use App\Filament\Resources\Channels\Pages\ChannelProcess; use App\Filament\Resources\Channels\Pages\EditChannel; use App\Filament\Resources\Channels\Pages\ListChannels; use App\Models\Booking; @@ -113,10 +114,12 @@ public function test_the_channel_manager_lists_the_website_and_saves_its_setting Livewire::test(EditChannel::class, ['record' => $website->getRouteKey()]) ->assertSee('Anfragen über die eigene Webseite') - ->assertDontSee('Eigener iCal-Exportlink') - ->fillForm(['process_overrides' => ['inquiry' => ['clarification_hold_manual_minutes' => '0', 'form_requires_address' => '1']]]) - ->call('save') - ->assertHasNoFormErrors(); + ->assertDontSee('Eigener iCal-Exportlink'); + // Architektur V2: the process of the website is set up step by step under "Ablauf" (no flat list in the form). + Livewire::test(ChannelProcess::class, ['record' => $website->getRouteKey()]) + ->set('drafts.inquiry.settings.clarification_hold_manual_minutes', '0') + ->set('drafts.inquiry.settings.form_requires_address', '1') + ->call('save'); $profile = app(ProcessSettings::class)->forWebsite($this->property); $this->assertSame(0, $profile->clarificationHoldMinutes()); diff --git a/tests/Feature/Process/ChannelProcessConfiguratorTest.php b/tests/Feature/Process/ChannelProcessConfiguratorTest.php new file mode 100644 index 0000000..17090e1 --- /dev/null +++ b/tests/Feature/Process/ChannelProcessConfiguratorTest.php @@ -0,0 +1,214 @@ +travelTo(CarbonImmutable::parse('2026-10-23 18:00')); + $this->seed([PropertySeeder::class, SiteSeeder::class]); + $this->property = Property::sole(); + Storage::fake('local'); + Content::save(['contract.terms' => '

Echte Bedingungen

', 'stay.cancellation' => '

Echtes Storno

']); + config(['mail.default' => 'array']); + Mail::swap(new MailManager($this->app)); + Settings::tenant()->update(['bank_iban' => 'DE02120300000000202051', 'test_recipient' => 'test@example.org']); + Http::preventStrayRequests(); + } + + /** K01 / E2 / O2 */ + public function test_only_admissible_models_per_channel_and_intake_are_offered(): void + { + $configuration = app(ChannelProcessConfiguration::class); + $fewo = $this->channel('FeWo-direkt', 'mixed'); + $ds = $this->channel('Destination Solution', 'portal_booking'); + $listing = $this->channel('Ostseeklar', 'inquiry'); + $website = Channel::websiteOf($this->property); + + $this->assertSame(['a2.offer', 'a2.information'], array_keys($configuration->admissibleModels($fewo, IntakeKind::Inquiry))); + $this->assertSame(['a4.portal_booking'], array_keys($configuration->admissibleModels($fewo, IntakeKind::Booking)), 'O2: FeWo-direkt bookings only A4 for now'); + $this->assertSame(['a3.portal_booking'], array_keys($configuration->admissibleModels($ds, IntakeKind::Booking))); + $this->assertSame([IntakeKind::Booking], $configuration->intakes($ds)); + $this->assertSame(['a2.offer', 'a2.information'], array_keys($configuration->admissibleModels($listing, IntakeKind::Inquiry))); + $this->assertSame(['a1.offer', 'a1.information'], array_keys($configuration->admissibleModels($website, IntakeKind::Inquiry))); + + // The restriction lives in the channel profile, not in the process core: a changed profile releases more models. + $fewo->update(['settings' => [...(array) $fewo->settings, 'portal_profile' => 'generic']]); + $this->assertSame(['a3.portal_booking', 'a4.portal_booking', 'a5.portal_booking'], array_keys($configuration->admissibleModels($fewo->fresh(), IntakeKind::Booking))); + + $this->expectException(ValidationException::class); + app(ConfigureChannelProcess::class)->handle($ds, IntakeKind::Booking, ['model' => 'a4.portal_booking']); + } + + /** K01, K05, N4 */ + public function test_a_mixed_channel_gets_different_models_for_requests_and_bookings_and_running_cases_keep_their_plan(): void + { + $fewo = $this->channel('FeWo-direkt', 'mixed'); + $running = app(TakeOverExternalBooking::class)->handle($this->property, $fewo, CarbonImmutable::parse('2026-12-05'), CarbonImmutable::parse('2026-12-12'), ['portal_reference' => 'HA-ALT']); + $before = $running->fresh()->profile; + + app(ConfigureChannelProcess::class)->handle($fewo, IntakeKind::Inquiry, ['model' => 'a2.information']); + app(ConfigureChannelProcess::class)->handle($fewo->fresh(), IntakeKind::Booking, ['model' => 'a4.portal_booking']); + + $inquiry = app(TakeOverPortalInquiry::class)->handle($fewo->fresh(), CarbonImmutable::parse('2026-11-14'), CarbonImmutable::parse('2026-11-18'), 'HA-ANF'); + $booking = app(TakeOverExternalBooking::class)->handle($this->property, $fewo->fresh(), CarbonImmutable::parse('2027-07-10'), CarbonImmutable::parse('2027-07-17'), ['portal_reference' => 'HA-NEU']); + + $this->assertSame(['a2.information', ProcessPlan::CONFIGURED, CaseType::A2], [$inquiry->profile['plan']['model'], $inquiry->profile['plan']['source'], $inquiry->case_type]); + $this->assertFalse($inquiry->process()->preReservation(), 'the model fixes the pre-reservation'); + $this->assertSame(ProcessProfile::MODEL, $inquiry->process()->source(ProcessSetting::PreReservation)); + $this->assertSame(['a4.portal_booking', CaseType::A4], [$booking->profile['plan']['model'], $booking->case_type]); + $this->assertSame($before, $running->fresh()->profile, 'K05: the running case keeps its frozen profile and plan'); + $this->assertSame(CaseType::A3, $running->fresh()->case_type); + } + + /** K07 */ + public function test_mandatory_steps_and_inadmissible_responsibilities_are_refused(): void + { + $fewo = $this->channel('FeWo-direkt', 'mixed'); + $configuration = app(ChannelProcessConfiguration::class); + + $this->assertNotSame([], $configuration->problems($fewo, IntakeKind::Booking, ['model' => 'a4.portal_booking', 'steps' => ['binding.portal' => ['on' => false]]])); + $this->assertNotSame([], $configuration->problems($fewo, IntakeKind::Booking, ['model' => 'a4.portal_booking', 'steps' => ['channels.block' => ['on' => false]]])); + $this->assertNotSame([], $configuration->problems($fewo, IntakeKind::Inquiry, ['model' => 'a2.offer', 'steps' => ['availability.check' => ['on' => false]]])); + $this->assertNotSame([], $configuration->problems($fewo, IntakeKind::Inquiry, ['model' => 'a2.offer', 'steps' => ['offer.acceptance' => ['on' => false]]])); + $this->assertNotSame([], $configuration->problems($fewo, IntakeKind::Booking, ['model' => 'a4.portal_booking', 'settings' => ['payments' => 'landlord']]), 'A4 fixes portal collection'); + $this->assertSame([], $configuration->problems($fewo, IntakeKind::Inquiry, ['model' => 'a2.offer', 'steps' => ['review.request' => ['on' => false], 'guest.data_request' => ['on' => false]]]), 'optional steps may be switched off'); + } + + /** K08 / O1: a variable responsibility changes without a model change, a fixed one cannot */ + public function test_arrival_information_can_go_to_the_portal_within_a4_without_changing_the_model(): void + { + $fewo = $this->channel('FeWo-direkt', 'mixed'); + app(ConfigureChannelProcess::class)->handle($fewo, IntakeKind::Booking, ['model' => 'a4.portal_booking', 'settings' => ['guest_messages' => 'portal']]); + + $booking = app(TakeOverExternalBooking::class)->handle($this->property, $fewo->fresh(), CarbonImmutable::parse('2027-07-10'), CarbonImmutable::parse('2027-07-17'), ['portal_reference' => 'HA-K08']); + + $this->assertSame([CaseType::A4, 'a4.portal_booking'], [$booking->case_type, $booking->profile['plan']['model']]); + $arrival = collect(CaseActivities::for($booking))->firstWhere('key', 'arrival_info'); + $this->assertSame(ActivityState::External, $arrival->state); + $documents = collect(CaseActivities::for($booking))->firstWhere('key', 'documents'); + $this->assertNotSame(ActivityState::External, $documents->state, 'the contract documentation stays ours in A4 (O1)'); + $this->assertNotSame([], app(ChannelProcessConfiguration::class)->problems($fewo->fresh(), IntakeKind::Booking, ['model' => 'a4.portal_booking', 'settings' => ['documents' => 'portal']]), 'contract documentation decides the case type'); + } + + /** N5 */ + public function test_a_switched_off_optional_step_is_skipped_and_has_no_effect(): void + { + $website = Channel::websiteOf($this->property); + app(ConfigureChannelProcess::class)->handle($website, IntakeKind::Inquiry, ['model' => 'a1.offer', 'steps' => ['review.request' => ['on' => false]]]); + $booking = app(CreateReservation::class)->handle($this->property, new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org', 'street' => 'Weg 1', 'postal_code' => '10115', 'city' => 'Berlin', 'country' => 'DE']); + $booking->forceFill(['status' => BookingStatus::Confirmed, 'confirmed_at' => now()])->saveQuietly(); + + $this->assertNull(collect(CaseActivities::for($booking->fresh()))->firstWhere('key', 'review')); + $preview = collect(app(ChannelProcessConfiguration::class)->preview($website->fresh(), IntakeKind::Inquiry, ['model' => 'a1.offer', 'steps' => ['review.request' => ['on' => false]]]))->firstWhere('module', 'review.request'); + $this->assertSame([false, 'im Kanal abgeschaltet'], [$preview['on'], $preview['reason']]); + + $this->travelTo(CarbonImmutable::parse('2026-11-13 10:00')); + app(RequestReviews::class)->handle(); + $this->assertNull($booking->fresh()->review_requested_at); + } + + /** K09 */ + public function test_the_loyalty_variant_can_be_drafted_but_not_saved(): void + { + $website = Channel::websiteOf($this->property); + $configuration = app(ChannelProcessConfiguration::class); + + $preview = collect($configuration->preview($website, IntakeKind::Inquiry, ['model' => 'a1.offer', 'variant' => 'loyalty'])); + $this->assertTrue($preview->firstWhere('module', 'pricing.loyalty_discount')['tester_only']); + $this->assertSame([], $configuration->problems($website, IntakeKind::Inquiry, ['model' => 'a1.offer', 'variant' => 'loyalty'], sandbox: true)); + + $this->expectException(ValidationException::class); + app(ConfigureChannelProcess::class)->handle($website, IntakeKind::Inquiry, ['model' => 'a1.offer', 'variant' => 'loyalty']); + } + + /** K03: the preview lists exactly the steps that show up on a new case */ + public function test_the_preview_matches_the_course_of_a_new_case(): void + { + $website = Channel::websiteOf($this->property); + $draft = ['model' => 'a1.offer']; + app(ConfigureChannelProcess::class)->handle($website, IntakeKind::Inquiry, $draft); + $booking = app(CreateReservation::class)->handle($this->property, new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org']); + + $preview = collect(app(ChannelProcessConfiguration::class)->preview($website->fresh(), IntakeKind::Inquiry, $draft))->where('on', true)->pluck('module')->all(); + $this->assertSame(array_keys($booking->profile['plan']['modules']), collect(app(ChannelProcessConfiguration::class)->preview($website->fresh(), IntakeKind::Inquiry, $draft))->pluck('module')->all()); + foreach (['offer.binding', 'offer.acceptance', 'documents.send', 'stay', 'case.settlement'] as $module) { + $this->assertContains($module, $preview); + } + $this->assertNotContains('offer.information', $preview); + } + + /** K02, K06, K10: the page in the simple view, inherited and set values with their origin */ + public function test_the_page_shows_the_steps_with_their_settings_and_saves(): void + { + $this->actingAs(User::factory()->create()); + $website = Channel::websiteOf($this->property); + + Livewire::test(ChannelProcess::class, ['record' => $website->getRouteKey()]) + ->assertSee('Wie wird eine Anfrage über') + ->assertSee('Angebot mit Vorreservierung') + ->assertSee('Fehlende Angaben beim Gast anfragen') + ->assertSee('Pflicht') + ->assertSee('Vorschau: ein neuer Vorgang') + ->set('drafts.inquiry.settings.hold_hours', '24') + ->assertSee('hier gesetzt') + ->call('save') + ->assertHasNoErrors(); + + $profile = app(ProcessSettings::class)->forWebsite($this->property); + $this->assertSame(24, $profile->holdHours()); + $this->assertSame(ProcessProfile::WEBSITE, $profile->source(ProcessSetting::HoldHours)); + $this->assertSame('a1.offer', $website->fresh()->process_overrides['inquiry']['model']); + } + + private function channel(string $name, string $model): Channel + { + return Channel::factory()->for($this->property)->create(['name' => $name, 'booking_model' => $model, 'import_enabled' => false, 'settings' => ['import_url' => 'https://portal.example/'.md5($name).'.ics']]); + } +} From 0689c0a591156004f18d77de25206755fb319075 Mon Sep 17 00:00:00 2001 From: Lars Date: Wed, 4 Nov 2026 15:34:40 +0100 Subject: [PATCH 8/9] =?UTF-8?q?U-D/U-E/O5:=20Prozess-Tester=20im=20eigenen?= =?UTF-8?q?=20Prozess=20(standardm=C3=A4=C3=9Fig=20gesperrt,=2015=20Negati?= =?UTF-8?q?vtests,=20statischer=20W=C3=A4chter),=20Szenarien=20und=20Beric?= =?UTF-8?q?ht,=20Kanalereignisse=20(API-Eingang=20ohne=20Umbau=20von=20iCa?= =?UTF-8?q?l/Mail),=20Abschluss=20nach=20finanzieller=20Kl=C3=A4rung,=20L?= =?UTF-8?q?=C3=B6schfrist=2030=20Tage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- app/Actions/AnonymizeGuests.php | 4 + app/Actions/TakeOverExternalBooking.php | 2 +- app/Channels/Contracts/DeliversEvents.php | 20 ++ app/Channels/Contracts/ReceivesWebhooks.php | 19 ++ .../Events/BookingCancelledByChannel.php | 14 ++ .../Events/BookingChangedByChannel.php | 16 ++ app/Channels/Events/ChannelEvent.php | 13 ++ app/Channels/Events/ChannelEventHandler.php | 113 ++++++++++ app/Channels/Events/IncomingBooking.php | 16 ++ app/Channels/Events/PaymentReported.php | 16 ++ app/Channels/Events/PayoutReported.php | 16 ++ app/Channels/Events/Provenance.php | 32 +++ app/Channels/Intake/PortalIntake.php | 21 +- app/Console/Commands/ProcessSandboxRun.php | 40 ++++ .../Commands/ProcessSandboxTemplate.php | 49 +++++ .../Pages/Concerns/HandlesWishAndStay.php | 32 ++- .../Resources/Channels/ChannelResource.php | 2 + .../Channels/Pages/ChannelProcess.php | 9 + .../Channels/Pages/ChannelProcessTest.php | 151 +++++++++++++ app/Models/IntakeObservation.php | 3 + app/Models/ProcessTestRun.php | 39 ++++ app/Process/CaseClosure.php | 32 ++- app/Process/ProcessPlan.php | 2 + app/Process/Tester/EffectLedger.php | 50 +++++ app/Process/Tester/ProcessSandbox.php | 199 +++++++++++++++++ app/Process/Tester/ProcessSandboxDriver.php | 207 ++++++++++++++++++ app/Process/Tester/SandboxBootstrapper.php | 117 ++++++++++ app/Process/Tester/SandboxChannelRegistry.php | 22 ++ app/Process/Tester/SandboxContext.php | 88 ++++++++ app/Process/Tester/SandboxMailboxReader.php | 26 +++ app/Process/Tester/SandboxNetwork.php | 42 ++++ app/Process/Tester/SandboxServiceProvider.php | 126 +++++++++++ app/Process/Tester/SandboxSnapshot.php | 142 ++++++++++++ app/Process/Tester/SandboxViolation.php | 20 ++ app/Process/Tester/ScenarioCatalogue.php | 55 +++++ .../Tester/Scenarios/CommunicationFailure.php | 49 +++++ .../Tester/Scenarios/CompleteRequest.php | 57 +++++ .../Tester/Scenarios/MissingAddress.php | 57 +++++ .../Tester/Scenarios/PortalBooking.php | 85 +++++++ .../Tester/Scenarios/PortalInquiry.php | 47 ++++ .../Tester/Scenarios/ReturningGuest.php | 64 ++++++ app/Process/Tester/Scenarios/Scenario.php | 42 ++++ .../Tester/Scenarios/ScenarioEvent.php | 17 ++ app/Providers/AppServiceProvider.php | 7 +- app/Support/SystemSettings.php | 1 + bootstrap/app.php | 12 +- config/fewo.php | 10 + ..._100000_create_process_test_runs_table.php | 37 ++++ docs/BETRIEB.md | 9 + docs/LOESCHKONZEPT.md | 2 + .../Abnahme/ARCHITEKTUR_MODULAR_ABNAHME.md | 58 +++++ .../00_MANAGEMENT_ZUSAMMENFASSUNG.md | 20 +- .../Architektur/02_FACHMODUL_ARCHITEKTUR.md | 11 +- .../Architektur/04_PROZESS_TESTER.md | 14 +- .../06_MIGRATIONS_UND_UMSETZUNGSPLAN.md | 40 +++- pipeline.toml | 1 + .../channels/channel-process-test.blade.php | 103 +++++++++ .../channels/channel-process.blade.php | 5 +- tests/Feature/EndToEndStayAcceptanceTest.php | 7 +- .../Process/ChannelEventContractTest.php | 181 +++++++++++++++ .../Process/ProcessTestRunRetentionTest.php | 46 ++++ .../Process/ProcessTesterSecurityTest.php | 192 ++++++++++++++++ tests/Feature/Process/ProcessTesterTest.php | 186 ++++++++++++++++ .../Process/SettlementClarificationTest.php | 78 +++++++ tests/Feature/Process/SideEffectPathsTest.php | 63 ++++++ tests/Fixtures/process/intended.md | 5 +- tests/Support/Process/FakeApiConnector.php | 58 +++++ tests/Support/Process/HostileProbe.php | 66 ++++++ 68 files changed, 3350 insertions(+), 35 deletions(-) create mode 100644 app/Channels/Contracts/DeliversEvents.php create mode 100644 app/Channels/Contracts/ReceivesWebhooks.php create mode 100644 app/Channels/Events/BookingCancelledByChannel.php create mode 100644 app/Channels/Events/BookingChangedByChannel.php create mode 100644 app/Channels/Events/ChannelEvent.php create mode 100644 app/Channels/Events/ChannelEventHandler.php create mode 100644 app/Channels/Events/IncomingBooking.php create mode 100644 app/Channels/Events/PaymentReported.php create mode 100644 app/Channels/Events/PayoutReported.php create mode 100644 app/Channels/Events/Provenance.php create mode 100644 app/Console/Commands/ProcessSandboxRun.php create mode 100644 app/Console/Commands/ProcessSandboxTemplate.php create mode 100644 app/Filament/Resources/Channels/Pages/ChannelProcessTest.php create mode 100644 app/Models/ProcessTestRun.php create mode 100644 app/Process/Tester/EffectLedger.php create mode 100644 app/Process/Tester/ProcessSandbox.php create mode 100644 app/Process/Tester/ProcessSandboxDriver.php create mode 100644 app/Process/Tester/SandboxBootstrapper.php create mode 100644 app/Process/Tester/SandboxChannelRegistry.php create mode 100644 app/Process/Tester/SandboxContext.php create mode 100644 app/Process/Tester/SandboxMailboxReader.php create mode 100644 app/Process/Tester/SandboxNetwork.php create mode 100644 app/Process/Tester/SandboxServiceProvider.php create mode 100644 app/Process/Tester/SandboxSnapshot.php create mode 100644 app/Process/Tester/SandboxViolation.php create mode 100644 app/Process/Tester/ScenarioCatalogue.php create mode 100644 app/Process/Tester/Scenarios/CommunicationFailure.php create mode 100644 app/Process/Tester/Scenarios/CompleteRequest.php create mode 100644 app/Process/Tester/Scenarios/MissingAddress.php create mode 100644 app/Process/Tester/Scenarios/PortalBooking.php create mode 100644 app/Process/Tester/Scenarios/PortalInquiry.php create mode 100644 app/Process/Tester/Scenarios/ReturningGuest.php create mode 100644 app/Process/Tester/Scenarios/Scenario.php create mode 100644 app/Process/Tester/Scenarios/ScenarioEvent.php create mode 100644 database/migrations/2026_11_07_100000_create_process_test_runs_table.php create mode 100644 docs/Prozessarchitektur/Abnahme/ARCHITEKTUR_MODULAR_ABNAHME.md create mode 100644 resources/views/filament/resources/channels/channel-process-test.blade.php create mode 100644 tests/Feature/Process/ChannelEventContractTest.php create mode 100644 tests/Feature/Process/ProcessTestRunRetentionTest.php create mode 100644 tests/Feature/Process/ProcessTesterSecurityTest.php create mode 100644 tests/Feature/Process/ProcessTesterTest.php create mode 100644 tests/Feature/Process/SettlementClarificationTest.php create mode 100644 tests/Feature/Process/SideEffectPathsTest.php create mode 100644 tests/Support/Process/FakeApiConnector.php create mode 100644 tests/Support/Process/HostileProbe.php diff --git a/app/Actions/AnonymizeGuests.php b/app/Actions/AnonymizeGuests.php index 8d7e767..a98e40a 100644 --- a/app/Actions/AnonymizeGuests.php +++ b/app/Actions/AnonymizeGuests.php @@ -5,6 +5,7 @@ use App\Models\Booking; use App\Models\Guest; use App\Models\PortalEmail; +use App\Models\ProcessTestRun; /** * GDPR storage limitation: anonymises guests whose last stay ended longer ago than the retention period, and @@ -44,6 +45,9 @@ public function handle(): int private function purgeOperationalData(): void { + // Process tester reports (synthetic data only, decision O3). + ProcessTestRun::query()->where('created_at', '<', now()->subDays(config('fewo.retention.process_test_run_days')))->delete(); + PortalEmail::query() ->whereNotNull('excerpt') ->where('received_at', '<', now()->subDays(config('fewo.retention.portal_email_excerpt_days'))) diff --git a/app/Actions/TakeOverExternalBooking.php b/app/Actions/TakeOverExternalBooking.php index 68807a2..49cf248 100644 --- a/app/Actions/TakeOverExternalBooking.php +++ b/app/Actions/TakeOverExternalBooking.php @@ -111,7 +111,7 @@ public function handle(Property $property, Channel $channel, CarbonImmutable $ar */ private function checkEvidence(BlockedPeriod $evidence): ?Booking { - if (! in_array($evidence->source, ['channel', 'email'], true) || $evidence->channel_id === null) { + if (! in_array($evidence->source, ['channel', 'email', 'api'], true) || $evidence->channel_id === null) { throw new ReservationException('Übernehmen lassen sich nur Reservierungen aus einem Portalkalender.'); } if ($evidence->occupationKind() === OccupationKind::Block) { diff --git a/app/Channels/Contracts/DeliversEvents.php b/app/Channels/Contracts/DeliversEvents.php new file mode 100644 index 0000000..3abec53 --- /dev/null +++ b/app/Channels/Contracts/DeliversEvents.php @@ -0,0 +1,20 @@ + + */ + public function fetchEvents(Channel $channel, ?CarbonImmutable $since): array; +} diff --git a/app/Channels/Contracts/ReceivesWebhooks.php b/app/Channels/Contracts/ReceivesWebhooks.php new file mode 100644 index 0000000..b0e162c --- /dev/null +++ b/app/Channels/Contracts/ReceivesWebhooks.php @@ -0,0 +1,19 @@ + empty when the signature is not valid + */ + public function receive(Channel $channel, Request $request): array; +} diff --git a/app/Channels/Events/BookingCancelledByChannel.php b/app/Channels/Events/BookingCancelledByChannel.php new file mode 100644 index 0000000..61b75b9 --- /dev/null +++ b/app/Channels/Events/BookingCancelledByChannel.php @@ -0,0 +1,14 @@ +provenance->channel; + if (! $channel->isPortal() || $channel->tenant_id === null) { + throw new InvalidArgumentException('Kanalereignisse kommen nur von Portalen.'); + } + + return app(TenantContext::class)->run($channel->tenant, fn (): ?IntakeDecision => match (true) { + $event instanceof IncomingBooking => $this->booking($event), + $event instanceof BookingCancelledByChannel => $this->report($event, IntakeOutcome::CancellationSignal, $channel->name.' meldet über die Schnittstelle eine Stornierung'.($event->note ? ' ('.$event->note.')' : '').'. Bitte prüfen Sie die Buchung und die nächsten Schritte.'), + $event instanceof BookingChangedByChannel => $this->report($event, IntakeOutcome::ChangeSignal, $channel->name.' meldet über die Schnittstelle eine Änderung'.($event->arrival && $event->departure ? ': '.$event->arrival->format('d.m.').'–'.$event->departure->format('d.m.Y') : '').($event->guests ? ', '.$event->guests.' Personen' : '').'. Die Buchung bleibt unverändert, bis Sie entscheiden.'), + $event instanceof PaymentReported => $this->payment($event), + $event instanceof PayoutReported => $this->payout($event), + default => throw new InvalidArgumentException('Unbekanntes Kanalereignis '.$event::class.'.'), + }); + } + + /** + * A booking binding at the portal: blocked like a booking e-mail – source api, reference in the identifier – and judged + * by PortalIntake – the same case, never a second one; a case only when certain. + */ + private function booking(IncomingBooking $event): IntakeDecision + { + $provenance = $event->provenance; + $reference = $provenance->externalReference; + // The reference is the identity of the block (as for booking mails); without one it is never taken as a reference. + $uid = $reference !== null ? 'api:'.$reference : 'api-event:'.$provenance->evidenceRef; + $block = $provenance->channel->blockedPeriods()->withTrashed()->where('source', 'api')->where('external_uid', $uid)->first() + ?? new BlockedPeriod(['property_id' => $provenance->channel->property_id, 'source' => 'api', 'reason' => $provenance->channel->name, 'external_uid' => $uid]); + $block->fill(['starts_on' => $event->arrival->toDateString(), 'ends_on' => $event->departure->toDateString()]); + if ($block->trashed()) { + $block->restore(); + } + $provenance->channel->blockedPeriods()->save($block); + + return $this->intake->process($block->fresh(), IntakeObservation::SOURCE_API); + } + + private function report(BookingCancelledByChannel|BookingChangedByChannel $event, IntakeOutcome $outcome, string $message): ?IntakeDecision + { + $case = $this->case($event); + if ($case === null) { + return new IntakeDecision(IntakeOutcome::Clarify, ['Keinem gebuchten Vorgang sicher zuzuordnen.'], reference: $event->provenance->externalReference); + } + $this->intake->reportToCase($event->provenance->channel, $case, $outcome, $message, 'api:'.$event->provenance->evidenceRef, IntakeObservation::SOURCE_API); + + return new IntakeDecision($outcome, [$message], $case, reference: $event->provenance->externalReference); + } + + private function payment(PaymentReported $event): ?IntakeDecision + { + $case = $this->case($event); + if ($case === null) { + return new IntakeDecision(IntakeOutcome::Clarify, ['Zahlungsmeldung keinem gebuchten Vorgang sicher zuzuordnen.'], reference: $event->provenance->externalReference); + } + $this->amounts->handle($case, null, [], [['amount' => $event->amount, 'paid_on' => $event->paidOn->toDateString()]], $event->provenance->channel->name); + + return new IntakeDecision(IntakeOutcome::Link, ['Zahlung des Gastes laut Portal erfasst (kein Eingang auf unserem Konto).'], $case); + } + + private function payout(PayoutReported $event): ?IntakeDecision + { + $case = $this->case($event); + if ($case === null) { + return new IntakeDecision(IntakeOutcome::Clarify, ['Auszahlungsmeldung keinem gebuchten Vorgang sicher zuzuordnen.'], reference: $event->provenance->externalReference); + } + if ($event->executed) { + // Evidence level "laut Portal erledigt" – the receipt on our account is recorded by the landlord (O5). + CaseLog::record($case, 'evidence', 'Auszahlung laut '.$event->provenance->channel->name.' ausgeführt: '.Money::format($event->amount).' am '.$event->paidOn->format('d.m.Y').' – Eingang auf unserem Konto noch nicht erfasst.', data: ['module' => 'portal.payout', 'level' => 'stated_by_portal', 'source' => $event->provenance->transport, 'ref' => $event->provenance->evidenceRef], actor: $event->provenance->channel->name); + } else { + $this->amounts->handle($case, null, [['kind' => 'payout_announced', 'amount' => $event->amount, 'due_on' => $event->paidOn->toDateString()]], [], $event->provenance->channel->name); + } + + return new IntakeDecision(IntakeOutcome::Link, ['Auszahlung laut Portal vermerkt.'], $case); + } + + /** + * The binding case of the event: by the portal's booking reference only (no merging by dates for reports). + */ + private function case(ChannelEvent $event): ?Booking + { + $reference = $event->provenance->externalReference; + $case = $reference === null ? null : $this->intake->caseByReference($event->provenance->channel, $reference); + + return $case !== null && $case->isBinding() ? $case : null; + } +} diff --git a/app/Channels/Events/IncomingBooking.php b/app/Channels/Events/IncomingBooking.php new file mode 100644 index 0000000..6b44c3f --- /dev/null +++ b/app/Channels/Events/IncomingBooking.php @@ -0,0 +1,16 @@ +authenticity === self::AUTHENTICATED; + } +} diff --git a/app/Channels/Intake/PortalIntake.php b/app/Channels/Intake/PortalIntake.php index 4507bda..04b3aac 100644 --- a/app/Channels/Intake/PortalIntake.php +++ b/app/Channels/Intake/PortalIntake.php @@ -65,7 +65,7 @@ public function evaluate(BlockedPeriod $block): IntakeDecision $channel = $block->channel; $reference = self::reference($block); - if ($channel === null || ! in_array($block->source, ['channel', 'email'], true)) { + if ($channel === null || ! in_array($block->source, ['channel', 'email', 'api'], true)) { return new IntakeDecision(IntakeOutcome::Ignore, ['Kein importierter Portaleintrag.'], reference: $reference); } if ($block->trashed()) { @@ -246,6 +246,15 @@ public function cancellationMail(Channel $channel, ParsedPortalMail $parsed, Por return $case; } + /** + * A report of the portal about a known case (channel events, Architektur V2: cancellation or change via an API): + * the case gets a task and a history entry, nothing about the booking changes (E-019, stage M2 of 02 §8.2). + */ + public function reportToCase(Channel $channel, Booking $case, IntakeOutcome $outcome, string $message, string $key, string $source): void + { + $this->report($channel, $channel->case_intake ?? CaseIntakeMode::Off, $case, $outcome, $message, $key, $source); + } + /** * A request e-mail of a portal: a request case with the dates and the reference (A2), when the channel creates * cases; otherwise only recorded. @@ -292,6 +301,11 @@ public static function reference(BlockedPeriod $block): ?string return trim((string) $fromRules); } + // A block of a portal's API (channel events, Architektur V2) carries the reference like a booking mail. + if ($block->source === 'api' && str_starts_with((string) $block->external_uid, 'api:')) { + return substr((string) $block->external_uid, 4); + } + if ($block->source === 'email' && str_starts_with((string) $block->external_uid, 'email:')) { $reference = substr((string) $block->external_uid, 6); @@ -315,7 +329,7 @@ public function caseByReference(Channel $channel, string $reference): ?Booking } $linked = $channel->blockedPeriods()->withTrashed()->whereNotNull('linked_booking_id') - ->whereIn('external_uid', [$reference, 'email:'.$reference])->value('linked_booking_id'); + ->whereIn('external_uid', [$reference, 'email:'.$reference, 'api:'.$reference])->value('linked_booking_id'); return $linked !== null ? Booking::query()->find($linked) : null; } @@ -346,6 +360,9 @@ private function certainty(BlockedPeriod $block, ?string $reference): ?string if ($block->source === 'email') { return $reference === null ? 'Buchungsmail ohne Buchungsnummer – ohne Nummer lässt sich ein späterer Kalendereintrag nicht sicher zuordnen.' : null; } + if ($block->source === 'api') { + return $reference === null ? 'Portalmeldung ohne Buchungsnummer – keinem Vorgang sicher zuzuordnen.' : null; + } // Classified by the landlord as a reservation booked at this portal. if ($block->occupation_kind === OccupationKind::Reservation && $block->reviewed_at !== null && $block->origin_channel_id === $block->channel_id) { diff --git a/app/Console/Commands/ProcessSandboxRun.php b/app/Console/Commands/ProcessSandboxRun.php new file mode 100644 index 0000000..25c87f3 --- /dev/null +++ b/app/Console/Commands/ProcessSandboxRun.php @@ -0,0 +1,40 @@ +argument('run') || config('sandbox.run') !== $this->argument('run')) { + $this->error('Nur innerhalb eines vom Prozess-Tester gestarteten Laufs.'); + + return self::FAILURE; + } + + $directory = (string) config('sandbox.directory'); + try { + $report = $driver->run((array) json_decode((string) file_get_contents($directory.'/input.json'), true)); + } catch (Throwable $exception) { + $report = ['aborted' => 'Lauf abgebrochen: '.class_basename($exception).': '.$exception->getMessage(), 'timeline' => [], 'violations' => EffectLedger::violations()]; + } + file_put_contents($directory.'/report.json', json_encode($report, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); + + return self::SUCCESS; + } +} diff --git a/app/Console/Commands/ProcessSandboxTemplate.php b/app/Console/Commands/ProcessSandboxTemplate.php new file mode 100644 index 0000000..bb70d5f --- /dev/null +++ b/app/Console/Commands/ProcessSandboxTemplate.php @@ -0,0 +1,49 @@ +warn('pdo_sqlite fehlt – der Prozess-Tester bleibt gesperrt.'); + + return self::SUCCESS; + } + + $directory = storage_path('app/sandbox'); + @mkdir($directory.'/runs', 0775, true); + $file = $directory.'/template.building.sqlite'; + @unlink($file); + touch($file); + + config(['database.connections.sandbox_template' => ['driver' => 'sqlite', 'database' => $file, 'prefix' => '', 'foreign_key_constraints' => true]]); + // `migrate --database` switches the default connection of this process and does not switch it back. + $default = DB::getDefaultConnection(); + try { + Artisan::call('migrate', ['--database' => 'sandbox_template', '--force' => true, '--no-interaction' => true]); + } finally { + DB::setDefaultConnection($default); + DB::purge('sandbox_template'); + config(['database.connections.sandbox_template' => null]); + } + + rename($file, $directory.'/template.sqlite'); + $this->info('Vorlage erstellt: '.$directory.'/template.sqlite'); + + return self::SUCCESS; + } +} diff --git a/app/Filament/Resources/Bookings/Pages/Concerns/HandlesWishAndStay.php b/app/Filament/Resources/Bookings/Pages/Concerns/HandlesWishAndStay.php index 1b2e092..de0e6e4 100644 --- a/app/Filament/Resources/Bookings/Pages/Concerns/HandlesWishAndStay.php +++ b/app/Filament/Resources/Bookings/Pages/Concerns/HandlesWishAndStay.php @@ -13,9 +13,12 @@ use App\Enums\BookingTaskStatus; use App\Enums\DocumentKind; use App\Enums\IntakeKind; +use App\Enums\Responsibility; +use App\Exceptions\ReservationException; use App\Filament\Forms\DocumentCompositionFields; use App\Models\Booking; use App\Models\BookingTask; +use App\Pricing\CaseMoney; use App\Pricing\StayRequest; use App\Process\CaseClosure; use App\Process\CaseLog; @@ -230,14 +233,37 @@ private function settleAction(): Action ->visible(fn (): bool => in_array($this->record->status, [BookingStatus::Completed, BookingStatus::Cancelled], true) && $this->record->settled_at === null) ->modalHeading('Kaufmännisch abschließen') ->modalDescription(fn (): string => 'Noch offen: '.implode(' ', CaseClosure::commercialPoints($this->record)).' Abschließen nur, wenn das geklärt ist (z. B. kleine Differenz akzeptiert, Forderung ausgebucht).') - ->schema([Textarea::make('note')->label('Begründung')->required()->rows(2)->maxLength(500)]) + ->schema([ + // Decision O5: with portal collection an open payout needs its financial clarification, not only a reason. + Select::make('clarification')->label('Wie ist die Auszahlung geklärt?') + ->options(CaseClosure::PAYOUT_CLARIFICATIONS) + ->visible(fn (): bool => $this->payoutOpen()) + ->required(fn (): bool => $this->payoutOpen()) + ->helperText('Eine Meldung des Portals über die Auszahlung ist kein Nachweis des Geldeingangs. „Als offene Forderung weiterführen“ legt eine Aufgabe an; der Vorgang bleibt kaufmännisch offen.'), + Textarea::make('note')->label('Begründung')->required()->rows(2)->maxLength(500), + ]) ->action(function (array $data): void { - CaseClosure::settle($this->record, trim((string) $data['note']), CaseLog::actor()); + try { + CaseClosure::settle($this->record, trim((string) $data['note']), CaseLog::actor(), $data['clarification'] ?? null); + } catch (ReservationException $exception) { + Notification::make()->title('Nicht abgeschlossen')->body($exception->getMessage())->danger()->send(); + + return; + } $this->record->refresh(); - Notification::make()->title('Kaufmännisch abgeschlossen')->success()->send(); + Notification::make()->title($this->record->settled_at !== null ? 'Kaufmännisch abgeschlossen' : 'Als offene Forderung weitergeführt')->success()->send(); }); } + /** + * Whether the portal's payout is open or deviating (decision O5). + */ + private function payoutOpen(): bool + { + return CaseMoney::of($this->record)->collector() === Responsibility::Portal + && collect(CaseClosure::commercialPoints($this->record))->contains(fn (string $point): bool => str_contains($point, 'Auszahlung')); + } + /** * Open tasks the landlord can settle on the page (not the ones with an action of their own). * diff --git a/app/Filament/Resources/Channels/ChannelResource.php b/app/Filament/Resources/Channels/ChannelResource.php index a8f3645..ab20d75 100644 --- a/app/Filament/Resources/Channels/ChannelResource.php +++ b/app/Filament/Resources/Channels/ChannelResource.php @@ -5,6 +5,7 @@ use App\Filament\Concerns\FollowsAdminMode; use App\Filament\Concerns\SelectsRecordProperty; use App\Filament\Resources\Channels\Pages\ChannelProcess; +use App\Filament\Resources\Channels\Pages\ChannelProcessTest; use App\Filament\Resources\Channels\Pages\ChannelRules; use App\Filament\Resources\Channels\Pages\CreateChannel; use App\Filament\Resources\Channels\Pages\EditChannel; @@ -63,6 +64,7 @@ public static function getPages(): array 'edit' => EditChannel::route('/{record}/edit'), 'rules' => ChannelRules::route('/{record}/rules'), 'process' => ChannelProcess::route('/{record}/process'), + 'test' => ChannelProcessTest::route('/{record}/test'), ]; } } diff --git a/app/Filament/Resources/Channels/Pages/ChannelProcess.php b/app/Filament/Resources/Channels/Pages/ChannelProcess.php index 5470513..1b8f209 100644 --- a/app/Filament/Resources/Channels/Pages/ChannelProcess.php +++ b/app/Filament/Resources/Channels/Pages/ChannelProcess.php @@ -211,6 +211,15 @@ public function save(): void Notification::make()->title('Ablauf gespeichert')->body('Gilt für neue Vorgänge.'.($running > 0 ? ' '.$running.' laufende Vorgänge behalten ihren bisherigen Ablauf.' : ''))->success()->send(); } + /** + * Opens the process tester with the current – also unsaved – draft of this intake kind. + */ + public function test(): void + { + session()->put('process-tester.draft.'.$this->record->id.'.'.$this->intake, $this->drafts[$this->intake]); + $this->redirect(ChannelResource::getUrl('test', ['record' => $this->record, 'intake' => $this->intake])); + } + /** * The effective value a new case would get, for the landlord's comparison (expert view). */ diff --git a/app/Filament/Resources/Channels/Pages/ChannelProcessTest.php b/app/Filament/Resources/Channels/Pages/ChannelProcessTest.php new file mode 100644 index 0000000..f149275 --- /dev/null +++ b/app/Filament/Resources/Channels/Pages/ChannelProcessTest.php @@ -0,0 +1,151 @@ + */ + public array $inputs = []; + + /** @var array */ + public array $draft = []; + + public int $steps = 1; + + public ?int $runId = null; + + public static function canAccess(array $parameters = []): bool + { + $user = auth()->user(); + + return $user instanceof User && $user->hasRole(UserRole::Admin); + } + + public function mount(int|string $record): void + { + $this->record = $this->resolveRecord($record); + $intakes = array_map(fn (IntakeKind $intake): string => $intake->value, app(ChannelProcessConfiguration::class)->intakes($this->record)); + $requested = (string) request()->query('intake', ''); + $this->intake = in_array($requested, $intakes, true) ? $requested : ($intakes[0] ?? 'inquiry'); + $this->draft = (array) session()->get($this->draftKey(), []); + if ($this->draft === []) { + $current = app(ChannelProcessConfiguration::class)->current($this->record, IntakeKind::from($this->intake)); + $stored = (array) (($this->record->process_overrides ?? [])[$this->intake] ?? []); + $this->draft = ['model' => $current['model'], 'variant' => $current['variant'], 'steps' => (array) ($stored['steps'] ?? []), 'settings' => []]; + } + $this->scenario = (string) array_key_first($this->scenarios()); + $this->resetInputs(); + } + + public function draftKey(): string + { + return 'process-tester.draft.'.$this->record->id.'.'.$this->intake; + } + + /** + * @return array> + */ + public function scenarios(): array + { + return ScenarioCatalogue::for(IntakeKind::from($this->intake), $this->record->isWebsite()); + } + + public function updatedScenario(): void + { + $this->resetInputs(); + $this->runId = null; + $this->steps = 1; + } + + private function resetInputs(): void + { + $class = $this->scenarios()[$this->scenario] ?? null; + $this->inputs = $class === null ? [] : array_map(fn (array $input): mixed => $input['type'] === 'date' ? now()->modify((string) $input['default'])->toDateString() : $input['default'], $class::inputs()); + } + + /** + * @return list + */ + public function requirements(): array + { + return ProcessSandbox::requirements(); + } + + public function start(): void + { + $this->steps = 1; + $this->play(); + } + + public function next(): void + { + $this->steps++; + $this->play(); + } + + private function play(): void + { + try { + $run = app(ProcessSandbox::class)->run($this->record, IntakeKind::from($this->intake), $this->draft, $this->scenario, $this->inputs, $this->steps, auth()->user()); + $this->runId = $run->id; + } catch (Throwable $exception) { + Notification::make()->title('Test nicht möglich')->body($exception->getMessage())->danger()->persistent()->send(); + } + } + + public function run(): ?ProcessTestRun + { + return $this->runId === null ? null : ProcessTestRun::query()->find($this->runId); + } + + /** + * @return iterable + */ + public function recent(): iterable + { + return ProcessTestRun::query()->where('channel_id', $this->record->id)->latest()->limit(5)->get(); + } + + protected function getHeaderActions(): array + { + return [ + Action::make('back')->label('Zurück zum Ablauf')->color('gray')->url(fn (): string => ChannelResource::getUrl('process', ['record' => $this->record])), + ]; + } +} diff --git a/app/Models/IntakeObservation.php b/app/Models/IntakeObservation.php index 6c11e06..2bcc946 100644 --- a/app/Models/IntakeObservation.php +++ b/app/Models/IntakeObservation.php @@ -24,6 +24,9 @@ class IntakeObservation extends Model public const SOURCE_ADOPTION = 'adoption'; + /** A normalised channel event of a portal's interface (Architektur V2, App\Channels\Events). */ + public const SOURCE_API = 'api'; + /** * Get the attributes that should be cast. * diff --git a/app/Models/ProcessTestRun.php b/app/Models/ProcessTestRun.php new file mode 100644 index 0000000..ed49eab --- /dev/null +++ b/app/Models/ProcessTestRun.php @@ -0,0 +1,39 @@ + 'array', + 'inputs' => 'array', + 'report' => 'array', + ]; + } + + /** + * @return BelongsTo + */ + public function channel(): BelongsTo + { + return $this->belongsTo(Channel::class); + } +} diff --git a/app/Process/CaseClosure.php b/app/Process/CaseClosure.php index b09b070..18f0dfe 100644 --- a/app/Process/CaseClosure.php +++ b/app/Process/CaseClosure.php @@ -3,8 +3,10 @@ namespace App\Process; use App\Enums\BookingStatus; +use App\Enums\BookingTaskKind; use App\Enums\BookingTaskStatus; use App\Enums\Responsibility; +use App\Exceptions\ReservationException; use App\Models\Booking; use App\Models\BookingTask; use App\Pricing\CaseMoney; @@ -21,6 +23,16 @@ */ final class CaseClosure { + /** Kinds of financial clarification that allow settling an open portal payout (decision O5). */ + public const PAYOUT_CLARIFICATIONS = [ + 'offset' => 'Verrechnung dokumentiert', + 'difference_booked' => 'Differenz geklärt und verbucht', + 'written_off' => 'Forderung ausgebucht', + self::CLAIM_OPEN => 'Als offene Forderung weiterführen', + ]; + + public const CLAIM_OPEN = 'open_claim'; + public const AUTOMATIC = 'automatisch'; /** @@ -92,8 +104,26 @@ public static function refresh(Booking $booking): void * The landlord settles the case although points are open (e.g. a small payout difference accepted); open commercial * tasks are closed with the same note. The reason is required and kept. */ - public static function settle(Booking $booking, string $note, string $by): void + public static function settle(Booking $booking, string $note, string $by, ?string $clarification = null): void { + // Decision O5: with portal collection, an open or deviating payout is settled only after its financial + // clarification – a reason alone is not enough, and a portal's report of a payout is no proof of the receipt. + $payoutPoints = $booking->status !== BookingStatus::Cancelled && CaseMoney::of($booking)->collector() === Responsibility::Portal + ? self::portalMoney($booking, CaseMoney::of($booking)) : []; + if ($payoutPoints !== [] && ! array_key_exists((string) $clarification, self::PAYOUT_CLARIFICATIONS)) { + throw new ReservationException('Bei Inkasso durch das Portal ist der kaufmännische Abschluss erst nach finanzieller Klärung möglich: Auszahlung eingegangen, Verrechnung, verbuchte Differenz oder ausgebuchte Forderung. Offen: '.implode(' ', $payoutPoints)); + } + if ($clarification === self::CLAIM_OPEN) { + // The claim stays traceable: an open task of its own, the case stays commercially open. + BookingTask::query()->firstOrCreate(['booking_id' => $booking->id, 'kind' => BookingTaskKind::OpenClaim, 'status' => BookingTaskStatus::Open], ['tenant_id' => $booking->tenant_id, 'due_on' => today()->addDays(14), 'note' => mb_substr($note, 0, 1000)]); + CaseLog::record($booking, 'settled', 'Als offene Forderung weitergeführt', reason: $note, data: ['open_points' => $payoutPoints, 'clarification' => $clarification], actor: $by); + + return; + } + if ($clarification !== null && isset(self::PAYOUT_CLARIFICATIONS[$clarification])) { + $note = self::PAYOUT_CLARIFICATIONS[$clarification].': '.$note; + } + foreach (BookingTask::query()->where('booking_id', $booking->id)->where('status', BookingTaskStatus::Open)->get() as $task) { if ($task->kind->isCommercial()) { $task->complete($by, 'Mit dem kaufmännischen Abschluss geklärt: '.$note); diff --git a/app/Process/ProcessPlan.php b/app/Process/ProcessPlan.php index 76c00d7..e4aba86 100644 --- a/app/Process/ProcessPlan.php +++ b/app/Process/ProcessPlan.php @@ -69,6 +69,8 @@ public static function derive(ProcessProfile $profile): self public static function freeze(ProcessProfile $profile, array $configuration, bool $sandbox = false): self { $catalogue = app(ProcessCatalogue::class); + // Inside a process tester run (its own process, SandboxBootstrapper) tester-only variants are allowed. + $sandbox = $sandbox || filled(config('sandbox.run')); $chosen = (string) ($configuration['model'] ?? ''); if ($chosen === '') { return self::build($catalogue->model($catalogue->derivedModel($profile)), 'standard', (array) ($configuration['steps'] ?? []), self::DERIVED); diff --git a/app/Process/Tester/EffectLedger.php b/app/Process/Tester/EffectLedger.php new file mode 100644 index 0000000..87a60b1 --- /dev/null +++ b/app/Process/Tester/EffectLedger.php @@ -0,0 +1,50 @@ + $data + */ + public static function record(string $type, array $data = []): void + { + if (self::$path === null) { + return; + } + file_put_contents(self::$path, json_encode(['type' => $type, ...$data], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)."\n", FILE_APPEND | LOCK_EX); + } + + /** + * @return list> + */ + public static function entries(): array + { + if (self::$path === null || ! is_file(self::$path)) { + return []; + } + + return array_values(array_map(fn (string $line): array => (array) json_decode($line, true), array_filter(explode("\n", (string) file_get_contents(self::$path))))); + } + + public static function violations(): array + { + return array_values(array_filter(self::entries(), fn (array $entry): bool => ($entry['type'] ?? null) === 'violation')); + } +} diff --git a/app/Process/Tester/ProcessSandbox.php b/app/Process/Tester/ProcessSandbox.php new file mode 100644 index 0000000..e6c3e2a --- /dev/null +++ b/app/Process/Tester/ProcessSandbox.php @@ -0,0 +1,199 @@ + + */ + public static function requirements(): array + { + $missing = []; + if (! extension_loaded('pdo_sqlite')) { + $missing[] = 'Die PHP-Erweiterung pdo_sqlite fehlt (eigene Testdatenbank je Lauf).'; + } + if (! is_file(storage_path('app/sandbox/template.sqlite'))) { + $missing[] = 'Die Vorlage der Testdatenbank fehlt (php artisan process:sandbox-template).'; + } + $disabled = array_map('trim', explode(',', (string) ini_get('disable_functions'))); + if (! function_exists('proc_open') || in_array('proc_open', $disabled, true)) { + $missing[] = 'Eigene Prozesse lassen sich nicht starten (proc_open gesperrt) – ohne eigenen Prozess ist keine sichere Trennung möglich.'; + } + if (str_contains(str_replace(DIRECTORY_SEPARATOR, '/', self::php()), '/') && ! is_file(self::php())) { + $missing[] = 'Das PHP-Programm für den Testlauf wurde nicht gefunden.'; + } + + return $missing; + } + + /** + * Plays a scenario with the (possibly unsaved) draft of a channel's process and returns the stored report. + * + * @param array $draft + * @param array $inputs + */ + public function run(Channel $channel, IntakeKind $intake, array $draft, string $scenario, array $inputs, int $steps, User $user): ProcessTestRun + { + if (($missing = self::requirements()) !== []) { + throw new RuntimeException('Der Prozess-Tester ist auf diesem Server gesperrt: '.implode(' ', $missing)); + } + if (ScenarioCatalogue::find($scenario) === null) { + throw new RuntimeException('Unbekanntes Szenario.'); + } + if (($problems = app(ChannelProcessConfiguration::class)->problems($channel, $intake, $draft, sandbox: true)) !== []) { + throw new RuntimeException('Die Konfiguration ist nicht zulässig: '.implode(' ', $problems)); + } + + self::prune(); + $locks = $this->slot($channel->tenant_id); + $run = (string) Str::uuid(); + $directory = SandboxBootstrapper::directory($run); + + try { + File::ensureDirectoryExists($directory.'/files', 0700); + $input = [ + 'snapshot' => SandboxSnapshot::build($channel, $intake, $draft), + 'scenario' => $scenario, + 'inputs' => $inputs, + 'steps' => $steps, + 'start' => now()->startOfMinute()->toIso8601String(), + ]; + File::put($directory.'/input.json', (string) json_encode($input, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); + + $result = Process::path(base_path()) + ->timeout(self::TIMEOUT_SECONDS) + ->env([SandboxBootstrapper::ENV => $run, ...self::childEnvironment(), ...(app()->environment('testing') ? (array) config('fewo.sandbox.test_environment', []) : [])]) + ->run([self::php(), 'artisan', 'process:sandbox-run', $run, '--no-interaction']); + + $report = is_file($directory.'/report.json') ? (array) json_decode((string) File::get($directory.'/report.json'), true) : []; + if ($report === []) { + $report = ['aborted' => 'Der Testlauf hat keinen Bericht geliefert'.($result->successful() ? '.' : ': '.mb_substr(trim($result->errorOutput() ?: $result->output()), 0, 300)), 'timeline' => [], 'violations' => []]; + } + + return ProcessTestRun::query()->create([ + 'tenant_id' => $channel->tenant_id, + 'channel_id' => $channel->id, + 'user_id' => $user->id, + 'intake' => $intake->value, + 'scenario' => $scenario, + 'configuration' => $draft, + 'inputs' => $inputs, + 'steps' => $steps, + 'report' => $report, + 'outcome' => filled($report['aborted'] ?? null) ? ProcessTestRun::ABORTED : ProcessTestRun::COMPLETED, + 'release' => self::release(), + ]); + } finally { + File::deleteDirectory($directory); + foreach ($locks as $lock) { + flock($lock, LOCK_UN); + fclose($lock); + } + } + } + + /** + * Removes directories of runs that ended abnormally (older than an hour). + */ + public static function prune(): void + { + foreach (glob(storage_path('app/sandbox/runs/*'), GLOB_ONLYDIR) ?: [] as $directory) { + if (filemtime($directory) < time() - 3600) { + File::deleteDirectory($directory); + } + } + } + + /** + * The release the report belongs to. + */ + public static function release(): ?string + { + // Releases on Strato live in releases/- (pipeline-manager, scripts/deploy.sh). + $release = basename(base_path()); + + return preg_match('/^\d{14}-[0-9a-f]{7,40}$/', $release) === 1 ? $release : null; + } + + /** + * The PHP command line program for the run (Strato: php-cli next to the web PHP). + */ + public static function php(): string + { + $configured = (string) config('fewo.sandbox.php', ''); + if ($configured !== '') { + return $configured; + } + + return PHP_SAPI === 'cli' ? PHP_BINARY : (is_file('/opt/RZphp84/bin/php-cli') ? '/opt/RZphp84/bin/php-cli' : 'php'); + } + + /** + * Environment of the run's process: what Laravel needs to boot – never database, mail or service credentials (the + * run's configuration replaces them anyway, this keeps them out of its environment, too). + * + * @return array + */ + private static function childEnvironment(): array + { + $blank = []; + foreach (array_keys(getenv()) as $key) { + if (preg_match('/^(DB_|MAIL_|REDIS_|AWS_|MAILBOX_|FEWO_MAILBOX|OPENAI|ANTHROPIC|OPENROUTER|N8N_|PIPELINE_)/', (string) $key) === 1) { + $blank[$key] = false; + } + } + + return $blank; + } + + /** + * One run per landlord and at most SLOTS on the server, as file locks (they end with the process). + * + * @return list the held locks (landlord, slot) + */ + private function slot(int $tenant): array + { + $directory = storage_path('app/sandbox/slots'); + File::ensureDirectoryExists($directory, 0700); + $tenantLock = fopen($directory.'/tenant-'.$tenant.'.lock', 'c'); + if ($tenantLock === false || ! flock($tenantLock, LOCK_EX | LOCK_NB)) { + throw new RuntimeException('Für diesen Vermieter läuft bereits ein Test. Bitte einen Moment warten.'); + } + for ($index = 1; $index <= self::SLOTS; $index++) { + $slot = fopen($directory.'/slot-'.$index.'.lock', 'c'); + if ($slot !== false && flock($slot, LOCK_EX | LOCK_NB)) { + return [$tenantLock, $slot]; + } + if ($slot !== false) { + fclose($slot); + } + } + fclose($tenantLock); + + throw new RuntimeException('Der Prozess-Tester ist gerade belegt. Bitte gleich noch einmal versuchen.'); + } +} diff --git a/app/Process/Tester/ProcessSandboxDriver.php b/app/Process/Tester/ProcessSandboxDriver.php new file mode 100644 index 0000000..465fb5c --- /dev/null +++ b/app/Process/Tester/ProcessSandboxDriver.php @@ -0,0 +1,207 @@ + every mail of the run (simulated: the only mailer is `array`) */ + private array $sent = []; + + /** + * @param array $input input.json of the run + * @return array the report + */ + public function run(array $input): array + { + $this->assertSandbox(); + $started = microtime(true); + // Mails are collected when they are sent: the transport is rebuilt whenever the landlord context changes. + Event::listen(MessageSent::class, function (MessageSent $event): void { + $this->sent[] = $event->message; + EffectLedger::record('mail', ['subject' => (string) $event->message->getSubject()]); + }); + SandboxSnapshot::seed($input['snapshot']); + Date::setTestNow(CarbonImmutable::parse((string) $input['start'])); + + $tenant = Tenant::query()->findOrFail($input['snapshot']['tenant_id']); + $channel = Channel::withoutGlobalScopes()->findOrFail($input['snapshot']['channel_id']); + $intake = IntakeKind::from((string) $input['snapshot']['intake']); + $class = ScenarioCatalogue::find((string) $input['scenario']) ?? throw new \RuntimeException('Unbekanntes Szenario.'); + /** @var Scenario $scenario */ + $scenario = new $class; + + return app(TenantContext::class)->run($tenant, function () use ($input, $channel, $intake, $scenario, $started): array { + $property = Property::query()->findOrFail($channel->property_id); + $context = new SandboxContext($channel, $intake, $property, (array) $input['inputs']); + $events = array_slice($scenario->events($context->inputs), 0, min(self::MAX_EVENTS, max(1, (int) $input['steps']))); + $timeline = []; + $aborted = null; + + if (filled(config('sandbox.probe'))) { + // Negative tests only: a probe tries forbidden accesses before the scenario. + rescue(fn () => app((string) config('sandbox.probe'))->handle($context), report: false); + } + + foreach ($events as $event) { + $error = null; + try { + ($event->run)($context); + } catch (Throwable $exception) { + $error = class_basename($exception).': '.$exception->getMessage(); + } + $timeline[] = ['label' => $event->label, 'at' => now()->format('d.m.Y H:i'), 'error' => $error, ...$this->capture($context)]; + + if (EffectLedger::violations() !== []) { + $aborted = 'Unzulässiger Zugriff – Lauf abgebrochen.'; + break; + } + if (microtime(true) - $started > self::MAX_SECONDS) { + $aborted = 'Laufzeitgrenze erreicht – Lauf abgebrochen.'; + break; + } + } + + $booking = $context->booking?->fresh(); + + return [ + 'scenario' => ['key' => $scenario::key(), 'label' => $scenario::label(), 'inputs' => $context->inputs, 'available_events' => count($scenario->events($context->inputs))], + 'plan' => $booking === null ? null : $this->plan($booking), + 'timeline' => $timeline, + 'result' => $booking === null ? null : ['status' => $booking->status->getLabel(), 'situation' => CaseActivities::situation($booking), 'next' => CaseActivities::next($booking)?->label], + 'violations' => EffectLedger::violations(), + 'aborted' => $aborted ?? (EffectLedger::violations() !== [] ? 'Unzulässiger Zugriff – Lauf abgebrochen.' : null), + ]; + }); + } + + /** + * Refuses to run unless the process really is a sandbox (defence in depth behind SandboxBootstrapper). + */ + private function assertSandbox(): void + { + $connections = array_keys((array) config('database.connections')); + $mailers = array_keys((array) config('mail.mailers')); + if (config('database.default') !== 'sandbox' || $connections !== ['sandbox'] || $mailers !== ['array'] || config('cache.default') !== 'array' || blank(config('sandbox.run'))) { + throw new \RuntimeException('Sicherheitsprüfung des Prozess-Testers fehlgeschlagen: der Prozess ist nicht isoliert ('.json_encode(['db' => config('database.default'), 'connections' => $connections, 'mailers' => $mailers, 'cache' => config('cache.default')]).').'); + } + } + + /** + * @return array + */ + private function plan(Booking $booking): array + { + $plan = ProcessPlan::of($booking); + $profile = $booking->process(); + + return [ + 'model' => $plan->model, + 'label' => $plan->modelDefinition()::label(), + 'version' => $plan->modelVersion, + 'variant' => $plan->variant, + 'modules' => $plan->modules, + 'case_type' => strtoupper($profile->caseType->value), + 'configuration' => collect(ProcessSetting::cases())->map(fn ($setting): array => ['question' => $setting->question(), 'value' => $setting->describe($profile->value($setting)), 'source' => ProcessProfile::sourceLabel($profile->source($setting))])->all(), + ]; + } + + /** + * The case after one event: its course, the skipped steps, the simulated mails and effects. + * + * @return array + */ + private function capture(SandboxContext $context): array + { + $booking = $context->booking?->fresh(); + $ledger = EffectLedger::entries(); + $effects = array_slice($ledger, $this->ledgerSeen); + $this->ledgerSeen = count($ledger); + + if ($booking === null) { + return ['activities' => [], 'skipped' => [], 'mails' => $this->mails(), 'effects' => $effects]; + } + + $caseContext = CaseContext::of($booking); + $catalogue = app(ProcessCatalogue::class); + $skipped = []; + foreach ($caseContext->plan->moduleKeys() as $key) { + if (! $catalogue->hasModule($key)) { + continue; + } + $module = $catalogue->module($key); + $reason = match (true) { + ! $caseContext->plan->enabled($key) => 'übersprungen (Konfiguration)', + ! $module->applies($caseContext) => 'trifft hier nicht zu', + default => null, + }; + if ($reason !== null) { + $skipped[] = ['label' => $module::definition()->label, 'reason' => $reason]; + } + } + + return [ + 'status' => $booking->status->getLabel(), + 'situation' => CaseActivities::situation($booking), + 'activities' => array_map(fn ($activity): array => ['label' => $activity->label, 'state' => $activity->state->getLabel(), 'state_key' => $activity->state->value, 'detail' => $activity->detail], CaseActivities::for($booking)), + 'skipped' => $skipped, + 'calendar' => ['occupying' => Booking::query()->occupying()->whereKey($booking->id)->exists(), 'hold_until' => $booking->isHoldActive() ? $booking->hold_expires_at->format('d.m.Y H:i') : null], + 'price' => ['total' => $booking->total, 'lines' => array_map(fn (array $line): array => ['label' => $line['label'] ?? '', 'amount' => $line['amount'] ?? 0], (array) ($booking->quote['lines'] ?? []))], + 'mails' => $this->mails(), + 'effects' => $effects, + ]; + } + + /** + * Mails sent since the last capture – simulated, never delivered. Links are shown as text only. + * + * @return list + */ + private function mails(): array + { + $new = array_slice($this->sent, $this->mailsSeen); + $this->mailsSeen = count($this->sent); + + return array_values(array_map(function (Email $email): array { + $text = trim(preg_replace('/\s+/', ' ', strip_tags((string) ($email->getTextBody() ?? $email->getHtmlBody() ?? ''))) ?? ''); + + return [ + 'subject' => (string) $email->getSubject(), + 'to' => implode(', ', array_map(fn ($address): string => $address->getAddress(), $email->getTo())), + 'excerpt' => mb_substr((string) preg_replace('~https?://\S+~', '[Link]', $text), 0, 400), + ]; + }, $new)); + } +} diff --git a/app/Process/Tester/SandboxBootstrapper.php b/app/Process/Tester/SandboxBootstrapper.php new file mode 100644 index 0000000..411f71a --- /dev/null +++ b/app/Process/Tester/SandboxBootstrapper.php @@ -0,0 +1,117 @@ +set('database.default', 'sandbox'); + $config->set('database.connections', ['sandbox' => [ + 'driver' => 'sqlite', + 'database' => $directory.'/db.sqlite', + 'prefix' => '', + 'foreign_key_constraints' => true, + ]]); + $config->set('database.redis', []); + + $config->set('mail.default', 'array'); + $config->set('mail.mailers', ['array' => ['transport' => 'array']]); + $config->set('mail.from', ['address' => 'tester@sandbox.invalid', 'name' => 'Prozess-Tester']); + $config->set('fewo.mail_redirect_to', null); + + $config->set('cache.default', 'array'); + $config->set('cache.stores', ['array' => ['driver' => 'array', 'serialize' => false]]); + $config->set('session.driver', 'array'); + $config->set('queue.default', 'sync'); + $config->set('queue.connections', ['sync' => ['driver' => 'sync']]); + $config->set('queue.failed', ['driver' => 'null']); + + $files = $directory.'/files'; + $config->set('filesystems.default', 'local'); + $config->set('filesystems.disks', [ + 'local' => ['driver' => 'local', 'root' => $files.'/private', 'throw' => true], + 'private' => ['driver' => 'local', 'root' => $files.'/private', 'throw' => true], + 'public' => ['driver' => 'local', 'root' => $files.'/public', 'throw' => true], + 'media' => ['driver' => 'local', 'root' => $files.'/media', 'throw' => true], + ]); + + $config->set('logging.default', 'sandbox'); + $config->set('logging.channels', [ + 'sandbox' => ['driver' => 'single', 'path' => $directory.'/log.txt', 'level' => 'debug'], + 'null' => ['driver' => 'monolog', 'handler' => NullHandler::class], + 'emergency' => ['path' => $directory.'/log.txt'], + ]); + + $config->set('app.key', 'base64:'.base64_encode(random_bytes(32))); + $config->set('app.previous_keys', []); + + // Secrets and outside services: blank. The scripted answers of the scenario replace them. + foreach (['services', 'fewo.mailbox', 'fewo.automation', 'fewo.llm'] as $key) { + if (is_array($config->get($key))) { + $config->set($key, array_map(fn (mixed $value): mixed => is_array($value) ? [] : null, (array) $config->get($key))); + } + } + + $config->set('sandbox', ['run' => $run, 'directory' => $directory, 'probe' => self::probe($app)]); + // Registered after every framework provider, so its bindings replace the managers before anything resolves them. + $config->set('app.providers', [...($config->get('app.providers') ?? ServiceProvider::defaultProviders()->toArray()), SandboxServiceProvider::class]); + } + + /** + * A probe that deliberately tries forbidden accesses – only for the negative tests of the test suite. + */ + private static function probe(Application $app): ?string + { + $probe = getenv('FEWO_SANDBOX_PROBE') ?: null; + + return $probe !== null && $app->environment('testing') && class_exists($probe) ? $probe : null; + } +} diff --git a/app/Process/Tester/SandboxChannelRegistry.php b/app/Process/Tester/SandboxChannelRegistry.php new file mode 100644 index 0000000..d271392 --- /dev/null +++ b/app/Process/Tester/SandboxChannelRegistry.php @@ -0,0 +1,22 @@ + $inputs + */ + public function __construct( + public readonly Channel $channel, + public readonly IntakeKind $intake, + public readonly Property $property, + public readonly array $inputs, + ) {} + + public function arrival(): CarbonImmutable + { + $value = (string) ($this->inputs['arrival'] ?? '+21 days'); + + return CarbonImmutable::parse($value, now()->getTimezone())->startOfDay(); + } + + public function departure(): CarbonImmutable + { + return $this->arrival()->addDays(max(1, (int) ($this->inputs['nights'] ?? 4))); + } + + public function guests(): int + { + return max(1, (int) ($this->inputs['guests'] ?? 2)); + } + + /** + * A request through the same action as the website's booking form. + * + * @param array $guest + */ + public function request(array $guest): Booking + { + return $this->booking = app(CreateReservation::class)->handle( + $this->property, + new StayRequest($this->arrival(), $this->departure(), $this->guests()), + ['first_name' => 'Testgast', 'last_name' => 'Sandbox', 'email' => 'gast@tester.invalid', ...$guest], + source: $this->channel->isWebsite() ? 'website' : 'channel', + originChannel: $this->channel->isWebsite() ? null : $this->channel, + ); + } + + /** + * Time passes: the clock moves on and the case-related schedulers run in the order of routes/console.php. + */ + public function travel(int $minutes): void + { + Date::setTestNow(now()->addMinutes($minutes)); + foreach (['bookings:expire-holds', 'bookings:auto-offers', 'cases:data-requests'] as $command) { + Artisan::call($command); + } + app(SendBookingReminders::class)->handle(); + app(PrepareStays::class)->handle(); + app(RequestReviews::class)->handle(); + } + + public function travelTo(CarbonImmutable $moment): void + { + $minutes = (int) max(0, now()->diffInMinutes($moment)); + $this->travel($minutes); + } +} diff --git a/app/Process/Tester/SandboxMailboxReader.php b/app/Process/Tester/SandboxMailboxReader.php new file mode 100644 index 0000000..6d8449e --- /dev/null +++ b/app/Process/Tester/SandboxMailboxReader.php @@ -0,0 +1,26 @@ +|null)> host => answer */ + private static array $answers = []; + + /** + * @param callable(Request): (PromiseInterface|array|null) $answer + */ + public static function script(string $host, callable $answer): void + { + self::$answers[$host] = $answer; + } + + public static function reset(): void + { + self::$answers = []; + } + + public static function answer(Request $request): ?PromiseInterface + { + $host = (string) parse_url($request->url(), PHP_URL_HOST); + $answer = isset(self::$answers[$host]) ? (self::$answers[$host])($request) : null; + + return match (true) { + $answer === null => null, + $answer instanceof PromiseInterface => $answer, + default => Http::response($answer), + }; + } +} diff --git a/app/Process/Tester/SandboxServiceProvider.php b/app/Process/Tester/SandboxServiceProvider.php new file mode 100644 index 0000000..1041fbd --- /dev/null +++ b/app/Process/Tester/SandboxServiceProvider.php @@ -0,0 +1,126 @@ +app->singleton('db', fn ($app): DatabaseManager => new class($app, $app['db.factory'], $file) extends DatabaseManager + { + public function __construct($app, $factory, private string $file) + { + parent::__construct($app, $factory); + } + + public function connection($name = null) + { + $name ??= $this->getDefaultConnection(); + [$database] = $this->parseConnectionName($name); + if ($database !== 'sandbox') { + throw SandboxViolation::record('database', "Verbindung [{$name}] ist im Prozess-Tester nicht erlaubt."); + } + + return parent::connection($name); + } + + /** Every (re)connected sandbox connection gets the guard: each statement must go to the run's own file. */ + protected function configure(Connection $connection, $type) + { + $connection = parent::configure($connection, $type); + $expected = realpath($this->file) ?: $this->file; + $connection->beforeExecuting(function (string $query, array $bindings, Connection $connection) use ($expected): void { + $actual = (string) $connection->getConfig('database'); + if ((realpath($actual) ?: $actual) !== $expected) { + throw SandboxViolation::record('database', 'Abfrage an eine andere Datenbankdatei: '.basename($actual)); + } + }); + + return $connection; + } + }); + + $this->app->singleton('filesystem', fn ($app): FilesystemManager => new class($app) extends FilesystemManager + { + public function build($config) + { + $root = is_array($config) ? (string) ($config['root'] ?? '') : ''; + if (! str_starts_with(str_replace('\\', '/', $root), str_replace('\\', '/', (string) config('sandbox.directory')))) { + throw SandboxViolation::record('file', 'Dateiablage außerhalb des Laufverzeichnisses ist im Prozess-Tester nicht erlaubt.'); + } + + return parent::build($config); + } + }); + + // Mail and cache come from deferred providers, which would register their managers again on first use: they are + // loaded and replaced just before the application boots, when the list of deferred services is complete. + $this->app->booting(function (): void { + foreach (['mail.manager', 'cache'] as $service) { + $this->app->loadDeferredProvider($service); + } + + $this->app->singleton('mail.manager', fn ($app): MailManager => new class($app) extends MailManager + { + public function mailer($name = null) + { + if (($name ?? $this->getDefaultDriver()) !== 'array') { + throw SandboxViolation::record('mail', "Mailer [{$name}] ist im Prozess-Tester nicht erlaubt."); + } + + return parent::mailer($name); + } + }); + + $this->app->singleton('cache', fn ($app): CacheManager => new class($app) extends CacheManager + { + public function store($name = null) + { + if (($name ?? $this->getDefaultDriver()) !== 'array') { + throw SandboxViolation::record('cache', "Cache [{$name}] ist im Prozess-Tester nicht erlaubt."); + } + + return parent::store($name); + } + }); + }); + + $this->app->singleton(MailboxReader::class, fn (): MailboxReader => new SandboxMailboxReader); + $this->app->singleton(ChannelRegistry::class, fn (): ChannelRegistry => new SandboxChannelRegistry); + } + + public function boot(): void + { + // No network: only the scenario's scripted answers (ProcessSandboxDriver::script) are served. + Http::preventStrayRequests(); + Http::fake(function (Request $request) { + $answer = SandboxNetwork::answer($request); + if ($answer === null) { + throw SandboxViolation::record('network', 'Netzzugriff ohne Szenario-Antwort: '.$request->method().' '.parse_url($request->url(), PHP_URL_HOST)); + } + EffectLedger::record('network', ['method' => $request->method(), 'host' => parse_url($request->url(), PHP_URL_HOST), 'scripted' => true]); + + return $answer; + }); + } +} diff --git a/app/Process/Tester/SandboxSnapshot.php b/app/Process/Tester/SandboxSnapshot.php new file mode 100644 index 0000000..dd78a71 --- /dev/null +++ b/app/Process/Tester/SandboxSnapshot.php @@ -0,0 +1,142 @@ + ['mailbox_password'], + 'channels' => ['previous_export_token', 'export_snapshot', 'ical_analysis'], + 'blocked_periods' => ['ical_properties', 'ical_raw', 'ical_interpretation', 'linked_booking_id', 'guest_name'], + ]; + + /** Encrypted columns that are carried as plain values and encrypted again in the run. */ + public const ENCRYPTED = ['tenants' => ['bank_account_holder', 'bank_iban', 'bank_bic', 'bank_name', 'tax_note']]; + + /** + * @param array $draft model, variant, steps, settings of the tested channel and intake kind + * @return array{tenant_id: int, channel_id: int, intake: string, tables: array>>, encrypted: array>} + */ + public static function build(Channel $channel, IntakeKind $intake, array $draft): array + { + $tenant = Tenant::query()->findOrFail($channel->tenant_id); + $propertyIds = DB::table('properties')->where('tenant_id', $tenant->id)->pluck('id')->all(); + $tables = []; + + foreach (self::TABLES as $table) { + if (! Schema::hasTable($table)) { + continue; + } + $query = DB::table($table); + $query = match (true) { + $table === 'tenants' => $query->where('id', $tenant->id), + Schema::hasColumn($table, 'tenant_id') => $query->where('tenant_id', $tenant->id), + Schema::hasColumn($table, 'property_id') => $query->whereIn('property_id', $propertyIds), + default => null, + }; + if ($query === null) { + continue; + } + $tables[$table] = $query->orderBy('id')->get()->map(fn (object $row): array => self::clean($table, (array) $row))->all(); + } + + // The tested channel carries the draft (also unsaved) – and creates cases from portal mails in the run. + foreach ($tables['channels'] ?? [] as $index => $row) { + if ((int) $row['id'] === $channel->id) { + $overrides = (array) json_decode((string) ($row['process_overrides'] ?? '[]'), true); + $overrides[$intake->value] = [...array_filter((array) ($draft['settings'] ?? []), fn (mixed $value): bool => $value !== null && $value !== ''), 'model' => $draft['model'] ?? null, 'variant' => $draft['variant'] ?? 'standard', 'steps' => (array) ($draft['steps'] ?? [])]; + $tables['channels'][$index]['process_overrides'] = json_encode($overrides); + $tables['channels'][$index]['case_intake'] = 'create'; + // In the run the tested portal is active, so its (synthetic) booking mails are recognised. + $tables['channels'][$index]['is_active'] = 1; + $tables['channels'][$index]['status'] = 'active'; + $settings = (array) json_decode((string) ($row['settings'] ?? '[]'), true); + $settings['email_senders'] = filled($settings['email_senders'] ?? null) ? $settings['email_senders'] : 'portal.invalid'; + $tables['channels'][$index]['settings'] = json_encode($settings); + } + } + + return ['tenant_id' => $tenant->id, 'channel_id' => $channel->id, 'intake' => $intake->value, 'tables' => $tables, 'encrypted' => self::ENCRYPTED]; + } + + /** + * @param array $row + * @return array + */ + private static function clean(string $table, array $row): array + { + foreach (self::DROPPED[$table] ?? [] as $column) { + if (array_key_exists($column, $row)) { + $row[$column] = null; + } + } + foreach (self::ENCRYPTED[$table] ?? [] as $column) { + if (filled($row[$column] ?? null)) { + try { + $row[$column] = Crypt::decryptString((string) $row[$column]); + } catch (Throwable) { + $row[$column] = null; + } + } + } + if ($table === 'channels' && array_key_exists('export_token', $row)) { + // The real export link is never part of a run: a random one of no use outside it. + $row['export_token'] = bin2hex(random_bytes(20)); + } + if ($table === 'tenants') { + // The run is always in test operation and writes only to its own test address. + $row['operating_mode'] = 'test'; + $row['test_recipient'] = 'tester@sandbox.invalid'; + } + + return $row; + } + + /** + * Writes the snapshot into the run's own database (inside the tester process only). + * + * @param array{tables: array>>, encrypted: array>} $snapshot + */ + public static function seed(array $snapshot): void + { + if (config('database.default') !== 'sandbox') { + throw SandboxViolation::record('database', 'Einspielen nur in die Testdatenbank.'); + } + + Schema::disableForeignKeyConstraints(); + foreach ($snapshot['tables'] as $table => $rows) { + if (! Schema::hasTable($table)) { + continue; + } + $columns = array_flip(Schema::getColumnListing($table)); + foreach ($rows as $row) { + foreach ($snapshot['encrypted'][$table] ?? [] as $column) { + if (filled($row[$column] ?? null)) { + $row[$column] = Crypt::encryptString((string) $row[$column]); + } + } + DB::table($table)->insert(array_intersect_key($row, $columns)); + } + } + Schema::enableForeignKeyConstraints(); + } +} diff --git a/app/Process/Tester/SandboxViolation.php b/app/Process/Tester/SandboxViolation.php new file mode 100644 index 0000000..6513ddc --- /dev/null +++ b/app/Process/Tester/SandboxViolation.php @@ -0,0 +1,20 @@ + $kind, 'message' => $message]); + + return new self('Prozess-Tester: unzulässiger Zugriff ('.$kind.'): '.$message); + } +} diff --git a/app/Process/Tester/ScenarioCatalogue.php b/app/Process/Tester/ScenarioCatalogue.php new file mode 100644 index 0000000..3d59e32 --- /dev/null +++ b/app/Process/Tester/ScenarioCatalogue.php @@ -0,0 +1,55 @@ +> */ + public const SCENARIOS = [CompleteRequest::class, MissingAddress::class, PortalInquiry::class, ReturningGuest::class, CommunicationFailure::class, PortalBooking::class]; + + /** + * @return array> + */ + public static function for(IntakeKind $intake, bool $website): array + { + $scenarios = []; + foreach (self::SCENARIOS as $class) { + if (! in_array($intake, $class::intakes(), true)) { + continue; + } + // A website request is never a portal's request and vice versa. + if (($class === PortalInquiry::class && $website) || ($website === false && $intake === IntakeKind::Inquiry && in_array($class, [CompleteRequest::class, MissingAddress::class, ReturningGuest::class, CommunicationFailure::class], true))) { + continue; + } + $scenarios[$class::key()] = $class; + } + + return $scenarios; + } + + /** + * @return class-string|null + */ + public static function find(string $key): ?string + { + foreach (self::SCENARIOS as $class) { + if ($class::key() === $key) { + return $class; + } + } + + return null; + } +} diff --git a/app/Process/Tester/Scenarios/CommunicationFailure.php b/app/Process/Tester/Scenarios/CommunicationFailure.php new file mode 100644 index 0000000..47bc6a1 --- /dev/null +++ b/app/Process/Tester/Scenarios/CommunicationFailure.php @@ -0,0 +1,49 @@ + $context->request(['street' => 'Teststraße 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'])), + ]; + } +} diff --git a/app/Process/Tester/Scenarios/CompleteRequest.php b/app/Process/Tester/Scenarios/CompleteRequest.php new file mode 100644 index 0000000..d97ac93 --- /dev/null +++ b/app/Process/Tester/Scenarios/CompleteRequest.php @@ -0,0 +1,57 @@ + $context->request(['street' => 'Teststraße 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'])), + new ScenarioEvent('Sie senden das Angebot (falls es nicht automatisch ging)', function (SandboxContext $context): void { + $booking = $context->booking->fresh(); + if ($booking->status === BookingStatus::Reserved && $booking->offer_version === 0 && $booking->process()->preReservation()) { + app(SendOffer::class)->handle($booking); + } + }), + new ScenarioEvent('Gast nimmt das Angebot an', function (SandboxContext $context): void { + $booking = $context->booking->fresh(); + if ($booking->status === BookingStatus::OfferSent) { + app(AcceptOffer::class)->handle($booking, $booking->offer_version); + } + }), + new ScenarioEvent('Zwei Tage vor der Anreise', fn (SandboxContext $context) => $context->travelTo($context->arrival()->subDays(2)->setTime(9, 0))), + new ScenarioEvent('Drei Tage nach der Abreise', fn (SandboxContext $context) => $context->travelTo($context->departure()->addDays(3)->setTime(9, 0))), + ]; + } +} diff --git a/app/Process/Tester/Scenarios/MissingAddress.php b/app/Process/Tester/Scenarios/MissingAddress.php new file mode 100644 index 0000000..60cd9f0 --- /dev/null +++ b/app/Process/Tester/Scenarios/MissingAddress.php @@ -0,0 +1,57 @@ + ['label' => 'Antwort des Gastes nach (Stunden)', 'default' => 26, 'type' => 'int'], + 'answer_by' => ['label' => 'Antwort über', 'default' => 'link', 'type' => 'select', 'options' => ['link' => 'Link im Formular', 'email' => 'E-Mail (ausgewertete Angaben)']], + ]; + } + + public function events(array $inputs): array + { + return [ + new ScenarioEvent('Gast fragt ohne Anschrift an', fn (SandboxContext $context) => $context->request([])), + new ScenarioEvent('Zwei Stunden vergehen (Klärungsfrist)', fn (SandboxContext $context) => $context->travel(125)), + new ScenarioEvent('Gast antwortet mit seiner Anschrift', function (SandboxContext $context) use ($inputs): void { + $context->travel(max(0, (int) ($inputs['answer_after_hours'] ?? 26) * 60 - 125)); + app(ContributeCaseFacts::class)->handle($context->booking->fresh(), ['guest.street' => 'Teststraße 1', 'guest.postal_code' => '18225', 'guest.city' => 'Kühlungsborn', 'guest.country' => 'DE'], ($inputs['answer_by'] ?? 'link') === 'email' ? FactSource::Email : FactSource::GuestLink); + }), + new ScenarioEvent('Die Angebotsfrist vergeht ohne Annahme', fn (SandboxContext $context) => $context->travel(73 * 60)), + ]; + } +} diff --git a/app/Process/Tester/Scenarios/PortalBooking.php b/app/Process/Tester/Scenarios/PortalBooking.php new file mode 100644 index 0000000..f62c380 --- /dev/null +++ b/app/Process/Tester/Scenarios/PortalBooking.php @@ -0,0 +1,85 @@ + ['label' => 'Gesamtpreis laut Portal (€)', 'default' => 980, 'type' => 'int'], + 'cancellation' => ['label' => 'Portal meldet eine Stornierung', 'default' => false, 'type' => 'bool'], + ]; + } + + public function events(array $inputs): array + { + $total = max(1, (int) ($inputs['portal_total'] ?? 980)) * 100; + $events = [ + new ScenarioEvent('Buchungsmail des Portals kommt an', fn (SandboxContext $context) => $this->sendPortalMail($context, 'Neue Buchung: '.$context->property->name, $this->text($context))), + new ScenarioEvent('Dieselbe Buchungsmail kommt noch einmal', fn (SandboxContext $context) => $this->sendPortalMail($context, 'Neue Buchung: '.$context->property->name, $this->text($context))), + new ScenarioEvent('Gastdaten laut Portal', fn (SandboxContext $context) => app(ContributeCaseFacts::class)->handle($context->booking->fresh(), ['guest.first_name' => 'Testgast', 'guest.last_name' => 'Portal', 'guest.email' => 'portalgast@tester.invalid', 'booking.guests' => (string) $context->guests()], FactSource::PortalMail)), + new ScenarioEvent('Portal meldet Preis, Gastzahlung und angekündigte Auszahlung', fn (SandboxContext $context) => app(RecordPortalAmounts::class)->handle($context->booking->fresh(), $total, [['kind' => 'payout_announced', 'amount' => (int) round($total * 0.9)]], [['amount' => (int) round($total * 0.4), 'paid_on' => now()->toDateString()]], $context->channel->name)), + ]; + if ((bool) ($inputs['cancellation'] ?? false)) { + $events[] = new ScenarioEvent('Portal meldet eine Stornierung', fn (SandboxContext $context) => $this->sendPortalMail($context, 'Buchung storniert: '.$this->reference($context), 'Die Buchung vom '.$context->arrival()->format('d.m.Y').' bis '.$context->departure()->format('d.m.Y').' wurde storniert. Buchungsnummer: '.$this->reference($context))); + } + $events[] = new ScenarioEvent('Drei Tage nach der Abreise', fn (SandboxContext $context) => $context->travelTo($context->departure()->addDays(3)->setTime(9, 0))); + + return $events; + } + + private function reference(SandboxContext $context): string + { + return 'TEST-'.$context->arrival()->format('md'); + } + + private function text(SandboxContext $context): string + { + return "Gast: Testgast Portal\nAnreise: ".$context->arrival()->format('d.m.Y')."\nAbreise: ".$context->departure()->format('d.m.Y')."\nBuchungsnummer: ".$this->reference($context); + } + + private function sendPortalMail(SandboxContext $context, string $subject, string $text): void + { + $senders = array_values(array_filter(array_map('trim', explode(',', (string) ($context->channel->setting('email_senders') ?? ''))))); + $sender = 'buchung@'.($senders[0] ?? 'portal.invalid'); + app(ProcessPortalMail::class)->handle(new PortalMail('<'.md5($subject).'@tester.invalid>', $sender, $subject, $text, CarbonImmutable::now())); + $context->booking = Booking::query()->latest('id')->first() ?? $context->booking; + } +} diff --git a/app/Process/Tester/Scenarios/PortalInquiry.php b/app/Process/Tester/Scenarios/PortalInquiry.php new file mode 100644 index 0000000..d71dd75 --- /dev/null +++ b/app/Process/Tester/Scenarios/PortalInquiry.php @@ -0,0 +1,47 @@ +booking = app(TakeOverPortalInquiry::class)->handle($context->channel, $context->arrival(), $context->departure(), 'ANF-'.$context->arrival()->format('md')); + }), + new ScenarioEvent('Kontaktdaten laut Portal', fn (SandboxContext $context) => app(ContributeCaseFacts::class)->handle($context->booking->fresh(), ['guest.first_name' => 'Testgast', 'guest.last_name' => 'Anfrage', 'guest.email' => 'anfrage@tester.invalid', 'booking.guests' => (string) $context->guests()], FactSource::PortalMail)), + new ScenarioEvent('Gast ergänzt seine Anschrift', fn (SandboxContext $context) => app(ContributeCaseFacts::class)->handle($context->booking->fresh(), ['guest.street' => 'Teststraße 1', 'guest.postal_code' => '18225', 'guest.city' => 'Kühlungsborn', 'guest.country' => 'DE'], FactSource::GuestLink)), + ]; + } +} diff --git a/app/Process/Tester/Scenarios/ReturningGuest.php b/app/Process/Tester/Scenarios/ReturningGuest.php new file mode 100644 index 0000000..2486bd1 --- /dev/null +++ b/app/Process/Tester/Scenarios/ReturningGuest.php @@ -0,0 +1,64 @@ + ['label' => 'Gast war schon einmal da', 'default' => true, 'type' => 'bool']]; + } + + public function events(array $inputs): array + { + return [ + new ScenarioEvent('Früherer Aufenthalt (nur in den Testdaten)', function (SandboxContext $context) use ($inputs): void { + if (! (bool) ($inputs['returning'] ?? true)) { + return; + } + $guest = Guest::query()->create(['tenant_id' => $context->property->tenant_id, 'first_name' => 'Testgast', 'last_name' => 'Sandbox', 'email' => 'gast@tester.invalid']); + Booking::query()->create(['tenant_id' => $context->property->tenant_id, 'property_id' => $context->property->id, 'guest_id' => $guest->id, 'status' => BookingStatus::Completed, 'intake' => 'inquiry', + 'arrival' => now()->subYear()->toDateString(), 'departure' => now()->subYear()->addDays(7)->toDateString(), 'guests' => 2, 'total' => 80000, 'deposit' => 20000, 'completed_at' => now()->subYear()->addDays(8)]); + }), + new ScenarioEvent('Gast fragt mit allen Angaben an', fn (SandboxContext $context) => $context->request(['street' => 'Teststraße 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'])), + new ScenarioEvent('Sie senden das Angebot (falls es nicht automatisch ging)', function (SandboxContext $context): void { + $booking = $context->booking->fresh(); + if ($booking->status === BookingStatus::Reserved && $booking->offer_version === 0 && $booking->process()->preReservation()) { + app(SendOffer::class)->handle($booking); + } + }), + ]; + } +} diff --git a/app/Process/Tester/Scenarios/Scenario.php b/app/Process/Tester/Scenarios/Scenario.php new file mode 100644 index 0000000..c11241f --- /dev/null +++ b/app/Process/Tester/Scenarios/Scenario.php @@ -0,0 +1,42 @@ + */ + abstract public static function intakes(): array; + + /** + * Inputs the landlord may change, with their defaults. + * + * @return array}> + */ + public static function inputs(): array + { + return [ + 'arrival' => ['label' => 'Anreise', 'default' => '+21 days', 'type' => 'date'], + 'nights' => ['label' => 'Nächte', 'default' => 4, 'type' => 'int'], + 'guests' => ['label' => 'Personen', 'default' => 2, 'type' => 'int'], + ]; + } + + /** + * @param array $inputs + * @return list + */ + abstract public function events(array $inputs): array; +} diff --git a/app/Process/Tester/Scenarios/ScenarioEvent.php b/app/Process/Tester/Scenarios/ScenarioEvent.php new file mode 100644 index 0000000..08864cb --- /dev/null +++ b/app/Process/Tester/Scenarios/ScenarioEvent.php @@ -0,0 +1,17 @@ +app->make(TenantConfig::class)->refresh(); } catch (Throwable) { // no database yet (package discovery, first install) diff --git a/app/Support/SystemSettings.php b/app/Support/SystemSettings.php index cc3675d..2bfc624 100644 --- a/app/Support/SystemSettings.php +++ b/app/Support/SystemSettings.php @@ -30,6 +30,7 @@ class SystemSettings 'fewo.retention.inquiry_months' => ['Nicht gebuchte Anfragen löschen nach (Monate)', 'int', 'Löschfristen', ''], 'fewo.retention.portal_email_excerpt_days' => ['Portal-Mail-Auszug löschen nach (Tage)', 'int', 'Löschfristen', ''], 'fewo.retention.attribution_months' => ['Herkunftsangaben löschen nach (Monate)', 'int', 'Löschfristen', ''], + 'fewo.retention.process_test_run_days' => ['Berichte des Prozess-Testers löschen nach (Tage)', 'int', 'Löschfristen', 'Nur synthetische Testdaten; Grundlage 30 Tage (Entscheidung O3).'], 'fewo.spam.min_seconds' => ['Mindestzeit im Formular (Sekunden)', 'int', 'Bot-Schutz', 'Untergrenze; ein Mandant kann länger warten lassen.'], 'fewo.spam.per_ip_per_hour' => ['Anfragen je IP und Stunde', 'int', 'Bot-Schutz', ''], diff --git a/bootstrap/app.php b/bootstrap/app.php index 1c6e525..2d3342e 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -3,12 +3,14 @@ use App\Http\Middleware\ForceHttps; use App\Http\Middleware\ResolveTheme; use App\Http\Middleware\SecurityHeaders; +use App\Process\Tester\SandboxBootstrapper; use Illuminate\Foundation\Application; +use Illuminate\Foundation\Bootstrap\LoadConfiguration; use Illuminate\Foundation\Configuration\Exceptions; use Illuminate\Foundation\Configuration\Middleware; use Illuminate\Http\Request; -return Application::configure(basePath: dirname(__DIR__)) +$app = Application::configure(basePath: dirname(__DIR__)) ->withRouting( web: __DIR__.'/../routes/web.php', commands: __DIR__.'/../routes/console.php', @@ -30,3 +32,11 @@ fn (Request $request) => $request->is('api/*') || $request->expectsJson(), ); })->create(); + +// Process tester (Architektur V2, docs/Prozessarchitektur/Architektur/04 §3): a process started for a tester run is +// turned into a sandbox right after its configuration is loaded – before any provider registers or anything resolves. +if (SandboxBootstrapper::active()) { + $app->afterBootstrapping(LoadConfiguration::class, fn (Application $app) => SandboxBootstrapper::configure($app)); +} + +return $app; diff --git a/config/fewo.php b/config/fewo.php index 6db4510..48a5852 100644 --- a/config/fewo.php +++ b/config/fewo.php @@ -81,6 +81,16 @@ 'portal_email_excerpt_days' => (int) env('FEWO_RETENTION_PORTAL_EMAIL_EXCERPT_DAYS', 90), // Marketing attribution (UTM parameters, "how did you hear about us") is removed after … months. 'attribution_months' => (int) env('FEWO_RETENTION_ATTRIBUTION_MONTHS', 24), + // Reports of the process tester (synthetic data only) are deleted after … days (decision O3). + 'process_test_run_days' => (int) env('FEWO_RETENTION_PROCESS_TEST_RUN_DAYS', 30), + ], + + /* + | Process tester (Architektur V2): the PHP command line program its isolated runs start with. Empty: the running PHP + | in the console, on Strato /opt/RZphp84/bin/php-cli. + */ + 'sandbox' => [ + 'php' => env('FEWO_SANDBOX_PHP'), ], /* diff --git a/database/migrations/2026_11_07_100000_create_process_test_runs_table.php b/database/migrations/2026_11_07_100000_create_process_test_runs_table.php new file mode 100644 index 0000000..8b8901b --- /dev/null +++ b/database/migrations/2026_11_07_100000_create_process_test_runs_table.php @@ -0,0 +1,37 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->foreignId('channel_id')->nullable()->constrained()->nullOnDelete(); + $table->foreignId('user_id')->nullable()->constrained()->nullOnDelete(); + $table->string('intake', 20); + $table->string('scenario', 60); + $table->json('configuration'); + $table->json('inputs'); + $table->unsignedSmallInteger('steps'); + $table->json('report'); + $table->string('outcome', 20); + $table->string('release', 80)->nullable(); + $table->timestamps(); + $table->index(['tenant_id', 'created_at']); + }); + } + + public function down(): void + { + Schema::dropIfExists('process_test_runs'); + } +}; diff --git a/docs/BETRIEB.md b/docs/BETRIEB.md index 04ec6d8..20262ac 100644 --- a/docs/BETRIEB.md +++ b/docs/BETRIEB.md @@ -204,12 +204,21 @@ ## 7a. Datensicherung, Löschfristen, Automationen ``` Regelmäßig z. B. per Aufgabenplanung des NAS/PC ausführen (braucht den SSH-Schlüssel aus §4). - **Löschfristen** (Vorschläge, rechtlich zu bestätigen – `config/fewo.php` bzw. `.env`): Gästedaten 10 Jahre nach letztem Aufenthalt (`FEWO_GUEST_RETENTION_YEARS`), nie verbindlich gewordene Anfragen/Angebote 6 Monate (`FEWO_RETENTION_INQUIRY_MONTHS`), Textauszüge von Portal-Mails 90 Tage (`FEWO_RETENTION_PORTAL_EMAIL_EXCERPT_DAYS`), Herkunftsangaben/UTM 24 Monate (`FEWO_RETENTION_ATTRIBUTION_MONTHS`). Läuft täglich 03:00. Anonymisierung ersetzt Name, Kontaktdaten, Nachrichten, Notizen, Herkunft und Bewertungs-Anzeigenamen; Buchung, Preise und Zahlungen bleiben als Beleg. +- **Testberichte des Prozess-Testers:** 30 Tage (`FEWO_RETENTION_PROCESS_TEST_RUN_DAYS`, Entscheidung O3; System › Einstellungen › Löschfristen), gelöscht vom selben täglichen Lauf. Sie enthalten nur synthetische Testdaten. - **Bot-Schutz der Buchungsanfrage** (ohne externen Captcha-Dienst, `config/fewo.php › spam`): verstecktes Köderfeld, Zeitsperre (Absenden schneller als 4 s nach dem Öffnen = Bot, wird still ignoriert), höchstens 5 Anfragen/Stunde je IP, 3/Tag je E-Mail-Adresse, 30/Stunde insgesamt, höchstens 2 gleichzeitig vorgemerkte Anfragen je E-Mail-Adresse (sonst könnten Bots den Kalender blockieren), keine Links in Namen und höchstens 1 Link in der Nachricht. - **Automationen (n8n):** Token bitte als Header `Authorization: Bearer ` senden (landet nicht in Server-Logs); `?token=` funktioniert übergangsweise weiter. - **HTTPS:** `App\Http\Middleware\ForceHttps` leitet HTTP-Aufrufe (GET/HEAD 301, sonst 308) auf HTTPS um, in der Anwendung statt in der `.htaccess` – diese wird bei jedem Deployment neu geschrieben. Abschaltbar mit `FEWO_FORCE_HTTPS=false`. Zusätzlich sollte in Strato „SSL erzwingen“ aktiv sein, falls das Paket die Option anbietet. - **Restore-Test (30.10.2026, lokal, SQLite):** Dump mit `backup:database` aus einer frisch migrierten und gesäten Datenbank, in eine leere Datei zurückgespielt: 42 von 42 Tabellen, alle Zeilenzahlen gleich, 66 Migrationen „Ran“, keine ausstehend. Für **MariaDB (Strato) steht der Nachweis noch aus**: Dump mit `backup:database` erzeugen, in eine zweite, leere Strato-Datenbank per phpMyAdmin/`mysql` einspielen und Zeilenzahlen von `bookings`, `guests`, `pages`, `channels` vergleichen. Die Produktionsdatenbank wird dabei nicht verändert. - **Fotos:** Beim Hochladen werden Metadaten (GPS, Kamera) aus dem Original entfernt; bestehende Fotos einmalig: `php artisan photos:strip-metadata` (`--force` bearbeitet auch bereits markierte erneut). Hinweis: bewusst mit GD – Imagick (auf Strato installiert) behält EXIF beim Speichern. +## 7b. Prozess-Tester und Prozesskern (Architektur V2) + +- **Was er ist:** Kanal › Ablauf › „Ablauf testen“ spielt ausgedachte Vorgänge mit der (auch ungespeicherten) Einstellung durch – in einem **eigenen PHP-Prozess** (`php artisan process:sandbox-run`), der nur eine eigene SQLite-Datei je Lauf (`shared/storage/app/sandbox/runs//`), den Mailer `array`, den Cache `array` und Netzantworten des Szenarios kennt. Details: `docs/Prozessarchitektur/Architektur/04_PROZESS_TESTER.md`. +- **Voraussetzungen auf dem Server** (sonst ist der Tester gesperrt und sagt warum): PHP-Erweiterung `pdo_sqlite` (CLI: vorhanden, 04.11.2026), erlaubtes `proc_open` im Web-PHP, PHP-CLI unter `/opt/RZphp84/bin/php-cli` (abweichend: `FEWO_SANDBOX_PHP` in `shared/.env`), Vorlage `shared/storage/app/sandbox/template.sqlite` – sie entsteht bei jedem Deployment (`php artisan process:sandbox-template` nach `migrate`, `pipeline.toml`). +- **Grenzen (Restrisiko, dokumentiert):** Shared Hosting bietet keine Trennung auf Betriebssystemebene. Der Testprozess läuft unter demselben Systembenutzer; nativer PHP-Code könnte `shared/.env` lesen. Die Anwendung verhindert das über die ersetzte Konfiguration, entzogene Umgebungsvariablen und den statischen `SideEffectPathsTest`, der native Netz-, Mail-, Datenbank- und Dateizugriffe in `app/` verbietet. +- **Grenzen der Last:** höchstens 1 Lauf je Mandant, 3 gleichzeitig, 20 s und 60 Ereignisse je Lauf, Abbruch nach 30 s. Abgebrochene Laufverzeichnisse räumt der nächste Lauf (älter als 1 h). +- **Prüfbefehle:** `bash scripts/deploy.sh staging artisan process:check --cases` (Katalog und eingefrorene Pläne aller Vorgänge), `… artisan process:fingerprint` (Prüfsummen von Vorgängen, Kanalkonfiguration und Sperren; vor und nach einem Deployment vergleichen), `… artisan process:impact `. + ## 8. Bekannte Eigenheiten und Lösungen | Problem | Ursache | Lösung (umgesetzt) | diff --git a/docs/LOESCHKONZEPT.md b/docs/LOESCHKONZEPT.md index b61a77a..be87685 100644 --- a/docs/LOESCHKONZEPT.md +++ b/docs/LOESCHKONZEPT.md @@ -39,6 +39,8 @@ ## 2. Frist-Übersicht | Webserver-Logs STRATO | Hosting | technisch | Anbieterabhängig | ❓ | Strato-Info/AVV | ❓ | | Audit-Log (neu) | `audit_events` | Nachweis Sicherheit | z. B. 12 Monate ⚖ | existiert nicht | einführen | 🗓 | | Fehlgeschlagene Jobs | `failed_jobs` | technisch | 30 Tage | Standard behalten | Job `queue:prune-failed` | ⚠ | +| Testberichte des Prozess-Testers | `process_test_runs` | technisch (nur synthetische Daten, Konfiguration, Benutzer-ID) | **30 Tage** (Entscheidung O3, 04.11.2026) | `AnonymizeGuests` löscht nach `fewo.retention.process_test_run_days` | – | ✅ | +| Laufverzeichnisse des Prozess-Testers | `storage/app/sandbox/runs` | technisch (synthetisch) | Ende des Laufs | gelöscht nach jedem Lauf, Reste nach 1 h beim nächsten Lauf | – | ✅ | | Datenbank-Backups | Strato/eigen | technisch | z. B. 30 Tage rollierend ⚖ | ❓ nicht belegt | dokumentieren; Restore-Test; Löschung aus Backups via Frist | ❓ | ## 3. Löschmechanik (Soll) diff --git a/docs/Prozessarchitektur/Abnahme/ARCHITEKTUR_MODULAR_ABNAHME.md b/docs/Prozessarchitektur/Abnahme/ARCHITEKTUR_MODULAR_ABNAHME.md new file mode 100644 index 0000000..59d8551 --- /dev/null +++ b/docs/Prozessarchitektur/Abnahme/ARCHITEKTUR_MODULAR_ABNAHME.md @@ -0,0 +1,58 @@ +# Abnahmeprotokoll: Modulare Prozessarchitektur V2 (Kanalkonfigurator und Prozess-Tester) + +Stand: 04.11.2026 · Umsetzung `feature/prozessarchitektur-v2` · Testsystem https://www.stommer.info + +Teil A ist die technische Abnahme. Sie wurde vor der Bereitstellung durchgeführt, die Ergebnisse stehen im [Abschlussbericht](../Implementierungsstände/ABSCHLUSSBERICHT_PROZESSARCHITEKTUR_V2.md). Teil B ist das Drehbuch für die fachliche Abnahme durch den Betreiber. Konfigurator und Tester werden gemeinsam abgenommen. + +--- + +## Teil A – Technische Abnahme (automatisiert) + +| Kriterium | Nachweis (Testklasse) | +|---|---| +| N1 A1-Bestand | `BehaviourComparisonTest` (a1_*), `ProcessCoreTest`, `EndToEndAcceptanceTest` | +| N2 A4-Bestand | `BehaviourComparisonTest` (a4_booking), `ChannelProcessConfiguratorTest` (K08), `EndToEndStayAcceptanceTest` (T20) | +| N3 Loyalty | `LoyaltyArchitectureProofTest`, `ProcessTesterTest::test_the_loyalty_variant_runs_in_the_tester_only` | +| N4 gemischter Kanal | `ChannelProcessConfiguratorTest::test_a_mixed_channel_…` | +| N5 optionaler Schritt aus | `ChannelProcessConfiguratorTest::test_a_switched_off_optional_step_…`, `ProcessRunnerTest` | +| N6 Prozess-Tester | `ProcessTesterTest`, `ProcessTesterSecurityTest` (15 Negativfälle), `SideEffectPathsTest` | +| N7 neue Portal-API | `ChannelEventContractTest::test_a_new_api_adapter_uses_the_same_intake` | +| K01–K10 | `ChannelProcessConfiguratorTest` | +| T1 Abhängigkeiten | `ProcessRunnerTest`, `ProcessCoreTest`, `LoyaltyArchitectureProofTest` | +| T2 Sicherheitsgrenzen | `ProcessTesterSecurityTest`, `SideEffectPathsTest`, `04` §3.1a | +| T3 historische Versionen | `ProcessCoreTest::test_a_finished_case_of_a_retired_version_stays_readable`, `process:check --cases` | +| Laufende/abgeschlossene Vorgänge | `OngoingCaseRegressionTest` (12 eingefrorene v0.11-Fälle) | +| Verhaltensvergleich alt/neu | `BehaviourComparisonTest` (11 Abläufe, 198 Konstellationen; Abweichungen nur I-004/I-005) | +| O3 Aufbewahrung | `ProcessTestRunRetentionTest` | +| O4 Aussetzen der Außenwirkungen | `PortalReportSuspendsAutomationTest` | +| O5 Abschluss nach finanzieller Klärung | `SettlementClarificationTest` | +| Kanalereignisse, Duplikate | `ChannelEventContractTest` | +| Bestehende Regression | gesamte Suite | + +--- + +## Teil B – Fachliche Abnahme durch den Betreiber (Drehbuch) + +**Schutz des Testsystems:** Für die Abnahme werden ausschließlich der Prozess-Tester (ohne Wirkung auf echte Daten) und synthetische Testvorgänge verwendet. Es werden keine echten Gäste angeschrieben, keine Portalbuchungen ausgelöst, keine Kalender verändert, keine bestehenden Buchungen umgeschrieben. Der Mandant steht im Testbetrieb (Mails nur an die Testadresse). + +Vorher und nachher: `bash scripts/deploy.sh staging artisan process:fingerprint` – die Prüfsummen `h_bookings`, `h_overrides` und `h_blocks` müssen gleich bleiben. Ausnahme ist eine bewusste Speicherung im Konfigurator; sie ändert nur `h_overrides`, und dann nur den betreffenden Kanal. + +| # | Schritt | Erwartung | Ergebnis / Notiz | +|---|---|---|---| +| B1 | Einrichtung › Kanäle › „Eigene Webseite“ › **Ablauf** | Frage „Wie wird eine Anfrage … abgewickelt?“. Wählbar: „Angebot mit Vorreservierung“ und „Unverbindliche Auskunft“. Schritte nach Phasen, Pflichtschritte mit Schloss. | | +| B2 | An einem Schritt einen Wert ändern, z. B. Haltefrist | „hier gesetzt“; die Vorschau zeigt den Ablauf sofort; „auf geerbten Wert zurücksetzen“ möglich | | +| B3 | „Bitte um eine Bewertung“ ausschalten | Schritt „aus“, in der Vorschau durchgestrichen mit „im Kanal abgeschaltet“ | | +| B4 | **Ablauf testen** → „Vollständige Anfrage bis zur Buchung“ → „Test starten“, dann mehrmals „Weiter“ | Bericht: Modell und Version, wirksame Einstellungen mit Herkunft, je Ereignis Schritte, Kalender, Preis, simulierte Mails (an tester@sandbox.invalid), übersprungene Schritte; „Bewertung“ übersprungen (Konfiguration) | | +| B5 (A1) | Szenario „Fehlende Anschrift, späte Antwort“ | Rückfrage beim Gast und Klärungsreservierung laufen nebeneinander; die Reservierung läuft ab, die Anfrage bleibt offen; nach der Antwort geht das Angebot; danach läuft die Angebotsfrist ab | | +| B6 (Loyalty) | Variante „Angebot mit Stammgastrabatt“ wählen, Szenario „Stammgast fragt an“ testen, dann **Speichern** versuchen | Im Bericht erscheint die Rabattzeile im Preis vor dem Angebot. Speichern wird abgewiesen („nur im Prozess-Tester verwendbar“). | | +| B7 (A2) | Kanal FeWo-direkt › Ablauf › Reiter „Anfragen“ | wählbar: „Portalanfrage mit Angebot“ / „… mit Auskunft“; Test „Anfrage über das Portal“ | | +| B8 (A4) | FeWo-direkt › Reiter „Feste Buchungen“ | nur „Portalbuchung, Inkasso beim Portal“ (O2). Bei „Anreise-Informationen“ lässt sich „Portal“ wählen, ohne das Modell zu wechseln. Test „Feste Buchung über das Portal“ zeigt: Buchungsmail zweimal → ein Vorgang; Zahlung „laut Portal“; Auszahlung offen | | +| B9 (Storno-Meldung) | Im selben Test „Portal meldet eine Stornierung“ anhaken | Aufgabe „Portal meldet Stornierung“, Buchung bleibt fest, automatische Nachrichten warten (O4) | | +| B10 (A3) | Kanal Destination Solution › Ablauf | nur „Portalbuchung, eigene Abwicklung“; Test „Feste Buchung über das Portal“ | | +| B11 (A5) | Nur über ein Portal mit Kanalprofil „Sonstiges Portal“ wählbar (für FeWo-direkt bewusst nicht) | Modell vorhanden, synthetisch getestet | | +| B12 (gemischter Kanal) | FeWo-direkt: beide Reiter verschiedene Modelle | Anfrage und Buchung desselben Kanals folgen verschiedenen Modellen | | +| B13 | Nach dem Speichern: laufende Vorgänge | Hinweis „laufende Vorgänge behalten ihren bisherigen Ablauf“; bestehende Vorgänge unverändert (`process:fingerprint`: `h_bookings` gleich) | | +| B14 (O5) | Ein abgereister Portalvorgang mit offener Auszahlung: „Kaufmännisch abschließen …“ | Ohne Klärungsart nicht möglich; „Als offene Forderung weiterführen“ legt eine Aufgabe an | nur mit synthetischem Vorgang | +| B15 | Bestandsfälle öffnen (abgeschlossene und laufende Vorgänge) | Ablauf, Preise und Fristen wie vorher | | + +**Freigabe:** ☐ Konfigurator betriebsfähig ☐ Prozess-Tester schadensfrei · Datum / Name: ____________ diff --git a/docs/Prozessarchitektur/Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md b/docs/Prozessarchitektur/Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md index 6f5b863..76eadd8 100644 --- a/docs/Prozessarchitektur/Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md +++ b/docs/Prozessarchitektur/Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md @@ -78,16 +78,16 @@ ## Verbleibende Risiken ## Entscheidungen -Entschieden sind E1–E9 sowie D4 und D6 (als Regel). D3 ist aus den Geschäftsregeln abgeleitet. Die Matrix mit Begründung, Komponenten, Auswirkung und Testnachweis steht in `06` §9.1. +Entschieden sind E1–E9, D3/D4/D6 sowie – mit dem Implementierungsauftrag vom 04.11.2026 – **O1–O5** (`06` §9.2): -**Tatsächlich noch offen** (`06` §9.2): +- **O1:** Vertragsdokumentation bleibt archetypbestimmend. +- **O2:** FeWo-direkt: Anfrage A2, Buchung zunächst nur A4; Destination Solutions A3; gesteuert über das Kanalprofil. +- **O3:** Testberichte 30 Tage, im Löschkonzept. +- **O4:** Zugeordnete Portal-Storno-/Änderungsmeldungen setzen betroffene automatische Außenwirkungen aus. +- **O5:** Abschluss bei Portal-Inkasso nur nach finanzieller Klärung. -| # | Frage | Empfehlung | -|---|---|---| -| O1 | Bleibt die Vertragsdokumentation archetypbestimmend (`Documents = Portal` ⇒ A5)? | ja | -| O2 | FeWo-direkt zusätzlich A5 oder A3? | zunächst nur A4 | -| O3 | Aufbewahrungsfrist der Testberichte im Löschkonzept | kurz, z. B. 30 Tage | -| O4 | Gemeldete Portal-Stornierung/-Änderung setzt automatische Außenwirkungen aus? | ja | -| O5 | Abschluss A4/A5 ohne erfassten Auszahlungseingang? | nur begründet, mit Protokoll | +Zusätzliche technische Anforderungen: **T1** harte/weiche Abhängigkeiten (`02` §7), **T2** tatsächliche Sicherheitsgrenzen des Testers (`04` §3), **T3** historische Modellversionen (`02` §5.3, `06` §10). -Vor Beginn (U-0): tatsächlichen Repository- und Testsystemstand prüfen, V1/V6 auf dem Server prüfen, Referenz-Snapshots erzeugen. +## Umsetzungsstand + +Umgesetzt auf `feature/prozessarchitektur-v2` (U-0 bis U-E), Abweichungen und Einschränkungen in `06` §10, Ergebnisse im Abschlussbericht (`../Implementierungsstände/ABSCHLUSSBERICHT_PROZESSARCHITEKTUR_V2.md`) und im Abnahmeprotokoll (`../Abnahme/ARCHITEKTUR_MODULAR_ABNAHME.md`). diff --git a/docs/Prozessarchitektur/Architektur/02_FACHMODUL_ARCHITEKTUR.md b/docs/Prozessarchitektur/Architektur/02_FACHMODUL_ARCHITEKTUR.md index e7ee7fd..0900263 100644 --- a/docs/Prozessarchitektur/Architektur/02_FACHMODUL_ARCHITEKTUR.md +++ b/docs/Prozessarchitektur/Architektur/02_FACHMODUL_ARCHITEKTUR.md @@ -294,7 +294,7 @@ ### 5.3 Versionierung und Schutz laufender Vorgänge (K3) Geld- und Fristwirkungen auf bereits **verbindliche** Vorgänge werden nicht durch Code korrigiert, sondern als Aufgabe für den Vermieter ausgewiesen. - **R5 – Kein Neuberechnen.** Kein Release berechnet Preise, Rabatte, Fristen oder Status bestehender Vorgänge neu, außer eine fachliche Action wird ausdrücklich ausgelöst. -- **R6 – Aufbewahrung alter Versionen.** Alte Modell- und Modulklassen bleiben, solange offene Vorgänge sie im Plan tragen. `process:check` meldet Versionen ohne offene Vorgänge; erst dann wird entfernt. +- **R6 – Aufbewahrung alter Versionen (T3, entschieden).** Eine Modellversion bleibt registriert, solange **irgendein** Vorgang – auch ein abgeschlossener – sie im Plan trägt; `process:check --cases` prüft das. Der Plan speichert zusätzlich die Bezeichnungen seiner Schritte. Wird ein Modul dennoch einmal entfernt, erscheint sein Schritt bei abgeschlossenen Vorgängen als „(frühere Fassung)“; eine fehlende Modellversion fällt beim Lesen auf die aktuelle Definition desselben Modells zurück (`ProcessPlan::isHistoric`). Alte Programmlogik muss nicht ausführbar bleiben; offene Vorgänge brauchen ihre Modulversion (oder eine als kompatibel erklärte, `config/process.php` › `compatible`). Es wird **nicht** verlangt, frühere Anwendungsversionen vollständig zu betreiben. Ältere Vorgänge werden sicher weitergeführt, weil @@ -384,6 +384,15 @@ ### 6.4 Was geändert wird und was unverändert bleibt ## 7. Ausführungslogik (K1) [Vorschlag] +### 7.0 Umsetzung T1 (entschieden) + +- **Harte Abhängigkeit** (`Dependency::hard`): Der Schritt läuft erst, wenn der andere `Done` ist. Ein nicht zutreffender oder (nur bei optionalen Schritten möglich) abgeschalteter Schritt erfüllt sie, weil seine Bedingung den Fall nicht betrifft. `blocksDependents` gibt es nicht: Die Kante entscheidet, nicht der wartende Schritt. +- **Weiche Abhängigkeit** (`Dependency::soft`): Sind beide in derselben Runde bereit, läuft die weiche Voraussetzung zuerst. Wartet oder scheitert sie, läuft der Schritt trotzdem. +- **Unabhängig:** keine Kante. **Bedingt:** `applies()`. +- **Neubewertung:** genau ein Schritt je Runde, danach wird der Vorgang neu gelesen. Eine Liste bereiter Schritte wird nie über eine Zustandsänderung weitergereicht. +- **Auslöser:** Die Module erklären, nach welchen Ereignissen sie bewertet werden (`triggers`). Der Runner berücksichtigt nur passende Module. +- Pflichttests: `ProcessRunnerTest` (u. a. Zustandsänderung während einer Runde), `ProcessCoreTest` (Klärungsreservierung parallel zur Datenbeschaffung, Adressprüfung mit Wartezustand), `LoyaltyArchitectureProofTest` (Preis nach Loyalty-Prüfung). + ### 7.1 Grundsatz: eine Wahrheit, abgeleitete Bereitschaft - **Zustand** jedes Schritts wird wie heute aus den Falldaten **abgeleitet**: Status, Versionen, Zeitstempel, `data_requests`, `case_facts`, `booking_tasks`. Der Runner speichert **keinen** Schrittzustand. Es gibt also keine zweite Wahrheit. diff --git a/docs/Prozessarchitektur/Architektur/04_PROZESS_TESTER.md b/docs/Prozessarchitektur/Architektur/04_PROZESS_TESTER.md index dde35f7..6b1d33d 100644 --- a/docs/Prozessarchitektur/Architektur/04_PROZESS_TESTER.md +++ b/docs/Prozessarchitektur/Architektur/04_PROZESS_TESTER.md @@ -75,6 +75,18 @@ ### 3.1 Bewertung des bisherigen Entwurfs **Korrektur:** Der Lauf findet in einer **eigenen Sandbox-Anfrage** statt. Diese wird von Anfang an im Sandbox-Modus gestartet. Die echte Datenbank ist in ihr **nicht konfiguriert**, und es gibt nichts wiederherzustellen, weil der PHP-Prozess der Anfrage endet. Laravel Octane oder ein anderer langlebiger Prozess wird nicht eingesetzt [Befund: `composer.json`]; jede Anfrage beginnt mit frischem Anwendungszustand. +### 3.1a Umsetzung T2 (entschieden): eigener Prozess, anwendungsseitige Isolation + +Umgesetzt ist die Sandbox nicht als eigene HTTP-Anfrage, sondern als **eigener PHP-Prozess** (`php artisan process:sandbox-run `). Die Admin-Anfrage startet ihn über die `Process`-Fassade mit der Umgebungsvariable `FEWO_SANDBOX_RUN`; `bootstrap/app.php` ruft dann `SandboxBootstrapper::configure` direkt nach dem Laden der Konfiguration auf. + +| Ebene | Was erreicht ist | Was nicht erreichbar ist (Shared Hosting) | +|---|---|---| +| Betriebssystem | eigener Prozess mit eigenem Speicher; Umgebungsvariablen für Datenbank, Mail, Dienste werden dem Kindprozess entzogen | kein eigener Systembenutzer, kein Netzwerk- oder Dateisystem-Sandboxing: der Prozess könnte mit nativem Code `shared/.env` lesen | +| Anwendung | Konfiguration ersetzt (nur `sandbox`, `array`, `sync`), Manager zeichnen Verstöße auf und werfen, Wächter auf jeder Sandbox-Verbindung, Netz nur mit Szenario-Antwort, eigener App-Schlüssel, `SystemSettings` werden nicht angewendet | – | +| Code | `SideEffectPathsTest` verbietet native Wege (PDO, Sockets, curl, `mail()`, Dateien per Pfad, Programme, `env()`) in `app/` | Code in `vendor/` wird nicht geprüft | + +**Voraussetzungen**, sonst ist der Tester gesperrt (keine Ausweichlösung): `pdo_sqlite`, Vorlage der Testdatenbank, erlaubtes `proc_open`, PHP-CLI (`FEWO_SANDBOX_PHP`, sonst `/opt/RZphp84/bin/php-cli`). Geprüft in der Anfrage, die den Lauf starten würde (`ProcessSandbox::requirements()`). + ### 3.2 Ablauf eines Testschritts ``` @@ -117,7 +129,7 @@ ### 3.3 Standardmäßig gesperrt: Konfiguration der Sandbox-Anfrage |---|---|---| | Datenbank | `database.connections` = **nur** `sandbox` (SQLite, Pfad `/db.sqlite`); `database.default = sandbox`; Redis-Konfiguration leer | `DB::connection('mysql')` → `InvalidArgumentException: Database connection [mysql] not configured` → Abbruch | | Zusätzlich | `beforeExecuting` auf `sandbox` prüft, dass der PDO-Dateipfad gleich `/db.sqlite` ist | `SandboxViolation` | -| Mail | `mail.mailers` = nur `array`; `mail.default = array`; `EnforceMailTestMode` bleibt aktiv (Sandbox-Mandant im Testbetrieb, Testadresse `tester@invalid`) | anderer Mailer → „not defined“ → Abbruch | +| Mail | `mail.mailers` = nur `array`; `mail.default = array`; `EnforceMailTestMode` bleibt aktiv (Sandbox-Mandant im Testbetrieb, Testadresse `tester@sandbox.invalid`) | anderer Mailer → „not defined“ → Abbruch | | HTTP | `Http::preventStrayRequests()`; `Http::fake` nur mit Szenario-Antworten (KI, iCal, künftige API, n8n-Webhook von `CreateChannelTasks`) | `StrayRequestException` → Abbruch | | IMAP | `MailboxReader` an `SandboxMailboxReader` gebunden (wirft); `config('fewo.mailbox')` leer | `SandboxViolation` | | Connectors | `ChannelRegistry` an Szenario-Connectors gebunden | unbekannter Connector → Abbruch | diff --git a/docs/Prozessarchitektur/Architektur/06_MIGRATIONS_UND_UMSETZUNGSPLAN.md b/docs/Prozessarchitektur/Architektur/06_MIGRATIONS_UND_UMSETZUNGSPLAN.md index 4c8ceaa..a8492e5 100644 --- a/docs/Prozessarchitektur/Architektur/06_MIGRATIONS_UND_UMSETZUNGSPLAN.md +++ b/docs/Prozessarchitektur/Architektur/06_MIGRATIONS_UND_UMSETZUNGSPLAN.md @@ -251,14 +251,38 @@ ### 9.1 Entscheidungsmatrix | K5 | eigene Sandbox-Anfrage, standardmäßig gesperrt | Umschalten in der Admin-Anfrage nicht sicher | `SandboxBootstrapper`, Sandbox-Manager | keine | `04` §7 | | K10 | Ereignisse als Ergänzung, Transporte unverändert | kleinster tragfähiger Ansatz | `ChannelEventHandler`, `PortalIntake` (2 Stellen) | keine | `TransportParityTest` | -### 9.2 Tatsächlich noch offen +### 9.2 Entscheidungen O1–O5 [Entschieden, Implementierungsauftrag 04.11.2026] -| # | Frage | Empfehlung | Nötig vor | +| # | Entscheidung | Umsetzung | Test | |---|---|---|---| -| **O1** | Bleibt die Vertragsdokumentation archetypbestimmend (`Documents = Portal` ⇒ A5, wie heute codiert)? | ja | U-C | -| **O2** | Lässt FeWo-direkt neben A4 auch A5 oder A3 zu? | zunächst nur A4 | U-C | -| **O3** | Aufbewahrungsfrist der Testberichte im Löschkonzept | kurz, z. B. 30 Tage; mit dem Löschkonzept bestätigen | U-D | -| **O4** | Setzt eine offene Portal-Storno-/Änderungsmeldung automatische Außenwirkungen aus? | ja (beabsichtigte Abweichung von v0.11) | U-A | -| **O5** | Kaufmännischer Abschluss A4/A5 ohne erfassten Auszahlungseingang? | nur als begründeter Abschluss mit Protokoll | U-C | +| **O1** | Die verbindliche Vertragsdokumentation bleibt archetypbestimmend (A3–A5 wie bisher). Ergänzende Unterlagen, Anreiseinformation, Kommunikation und lokale Aufgaben sind im Modell wählbar. | `Responsibilities` je Modell (`contract_documents` fest), `ConfigureChannelProcess` weist `documents = portal` in A4 ab | `ChannelProcessConfiguratorTest::test_arrival_information_can_go_to_the_portal_within_a4_without_changing_the_model` | +| **O2** | FeWo-direkt: Anfrage A2 (Angebot/Auskunft), feste Buchung zunächst nur A4. Destination Solutions: A3. Die Zulässigkeit steuert das Kanalprofil, nicht der Prozesskern. | `config/channels.php` › `portal_profiles`, Auswahl am Kanal (`settings.portal_profile`) | `test_only_admissible_models_per_channel_and_intake_are_offered` (auch: anderes Profil gibt weitere Modelle frei) | +| **O3** | Testberichte 30 Tage, im Löschkonzept, anpassbar | `fewo.retention.process_test_run_days` (Systemeinstellungen), Löschung in `AnonymizeGuests` | `ProcessTestRunRetentionTest` | +| **O4** | Betroffene automatische Außenwirkungen werden bei einer zugeordneten, offenen Portal-Storno-/Änderungsmeldung ausgesetzt; interne Prüfungen, Fristen, Konflikterkennung und Aufgaben laufen weiter; die Meldung ändert die Buchung nie. | `OutwardSuspension` (nur Aufgaben `PortalCancellationReported`/`PortalChangeReported`, die `PortalIntake` nur für sicher zugeordnete Vorgänge anlegt); Runner, `SendBookingReminders`, `RequestReviews` | `PortalReportSuspendsAutomationTest`, `ProcessRunnerTest::test_an_open_portal_report_suspends_outward_steps_only` | +| **O5** | Kaufmännischer Abschluss bei Portal-Inkasso nur nach finanzieller Klärung; eine Portalmeldung ist kein Nachweis; Freitext allein genügt nicht; die Forderung bleibt nachvollziehbar. | `CaseClosure::settle` verlangt bei offener/abweichender Auszahlung eine Klärungsart (Verrechnung, verbuchte Differenz, ausgebuchte Forderung). „Als offene Forderung weiterführen“ legt die Aufgabe `OpenClaim` an; der Vorgang bleibt dann kaufmännisch offen, der Aufenthalt kann abgeschlossen sein. | `SettlementClarificationTest` | -Technische Prüfungen statt Entscheidungen: V1 und V6 (U-0). +Technische Prüfungen statt Entscheidungen: V1 (U-0: `pdo_sqlite` im CLI vorhanden; im Web-PHP prüft der Tester zur Laufzeit) und V6 (nicht nötig, SQLite verfügbar). + +--- + +## 10. Umsetzungsstand und technische Detailentscheidungen (04.11.2026) + +Die Pakete U-0 bis U-E sind auf `feature/prozessarchitektur-v2` umgesetzt. Wo die Umsetzung vom Plan abweicht, steht hier die kleinste tragfähige Alternative mit Grund. + +| Thema | Plan | Umsetzung | Grund | +|---|---|---|---| +| Tester-Isolation (T2) | eigene Sandbox-**Anfrage** | eigener **Prozess** `php artisan process:sandbox-run `, gestartet über die `Process`-Fassade; die Konfiguration wird beim Laden ersetzt (`SandboxBootstrapper`) | Stärkere Trennung (eigener Speicher, eigene Umgebung), ohne zustandslose Token-Anfrage; im Testlauf identisch prüfbar. Ohne erlaubtes `proc_open` ist der Tester gesperrt. | +| Abhängigkeiten (T1) | `requires` + `blocksDependents` | `Dependency::hard()` / `Dependency::soft()` an der Kante; `blocksDependents` entfällt | Eine harte Voraussetzung kann so nicht durch eine Eigenschaft des wartenden Schritts aufgehoben werden. | +| Auslöser | vorhandene Stellen | wie geplant; die Module erklären ihre Auslöser (`triggers`), der Runner berücksichtigt nur passende Module | Jeder Aufrufer behält genau seinen v0.11-Umfang (Verhaltensvergleich gleich). | +| Preis-Erweiterungspunkt | 5 Aufrufer umstellen | nur `SendOffer::quoteFor` | Alle Preisfestlegungen vor Verbindlichkeit (Angebot, Auskunft, Wunsch, Vorschau) laufen schon über `quoteFor`. | +| Loyalty-Status | Fakt mit `FactSource::System` | aus den Aufenthalten abgeleitet (keine zweite Wahrheit), Nachweis im Schritt | Kein Eingriff in den gemeinsamen Fakteneingang nötig. | +| Historische Versionen (T3) | Versionen ohne offene Vorgänge melden/entfernen | **nie entfernen**, solange irgendein Vorgang (auch abgeschlossen) sie im Plan trägt (`process:check --cases`); der Plan speichert die Bezeichnungen seiner Schritte; ein nicht mehr registriertes Modul erscheint als „(frühere Fassung)“, eine fehlende Modellversion fällt beim Lesen auf die aktuelle Definition zurück | Abgeschlossene Vorgänge bleiben lesbar, ohne alte Programmlogik ausführbar halten zu müssen. | +| Kanalereignisse | `PortalIntake` an 2 Stellen | `PortalIntake` (Quelle `api`, Referenz, `reportToCase`) und `TakeOverExternalBooking` (Quelle `api` als Beleg) | Sonst hätte eine API-Buchung keinen Vorgang werden können. `SyncChannel` und `ProcessPortalMail` unverändert. | +| Release-Kennung | Datei vom Deploy-Skript | Name des Release-Verzeichnisses (`-`) | Das Deployment läuft über den PipelineManager (anderes Repository). | +| „So arbeite ich“ | dieselbe Schrittansicht | unverändert (Feldliste) | Bekannte Einschränkung; der Vermieterstandard wirkt weiter als Grundlage des Konfigurators. | + +**Bekannte Einschränkungen:** + +- Eine Buchung, die per API **und** per iCal eintrifft, wird ein Vorgang. Im Kalender stehen aber bis zur Klärung zwei Sperren nebeneinander, weil `SyncChannel` nur Mail-Sperren ersetzt. Das ist erst relevant, wenn ein echter API-Adapter kommt. +- Der Tester spielt eine Gast-Antwort per E-Mail als ausgewertete Angaben (`ContributeCaseFacts`, Quelle E-Mail) ein, nicht über Postfach und KI. +- Native PHP-Aufrufe am Framework vorbei sind nur statisch ausgeschlossen (`SideEffectPathsTest`). diff --git a/pipeline.toml b/pipeline.toml index 60dfe37..f1617d8 100644 --- a/pipeline.toml +++ b/pipeline.toml @@ -52,6 +52,7 @@ public = "public" backup = [["@php", "artisan", "backup:database", "--no-interaction"]] activate = [ ["@php", "artisan", "migrate", "--force", "--no-interaction"], + ["@php", "artisan", "process:sandbox-template", "--no-interaction"], ["@php", "artisan", "optimize", "--no-interaction"], ["@php", "artisan", "filament:optimize", "--no-interaction"], ] diff --git a/resources/views/filament/resources/channels/channel-process-test.blade.php b/resources/views/filament/resources/channels/channel-process-test.blade.php new file mode 100644 index 0000000..4564c5d --- /dev/null +++ b/resources/views/filament/resources/channels/channel-process-test.blade.php @@ -0,0 +1,103 @@ + + @php + $muted = 'color:#6b7280;font-size:.8rem'; + $input = 'border:1px solid rgba(128,128,128,.4);border-radius:.375rem;padding:.3rem .45rem;background:transparent'; + $card = 'border:1px solid rgba(128,128,128,.3);border-radius:.5rem;padding:.75rem 1rem;margin-bottom:.6rem'; + $requirements = $this->requirements(); + $scenarios = $this->scenarios(); + $run = $this->run(); + $report = $run?->report ?? []; + $stateColor = ['done' => '#15803d', 'external' => '#0369a1', 'open' => '#b45309', 'problem' => '#b91c1c', 'waiting' => '#6d28d9', 'later' => '#6b7280', 'not_applicable' => '#9ca3af']; + @endphp + + +

Der Test spielt einen ausgedachten Vorgang mit Ihrer aktuellen – auch noch nicht gespeicherten – Einstellung durch. Er nutzt dieselben Abläufe wie ein echter Vorgang, aber in einem eigenen, abgeschotteten Lauf: eigene Testdatenbank, keine echten Gäste, keine Mails an echte Empfänger, keine Portale, keine Kalender. Mails werden nur angezeigt. Links in den Mails sind nur Text.

+
+ + @if ($requirements !== []) + +
    + @foreach ($requirements as $requirement)
  • {{ $requirement }}
  • @endforeach +
+

Ohne diese Voraussetzungen lässt sich die Trennung von den echten Daten nicht sicher herstellen. Es gibt deshalb keinen Ausweichbetrieb.

+
+ @else + +

Ablauf: {{ app(\App\Process\ProcessCatalogue::class)->model($this->draft['model'])::label() }}{{ ($this->draft['variant'] ?? 'standard') !== 'standard' ? ' · Variante '.$this->draft['variant'] : '' }} · {{ $this->intake === 'booking' ? 'feste Buchungen' : 'Anfragen' }} über {{ $this->record->name }}

+
+ + @if ($class = $scenarios[$this->scenario] ?? null) + @foreach ($class::inputs() as $key => $definition) + + @endforeach + @endif +
+ @if ($class)

{{ $class::description() }}

@endif +
+ Test starten + @if ($run && count($report['timeline'] ?? []) < ($report['scenario']['available_events'] ?? 0) && blank($report['aborted'] ?? null)) + Weiter: nächstes Ereignis + @endif + Testlauf läuft … +
+
+ @endif + + @if ($run) + + @if (filled($report['aborted'] ?? null)) +

{{ $report['aborted'] }}

+ @foreach ($report['violations'] ?? [] as $violation)

{{ $violation['message'] ?? '' }}

@endforeach + @endif + @if ($plan = $report['plan'] ?? null) +

{{ $plan['label'] }} ({{ $plan['model'] }} Version {{ $plan['version'] }}{{ $plan['variant'] !== 'standard' ? ', Variante '.$plan['variant'] : '' }}) · Vorgangsart {{ $plan['case_type'] }}

+
Wirksame Einstellungen +
    + @foreach ($plan['configuration'] as $row)
  • {{ $row['question'] }}: {{ $row['value'] }} ({{ $row['source'] }})
  • @endforeach +
+
+ @endif + + @foreach ($report['timeline'] ?? [] as $index => $event) +
+
{{ $index + 1 }}. {{ $event['label'] }}{{ $event['at'] }} (simuliert)
+ @if ($event['error'])

Fehler: {{ $event['error'] }}

@endif + @isset($event['situation'])

{{ $event['status'] }} · {{ $event['situation'] }}

@endisset +
    + @foreach ($event['activities'] as $activity) +
  • {{ $activity['state'] }} – {{ $activity['label'] }}@if ($activity['detail']) · {{ $activity['detail'] }}@endif
  • + @endforeach +
+ @if (($event['skipped'] ?? []) !== []) +

Übersprungen: {{ collect($event['skipped'])->map(fn ($skipped) => $skipped['label'].' ('.$skipped['reason'].')')->implode(', ') }}

+ @endif + @if (isset($event['calendar'])) +

Kalender: {{ $event['calendar']['occupying'] ? 'Zeitraum belegt' : 'Zeitraum frei' }}{{ $event['calendar']['hold_until'] ? ', reserviert bis '.$event['calendar']['hold_until'] : '' }} · Preis: {{ $event['price']['total'] !== null ? \App\Support\Money::format($event['price']['total']) : 'noch offen' }}

+ @endif + @foreach ($event['mails'] as $mail) +
✉ simuliert: {{ $mail['subject'] }} an {{ $mail['to'] }}

{{ $mail['excerpt'] }}

+ @endforeach +
+ @endforeach + + @if ($result = $report['result'] ?? null) +

Ergebnis: {{ $result['status'] }} · {{ $result['situation'] }}@if ($result['next']) · nächster Schritt: {{ $result['next'] }}@endif

+ @endif +

Bericht Nr. {{ $run->id }} vom {{ $run->created_at->format('d.m.Y H:i') }} · wird nach {{ config('fewo.retention.process_test_run_days') }} Tagen gelöscht.

+
+ @endif +
diff --git a/resources/views/filament/resources/channels/channel-process.blade.php b/resources/views/filament/resources/channels/channel-process.blade.php index 41d2458..fee9bda 100644 --- a/resources/views/filament/resources/channels/channel-process.blade.php +++ b/resources/views/filament/resources/channels/channel-process.blade.php @@ -130,9 +130,8 @@ @endforeach

Gilt für neue Vorgänge. Laufende Vorgänge dieses Kanals ({{ $this->runningCases() }}) behalten ihren bisherigen Ablauf.

- @if (\Illuminate\Support\Facades\Route::has('filament.admin.resources.channels.test')) - Ablauf testen - @endif + Ablauf testen +

Spielt einen ausgedachten Vorgang mit genau dieser Einstellung durch – ohne Wirkung auf echte Daten.

diff --git a/tests/Feature/EndToEndStayAcceptanceTest.php b/tests/Feature/EndToEndStayAcceptanceTest.php index f8b8407..dc44f4f 100644 --- a/tests/Feature/EndToEndStayAcceptanceTest.php +++ b/tests/Feature/EndToEndStayAcceptanceTest.php @@ -430,9 +430,12 @@ public function test_t22_stay_closed_while_commercial_points_are_open(): void $portal->refresh(); $this->assertSame(BookingStatus::Completed, $portal->status); $this->assertNull($portal->settled_at, 'the 5,51 € difference is not settled by the system'); - Livewire::test(ViewBooking::class, ['record' => $portal->getRouteKey()])->callAction('settle', ['note' => 'Differenz 5,51 € laut FeWo-direkt Servicegebühr – akzeptiert']); + // Decision O5 (Architektur V2): a reason alone is not enough with portal collection – the kind of clarification is required. + Livewire::test(ViewBooking::class, ['record' => $portal->getRouteKey()])->callAction('settle', ['note' => 'Differenz 5,51 € laut FeWo-direkt Servicegebühr – akzeptiert'])->assertHasActionErrors(['clarification']); + $this->assertNull($portal->fresh()->settled_at); + Livewire::test(ViewBooking::class, ['record' => $portal->getRouteKey()])->callAction('settle', ['clarification' => 'difference_booked', 'note' => 'Differenz 5,51 € laut FeWo-direkt Servicegebühr – akzeptiert']); $portal->refresh(); - $this->assertSame(['Ingrid', 'Differenz 5,51 € laut FeWo-direkt Servicegebühr – akzeptiert'], [$portal->settled_by, $portal->settled_note]); + $this->assertSame(['Ingrid', 'Differenz geklärt und verbucht: Differenz 5,51 € laut FeWo-direkt Servicegebühr – akzeptiert'], [$portal->settled_by, $portal->settled_note]); } /** T24 – landlord, property, portal and case settings decide the whole run. */ diff --git a/tests/Feature/Process/ChannelEventContractTest.php b/tests/Feature/Process/ChannelEventContractTest.php new file mode 100644 index 0000000..787aa50 --- /dev/null +++ b/tests/Feature/Process/ChannelEventContractTest.php @@ -0,0 +1,181 @@ +travelTo(CarbonImmutable::parse('2026-10-22 10:00')); + $this->seed(PropertySeeder::class); + Mail::fake(); + $this->fewo = Channel::factory()->for(Property::sole())->create(['name' => 'FeWo-direkt', 'booking_model' => 'mixed', 'case_intake' => 'create', 'import_enabled' => false, + 'settings' => ['import_url' => 'https://www.fewo-direkt.de/icalendar/x.ics', 'email_senders' => 'fewo-direkt.de']]); + app(ConfigureChannelProcess::class)->handle($this->fewo, IntakeKind::Booking, ['model' => 'a4.portal_booking']); + $this->fewo->refresh(); + } + + public function test_an_api_booking_becomes_one_case_whatever_the_transport_and_order(): void + { + $first = $this->handle(new IncomingBooking($this->provenance('HA-API1'), CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'))); + $this->assertSame(IntakeOutcome::Create, $first->outcome, implode(' ', $first->reasons)); + $case = Booking::query()->sole(); + $this->assertSame(['a4.portal_booking', BookingStatus::Confirmed, 'HA-API1'], [$case->profile['plan']['model'], $case->status, $case->portal_reference]); + + // The same event again, then the booking mail of the same booking: still one case. + $this->assertSame(IntakeOutcome::Link, $this->handle(new IncomingBooking($this->provenance('HA-API1'), CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10')))->outcome); + app(ProcessPortalMail::class)->handle(new PortalMail('', 'noreply@fewo-direkt.de', 'Neue Buchung', "Anreise: 07.11.2026\nAbreise: 10.11.2026\nBuchungsnummer: HA-API1", CarbonImmutable::now())); + $this->assertSame(1, Booking::query()->count()); + } + + public function test_a_mail_first_and_the_api_event_afterwards_stay_one_case(): void + { + app(ProcessPortalMail::class)->handle(new PortalMail('', 'noreply@fewo-direkt.de', 'Neue Buchung', "Anreise: 14.11.2026\nAbreise: 18.11.2026\nBuchungsnummer: HA-API2", CarbonImmutable::now())); + $this->assertSame(1, Booking::query()->count()); + + $decision = $this->handle(new IncomingBooking($this->provenance('HA-API2'), CarbonImmutable::parse('2026-11-14'), CarbonImmutable::parse('2026-11-18'))); + + $this->assertSame(IntakeOutcome::Link, $decision->outcome); + $this->assertSame(1, Booking::query()->count()); + } + + public function test_an_api_booking_without_reference_or_with_another_reference_on_the_same_nights_is_clarified(): void + { + $this->assertSame(IntakeOutcome::Clarify, $this->handle(new IncomingBooking($this->provenance(null), CarbonImmutable::parse('2026-12-01'), CarbonImmutable::parse('2026-12-05')))->outcome); + $this->assertSame(0, Booking::query()->count()); + + $this->handle(new IncomingBooking($this->provenance('HA-A'), CarbonImmutable::parse('2026-12-10'), CarbonImmutable::parse('2026-12-14'))); + $this->assertSame(IntakeOutcome::Clarify, $this->handle(new IncomingBooking($this->provenance('HA-B'), CarbonImmutable::parse('2026-12-10'), CarbonImmutable::parse('2026-12-14')))->outcome); + $this->assertSame(1, Booking::query()->count()); + } + + public function test_a_cancellation_report_is_a_task_and_never_a_cancellation(): void + { + $case = $this->booking('HA-C'); + + $decision = $this->handle(new BookingCancelledByChannel($this->provenance('HA-C', 'evt-1'), 'vom Gast im Portal')); + $this->handle(new BookingCancelledByChannel($this->provenance('HA-C', 'evt-1'), 'vom Gast im Portal')); + + $case->refresh(); + $this->assertSame(IntakeOutcome::CancellationSignal, $decision->outcome); + $this->assertSame(BookingStatus::Confirmed, $case->status, 'the booking stays binding'); + $this->assertNull($case->cancelled_at); + $this->assertSame(1, BookingTask::query()->where('booking_id', $case->id)->where('kind', BookingTaskKind::PortalCancellationReported)->count(), 'one task, also when repeated'); + $this->assertFalse($case->payments()->where('kind', PaymentKind::Refund)->exists()); + $this->assertNotNull(OutwardSuspension::reason($case), 'O4: automatic messages wait'); + $this->assertTrue(Booking::query()->occupying()->whereKey($case->id)->exists(), 'the calendar stays blocked'); + + $this->assertSame(IntakeOutcome::Clarify, $this->handle(new BookingCancelledByChannel($this->provenance('UNBEKANNT', 'evt-2')))->outcome, 'an unassigned report stops nothing'); + } + + public function test_a_change_report_leaves_the_booking_as_it_is(): void + { + $case = $this->booking('HA-D'); + + $this->handle(new BookingChangedByChannel($this->provenance('HA-D', 'evt-3'), CarbonImmutable::parse('2026-11-08'), CarbonImmutable::parse('2026-11-12'), 3)); + + $case->refresh(); + $this->assertSame(['2026-11-07', '2026-11-10'], [$case->arrival->toDateString(), $case->departure->toDateString()]); + $this->assertTrue(BookingTask::query()->where('booking_id', $case->id)->where('kind', BookingTaskKind::PortalChangeReported)->exists()); + } + + public function test_portal_payments_and_payouts_are_only_stated_by_the_portal(): void + { + $case = $this->booking('HA-E'); + + $this->handle(new PaymentReported($this->provenance('HA-E', 'p1'), 39061, CarbonImmutable::parse('2026-10-22'))); + $this->handle(new PaymentReported($this->provenance('HA-E', 'p1'), 39061, CarbonImmutable::parse('2026-10-22'))); + $this->handle(new PayoutReported($this->provenance('HA-E', 'p2'), 89469, CarbonImmutable::parse('2026-11-12'), executed: true)); + + $case->refresh(); + $this->assertSame(1, $case->payments()->where('kind', PaymentKind::GuestViaPortal)->count(), 'recorded once, "laut Portal"'); + $this->assertSame(0, $case->payments()->whereIn('kind', [PaymentKind::Guest, PaymentKind::PortalPayout])->count(), 'never money on our account by a report'); + $this->assertTrue($case->events()->where('type', 'evidence')->exists(), 'the payout is evidence "laut Portal"'); + } + + public function test_only_portals_deliver_events(): void + { + $this->expectException(InvalidArgumentException::class); + $this->handle(new PaymentReported(new Provenance(Channel::websiteOf(Property::sole()), 'api', Provenance::AUTHENTICATED, 'X', 'e', CarbonImmutable::now()), 1, CarbonImmutable::now())); + } + + /** N7: a new portal interface needs only its adapter and its registry entry. */ + public function test_a_new_api_adapter_uses_the_same_intake(): void + { + config(['channels.connectors' => [...config('channels.connectors'), FakeApiConnector::class]]); + Http::fake(['api.portal.example/*' => Http::response(['bookings' => [['reference' => 'HA-N7', 'arrival' => '2026-11-21', 'departure' => '2026-11-24', 'guests' => 2, 'paid' => 10000, 'paid_on' => '2026-10-22']]])]); + $this->assertArrayHasKey('fake_api', app(ChannelRegistry::class)->connectors()); + + foreach (app(FakeApiConnector::class)->fetchEvents($this->fewo, null) as $event) { + $this->handle($event); + } + foreach (app(FakeApiConnector::class)->fetchEvents($this->fewo, null) as $event) { + $this->handle($event); + } + + $case = Booking::query()->sole(); + $this->assertSame(['HA-N7', 'a4.portal_booking'], [$case->portal_reference, $case->profile['plan']['model']]); + $this->assertSame(1, $case->payments()->where('kind', PaymentKind::GuestViaPortal)->count()); + } + + private function booking(string $reference): Booking + { + $this->handle(new IncomingBooking($this->provenance($reference), CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'))); + + return Booking::query()->where('portal_reference', $reference)->sole(); + } + + private function provenance(?string $reference, string $evidence = 'evt'): Provenance + { + return new Provenance($this->fewo, 'api', Provenance::AUTHENTICATED, $reference, $evidence.'-'.($reference ?? 'none'), CarbonImmutable::now()); + } + + private function handle(object $event): ?IntakeDecision + { + return app(ChannelEventHandler::class)->handle($event); + } +} diff --git a/tests/Feature/Process/ProcessTestRunRetentionTest.php b/tests/Feature/Process/ProcessTestRunRetentionTest.php new file mode 100644 index 0000000..29cf89b --- /dev/null +++ b/tests/Feature/Process/ProcessTestRunRetentionTest.php @@ -0,0 +1,46 @@ +travelTo(CarbonImmutable::parse('2026-10-23 10:00')); + $this->seed(PropertySeeder::class); + $channel = Channel::websiteOf(Property::sole()); + $user = User::factory()->create(); + $run = fn (): ProcessTestRun => ProcessTestRun::query()->create(['tenant_id' => $channel->tenant_id, 'channel_id' => $channel->id, 'user_id' => $user->id, 'intake' => 'inquiry', 'scenario' => 'complete_request', 'configuration' => [], 'inputs' => [], 'steps' => 1, 'report' => [], 'outcome' => ProcessTestRun::COMPLETED]); + + $old = $run(); + $this->travel(29)->days(); + $recent = $run(); + $this->travel(2)->days(); + + $this->assertSame(30, config('fewo.retention.process_test_run_days')); + $this->assertArrayHasKey('fewo.retention.process_test_run_days', SystemSettings::EDITABLE); + app(AnonymizeGuests::class)->handle(); + + $this->assertModelMissing($old); + $this->assertModelExists($recent); + } +} diff --git a/tests/Feature/Process/ProcessTesterSecurityTest.php b/tests/Feature/Process/ProcessTesterSecurityTest.php new file mode 100644 index 0000000..b334b80 --- /dev/null +++ b/tests/Feature/Process/ProcessTesterSecurityTest.php @@ -0,0 +1,192 @@ +travelTo(CarbonImmutable::parse('2026-10-23 10:00')); + $this->seed([PropertySeeder::class, SiteSeeder::class]); + Settings::tenant()->update(['test_recipient' => 'vermieter@example.org', 'mailbox_password' => 'geheim']); + $this->website = Channel::websiteOf(Property::sole()); + $this->user = User::factory()->create(); + ProcessTesterTest::template(); + + $this->operational = storage_path('framework/testing/operational-'.getmypid().'.sqlite'); + File::ensureDirectoryExists(dirname($this->operational)); + @unlink($this->operational); + $pdo = new PDO('sqlite:'.$this->operational); + $pdo->exec('create table probe (id integer primary key, value text)'); + $pdo->exec("insert into probe (value) values ('real')"); + $pdo = null; + } + + protected function tearDown(): void + { + @unlink($this->operational); + @unlink(base_path('sandbox-probe.txt')); + parent::tearDown(); + } + + /** + * @return array + */ + public static function forbidden(): array + { + return [ + 'N-DB1 other connection' => ['db_other_connection', 'database'], + 'N-DB3 new connection to the real file' => ['db_new_connection', 'database'], + 'N-DB3 sandbox redirected to the real file' => ['db_redirected_sandbox', 'database'], + 'N-NET1 network without scripted answer' => ['network', 'network'], + 'N-NET2 automation webhook' => ['webhook', 'network'], + 'N-IMAP mailbox' => ['imap', 'imap'], + 'N-MAIL other mailer' => ['mail_other_mailer', 'mail'], + 'N-FILE storage outside the run' => ['file_outside', 'file'], + 'N-CACHE other store' => ['cache_other_store', 'cache'], + ]; + } + + #[DataProvider('forbidden')] + public function test_a_forbidden_access_is_recorded_aborts_the_run_and_changes_nothing(string $case, string $kind): void + { + $before = hash_file('sha256', $this->operational); + + $run = $this->probe($case); + + $this->assertSame(ProcessTestRun::ABORTED, $run->outcome, json_encode($run->report)); + $this->assertSame($kind, $run->report['violations'][0]['kind'] ?? null, json_encode($run->report['violations'])); + $this->assertSame($before, hash_file('sha256', $this->operational), 'the operational database file is unchanged'); + $this->assertFileDoesNotExist(base_path('sandbox-probe.txt')); + $this->assertSame(0, Booking::query()->count()); + } + + /** N-DB2: the run's own database has no access to the operational tables at all. */ + public function test_the_runs_database_does_not_contain_the_operational_tables(): void + { + $before = hash_file('sha256', $this->operational); + + $run = $this->probe('db_operational_table'); + + $probe = collect($run->report['timeline'][0]['effects'] ?? [])->firstWhere('type', 'probe'); + $this->assertSame('QueryException', $probe['outcome'] ?? null); + $this->assertSame($before, hash_file('sha256', $this->operational)); + } + + /** No credentials, no real configuration, no real cases inside the run; its key is its own. */ + public function test_the_run_has_no_credentials_no_real_data_and_its_own_key(): void + { + Booking::factory()->for(Property::sole())->create(); + + $run = $this->probe('environment'); + + $probe = collect($run->report['timeline'][0]['effects'])->firstWhere('type', 'probe'); + $this->assertFalse($probe['db_password_env']); + $this->assertSame(['sandbox'], $probe['connections']); + $this->assertSame(['array'], $probe['mailers']); + $this->assertNull($probe['smtp_password']); + $this->assertTrue($probe['app_key_differs']); + $this->assertSame([0, 0], [$probe['bookings'], $probe['guests']], 'no real case or guest is copied'); + $snapshot = SandboxSnapshot::build($this->website, IntakeKind::Inquiry, ['model' => 'a1.offer']); + $this->assertArrayNotHasKey('bookings', $snapshot['tables']); + $this->assertNull($snapshot['tables']['tenants'][0]['mailbox_password']); + } + + /** N-SIGN: a link signed inside a run is worthless in the real application. */ + public function test_a_link_signed_in_a_run_is_invalid_outside(): void + { + $run = $this->probe('signed_link'); + + $url = collect($run->report['timeline'][0]['effects'])->firstWhere('type', 'probe')['url']; + $this->assertStringContainsString('signature=', $url); + $this->assertFalse(URL::hasValidSignature(Request::create($url))); + } + + /** N-TOKEN: the run command refuses to work outside a run the tester started. */ + public function test_the_run_command_refuses_outside_a_prepared_run(): void + { + $this->artisan('process:sandbox-run', ['run' => '00000000-0000-0000-0000-000000000000'])->assertFailed(); + } + + /** N-PAR: one run per landlord at a time. */ + public function test_a_second_run_of_the_same_landlord_waits(): void + { + $directory = storage_path('app/sandbox/slots'); + File::ensureDirectoryExists($directory); + $lock = fopen($directory.'/tenant-'.$this->website->tenant_id.'.lock', 'c'); + flock($lock, LOCK_EX | LOCK_NB); + + try { + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage('läuft bereits'); + $this->probe('none'); + } finally { + flock($lock, LOCK_UN); + fclose($lock); + } + } + + /** N-ABORT: the directory of an aborted run is removed by the next run. */ + public function test_leftovers_of_aborted_runs_are_removed(): void + { + $left = storage_path('app/sandbox/runs/11111111-1111-1111-1111-111111111111'); + File::ensureDirectoryExists($left); + touch($left, time() - 7200); + + $this->probe('none'); + + $this->assertDirectoryDoesNotExist($left); + } + + private function probe(string $case): ProcessTestRun + { + config(['fewo.sandbox.test_environment' => [ + 'FEWO_SANDBOX_PROBE' => HostileProbe::class, + 'FEWO_SANDBOX_PROBE_CASE' => $case, + 'FEWO_SANDBOX_PROBE_FILE' => $this->operational, + 'FEWO_SANDBOX_PROBE_PARENT_KEY' => (string) config('app.key'), + 'APP_ENV' => 'testing', + ]]); + + return app(ProcessSandbox::class)->run($this->website, IntakeKind::Inquiry, ['model' => 'a1.offer'], 'complete_request', ['arrival' => '2026-11-07', 'nights' => 3], 1, $this->user); + } +} diff --git a/tests/Feature/Process/ProcessTesterTest.php b/tests/Feature/Process/ProcessTesterTest.php new file mode 100644 index 0000000..ad27a59 --- /dev/null +++ b/tests/Feature/Process/ProcessTesterTest.php @@ -0,0 +1,186 @@ +travelTo(CarbonImmutable::parse('2026-10-23 10:00')); + $this->seed([PropertySeeder::class, SiteSeeder::class]); + $this->property = Property::sole(); + Content::save(['contract.terms' => '

Echte Bedingungen

', 'stay.cancellation' => '

Echtes Storno

']); + Settings::tenant()->update(['bank_iban' => 'DE02120300000000202051', 'test_recipient' => 'vermieter@example.org', 'process_defaults' => ['processing' => 'automatic', 'clarification_hold_auto_minutes' => 120, 'data_request_mode' => 'automatic']]); + $this->user = User::factory()->create(); + self::template(); + } + + public static function template(): void + { + $template = storage_path('app/sandbox/template.sqlite'); + $newest = max(array_map('filemtime', glob(database_path('migrations/*.php')))); + if (! is_file($template) || filemtime($template) < $newest) { + // A fresh process, as at deployment (the migrator binds the schema of the process that runs it). + Process::path(base_path())->timeout(120)->run([PHP_BINARY, 'artisan', 'process:sandbox-template'])->throw(); + } + } + + public function test_a_scenario_runs_isolated_with_the_real_business_logic_and_leaves_no_trace(): void + { + Mail::fake(); + $website = Channel::websiteOf($this->property); + + $run = app(ProcessSandbox::class)->run($website, IntakeKind::Inquiry, ['model' => 'a1.offer'], 'missing_address', ['arrival' => '2026-11-07', 'nights' => 3, 'guests' => 2], 3, $this->user); + + $report = $run->report; + $this->assertNull($report['aborted'] ?? null, json_encode($report)); + $this->assertSame(ProcessTestRun::COMPLETED, $run->outcome); + $this->assertCount(3, $report['timeline']); + $this->assertSame(['a1.offer', 1, 'A1'], [$report['plan']['model'], $report['plan']['version'], $report['plan']['case_type']]); + + // Same logic as the real case: data request and clarification hold, later the offer. + [$request, $expired, $answer] = $report['timeline']; + $this->assertStringContainsString('reserviert', $request['situation']); + $this->assertContains('tester@sandbox.invalid', array_column($request['mails'], 'to'), 'mails are simulated and go to the test address'); + $this->assertSame('Angebot gesendet', $answer['status']); + $this->assertStringContainsString('Angebot', implode(' ', array_column($answer['mails'], 'subject'))); + $this->assertSame([], $report['violations']); + + // Nothing reached the real data: no case, no mail. + $this->assertSame(0, Booking::query()->count()); + Mail::assertNothingSent(); + $this->assertDirectoryDoesNotExist(storage_path('app/sandbox/runs/'.$run->id)); + } + + public function test_a_run_with_the_same_snapshot_gives_the_same_report(): void + { + $website = Channel::websiteOf($this->property); + $inputs = ['arrival' => '2026-11-07', 'nights' => 3, 'guests' => 2]; + + $first = app(ProcessSandbox::class)->run($website, IntakeKind::Inquiry, ['model' => 'a1.offer'], 'complete_request', $inputs, 3, $this->user); + $second = app(ProcessSandbox::class)->run($website, IntakeKind::Inquiry, ['model' => 'a1.offer'], 'complete_request', $inputs, 3, $this->user); + + $strip = fn (array $report): array => array_map(fn (array $event): array => array_diff_key($event, ['effects' => true]), $report['timeline']); + $this->assertSame($strip($first->report), $strip($second->report)); + } + + public function test_the_loyalty_variant_runs_in_the_tester_only(): void + { + $website = Channel::websiteOf($this->property); + + $run = app(ProcessSandbox::class)->run($website, IntakeKind::Inquiry, ['model' => 'a1.offer', 'variant' => 'loyalty'], 'returning_guest', ['arrival' => '2026-11-07', 'nights' => 3, 'guests' => 2], 3, $this->user); + + $this->assertNull($run->report['aborted'] ?? null, json_encode($run->report)); + $this->assertSame('loyalty', $run->report['plan']['variant']); + $timeline = $run->report['timeline']; + $lines = array_column(end($timeline)['price']['lines'], 'label'); + $this->assertNotEmpty(array_filter($lines, fn (string $label): bool => str_starts_with($label, 'Stammgastrabatt')), 'the discount enters the price before it is fixed'); + $this->assertNull($website->fresh()->process_overrides['inquiry']['variant'] ?? null, 'nothing was saved'); + } + + /** S07/S08/S13: a portal booking by mail (twice), portal amounts and a cancellation report – A4 of FeWo-direkt */ + public function test_a_portal_booking_scenario_with_cancellation_report(): void + { + $fewo = Channel::factory()->for($this->property)->create(['name' => 'FeWo-direkt', 'booking_model' => 'mixed', 'status' => 'setup', 'is_active' => false, 'import_enabled' => false, 'settings' => ['import_url' => 'https://www.fewo-direkt.de/x.ics']]); + + $run = app(ProcessSandbox::class)->run($fewo, IntakeKind::Booking, ['model' => 'a4.portal_booking', 'settings' => ['guest_messages' => 'portal']], 'portal_booking', ['arrival' => '2026-11-14', 'nights' => 4, 'guests' => 2, 'portal_total' => 980, 'cancellation' => true], 6, $this->user); + + $report = $run->report; + $this->assertNull($report['aborted'] ?? null, json_encode($report)); + $this->assertSame(['a4.portal_booking', 'A4'], [$report['plan']['model'], $report['plan']['case_type']]); + [$mail, $repeated, , $amounts, $cancellation] = $report['timeline']; + $this->assertSame('Bestätigt', $mail['status'] ?? null, json_encode($mail)); + $this->assertSame($mail['situation'], $repeated['situation'], 'the same mail twice: one case'); + $this->assertStringContainsString('laut Portal', implode(' ', array_column($amounts['activities'], 'detail'))); + $this->assertContains('Das Portal meldet eine Stornierung – bitte prüfen', array_column($cancellation['activities'], 'label')); + $this->assertSame('Bestätigt', $cancellation['status'], 'the report never cancels'); + $this->assertSame(0, Booking::query()->count()); + $this->assertFalse((bool) $fewo->fresh()->is_active, 'the real channel is unchanged'); + } + + /** S12/T06: a failing mail server leaves the case in a defined state */ + public function test_a_mail_failure_keeps_the_case(): void + { + $run = app(ProcessSandbox::class)->run(Channel::websiteOf($this->property), IntakeKind::Inquiry, ['model' => 'a1.offer'], 'mail_failure', ['arrival' => '2026-11-07', 'nights' => 3, 'guests' => 2], 2, $this->user); + + $request = $run->report['timeline'][1]; + $this->assertNull($run->report['aborted'] ?? null); + // v0.11 behaviour: the offer is saved even if its mail fails (SendOffer reports it); nothing went out. + $this->assertSame('Angebot gesendet', $request['status'], 'the case is kept'); + $this->assertSame([], $request['mails'], 'no mail went out'); + } + + /** T01/T02: from the configurator with the unsaved draft, step by step, with a readable report */ + public function test_the_landlord_tests_the_unsaved_draft_step_by_step(): void + { + $this->actingAs($this->user); + $website = Channel::websiteOf($this->property); + + $configurator = Livewire::test(ChannelProcess::class, ['record' => $website->getRouteKey()]) + ->call('toggleStep', 'review.request') + ->call('test'); + $configurator->assertRedirect(); + $this->assertFalse(session('process-tester.draft.'.$website->id.'.inquiry')['steps']['review.request']['on']); + + Livewire::test(ChannelProcessTest::class, ['record' => $website->getRouteKey()]) + ->assertSee('Vollständige Anfrage bis zur Buchung') + ->set('inputs.arrival', '2026-11-07') + ->call('start') + ->assertSee('Bericht') + ->assertSee('Gast fragt mit allen Angaben an') + ->assertSee('simuliert') + ->call('next') + ->assertSee('Sie senden das Angebot'); + $this->assertNull($website->fresh()->process_overrides['inquiry']['steps'] ?? null, 'the draft was never saved'); + $this->assertSame(2, ProcessTestRun::query()->count()); + } + + public function test_without_the_isolation_the_tester_is_locked(): void + { + $this->actingAs($this->user); + $template = storage_path('app/sandbox/template.sqlite'); + rename($template, $template.'.off'); + + try { + Livewire::test(ChannelProcessTest::class, ['record' => Channel::websiteOf($this->property)->getRouteKey()]) + ->assertSee('auf diesem Server gesperrt') + ->assertDontSee('Test starten'); + } finally { + rename($template.'.off', $template); + } + } +} diff --git a/tests/Feature/Process/SettlementClarificationTest.php b/tests/Feature/Process/SettlementClarificationTest.php new file mode 100644 index 0000000..8b396eb --- /dev/null +++ b/tests/Feature/Process/SettlementClarificationTest.php @@ -0,0 +1,78 @@ +travelTo(CarbonImmutable::parse('2026-10-22 10:00')); + $this->seed(PropertySeeder::class); + Mail::fake(); + $portal = Channel::factory()->for(Property::sole())->create(['name' => 'FeWo-direkt', 'booking_model' => 'portal_booking', 'process_overrides' => ['booking' => ['payments' => 'portal']]]); + $this->booking = Booking::factory()->for(Property::sole())->create(['status' => BookingStatus::Completed, 'intake' => 'booking', 'import_channel_id' => $portal->id, 'origin_channel_id' => $portal->id, + 'arrival' => '2026-10-10', 'departure' => '2026-10-17', 'total' => 97951, 'completed_at' => now()]); + app(RecordPortalAmounts::class)->handle($this->booking->fresh(), null, [['kind' => 'payout_announced', 'amount' => 89469]], [], 'FeWo-direkt'); + } + + public function test_a_reason_alone_does_not_settle_an_open_payout(): void + { + $this->expectException(ReservationException::class); + CaseClosure::settle($this->booking->fresh(), 'Portal hat ausgezahlt', 'Lars'); + } + + public function test_an_open_claim_stays_traceable_and_the_case_stays_commercially_open(): void + { + CaseClosure::settle($this->booking->fresh(), 'Auszahlung fehlt, beim Portal nachgefragt', 'Lars', CaseClosure::CLAIM_OPEN); + + $this->assertNull($this->booking->fresh()->settled_at); + $this->assertTrue(BookingTask::query()->where('booking_id', $this->booking->id)->where('kind', BookingTaskKind::OpenClaim)->where('status', BookingTaskStatus::Open)->exists()); + } + + public function test_a_written_off_claim_settles_with_its_clarification_on_record(): void + { + CaseClosure::settle($this->booking->fresh(), 'Kulanz, Betrag ausgebucht', 'Lars', 'written_off'); + + $booking = $this->booking->fresh(); + $this->assertNotNull($booking->settled_at); + $this->assertSame('Forderung ausgebucht: Kulanz, Betrag ausgebucht', $booking->settled_note); + } + + public function test_the_received_payout_settles_by_itself(): void + { + app(RecordPayment::class)->handle($this->booking->fresh(), 89469, CarbonImmutable::today(), kind: PaymentKind::PortalPayout, source: 'FeWo-direkt'); + + $this->assertNotNull($this->booking->fresh()->settled_at); + } +} diff --git a/tests/Feature/Process/SideEffectPathsTest.php b/tests/Feature/Process/SideEffectPathsTest.php new file mode 100644 index 0000000..dfdd4d7 --- /dev/null +++ b/tests/Feature/Process/SideEffectPathsTest.php @@ -0,0 +1,63 @@ + what it is). */ + private const FORBIDDEN = [ + '/new\s+\\\\?PDO\b/' => 'own database connection', + '/->getPdo\(/' => 'raw database handle', + '/\b(fsockopen|pfsockopen|stream_socket_client|socket_create)\s*\(/' => 'socket', + '/\bcurl_[a-z_]+\s*\(/' => 'curl', + '/(?:$])(? 'mail()', + '/(?:$])(? 'file by path', + '/(?:])(exec|shell_exec|passthru|system|popen|proc_open)\s*\(/' => 'program', + '/(?:$])env\s*\(/' => 'environment outside config/', + '/\bgetenv\s*\(/' => 'environment outside config/', + ]; + + /** Files allowed to use a forbidden call, with the reason. */ + private const ALLOWED = [ + 'Console/Commands/BackupDatabase.php' => 'backup of the real database; console only, never reachable in a tester run (no scheduler there)', + 'Console/Commands/ProcessCheck.php' => 'writes MODULMATRIX.md (developer command)', + 'Console/Commands/ProcessSandboxRun.php' => 'writes the report into the run directory', + 'Console/Commands/ProcessSandboxTemplate.php' => 'builds the template file', + 'Filament/Resources/Guests/Pages/ListGuests.php' => 'CSV download to php://output', + 'Process/Tester/EffectLedger.php' => 'appends to the run ledger', + 'Process/Tester/ProcessSandbox.php' => 'slot locks and the check of proc_open', + 'Process/Tester/SandboxBootstrapper.php' => 'reads FEWO_SANDBOX_RUN and copies the template before the application starts', + 'Process/Tester/SandboxSnapshot.php' => 'none expected', + ]; + + public function test_no_native_way_around_the_framework_in_the_application(): void + { + $violations = []; + foreach (Finder::create()->files()->in(app_path())->name('*.php') as $file) { + $relative = str_replace('\\', '/', $file->getRelativePathname()); + if (array_key_exists($relative, self::ALLOWED)) { + continue; + } + $code = (string) preg_replace('~//[^\n]*|/\*.*?\*/~s', '', $file->getContents()); + foreach (self::FORBIDDEN as $pattern => $what) { + if (preg_match($pattern, $code, $match) === 1) { + $violations[] = "{$relative}: {$what} ({$match[0]})"; + } + } + } + + $this->assertSame([], $violations, 'Native calls bypass the process tester\'s isolation – use Laravel facades (DB, Http, Mail, Storage, Process).'); + } +} diff --git a/tests/Fixtures/process/intended.md b/tests/Fixtures/process/intended.md index eb43011..2d1d138 100644 --- a/tests/Fixtures/process/intended.md +++ b/tests/Fixtures/process/intended.md @@ -4,9 +4,12 @@ # Beabsichtigte Abweichungen von der v0.11-Referenz | # | Abweichung | Begründung | Test | betroffene Referenzen | |---|---|---|---|---| -| I-001 | Ereignistypen der Schrittdetails kommen aus der Moduldefinition statt aus `ActivityDetails::EVENT_TYPES` | eine Quelle (Architektur `02` §7.7) | `ActivityDetailsTest` unverändert grün | keine (gleiches Ergebnis) | +| I-001 | ~~Ereignistypen aus der Moduldefinition~~ – **entfällt**: `ActivityDetails::EVENT_TYPES` bleibt; die Moduldefinition nennt die Typen zusätzlich für Konfigurator und Analyse | – | – | – | | I-002 | Offene, einem Vorgang zugeordnete Portalmeldung (Storno/Änderung) setzt automatische **Außenwirkungen** aus: Unterlagen, Erinnerungen, Anreiseinformation | Entscheidung O4 | `PortalReportSuspendsAutomationTest` | `portal_mail_cancellation` (nur wenn Außenwirkungen anstanden) | | I-003 | ~~Zeit-Actions rufen danach `advance`~~ – **entfällt**: `bookings:auto-offers` bewertet offene Anfragen alle 5 Minuten über den Runner neu; `ExpireReservations` und `handOver` machen keinen Schritt bereit | – | – | – | | I-004 | Angebotsschritt bei belegtem Zeitraum = `problem`, ohne Senden-Aktion | Fehler F-001 | `BehaviourComparisonTest` (`a1_dates_taken`, neu aufgenommen) | `a1_dates_taken.answer_dates_taken` | | I-005 | Detail des Angebotsschritts zeigt den tatsächlichen Reservierungszustand | Fehler F-002 | `BehaviourComparisonTest` (`a1_dates_taken`), `OngoingCaseRegressionTest` (`legacy_migration_offer`) | `a1_dates_taken.answer_dates_taken`; Bestandsfall `legacy_migration_offer` | | I-006 | Technischer Fehler eines automatischen Schritts: einheitlicher Text „Technischer Fehler beim automatischen Weiterbearbeiten – bitte von Hand fortsetzen.“ je Schritt (vorher je Aufrufer eigener Text); `CreateReservation` behält seinen Text, wenn der Runner selbst scheitert | ein Ablaufkern | `ProcessRunnerTest::test_a_failing_step_is_reported_and_independent_steps_go_on` | keine (kein Fehlerfall in der Referenz) | +| I-007 | Kaufmännischer Abschluss bei Portal-Inkasso mit offener oder abweichender Auszahlung nur mit Klärungsart (Verrechnung, verbuchte Differenz, ausgebuchte Forderung) oder Überführung in eine offene Forderung; eine Begründung allein genügt nicht | Entscheidung O5 | `SettlementClarificationTest`; angepasst: `EndToEndStayAcceptanceTest::test_t22_…` (Klärungsart „Differenz geklärt und verbucht“, Notiz mit Präfix) | keine Referenzdatei | +| I-008 | Die Prozesseinstellungen eines Kanals stehen nicht mehr als flache Liste im Kanalformular, sondern unter Kanal › Ablauf am Schritt | Anforderung U-C | `ChannelProcessConfiguratorTest`; angepasst: `ChannelManagerTest::test_the_channel_manager_lists_the_website_and_saves_its_settings` | keine | + diff --git a/tests/Support/Process/FakeApiConnector.php b/tests/Support/Process/FakeApiConnector.php new file mode 100644 index 0000000..4abc68d --- /dev/null +++ b/tests/Support/Process/FakeApiConnector.php @@ -0,0 +1,58 @@ +json('bookings', []) as $row) { + $provenance = new Provenance($channel, 'api', Provenance::AUTHENTICATED, (string) $row['reference'], 'fake-api:'.$row['reference'], CarbonImmutable::now()); + $events[] = new IncomingBooking($provenance, CarbonImmutable::parse($row['arrival']), CarbonImmutable::parse($row['departure']), $row['guests'] ?? null); + if (isset($row['paid'])) { + $events[] = new PaymentReported($provenance, (int) $row['paid'], CarbonImmutable::parse($row['paid_on'])); + } + } + + return $events; + } +} diff --git a/tests/Support/Process/HostileProbe.php b/tests/Support/Process/HostileProbe.php new file mode 100644 index 0000000..d32994f --- /dev/null +++ b/tests/Support/Process/HostileProbe.php @@ -0,0 +1,66 @@ + DB::connection('mysql')->select('select 1'), + 'db_new_connection' => (function () use ($operational): void { + config(['database.connections.evil' => ['driver' => 'sqlite', 'database' => $operational, 'prefix' => '']]); + DB::connection('evil')->insert('insert into probe (value) values (?)', ['evil']); + })(), + 'db_redirected_sandbox' => (function () use ($operational): void { + config(['database.connections.sandbox.database' => $operational]); + DB::purge('sandbox'); + DB::connection('sandbox')->insert('insert into probe (value) values (?)', ['evil']); + })(), + 'db_operational_table' => DB::table('probe')->insert(['value' => 'evil']), + 'network' => Http::get('https://example.org/'), + 'webhook' => Http::withHeaders(['X-Signature' => 'x'])->post('https://n8n.example/webhook/channel-task', ['task' => 1]), + 'imap' => app(MailboxReader::class)->fetchAll(), + 'mail_other_mailer' => Mail::mailer('smtp')->raw('Test', fn ($message) => $message->to('someone@example.org')), + 'file_outside' => Storage::build(['driver' => 'local', 'root' => base_path()])->put('sandbox-probe.txt', 'evil'), + 'cache_other_store' => Cache::store('database')->put('probe', 'evil'), + 'signed_link' => EffectLedger::record('probe', ['url' => URL::temporarySignedRoute('offers.show', now()->addDay(), ['booking' => 1, 'v' => 1])]), + 'environment' => EffectLedger::record('probe', [ + 'db_password_env' => getenv('DB_PASSWORD'), + 'connections' => array_keys((array) config('database.connections')), + 'mailers' => array_keys((array) config('mail.mailers')), + 'smtp_password' => config('mail.mailers.smtp.password'), + 'app_key_differs' => config('app.key') !== getenv('FEWO_SANDBOX_PROBE_PARENT_KEY'), + 'bookings' => DB::table('bookings')->count(), + 'guests' => DB::table('guests')->count(), + ]), + default => null, + }; + EffectLedger::record('probe', ['case' => $case, 'outcome' => 'no exception']); + } catch (Throwable $exception) { + EffectLedger::record('probe', ['case' => $case, 'outcome' => class_basename($exception), 'message' => mb_substr($exception->getMessage(), 0, 200)]); + + throw $exception; + } + } +} From dba6292cd4df1f666d3b451048f100614ddfc1b5 Mon Sep 17 00:00:00 2001 From: Lars Date: Wed, 4 Nov 2026 15:41:24 +0100 Subject: [PATCH 9/9] =?UTF-8?q?Dokumentation=20V2:=20Entscheidungen=20O1?= =?UTF-8?q?=E2=80=93O5,=20T1=E2=80=93T3,=20Umsetzungsstand,=20Abschlussber?= =?UTF-8?q?icht,=20Abnahmeprotokoll,=20Betrieb,=20L=C3=B6schkonzept,=20Sta?= =?UTF-8?q?tus,=20Modulmatrix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- .../ABSCHLUSSBERICHT_PROZESSARCHITEKTUR_V2.md | 136 ++++++++++++++++++ docs/STATUS.md | 22 ++- 2 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 docs/Prozessarchitektur/Implementierungsstände/ABSCHLUSSBERICHT_PROZESSARCHITEKTUR_V2.md diff --git a/docs/Prozessarchitektur/Implementierungsstände/ABSCHLUSSBERICHT_PROZESSARCHITEKTUR_V2.md b/docs/Prozessarchitektur/Implementierungsstände/ABSCHLUSSBERICHT_PROZESSARCHITEKTUR_V2.md new file mode 100644 index 0000000..bdf75dd --- /dev/null +++ b/docs/Prozessarchitektur/Implementierungsstände/ABSCHLUSSBERICHT_PROZESSARCHITEKTUR_V2.md @@ -0,0 +1,136 @@ +# Abschlussbericht: Kontrolliert modulare Prozessarchitektur V2 + +Stand: 04.11.2026 · Grundlage: Architekturdokumente `docs/Prozessarchitektur/Architektur/00`–`06` (`750c1ed`), Implementierungsauftrag vom 04.11.2026 mit den Entscheidungen O1–O5 und den Anforderungen T1–T3. + +Dieser Bericht nennt nur Nachgewiesenes. Was nicht geprüft werden konnte, steht unter „Offen“. + +## 1. Repository und Bereitstellung + +| | | +|---|---| +| Umsetzungszweig | `feature/prozessarchitektur-v2` (von `feature/aufenthalt` @ `750c1ed`, Code-Stand = `develop` `7e4e208`) | +| Commits | `98df5e9` U-0 · `7e22e12` U-A/U-B · `d695566` Analysebefehle, O4 · `c255783` U-C · `0689c0a` U-D/U-E/O5 · Dokumentation (siehe Git-Historie) | +| Merge nach `develop`, Deployment | siehe §8 (wird nach dem Deployment ergänzt) | +| `main` | unverändert, kein Produktivdeployment | + +## 2. Implementierte Funktionen + +- **Prozesskern (U-A):** + - `ProcessRunner` mit harten und weichen Abhängigkeiten, Neubewertung nach jedem Schritt, Auslösern aus der Moduldefinition und Aussetzen nach O4. + - `CaseActivities` und `CaseAutomation` sind Fassaden darüber. + - Die Automatik von `CreateReservation`, `TakeOverExternalBooking`, `SubmitBookingWish` und `bookings:auto-offers` läuft über den Runner. +- **Fachmodule:** 25 registrierte Module (`config/process.php`, `MODULMATRIX.md`), davon 2 nur im Tester (Loyalty). Jedes hat eine `ModuleDefinition` als Vertrag. +- **Prozessmodelle:** `a1.offer` (Varianten `standard`, `loyalty` = nur Tester), `a1.information`, `a2.offer`, `a2.information`, `a3`/`a4`/`a5.portal_booking`, `a6.internal`, jeweils Version 1. Jedes mit Erweiterungspunkten, festen und variablen Verantwortungen und festgelegten Einstellungen. +- **Prozessplan:** + - wird beim Eingang in `bookings.profile.plan` eingefroren (Modell, Version, Variante, Modulversionen, Schritteinstellungen, Bezeichnungen); + - Bestandsfälle ohne Plan erhalten beim Lesen den abgeleiteten Plan (keine Datenänderung). +- **Preis-Erweiterungspunkt (U-B):** `CasePricing` in `SendOffer::quoteFor`. Ohne Beiträge ist das Ergebnis gleich `PriceCalculator`; für verbindliche Fälle gibt es nie Beiträge. +- **Loyalty-Nachweis (U-B):** `guest.loyalty_status` und `pricing.loyalty_discount`. Für echte Vorgänge technisch nicht aktivierbar (Konfigurator und Plan weisen ab). +- **Kanalkonfigurator (U-C):** Kanal › Ablauf. Je Eingangsart werden die zulässigen Modelle nach Kanalprofil angeboten (O2). Die Schritte stehen nach Phasen, mit: + - Schalter (nur optionale Schritte); + - Ausführungsart; + - Ausführenden im Rahmen des Modells; + - Fristen mit Herkunft „hier gesetzt / geerbt“ und Zurücksetzen; + - Vorschau und „Ablauf testen“ mit dem ungespeicherten Entwurf. + + Gespeichert wird über `ConfigureChannelProcess`. Die flache Liste im Kanalformular entfällt. +- **Prozess-Tester (U-D):** Szenarien + - vollständige Anfrage; + - fehlende Anschrift mit später Antwort (Link oder E-Mail); + - Portalanfrage; + - Stammgast; + - Mailausfall; + - Portalbuchung mit Duplikat, Beträgen und Storno-Meldung. + + Die Szenarien laufen schrittweise in einem eigenen PHP-Prozess. Der Bericht wird gespeichert und nach 30 Tagen gelöscht. +- **Kanalereignisse (U-E):** `IncomingBooking`, `BookingCancelledByChannel`, `BookingChangedByChannel`, `PaymentReported`, `PayoutReported` mit `Provenance`, dazu `ChannelEventHandler` und die Schnittstellen `DeliversEvents`/`ReceivesWebhooks`. iCal und Mail bleiben unverändert. +- **Entscheidungen:** + - O1 und O2 über Verantwortungsmatrix und Kanalprofile; + - O3: Löschfrist 30 Tage; + - O4: `OutwardSuspension`; + - O5: Klärungsart beim kaufmännischen Abschluss. +- **Analyse:** + - `process:check` (Katalog; mit `--cases` die eingefrorenen Pläne aller Vorgänge; `--matrix`), läuft in der CI; + - `process:impact `; + - `process:fingerprint` (Prüfsummen vor/nach Deployment). + +## 3. Geänderte bestehende Anwendungskomponenten + +| Datei | Änderung | +|---|---| +| `Process/CaseActivities`, `Process/CaseAutomation` | Fassaden über `ProcessRunner` (Ableitung in Module verschoben) | +| `Process/CaseRecorder` | friert den Plan mit ein | +| `Process/ProcessSettings`, `ProcessProfile` | Festlegungen des gewählten Modells (Herkunft „Ablaufmodell“) | +| `Process/CaseClosure` | O5: Klärungsart bei offener Portal-Auszahlung | +| `Actions/CreateReservation`, `TakeOverExternalBooking`, `SubmitBookingWish`, `Console/SendPendingAutoOffers` | Automatik über den Runner | +| `Actions/SendOffer` | Preis über `CasePricing` | +| `Actions/SendBookingReminders`, `RequestReviews` | O4; Bewertungsbitte je Kanal abschaltbar | +| `Actions/AnonymizeGuests`, `Support/SystemSettings`, `config/fewo.php` | Löschfrist Testberichte (O3), PHP-Programm des Testers | +| `Channels/Intake/PortalIntake`, `Actions/TakeOverExternalBooking`, `Models/IntakeObservation` | Quelle `api`, `reportToCase` | +| `Filament/.../ChannelResource`, `EditChannel`, `ChannelForm`, `HandlesWishAndStay`, `effective-settings` | Seiten Ablauf/Ablauf testen, Kanalprofil, Klärungsart | +| `Providers/AppServiceProvider`, `bootstrap/app.php` | Registerdienst; Sandbox-Bootstrap nur im Testprozess; keine Betreibereinstellungen im Testprozess | +| `config/channels.php` | Kanalprofile (O2) | +| `pipeline.toml` | `process:check` in der CI, `process:sandbox-template` nach `migrate` | + +Fachlogik der übrigen Actions, `PriceCalculator`, Fakteneingang, Datenbeschaffung, Posteingang/KI, Mail-Schranke, `SyncChannel`, `ProcessPortalMail`: unverändert. + +## 4. Migrationen + +Eine neue Tabelle `process_test_runs` (`2026_11_07_100000`). Keine Änderung bestehender Tabellen oder Daten. Bestandsvorgänge erhalten keinen Plan geschrieben; er wird beim Lesen abgeleitet. + +## 5. Testresultate (lokal, SQLite) + +| Lauf | Ergebnis | +|---|---| +| Ausgangsstand U-0 (`7e4e208` + Testwerkzeug) | 772 Tests, 771 grün; 1 im Gesamtlauf instabil (`TenantBrandRenderingTest`, einzeln grün; F-003) | +| nach U-A | 785/785 | +| nach U-C | 820/820 | +| nach U-D/U-E/O5 (Endstand vor dem Merge) | **856/856** (Laufzeit 6,3 min) | +| `process:check` | 25 Module, 8 Modelle, ohne Befund | +| `npm run build` | erfolgreich | + +**Verhaltensvergleich v0.11 → V2:** + +- 11 Abläufe mit 39 Ereignissen und 198 Zustandskonstellationen in acht Dimensionen sind gleich. +- Abweichungen gibt es nur bei I-004/I-005, den Korrekturen der Fehler F-001/F-002. +- 12 eingefrorene Bestandsfälle liefern gleiche Stornokosten, Fälligkeiten und Vertragstext-Hashes. Die einzige Abweichung ist I-005 im Detailtext. Die Automatik ändert keine Vertragsdaten. + +## 6. Sicherheitsnachweise des Prozess-Testers (T2) + +- **15 Negativtests** (`ProcessTesterSecurityTest`): + - andere Datenbankverbindung; + - neue Verbindung auf die Betriebsdatei; + - umgeleitete Sandbox-Verbindung; + - Betriebstabellen; + - Netz, Webhook, IMAP, fremder Mailer, Dateiablage außerhalb, fremder Cache; + - Umgebung und Zugangsdaten mit eigenem Schlüssel und ohne echte Vorgänge; + - signierter Link außerhalb ungültig; + - Laufbefehl ohne vorbereiteten Lauf; + - zweiter Lauf desselben Vermieters; + - Aufräumen abgebrochener Läufe. + + Jeder Verstoß wird aufgezeichnet und bricht den Lauf ab. Der Prüfsummenvergleich der „Betriebsdatenbank“ (eigene SQLite-Datei) ergibt jeweils keine Änderung. +- **Statischer Wächter** `SideEffectPathsTest`: keine nativen Netz-, Mail-, Datenbank-, Datei- oder Programmaufrufe und kein `env()` in `app/` außerhalb einer begründeten Positivliste. +- **Restrisiko:** Auf Shared Hosting gibt es keine Trennung auf Betriebssystemebene (`04` §3.1a, `BETRIEB.md` §7b). Nativer Code könnte `shared/.env` lesen; das verhindert nur der statische Wächter. + +## 7. Bekannte Einschränkungen + +Siehe `06` §10: + +- API- und iCal-Sperre derselben Buchung stehen bis zur Klärung nebeneinander (ein Vorgang). +- Die E-Mail-Antwort im Tester wird als ausgewertete Angaben eingespielt. +- „So arbeite ich“ ist noch nicht auf die Schrittansicht umgestellt. +- `ActivityDetails::EVENT_TYPES` bleibt als zweite Liste bestehen (I-001 entfällt). + +## 8. Bereitstellung auf stommer.info + +Wird nach Merge, Push und Deployment mit Revision, Migrationsstatus, Prüfsummen und den Ergebnissen der technischen Prüfung ergänzt. + +## 9. Offene Fehler, Risiken, Entscheidungen + +- **F-003:** instabiler Test `TenantBrandRenderingTest` (nicht prozessbezogen). +- **Risiko:** Ob `proc_open` im Web-PHP von Strato erlaubt ist, zeigt erst das Testsystem. Ist es gesperrt, bleibt der Tester gesperrt, und die Hosting-Voraussetzung ist ein Abnahmeblocker (T2). +- **Verbleibende fachliche Entscheidungen:** + - keine neuen aus der Umsetzung; + - für eine spätere produktive Loyalty: Berechtigung, Staffel, Kombination und Umbuchung (E5–E7); + - Freigabe weiterer Modelle für FeWo-direkt (O2) nach Klärung FW-01 bis FW-07. diff --git a/docs/STATUS.md b/docs/STATUS.md index 9561664..4ffc20e 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -1,6 +1,26 @@ # Projektstand -## Aktueller Stand (03.11.2026) +## Aktueller Stand (04.11.2026): Modulare Prozessarchitektur V2 + +**Umgesetzt auf `feature/prozessarchitektur-v2` (Pakete U-0 bis U-E, Entscheidungen O1–O5, Anforderungen T1–T3):** + +- **Prozesskern:** Fachmodule mit Verträgen, versionierte Prozessmodelle A1–A6 und ein beim Eingang eingefrorener Prozessplan. +- **Ablaufsteuerung:** `ProcessRunner` mit harten und weichen Abhängigkeiten. `CaseActivities` und `CaseAutomation` sind Fassaden darüber. +- **Kanalkonfigurator:** Kanal › Ablauf mit Modellwahl nach Kanalprofil, Einstellungen am Schritt und Vorschau. +- **Prozess-Tester:** „Ablauf testen“ läuft in einem eigenen, abgeschotteten PHP-Prozess. Ohne die Voraussetzungen auf dem Server ist er gesperrt. +- **Weitere Bausteine:** Kanalereignisse für künftige Portal-Schnittstellen sowie die Befehle `process:check`, `process:impact` und `process:fingerprint`. +- **O4:** Gemeldete Portal-Stornierungen und -Änderungen setzen automatische Nachrichten aus. +- **O5:** Kaufmännischer Abschluss bei Portal-Inkasso nur nach finanzieller Klärung. + +Dokumente: + +- [Abschlussbericht](Prozessarchitektur/Implementierungsstände/ABSCHLUSSBERICHT_PROZESSARCHITEKTUR_V2.md) +- [Abnahmeprotokoll und Drehbuch](Prozessarchitektur/Abnahme/ARCHITEKTUR_MODULAR_ABNAHME.md) +- [Architektur 00–06](Prozessarchitektur/Architektur/00_MANAGEMENT_ZUSAMMENFASSUNG.md), [Umsetzungsstand und Abweichungen](Prozessarchitektur/Architektur/06_MIGRATIONS_UND_UMSETZUNGSPLAN.md) +- [Bestandsaufnahme U-0](Prozessarchitektur/Implementierungsstände/U0_BESTANDSAUFNAHME_PROZESSARCHITEKTUR_V2.md) +- Betrieb: `BETRIEB.md` §7b + +## Stand (03.11.2026) **Prozessarchitektur v0.11: integrierter MVP umgesetzt (Pakete U1–U6), automatisiert getestet, noch nicht auf dem Testsystem.**