V2.1: Kanalfähigkeiten, Ausführungsvarianten, Dokumentenentkopplung, Portalbestätigung
Modellwahl über Kanalfähigkeiten mit erklärten Einschränkungen, Abgleich alter Werte, Ausführungsvarianten je Modul, getrennte Vertrags-/Buchungsinformation, Warten auf die Portalbestätigung mit Eskalation und Wiederaufnahme (Fälle C und D getestet). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ef1635e59a
commit
8442d0a3d8
62 files changed
+1818
-69
No files matched your search
@@ -3,6 +3,7 @@
|
||||
namespace App\Process\Modules\Intake;
|
||||
|
||||
use App\Availability\AvailabilityChecker;
|
||||
use App\Enums\Execution;
|
||||
use App\Process\CaseContext;
|
||||
use App\Process\Modules\Module;
|
||||
use App\Process\Modules\ModuleDefinition;
|
||||
@@ -25,6 +26,9 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Verfügbarkeit',
|
||||
purpose: 'Prüft, ob der Zeitraum frei ist und die Kalender der Portale aktuell sind.',
|
||||
phase: 'P01',
|
||||
executions: [Execution::Automatic],
|
||||
condition: 'bei jeder Anfrage vor Angebot oder Bestätigung',
|
||||
why: 'Doppelbuchungen sind nicht zu verantworten (E-027); die Verfügbarkeit wird immer geprüft.',
|
||||
effects: ['network'],
|
||||
triggers: ['intake', 'facts.applied'],
|
||||
);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\ChannelTaskStatus;
|
||||
use App\Enums\Execution;
|
||||
use App\Filament\Resources\ChannelTasks\ChannelTaskResource;
|
||||
use App\Models\ChannelTask;
|
||||
use App\Process\Activity;
|
||||
@@ -29,6 +30,9 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Andere Kanäle sperren',
|
||||
purpose: 'Sperrt den Zeitraum in Portalen, die nicht automatisch abgleichen, und gibt ihn bei Ende wieder frei – mit Nachweis je Portal.',
|
||||
phase: 'P02',
|
||||
executions: [Execution::Automatic, Execution::Manual],
|
||||
condition: 'sobald ein Vorgang den Zeitraum belegt',
|
||||
why: 'Die Belegung muss in anderen Portalen nachgezogen werden, sonst droht eine Doppelbuchung.',
|
||||
effects: ['channel_task', 'landlord_mail', 'network'],
|
||||
waits: ['landlord', 'portal'],
|
||||
triggers: ['booking.occupies', 'booking.released'],
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Actions\RequestCaseData;
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Models\DataRequest;
|
||||
use App\Process\Activity;
|
||||
@@ -34,6 +35,8 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Fehlende Angaben beim Gast anfragen',
|
||||
purpose: 'Fragt fehlende Pflichtangaben per Link beim Gast an, erinnert und übergibt an Sie, wenn der Gast nicht antwortet.',
|
||||
phase: 'P01',
|
||||
executions: [Execution::Automatic, Execution::Approval, Execution::Manual, Execution::NotRequired],
|
||||
condition: 'wenn Angaben für den nächsten Schritt fehlen und eine E-Mail-Adresse bekannt ist',
|
||||
requires: [Dependency::hard('intake.record')],
|
||||
effects: ['case_write', 'guest_mail'],
|
||||
waits: ['guest', 'landlord', 'time'],
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Process\Modules\Intake;
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Enums\Responsibility;
|
||||
use App\Models\DataRequest;
|
||||
@@ -30,6 +31,9 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Angaben des Gastes',
|
||||
purpose: 'Identifiziert den Gast, führt seine Angaben aus allen Quellen zusammen und prüft, ob alles für den nächsten Schritt da ist.',
|
||||
phase: 'P01',
|
||||
executions: [Execution::Automatic, Execution::Manual],
|
||||
condition: 'wenn wir selbst mit dem Gast schreiben (Anfrage, eigene Unterlagen, Nachrichten oder Zahlung)',
|
||||
why: 'Ohne die Angaben des Gastes entsteht kein eigenes Angebot und keine Unterlage (G2a).',
|
||||
requires: [Dependency::hard('intake.record')],
|
||||
effects: ['case_write'],
|
||||
waits: ['guest', 'landlord'],
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Process\Modules\Intake;
|
||||
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Models\Booking;
|
||||
use App\Process\CaseContext;
|
||||
@@ -29,6 +30,8 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Reservierung des Zeitraums',
|
||||
purpose: 'Hält den Zeitraum während der Klärung bzw. der Angebotsfrist frei und gibt ihn nach Ablauf wieder frei.',
|
||||
phase: 'P01',
|
||||
executions: [Execution::Automatic],
|
||||
condition: 'bei einer Anfrage, die den Zeitraum reservieren soll',
|
||||
requires: [Dependency::hard('intake.record')],
|
||||
effects: ['calendar_hold'],
|
||||
waits: ['time'],
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Process\Modules\Intake;
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\Execution;
|
||||
use App\Process\Activity;
|
||||
use App\Process\CaseContext;
|
||||
use App\Process\Modules\Module;
|
||||
@@ -25,6 +26,9 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Eingang',
|
||||
purpose: 'Hält den Eingang der Anfrage, Buchung oder Eigenbelegung fest und friert den Ablauf ein.',
|
||||
phase: 'P01',
|
||||
executions: [Execution::Automatic],
|
||||
condition: 'immer, sobald ein Vorgang entsteht',
|
||||
why: 'Ohne Eingang gibt es keinen Vorgang.',
|
||||
effects: ['case_write', 'calendar_hold'],
|
||||
triggers: ['intake'],
|
||||
events: ['created', 'intake', 'profile', 'hold', 'mode'],
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Process\Modules\Intake;
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\Execution;
|
||||
use App\Process\Activity;
|
||||
use App\Process\CaseContext;
|
||||
use App\Process\Modules\Dependency;
|
||||
@@ -27,6 +28,9 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Verbindlichkeit beim Portal',
|
||||
purpose: 'Stellt fest, dass die Buchung beim Portal verbindlich ist, und übernimmt den Gesamtpreis laut Portal.',
|
||||
phase: 'P02',
|
||||
executions: [Execution::Portal, Execution::Manual],
|
||||
condition: 'bei einer Buchung, die beim Portal schon verbindlich ist',
|
||||
why: 'Die Buchung ist beim Portal verbindlich und bleibt es (E-036); der Gesamtpreis laut Portal wird übernommen.',
|
||||
requires: [Dependency::hard('intake.record')],
|
||||
effects: ['case_write'],
|
||||
waits: ['portal', 'landlord'],
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Modules\Intake;
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\BookingTaskKind;
|
||||
use App\Enums\BookingTaskStatus;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Models\BookingTask;
|
||||
use App\Process\Activity;
|
||||
use App\Process\CaseContext;
|
||||
use App\Process\CaseLog;
|
||||
use App\Process\Modules\Dependency;
|
||||
use App\Process\Modules\Module;
|
||||
use App\Process\Modules\ModuleDefinition;
|
||||
use App\Process\Modules\RunsAutomatically;
|
||||
use App\Process\Modules\StepState;
|
||||
use App\Process\PortalConfirmation;
|
||||
use App\Process\StepResult;
|
||||
|
||||
/**
|
||||
* P02 for extern binding bookings (V2.1, docs/Prozessarchitektur/V2.1/02 §5): waits for the portal's booking confirmation
|
||||
* mail, assigned to the case deterministically, before the steps that depend on it hard (contract documents, booking notice)
|
||||
* go on. The occupation does not wait: the booking is binding from the start and its calendar entries are protected
|
||||
* (binding.portal, channels.block do not depend on this step). Without the mail within the configured time the landlord gets
|
||||
* one task; nothing is sent or released automatically. The landlord can confirm in the case, or send by hand.
|
||||
*/
|
||||
final class PortalConfirmationStep extends Module implements RunsAutomatically
|
||||
{
|
||||
public static function key(): string
|
||||
{
|
||||
return 'portal.confirmation';
|
||||
}
|
||||
|
||||
public static function definition(): ModuleDefinition
|
||||
{
|
||||
return new ModuleDefinition(
|
||||
label: 'Bestätigung des Portals abwarten',
|
||||
purpose: 'Wartet auf die Bestätigungsmail des Portals, bevor Unterlagen und Nachrichten an den Gast gehen. Die Belegung ist von Anfang an gesichert.',
|
||||
phase: 'P02',
|
||||
executions: [Execution::Automatic, Execution::Manual, Execution::NotRequired],
|
||||
condition: 'nur bei extern verbindlicher Buchung und nur, wenn für den Kanal „Bestätigungsmail abwarten“ eingestellt ist',
|
||||
requires: [Dependency::hard('intake.record')],
|
||||
effects: ['case_write'],
|
||||
waits: ['portal', 'time', 'landlord'],
|
||||
triggers: ['portal.mail', 'schedule:waiting', 'booking.taken_over'],
|
||||
parameters: [ProcessSetting::AwaitPortalConfirmation, ProcessSetting::PortalConfirmationWaitHours],
|
||||
toggle: ModuleDefinition::TOGGLE_CONDITIONAL,
|
||||
performers: ['portal', 'landlord'],
|
||||
modes: ['automatic'],
|
||||
events: ['portal_confirmation', 'evidence', 'task'],
|
||||
);
|
||||
}
|
||||
|
||||
public function applies(CaseContext $case): bool
|
||||
{
|
||||
return ! $case->inquiry && ! $case->closed && $case->profile->awaitsPortalConfirmation();
|
||||
}
|
||||
|
||||
public function state(CaseContext $case): ?StepState
|
||||
{
|
||||
if (PortalConfirmation::evidence($case->booking) !== null) {
|
||||
return StepState::Done;
|
||||
}
|
||||
|
||||
return PortalConfirmation::isOverdue($case->booking) ? StepState::Problem : StepState::Waiting;
|
||||
}
|
||||
|
||||
public function activities(CaseContext $case): array
|
||||
{
|
||||
$evidence = PortalConfirmation::evidence($case->booking);
|
||||
$deadline = PortalConfirmation::deadline($case->booking);
|
||||
|
||||
return [new Activity('portal_confirmation', 'Bestätigung des Portals abwarten', match (true) {
|
||||
$evidence !== null => ActivityState::Done,
|
||||
PortalConfirmation::isOverdue($case->booking) => ActivityState::Problem,
|
||||
default => ActivityState::Waiting,
|
||||
}, match (true) {
|
||||
$evidence !== null => $evidence['label'],
|
||||
PortalConfirmation::isOverdue($case->booking) => 'ausgeblieben seit '.$deadline->format('d.m.Y, H:i').' Uhr – bitte beim Portal prüfen; Unterlagen und Nachrichten warten weiter, bis Sie bestätigen oder von Hand senden',
|
||||
default => 'erwartet bis '.$deadline->format('d.m.Y, H:i').' Uhr – Unterlagen und Nachrichten warten; die Belegung ist gesichert',
|
||||
}, $evidence === null ? 'confirmPortal' : null)];
|
||||
}
|
||||
|
||||
/** Due when the time ran out without the mail (escalate once), or when the mail arrived and the escalation is still open. */
|
||||
public function due(CaseContext $case): bool
|
||||
{
|
||||
$open = $this->openTask($case) !== null;
|
||||
$evidence = PortalConfirmation::evidence($case->booking) !== null;
|
||||
|
||||
return ($evidence && $open) || (! $evidence && ! $open && PortalConfirmation::isOverdue($case->booking));
|
||||
}
|
||||
|
||||
public function blockers(CaseContext $case): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function run(CaseContext $case): StepResult
|
||||
{
|
||||
$task = $this->openTask($case);
|
||||
if (PortalConfirmation::evidence($case->booking) !== null) {
|
||||
$task?->complete(CaseLog::SYSTEM, 'Die Bestätigung des Portals liegt jetzt vor.');
|
||||
|
||||
return StepResult::ran();
|
||||
}
|
||||
|
||||
BookingTask::openOnce($case->booking, BookingTaskKind::PortalConfirmationMissing, 'portal-confirmation', [
|
||||
'due_on' => today(),
|
||||
'note' => 'Die Bestätigungsmail des Portals ist bis '.PortalConfirmation::deadline($case->booking)->format('d.m.Y, H:i').' Uhr nicht eingegangen. Die Belegung ist gesichert. Bitte beim Portal prüfen und im Vorgang bestätigen – oder die Unterlagen von Hand senden.',
|
||||
]);
|
||||
CaseLog::record($case->booking, 'task', 'Bestätigungsmail des Portals fehlt – Aufgabe angelegt', actor: CaseLog::SYSTEM);
|
||||
|
||||
return StepResult::ran();
|
||||
}
|
||||
|
||||
public function isOutward(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private function openTask(CaseContext $case): ?BookingTask
|
||||
{
|
||||
return BookingTask::query()->where('booking_id', $case->booking->id)->where('kind', BookingTaskKind::PortalConfirmationMissing)->where('status', BookingTaskStatus::Open)->first();
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Process\Modules;
|
||||
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\ProcessSetting;
|
||||
|
||||
/**
|
||||
@@ -41,6 +42,9 @@
|
||||
* @param list<string> $events history types that belong to the step (shown behind the step)
|
||||
* @param list<string> $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)
|
||||
* @param list<Execution> $executions the admissible ways to fulfil the task (V2.1; the model may narrow them)
|
||||
* @param string|null $condition when the step applies, in plain words (DESCRIBES – the logic is `applies()`, never read from here)
|
||||
* @param string|null $why why the task is mandatory, shown instead of a lock
|
||||
*/
|
||||
public function __construct(
|
||||
public string $label,
|
||||
@@ -58,6 +62,9 @@ public function __construct(
|
||||
public array $points = [],
|
||||
public bool $readsContractData = false,
|
||||
public string $availability = self::AVAILABILITY_PRODUCTION,
|
||||
public array $executions = [],
|
||||
public ?string $condition = null,
|
||||
public ?string $why = null,
|
||||
) {}
|
||||
|
||||
public function isOptional(): bool
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Process\Modules\Money;
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\Execution;
|
||||
use App\Process\Activity;
|
||||
use App\Process\CaseContext;
|
||||
use App\Process\Modules\Module;
|
||||
@@ -25,6 +26,8 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Zahlung (ohne Erinnerungen)',
|
||||
purpose: 'Hält fest, was bei einer Eigenbelegung oder privaten Überlassung bezahlt wurde – ohne Erinnerungen.',
|
||||
phase: 'P03',
|
||||
executions: [Execution::Manual],
|
||||
condition: 'bei einer Eigenbelegung mit Preis',
|
||||
effects: ['case_write'],
|
||||
toggle: ModuleDefinition::TOGGLE_CONDITIONAL,
|
||||
performers: ['landlord'],
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Process\Modules\Money;
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Enums\Responsibility;
|
||||
use App\Process\Activity;
|
||||
@@ -28,6 +29,9 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Zahlungen des Gastes',
|
||||
purpose: 'Überwacht Anzahlung und Restzahlung und erinnert rechtzeitig – oder zeigt, was das Portal laut eigener Angabe eingezogen hat.',
|
||||
phase: 'P03',
|
||||
executions: [Execution::Manual, Execution::Portal],
|
||||
condition: 'bei jeder verbindlichen Buchung',
|
||||
why: 'Zahlungen werden überwacht – von uns oder durch das Portal (nur „laut Portal“).',
|
||||
effects: ['case_write', 'guest_mail'],
|
||||
waits: ['guest', 'portal', 'time'],
|
||||
triggers: ['payment.recorded', 'portal.amounts', 'schedule:reminders'],
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Process\Modules\Money;
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\Responsibility;
|
||||
use App\Pricing\CaseMoney;
|
||||
use App\Process\Activity;
|
||||
@@ -28,6 +29,9 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Auszahlung des Portals',
|
||||
purpose: 'Prüft, ob die Auszahlung des Portals tatsächlich auf unserem Konto eingegangen ist und zu den Angaben passt.',
|
||||
phase: 'P03',
|
||||
executions: [Execution::Manual],
|
||||
condition: 'wenn das Portal das Geld einzieht',
|
||||
why: 'Die Auszahlung muss tatsächlich auf unserem Konto eingehen (O5).',
|
||||
effects: ['case_write'],
|
||||
waits: ['portal', 'landlord', 'time'],
|
||||
triggers: ['portal.amounts', 'payment.recorded'],
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
use App\Availability\AvailabilityChecker;
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\ProcessingMode;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Process\Activity;
|
||||
@@ -41,6 +42,9 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Verbindliches Angebot',
|
||||
purpose: 'Erstellt das verbindliche Angebot mit Vertragsentwurf und sendet es dem Gast; der Zeitraum ist für die Haltefrist reserviert.',
|
||||
phase: 'P02',
|
||||
executions: [Execution::Automatic, Execution::Manual],
|
||||
condition: 'bei einer Anfrage mit Reservierung',
|
||||
why: 'Ohne verbindliches Angebot gibt es auf eigenem Weg keinen Vertrag (E-003).',
|
||||
requires: [Dependency::hard('guest.details'), Dependency::hard('availability.check'), Dependency::soft('guest.data_request')],
|
||||
effects: ['case_write', 'guest_mail', 'landlord_mail', 'document', 'calendar_hold', 'network'],
|
||||
waits: ['guest', 'landlord'],
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\ProcessingMode;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Process\Activity;
|
||||
@@ -32,6 +33,8 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Unverbindliche Auskunft und Buchungswunsch',
|
||||
purpose: 'Beantwortet die Anfrage mit einer unverbindlichen Auskunft ohne Reservierung; fragt der Gast die Buchung an, wird erneut geprüft und verbindlich bestätigt.',
|
||||
phase: 'P02',
|
||||
executions: [Execution::Automatic, Execution::Manual],
|
||||
condition: 'bei einer Anfrage ohne Reservierung',
|
||||
requires: [Dependency::hard('intake.record'), Dependency::soft('guest.data_request')],
|
||||
effects: ['case_write', 'guest_mail', 'landlord_mail', 'document'],
|
||||
waits: ['guest', 'landlord'],
|
||||
|
||||
@@ -27,6 +27,9 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Annahme durch den Gast',
|
||||
purpose: 'Der Gast nimmt das Angebot an oder lehnt es ab; mit der Annahme wird die Buchung verbindlich.',
|
||||
phase: 'P02',
|
||||
executions: [],
|
||||
condition: 'nach einem verbindlichen Angebot',
|
||||
why: 'Der Gast nimmt an – ohne Annahme kommt kein Vertrag zustande (E-003). Eine zweite Freigabe ist nicht nötig.',
|
||||
requires: [Dependency::hard('offer.binding')],
|
||||
effects: ['case_write', 'guest_mail', 'landlord_mail', 'document'],
|
||||
waits: ['guest', 'time'],
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
use App\Actions\SendBookingDocuments;
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\ProcessingMode;
|
||||
use App\Enums\ContractDelivery;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Enums\Responsibility;
|
||||
use App\Process\Activity;
|
||||
@@ -14,6 +15,7 @@
|
||||
use App\Process\Modules\Module;
|
||||
use App\Process\Modules\ModuleDefinition;
|
||||
use App\Process\Modules\RunsAutomatically;
|
||||
use App\Process\PortalConfirmation;
|
||||
use App\Process\StepResult;
|
||||
|
||||
/**
|
||||
@@ -28,17 +30,27 @@ public static function key(): string
|
||||
return 'documents.send';
|
||||
}
|
||||
|
||||
public static function version(): int
|
||||
{
|
||||
// 2: the contract document is created and filed separately from sending it (contract_delivery); waits for the portal's
|
||||
// confirmation where the channel says so. Default behaviour is the one of version 1.
|
||||
return 2;
|
||||
}
|
||||
|
||||
public static function definition(): ModuleDefinition
|
||||
{
|
||||
return new ModuleDefinition(
|
||||
label: 'Buchungsunterlagen (Vertragsdokumentation)',
|
||||
purpose: 'Sendet dem Gast die verbindliche Buchungsbestätigung mit Vertrag bzw. die Unterlagen der Portalbuchung.',
|
||||
phase: 'P03',
|
||||
requires: [Dependency::hard('guest.details')],
|
||||
executions: [Execution::Automatic, Execution::Approval, Execution::Manual, Execution::Portal],
|
||||
condition: 'bei jeder verbindlichen Buchung, für die wir die Unterlagen verantworten',
|
||||
why: 'Die verbindliche Vertragsdokumentation muss den Gast erreichen – von uns oder vom Portal (O1). Wie, ist einstellbar.',
|
||||
requires: [Dependency::hard('guest.details'), Dependency::hard('portal.confirmation')],
|
||||
effects: ['case_write', 'guest_mail', 'document'],
|
||||
waits: ['landlord', 'portal'],
|
||||
triggers: ['automation', 'booking.taken_over'],
|
||||
parameters: [ProcessSetting::Documents, ProcessSetting::Processing, ProcessSetting::ContractTemplate],
|
||||
triggers: ['automation', 'booking.taken_over', 'portal.mail', 'schedule:waiting'],
|
||||
parameters: [ProcessSetting::Documents, ProcessSetting::Processing, ProcessSetting::ContractDelivery, ProcessSetting::ContractTemplate],
|
||||
performers: ['system', 'landlord', 'portal'],
|
||||
modes: ['automatic', 'manual'],
|
||||
events: ['document', 'mail'],
|
||||
@@ -59,8 +71,14 @@ public function activities(CaseContext $case): array
|
||||
}
|
||||
|
||||
$binding = $case->binding;
|
||||
$delivery = $case->profile->contractDelivery();
|
||||
$internal = $delivery === ContractDelivery::Internal;
|
||||
$stored = $booking->contract_path !== null;
|
||||
$awaiting = $binding && ! $case->inquiry && $case->profile->awaitsPortalConfirmation() && PortalConfirmation::evidence($booking) === null;
|
||||
$state = match (true) {
|
||||
$booking->confirmation_sent_at !== null => ActivityState::Done,
|
||||
// Created and filed internally is how the landlord chose to fulfil the step; sending stays possible by hand.
|
||||
$internal && $stored => ActivityState::Done,
|
||||
! $binding => ActivityState::Later,
|
||||
$booking->confirmation_failed_at !== null => ActivityState::Problem,
|
||||
default => ActivityState::Open,
|
||||
@@ -68,33 +86,42 @@ public function activities(CaseContext $case): array
|
||||
$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() : [];
|
||||
$waiting = $missing !== [] || ($awaiting && $state === ActivityState::Open);
|
||||
|
||||
return [new Activity('documents', match (true) {
|
||||
$internal && $state === ActivityState::Done && $booking->confirmation_sent_at === null => 'Vertrag intern abgelegt',
|
||||
$internal && $state === ActivityState::Open => 'Vertrag erstellen und intern ablegen',
|
||||
$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),
|
||||
}, $case->later($waiting ? ActivityState::Waiting : $state),
|
||||
match (true) {
|
||||
$booking->confirmation_sent_at !== null => 'gesendet am '.$booking->confirmation_sent_at->format('d.m.Y'),
|
||||
$internal && $state === ActivityState::Done => 'erstellt und intern abgelegt – nicht an den Gast gesendet (Einstellung des Kanals); Senden von Hand bleibt möglich',
|
||||
$state === ActivityState::Problem => 'Versand fehlgeschlagen',
|
||||
$missing !== [] => 'wartet: '.implode(' ', $missing),
|
||||
$awaiting => 'wartet auf die Bestätigungsmail des Portals (die Belegung ist gesichert)',
|
||||
$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',
|
||||
$binding && $missing === [] && $booking->confirmation_sent_at === null && ! ($internal && $stored) => 'sendDocuments',
|
||||
default => null,
|
||||
})];
|
||||
}
|
||||
|
||||
/** The guest's e-mail and the price are what the documents need – not every detail of a request. */
|
||||
/**
|
||||
* The guest's e-mail and the price are what the documents need – not every detail of a request. Due when they are
|
||||
* to go out automatically (as the case is processed or as chosen for the delivery), or – delivery „internal“ – when the
|
||||
* contract is still to be created and filed.
|
||||
*/
|
||||
public function due(CaseContext $case): bool
|
||||
{
|
||||
$booking = $case->booking;
|
||||
$delivery = $case->profile->contractDelivery();
|
||||
$mine = $case->binding && $booking->confirmation_sent_at === null && $case->profile->documents() === Responsibility::Landlord && $case->profile->origin !== 'migration';
|
||||
|
||||
return $booking->processingMode() === ProcessingMode::Automatic
|
||||
&& $case->binding && $booking->confirmation_sent_at === null
|
||||
&& $case->profile->documents() === Responsibility::Landlord && $case->profile->origin !== 'migration';
|
||||
return $mine && ($delivery === ContractDelivery::Internal ? $booking->contract_path === null : $delivery->sendsAutomatically($booking->processingMode()));
|
||||
}
|
||||
|
||||
public function blockers(CaseContext $case): array
|
||||
@@ -104,7 +131,8 @@ public function blockers(CaseContext $case): array
|
||||
|
||||
public function run(CaseContext $case): StepResult
|
||||
{
|
||||
$reasons = app(SendBookingDocuments::class)->automatically($case->booking);
|
||||
$documents = app(SendBookingDocuments::class);
|
||||
$reasons = $case->profile->contractDelivery() === ContractDelivery::Internal ? $documents->storeInternally($case->booking) : $documents->automatically($case->booking);
|
||||
|
||||
return $reasons === [] ? StepResult::ran() : StepResult::blocked($reasons);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Modules\Settlement;
|
||||
|
||||
use App\Actions\SendBookingNotice;
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\BookingNoticeMode;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Process\Activity;
|
||||
use App\Process\CaseContext;
|
||||
use App\Process\Modules\Dependency;
|
||||
use App\Process\Modules\Module;
|
||||
use App\Process\Modules\ModuleDefinition;
|
||||
use App\Process\Modules\RunsAutomatically;
|
||||
use App\Process\Modules\StepState;
|
||||
use App\Process\PortalConfirmation;
|
||||
use App\Process\StepResult;
|
||||
|
||||
/**
|
||||
* P03 (V2.1, docs/Prozessarchitektur/V2.1/02 §4): a short booking information for the guest of a binding booking – without
|
||||
* contract, independent of the contract documentation. Off by default. It waits for the portal's confirmation where the
|
||||
* channel is set up that way, and is not needed where the portal informs the guest itself and confirmed (evidence on record).
|
||||
*/
|
||||
final class BookingNoticeStep extends Module implements RunsAutomatically
|
||||
{
|
||||
public static function key(): string
|
||||
{
|
||||
return 'documents.booking_notice';
|
||||
}
|
||||
|
||||
public static function definition(): ModuleDefinition
|
||||
{
|
||||
return new ModuleDefinition(
|
||||
label: 'Buchungsinformation an den Gast',
|
||||
purpose: 'Sendet dem Gast eine kurze Information über seine Buchung – ohne Vertrag, unabhängig von den Vertragsunterlagen.',
|
||||
phase: 'P03',
|
||||
executions: [Execution::Automatic, Execution::Manual, Execution::Portal, Execution::NotRequired],
|
||||
condition: 'nur bei extern verbindlicher Buchung und nur, wenn für den Kanal eine Buchungsinformation eingestellt ist',
|
||||
requires: [Dependency::hard('portal.confirmation'), Dependency::hard('guest.details'), Dependency::soft('documents.send')],
|
||||
effects: ['case_write', 'guest_mail'],
|
||||
waits: ['portal', 'guest', 'landlord'],
|
||||
triggers: ['automation', 'booking.taken_over', 'portal.mail', 'schedule:waiting'],
|
||||
parameters: [ProcessSetting::BookingNotice],
|
||||
toggle: ModuleDefinition::TOGGLE_CONDITIONAL,
|
||||
performers: ['system', 'landlord', 'portal'],
|
||||
modes: ['automatic', 'manual'],
|
||||
events: ['booking_notice', 'mail'],
|
||||
);
|
||||
}
|
||||
|
||||
public function applies(CaseContext $case): bool
|
||||
{
|
||||
return ! $case->inquiry && $case->profile->bookingNotice() !== BookingNoticeMode::Off;
|
||||
}
|
||||
|
||||
public function activities(CaseContext $case): array
|
||||
{
|
||||
$booking = $case->booking;
|
||||
$suppression = SendBookingNotice::suppression($booking);
|
||||
$sent = SendBookingNotice::sent($booking);
|
||||
$waitsForPortal = $case->profile->awaitsPortalConfirmation() && PortalConfirmation::evidence($booking) === null;
|
||||
$label = 'Buchungsinformation an den Gast'.($case->profile->bookingNotice()->isAutomatic() ? ' (automatisch)' : '');
|
||||
|
||||
return [new Activity('booking_notice', $label, $case->later(match (true) {
|
||||
$sent => ActivityState::Done,
|
||||
$suppression !== null => ActivityState::NotApplicable,
|
||||
! $case->binding => ActivityState::Later,
|
||||
$waitsForPortal => ActivityState::Waiting,
|
||||
blank($booking->guest?->email) => ActivityState::Waiting,
|
||||
default => ActivityState::Open,
|
||||
}), match (true) {
|
||||
$sent => 'gesendet',
|
||||
$suppression !== null => 'nicht nötig: '.$suppression,
|
||||
$waitsForPortal => 'wartet auf die Bestätigungsmail des Portals',
|
||||
blank($booking->guest?->email) => 'wartet: Die E-Mail-Adresse des Gastes fehlt.',
|
||||
default => null,
|
||||
}, ! $sent && $suppression === null && $case->binding && filled($booking->guest?->email) ? 'sendBookingNotice' : null)];
|
||||
}
|
||||
|
||||
public function state(CaseContext $case): ?StepState
|
||||
{
|
||||
$booking = $case->booking;
|
||||
|
||||
return match (true) {
|
||||
SendBookingNotice::sent($booking) => StepState::Done,
|
||||
SendBookingNotice::suppression($booking) !== null => StepState::NotApplicable,
|
||||
! $case->binding => StepState::Later,
|
||||
default => StepState::Open,
|
||||
};
|
||||
}
|
||||
|
||||
public function due(CaseContext $case): bool
|
||||
{
|
||||
return $case->profile->bookingNotice()->isAutomatic() && $case->binding && ! $case->closed
|
||||
&& ! SendBookingNotice::sent($case->booking) && SendBookingNotice::suppression($case->booking) === null && $case->profile->origin !== 'migration';
|
||||
}
|
||||
|
||||
public function blockers(CaseContext $case): array
|
||||
{
|
||||
return filled($case->booking->guest?->email) ? [] : ['Die E-Mail-Adresse des Gastes fehlt.'];
|
||||
}
|
||||
|
||||
public function run(CaseContext $case): StepResult
|
||||
{
|
||||
return app(SendBookingNotice::class)->handle($case->booking, automatic: true) ? StepResult::ran() : StepResult::blocked([SendBookingNotice::suppression($case->booking) ?? 'Nicht gesendet.']);
|
||||
}
|
||||
|
||||
public function isOutward(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,8 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Aufgaben und Meldungen',
|
||||
purpose: 'Zeigt offene Aufgaben des Vorgangs – Meldungen der Portale, Entscheidungen, Zahlungs- und Leistungsaufgaben.',
|
||||
phase: 'P03',
|
||||
executions: [],
|
||||
condition: 'wenn eine Aufgabe oder Meldung vorliegt',
|
||||
effects: ['case_write'],
|
||||
waits: ['landlord'],
|
||||
triggers: ['task.created', 'portal.report'],
|
||||
|
||||
@@ -26,6 +26,8 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Änderungsvorschlag',
|
||||
purpose: 'Zeigt einen Änderungsvorschlag, der beim Gast liegt.',
|
||||
phase: 'P03',
|
||||
executions: [],
|
||||
condition: 'wenn ein Änderungsvorschlag beim Gast liegt',
|
||||
effects: ['case_write', 'guest_mail'],
|
||||
waits: ['guest', 'time'],
|
||||
triggers: ['change.proposed'],
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\Execution;
|
||||
use App\Process\Activity;
|
||||
use App\Process\CaseClosure;
|
||||
use App\Process\CaseContext;
|
||||
@@ -28,6 +29,9 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Kaufmännisch abschließen',
|
||||
purpose: 'Schließt den Vorgang kaufmännisch ab, wenn Zahlungen, Erstattungen und Auszahlungen geklärt sind.',
|
||||
phase: 'P05',
|
||||
executions: [Execution::Manual],
|
||||
condition: 'nach dem Aufenthalt',
|
||||
why: 'Zahlungen, Erstattungen und Auszahlungen müssen geklärt sein; eine Portalmeldung ersetzt den Nachweis nicht (O5).',
|
||||
requires: [Dependency::soft('case.closure')],
|
||||
effects: ['case_write'],
|
||||
waits: ['landlord', 'portal'],
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\InternalKind;
|
||||
use App\Models\BookingTask;
|
||||
use App\Process\Activity;
|
||||
@@ -28,6 +29,9 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Aufenthalt abschließen',
|
||||
purpose: 'Schließt den Aufenthalt ab, sobald nach der Abreise nichts mehr für ihn offen ist.',
|
||||
phase: 'P05',
|
||||
executions: [Execution::Automatic, Execution::Manual],
|
||||
condition: 'nach der Abreise',
|
||||
why: 'Ein Aufenthalt wird immer abgeschlossen, damit nichts offen bleibt (E-010).',
|
||||
effects: ['case_write'],
|
||||
waits: ['time', 'landlord'],
|
||||
triggers: ['schedule:daily'],
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Process\Modules\Settlement;
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\InternalKind;
|
||||
use App\Process\Activity;
|
||||
use App\Process\CaseContext;
|
||||
@@ -25,6 +26,8 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Aufenthaltsbestätigung',
|
||||
purpose: 'Bestätigt den Gästen einer Eigenbelegung oder privaten Überlassung den Aufenthalt – nur bei Bedarf.',
|
||||
phase: 'P03',
|
||||
executions: [Execution::Manual, Execution::NotRequired],
|
||||
condition: 'bei einer privaten Überlassung mit Gästen',
|
||||
effects: ['guest_mail', 'document'],
|
||||
toggle: ModuleDefinition::TOGGLE_OPTIONAL,
|
||||
performers: ['landlord'],
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\BookingTaskKind;
|
||||
use App\Enums\BookingTaskStatus;
|
||||
use App\Enums\Execution;
|
||||
use App\Models\BookingTask;
|
||||
use App\Process\Activity;
|
||||
use App\Process\CaseContext;
|
||||
@@ -28,6 +29,8 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Anreisedaten',
|
||||
purpose: 'Sammelt Telefon und Anreisezeit für die Übergabe und meldet rechtzeitig, was fehlt.',
|
||||
phase: 'P04',
|
||||
executions: [Execution::Manual, Execution::ServiceProvider, Execution::NotRequired],
|
||||
condition: 'bei verbindlichen Buchungen',
|
||||
effects: ['case_write'],
|
||||
waits: ['guest', 'landlord', 'time'],
|
||||
triggers: ['schedule:prepare-stays'],
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Process\Modules\Stay;
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Enums\Responsibility;
|
||||
use App\Process\Activity;
|
||||
@@ -27,6 +28,8 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Anreise-Informationen',
|
||||
purpose: 'Wegbeschreibung, Schlüssel und Kontakt vor Ort rechtzeitig vor der Anreise.',
|
||||
phase: 'P04',
|
||||
executions: [Execution::Automatic, Execution::Portal, Execution::ServiceProvider, Execution::NotRequired],
|
||||
condition: 'bei verbindlichen Buchungen',
|
||||
effects: ['guest_mail'],
|
||||
waits: ['time', 'portal'],
|
||||
triggers: ['schedule:reminders'],
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Process\Modules\Stay;
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\Responsibility;
|
||||
use App\Process\Activity;
|
||||
use App\Process\CaseContext;
|
||||
@@ -27,6 +28,8 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Bitte um eine Bewertung',
|
||||
purpose: 'Bittet den Gast nach dem Aufenthalt um eine Bewertung.',
|
||||
phase: 'P05',
|
||||
executions: [Execution::Automatic, Execution::Portal, Execution::NotRequired],
|
||||
condition: 'nach dem Aufenthalt, wenn wir dem Gast schreiben',
|
||||
requires: [Dependency::hard('stay')],
|
||||
effects: ['guest_mail'],
|
||||
waits: ['time'],
|
||||
|
||||
@@ -25,6 +25,8 @@ public static function definition(): ModuleDefinition
|
||||
label: 'Aufenthalt',
|
||||
purpose: 'Der Aufenthalt vom Anreise- bis zum Abreisetag.',
|
||||
phase: 'P04',
|
||||
executions: [],
|
||||
condition: 'immer',
|
||||
waits: ['time'],
|
||||
triggers: ['schedule:daily'],
|
||||
performers: ['guest', 'landlord'],
|
||||
|
||||
Reference in new issue
Block a user