Merge feature/anfrage-basisprozess: Anfrage-Basisprozess, Schablonen für alle Geschäftsvorfälle
Deploy FeWo mit PipelineManager / deploy (push) Successful in 6m35s
Deploy FeWo mit PipelineManager / deploy (push) Successful in 6m35s
This commit is contained in:
commit
4554af8056
58 files changed
+1418
-111
No files matched your search
@@ -8,6 +8,7 @@
|
||||
use App\Documents\DocumentFinding;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\DocumentKind;
|
||||
use App\Enums\InquiryAnswer;
|
||||
use App\Enums\ProcessingMode;
|
||||
use App\Exceptions\ReservationException;
|
||||
use App\Models\Booking;
|
||||
@@ -49,14 +50,16 @@ public function blockers(Booking $booking): array
|
||||
{
|
||||
$property = $booking->property;
|
||||
$reasons = [];
|
||||
$information = ! $booking->process()->preReservation();
|
||||
$information = $booking->process()->inquiryAnswer() === InquiryAnswer::Information;
|
||||
|
||||
if ($information && ($booking->status !== BookingStatus::Reserved || $booking->information_version > 0)) {
|
||||
$reasons[] = 'Die Anfrage ist bereits beantwortet oder nicht mehr offen.';
|
||||
}
|
||||
// A request after its clarification hold (v0.11) only needs free dates, which are checked below.
|
||||
$clarified = $booking->hold_purpose === Booking::HOLD_CLARIFICATION;
|
||||
if (! $information && ($booking->status !== BookingStatus::Reserved || (! $clarified && ! $booking->isHoldActive()))) {
|
||||
// Without a reservation at the request (offer without early hold) the offer itself creates the hold; availability is checked below.
|
||||
$holdRequired = $booking->process()->preReservation();
|
||||
if (! $information && ($booking->status !== BookingStatus::Reserved || ($holdRequired && ! $clarified && ! $booking->isHoldActive()))) {
|
||||
$reasons[] = 'Die Anfrage ist nicht mehr vorgemerkt (Frist abgelaufen oder bereits bearbeitet).';
|
||||
}
|
||||
if (blank($booking->guest?->email)) {
|
||||
@@ -87,7 +90,7 @@ public function handle(Booking $booking): array
|
||||
{
|
||||
$booking->loadMissing(['property', 'guest']);
|
||||
|
||||
if ($booking->process()->preReservation()) {
|
||||
if ($booking->process()->inquiryAnswer() === InquiryAnswer::Offer) {
|
||||
$this->clearance->refresh($booking->property);
|
||||
}
|
||||
|
||||
@@ -97,7 +100,7 @@ public function handle(Booking $booking): array
|
||||
}
|
||||
|
||||
try {
|
||||
if (! $booking->process()->preReservation()) {
|
||||
if ($booking->process()->inquiryAnswer() === InquiryAnswer::Information) {
|
||||
$this->sendInformation->handle($booking->fresh(), ['expected_version' => 0, 'acknowledged' => true]);
|
||||
} else {
|
||||
$this->sendOffer->handle($booking->fresh(), ['expected_version' => 0]);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
use App\Enums\DataRequestMode;
|
||||
use App\Enums\DocumentKind;
|
||||
use App\Enums\FactSource;
|
||||
use App\Enums\InquiryAnswer;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Mail\DataRequested;
|
||||
use App\Models\Booking;
|
||||
@@ -70,7 +71,7 @@ public static function needs(Booking $booking): ?array
|
||||
}
|
||||
|
||||
$purpose = match (true) {
|
||||
$booking->process()->preReservation() => self::FOR_OFFER,
|
||||
$booking->process()->inquiryAnswer() === InquiryAnswer::Offer => self::FOR_OFFER,
|
||||
$booking->wish_at !== null => self::FOR_WISH,
|
||||
default => null,
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@ 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()->reviewRequestSender() === 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);
|
||||
|
||||
@@ -63,7 +63,7 @@ public function handle(): array
|
||||
->whereNull('arrival_info_sent_at')
|
||||
->whereDate('arrival', '>=', $today)
|
||||
->whereDate('arrival', '<=', $today->copy()->addDays(self::ARRIVAL_INFO_MAX_DAYS_BEFORE)))
|
||||
->filter(fn (Booking $booking): bool => $booking->process()->guestMessages() === Responsibility::Landlord
|
||||
->filter(fn (Booking $booking): bool => $booking->process()->arrivalInfoSender() === Responsibility::Landlord
|
||||
&& $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);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
use App\Availability\AvailabilityChecker;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\DocumentKind;
|
||||
use App\Enums\InquiryAnswer;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Enums\Responsibility;
|
||||
@@ -167,7 +168,7 @@ private function prepareOffer(Booking $booking, Booking $draft, array $changes,
|
||||
'offer_message' => $changes['offer_message'] ?? $booking->offer_message,
|
||||
]);
|
||||
|
||||
if (! $booking->process()->preReservation()) {
|
||||
if ($booking->process()->inquiryAnswer() === InquiryAnswer::Information) {
|
||||
$findings[] = DocumentFinding::confirm('Nach Ihrer Einstellung reservieren Anfragen den Zeitraum nicht; vorgesehen ist eine unverbindliche Auskunft. Ein Angebot mit Annahmelink reserviert den Zeitraum für diesen Vorgang trotzdem bis '.$draft->hold_expires_at->format('d.m.Y, H:i').' Uhr, und der Gast kann bis dahin verbindlich annehmen.', DocumentFinding::HOLD_ZERO);
|
||||
}
|
||||
if ($booking->offer_version > 0) {
|
||||
|
||||
@@ -62,7 +62,7 @@ public static function forCase(Booking $booking): ?self
|
||||
$booking->intake === IntakeKind::Internal => $booking->guest_id !== null ? self::StayConfirmation : self::Internal,
|
||||
$booking->caseType()->isExternallyBinding() => $profile->documents() === Responsibility::Portal ? null : self::ExternalRecord,
|
||||
$booking->isBinding() => $profile->documents() === Responsibility::Portal ? null : self::Confirmation,
|
||||
! $profile->preReservation() => self::Information,
|
||||
$profile->inquiryAnswer() === InquiryAnswer::Information => self::Information,
|
||||
default => self::Offer,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
|
||||
/**
|
||||
* How a request is answered first: a non-binding information or a binding offer the guest can accept. Independent of the
|
||||
* reservation strategy (ProcessSetting::PreReservation) – except that an information reserves nothing by definition.
|
||||
*/
|
||||
enum InquiryAnswer: string implements HasLabel
|
||||
{
|
||||
case Information = 'information';
|
||||
case Offer = 'offer';
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Information => 'Unverbindliche Auskunft',
|
||||
self::Offer => 'Verbindliches Angebot',
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,9 @@ enum ProcessSetting: string
|
||||
case BookingNotice = 'booking_notice';
|
||||
case AwaitPortalConfirmation = 'await_portal_confirmation';
|
||||
case PortalConfirmationWaitHours = 'portal_confirmation_wait_hours';
|
||||
case InquiryAnswer = 'inquiry_answer';
|
||||
case ArrivalInfoSender = 'arrival_info_sender';
|
||||
case ReviewRequestSender = 'review_request_sender';
|
||||
|
||||
/**
|
||||
* Built-in default (the behaviour before any landlord setting existed).
|
||||
@@ -54,6 +57,8 @@ public function default(): string|int|bool|null
|
||||
self::BookingNotice => BookingNoticeMode::Off->value,
|
||||
self::AwaitPortalConfirmation => false,
|
||||
self::PortalConfirmationWaitHours => 48,
|
||||
// Not set: derived (ProcessSettings) – the answer from the reservation, the senders from guest_messages.
|
||||
self::InquiryAnswer, self::ArrivalInfoSender, self::ReviewRequestSender => null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -83,6 +88,9 @@ public function question(): string
|
||||
self::BookingNotice => 'Bekommt der Gast von uns eine Buchungsinformation (ohne Vertrag)?',
|
||||
self::AwaitPortalConfirmation => 'Sollen Unterlagen und Nachrichten erst nach der Bestätigungsmail des Portals gehen?',
|
||||
self::PortalConfirmationWaitHours => 'Wie lange wird auf die Bestätigungsmail des Portals gewartet, bevor Sie benachrichtigt werden?',
|
||||
self::InquiryAnswer => 'Womit wird eine Anfrage zuerst beantwortet?',
|
||||
self::ArrivalInfoSender => 'Wer schickt dem Gast die Anreise-Informationen?',
|
||||
self::ReviewRequestSender => 'Wer bittet den Gast nach dem Aufenthalt um eine Bewertung?',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -94,7 +102,8 @@ public function question(): string
|
||||
public function channelIntakes(): array
|
||||
{
|
||||
return match ($this) {
|
||||
self::Processing, self::Payments, self::GuestMessages, self::ContractTemplate => [IntakeKind::Inquiry, IntakeKind::Booking],
|
||||
self::Processing, self::Payments, self::GuestMessages, self::ContractTemplate, self::ArrivalInfoSender, self::ReviewRequestSender => [IntakeKind::Inquiry, IntakeKind::Booking],
|
||||
self::InquiryAnswer => [IntakeKind::Inquiry],
|
||||
self::PreReservation, self::HoldHours => [IntakeKind::Inquiry],
|
||||
self::Documents, self::ContractDelivery, self::BookingNotice, self::AwaitPortalConfirmation, self::PortalConfirmationWaitHours => [IntakeKind::Booking],
|
||||
self::ArrivalInfoDaysBefore, self::GuestLinkValidDays => [],
|
||||
@@ -108,7 +117,7 @@ public function channelIntakes(): array
|
||||
*/
|
||||
public function isLandlordSetting(): bool
|
||||
{
|
||||
return $this !== self::ContractTemplate;
|
||||
return ! in_array($this, [self::ContractTemplate, self::InquiryAnswer], true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,7 +131,8 @@ public function normalize(mixed $value): string|int|bool|null
|
||||
|
||||
return match ($this) {
|
||||
self::Processing => ($value instanceof ProcessingMode ? $value : ProcessingMode::tryFrom((string) $value))?->value,
|
||||
self::Documents, self::Payments, self::GuestMessages => ($value instanceof Responsibility ? $value : Responsibility::tryFrom((string) $value))?->value,
|
||||
self::Documents, self::Payments, self::GuestMessages, self::ArrivalInfoSender, self::ReviewRequestSender => ($value instanceof Responsibility ? $value : Responsibility::tryFrom((string) $value))?->value,
|
||||
self::InquiryAnswer => ($value instanceof InquiryAnswer ? $value : InquiryAnswer::tryFrom((string) $value))?->value,
|
||||
self::PreReservation, self::FormRequiresAddress, self::AwaitPortalConfirmation => is_bool($value) ? $value : filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE),
|
||||
self::HoldHours, self::ArrivalInfoDaysBefore, self::ContractTemplate => is_numeric($value) ? (int) $value : null,
|
||||
self::DataRequest => ($value instanceof DataRequestMode ? $value : DataRequestMode::tryFrom((string) $value))?->value,
|
||||
@@ -141,7 +151,8 @@ public function describe(string|int|bool|null $value): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Processing => ProcessingMode::tryFrom((string) $value)?->getLabel() ?? '–',
|
||||
self::Documents, self::Payments, self::GuestMessages => Responsibility::tryFrom((string) $value)?->getLabel() ?? '–',
|
||||
self::Documents, self::Payments, self::GuestMessages, self::ArrivalInfoSender, self::ReviewRequestSender => Responsibility::tryFrom((string) $value)?->getLabel() ?? '–',
|
||||
self::InquiryAnswer => InquiryAnswer::tryFrom((string) $value)?->getLabel() ?? '–',
|
||||
self::PreReservation => $value ? 'ja' : 'nein',
|
||||
self::HoldHours => $value.' Stunden',
|
||||
self::ArrivalInfoDaysBefore => $value.' Tage vor Anreise',
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
use App\Enums\BookingNoticeMode;
|
||||
use App\Enums\ContractDelivery;
|
||||
use App\Enums\DataRequestMode;
|
||||
use App\Enums\InquiryAnswer;
|
||||
use App\Enums\ProcessingMode;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Enums\Responsibility;
|
||||
@@ -39,7 +40,8 @@ public static function field(string $name, ProcessSetting $setting, string $inhe
|
||||
->helperText('Automatisch: Das System sendet Angebote bzw. Unterlagen selbst, sobald alle Angaben da sind. Sonst bereitet es alles vor und Sie geben frei.'),
|
||||
ProcessSetting::PreReservation => Select::make($name)->options(['1' => 'Ja – der Zeitraum ist bis zum Ablauf des Angebots reserviert', '0' => 'Nein – der Gast erhält eine unverbindliche Auskunft und kann daraus die Buchung anfragen (erneute Prüfung vor der Bestätigung)'])->placeholder($placeholder),
|
||||
ProcessSetting::HoldHours => TextInput::make($name)->integer()->minValue(1)->maxValue(720)->suffix('Stunden')->placeholder($placeholder),
|
||||
ProcessSetting::Documents, ProcessSetting::Payments, ProcessSetting::GuestMessages => Select::make($name)->options([Responsibility::Landlord->value => Responsibility::Landlord->getLabel(), Responsibility::Portal->value => Responsibility::Portal->getLabel()])->placeholder($placeholder),
|
||||
ProcessSetting::Documents, ProcessSetting::Payments, ProcessSetting::GuestMessages, ProcessSetting::ArrivalInfoSender, ProcessSetting::ReviewRequestSender => Select::make($name)->options([Responsibility::Landlord->value => Responsibility::Landlord->getLabel(), Responsibility::Portal->value => Responsibility::Portal->getLabel()])->placeholder($placeholder),
|
||||
ProcessSetting::InquiryAnswer => Select::make($name)->options(InquiryAnswer::class)->placeholder($placeholder),
|
||||
ProcessSetting::ArrivalInfoDaysBefore => TextInput::make($name)->integer()->minValue(1)->maxValue(14)->suffix('Tage vor Anreise')->placeholder($placeholder),
|
||||
ProcessSetting::ContractTemplate => Select::make($name)
|
||||
->options(fn (): array => ContractTemplate::query()->orderBy('name')->orderBy('version')->get()->mapWithKeys(fn (ContractTemplate $template): array => [$template->id => $template->label()])->all())
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Enums\InquiryAnswer;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Enums\UserRole;
|
||||
@@ -112,7 +113,9 @@ public static function where(ProcessSetting $setting): string
|
||||
public static function answer(ProcessProfile $profile): string
|
||||
{
|
||||
return match ($profile->intake) {
|
||||
IntakeKind::Inquiry => $profile->preReservation() ? 'Angebot mit Annahmelink, Zeitraum reserviert' : 'Unverbindliche Auskunft, „Buchung anfragen“, erneute Prüfung',
|
||||
IntakeKind::Inquiry => $profile->inquiryAnswer() === InquiryAnswer::Offer
|
||||
? 'Angebot mit Annahmelink'.($profile->preReservation() ? ', Zeitraum schon bei der Anfrage reserviert' : ', Zeitraum erst mit dem Angebot reserviert')
|
||||
: 'Unverbindliche Auskunft, „Buchung anfragen“, erneute Prüfung',
|
||||
IntakeKind::Booking => 'keine – beim Portal bereits verbindlich',
|
||||
IntakeKind::Internal => 'keine – eigene Belegung',
|
||||
};
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
use App\Enums\BookingTaskKind;
|
||||
use App\Enums\BookingTaskStatus;
|
||||
use App\Enums\DocumentKind;
|
||||
use App\Enums\InquiryAnswer;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\Responsibility;
|
||||
use App\Exceptions\ReservationException;
|
||||
@@ -52,7 +53,7 @@ private function sendInformationAction(): Action
|
||||
->label(fn (): string => $this->record->information_version > 0 ? 'Auskunft ändern & neu senden' : 'Unverbindliche Auskunft prüfen und senden')
|
||||
->icon(Heroicon::OutlinedPaperAirplane)
|
||||
->visible(fn (): bool => in_array($this->record->status, [BookingStatus::Reserved, BookingStatus::Expired], true) && $this->record->intake !== IntakeKind::Booking
|
||||
&& ! $this->record->process()->preReservation() && $this->record->offer_version === 0 && ! $this->record->isHoldActive())
|
||||
&& $this->record->process()->inquiryAnswer() === InquiryAnswer::Information && $this->record->offer_version === 0 && ! $this->record->isHoldActive())
|
||||
->modalHeading('Unverbindliche Auskunft an den Gast')
|
||||
->modalDescription('Nach Ihrer Einstellung reservieren Anfragen den Zeitraum nicht. Der Gast erhält Preis und Verfügbarkeit zum heutigen Stand und kann daraus die Buchung anfragen; dann wird erneut geprüft. Verbindlich wird erst Ihre (oder die automatische) Bestätigung.')
|
||||
->modalSubmitActionLabel('Senden')
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
use App\Enums\ChangeBasis;
|
||||
use App\Enums\ChangeStatus;
|
||||
use App\Enums\DocumentKind;
|
||||
use App\Enums\InquiryAnswer;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\InternalKind;
|
||||
use App\Enums\ProcessingMode;
|
||||
@@ -190,7 +191,7 @@ private function sendOfferAction(): Action
|
||||
return Action::make('sendOffer')
|
||||
->label(fn (): string => match (true) {
|
||||
$this->record->status === BookingStatus::OfferSent => 'Angebot ändern & neu senden',
|
||||
! $this->record->process()->preReservation() => 'Stattdessen verbindliches Angebot mit Reservierung senden',
|
||||
$this->record->process()->inquiryAnswer() === InquiryAnswer::Information => 'Stattdessen verbindliches Angebot mit Reservierung senden',
|
||||
default => 'Angebot prüfen und senden',
|
||||
})
|
||||
->icon(Heroicon::OutlinedPaperAirplane)
|
||||
|
||||
@@ -3,9 +3,13 @@
|
||||
namespace App\Filament\Resources\Channels\Pages;
|
||||
|
||||
use App\Actions\ConfigureChannelProcess;
|
||||
use App\Communication\CommunicationRules;
|
||||
use App\Enums\AdminMode;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\Medium;
|
||||
use App\Enums\MessageEffect;
|
||||
use App\Enums\MessageIntent;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Filament\Resources\Channels\ChannelResource;
|
||||
use App\Models\Booking;
|
||||
@@ -15,9 +19,9 @@
|
||||
use App\Process\ChannelCapabilities;
|
||||
use App\Process\ChannelProcessConfiguration;
|
||||
use App\Process\ConfigurationImpact;
|
||||
use App\Process\Models\ExternalBookingModel;
|
||||
use App\Process\Models\ProcessModel;
|
||||
use App\Process\ProcessCatalogue;
|
||||
use App\Process\ProcessLanes;
|
||||
use App\Process\ProcessProfile;
|
||||
use App\Process\ProcessSettings;
|
||||
use App\Process\Restriction;
|
||||
@@ -243,10 +247,11 @@ public function chooseTemplate(string $area, string $key): void
|
||||
public function applyPreset(string $archetype): void
|
||||
{
|
||||
$presets = $this->presets();
|
||||
$base = app(ProcessCatalogue::class)->model(ExternalBookingModel::key());
|
||||
if (! isset($presets[$archetype]) || ! in_array(IntakeKind::from($this->intake), $base::intakes(), true)) {
|
||||
$composedBy = isset($presets[$archetype]) ? app(ProcessCatalogue::class)->model($archetype)::composedBy() : null;
|
||||
if ($composedBy === null) {
|
||||
return;
|
||||
}
|
||||
$base = app(ProcessCatalogue::class)->model($composedBy);
|
||||
$this->acknowledge = false;
|
||||
$this->drafts[$this->intake]['model'] = $base::key();
|
||||
$this->drafts[$this->intake]['variant'] = 'standard';
|
||||
@@ -254,6 +259,50 @@ public function applyPreset(string $archetype): void
|
||||
$this->drafts[$this->intake]['steps'] = array_intersect_key($this->drafts[$this->intake]['steps'], array_flip($base->modules('standard', $presets[$archetype]['templates'])));
|
||||
}
|
||||
|
||||
/**
|
||||
* The course as the runner executes it: parallel, waiting (with what for), event-driven, time-driven, not applying.
|
||||
*
|
||||
* @return array<string, list<array<string, mixed>>>
|
||||
*/
|
||||
public function lanes(): array
|
||||
{
|
||||
return app(ProcessLanes::class)->of($this->steps());
|
||||
}
|
||||
|
||||
/**
|
||||
* What arrives here and how binding it is (the start of the course).
|
||||
*
|
||||
* @return array{event: string, binding: string, media: list<string>}
|
||||
*/
|
||||
public function entry(): array
|
||||
{
|
||||
$rules = app(CommunicationRules::class);
|
||||
$media = array_values(array_map(fn (Medium $medium): string => $medium->getLabel(), array_filter(Medium::cases(), fn (Medium $medium): bool => $rules->mediumActive($medium))));
|
||||
$booking = $this->intake === IntakeKind::Booking->value;
|
||||
|
||||
return [
|
||||
'event' => $booking ? 'Eine feste Buchung kommt über '.$this->record->name.' an (Portalmail, Kalender).' : ($this->record->isWebsite() ? 'Ein Gast fragt über die Webseite einen Aufenthalt an.' : 'Eine Anfrage kommt über '.$this->record->name.' an.'),
|
||||
'binding' => $booking ? 'Beim Portal bereits verbindlich – wir übernehmen, wir verbinden nichts neu.' : 'Unverbindlich – verbindlich wird sie durch unser Angebot und die Annahme des Gastes.',
|
||||
'media' => $media,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* What a message does here, by its intent – the rules (not a process): a general question creates no case.
|
||||
*
|
||||
* @return list<array{intent: string, effects: list<string>, creates_case: bool}>
|
||||
*/
|
||||
public function messageRules(): array
|
||||
{
|
||||
$rules = app(CommunicationRules::class);
|
||||
|
||||
return array_map(fn (MessageIntent $intent): array => [
|
||||
'intent' => $intent->getLabel(),
|
||||
'effects' => array_map(fn (MessageEffect $effect): string => $effect->getLabel(), $rules->effects(Medium::Email, $intent)),
|
||||
'creates_case' => false,
|
||||
], MessageIntent::cases());
|
||||
}
|
||||
|
||||
/**
|
||||
* What the draft's change of templates means (modules, responsibilities, stored switches and settings).
|
||||
*
|
||||
|
||||
@@ -6,16 +6,15 @@
|
||||
use App\Enums\ChannelBookingModel;
|
||||
use App\Enums\ContractDelivery;
|
||||
use App\Enums\DataRequestMode;
|
||||
use App\Enums\InquiryAnswer;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\ProcessingMode;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Enums\Responsibility;
|
||||
use App\Models\Channel;
|
||||
use App\Process\Models\ExternalBookingModel;
|
||||
use App\Process\Models\ProcessModel;
|
||||
use App\Process\Models\Responsibilities;
|
||||
use App\Process\Templates\FunctionTemplate;
|
||||
use App\Process\Templates\TemplateArea;
|
||||
use App\Process\Templates\TemplateComposer;
|
||||
|
||||
/**
|
||||
@@ -34,13 +33,14 @@ final class ChannelProcessConfiguration
|
||||
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]],
|
||||
'hold' => ['parameters' => [ProcessSetting::PreReservation, ProcessSetting::HoldHours, 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::ContractDelivery, ProcessSetting::ContractTemplate]],
|
||||
'documents.booking_notice' => ['parameters' => [ProcessSetting::BookingNotice]],
|
||||
'portal.confirmation' => ['parameters' => [ProcessSetting::AwaitPortalConfirmation, ProcessSetting::PortalConfirmationWaitHours]],
|
||||
'arrival.info' => ['performer' => ['field' => 'guest_messages', 'setting' => ProcessSetting::GuestMessages], 'parameters' => [ProcessSetting::ArrivalInfoDaysBefore]],
|
||||
'arrival.info' => ['performer' => ['field' => 'guest_messages', 'setting' => ProcessSetting::ArrivalInfoSender], 'parameters' => [ProcessSetting::ArrivalInfoDaysBefore]],
|
||||
'review.request' => ['performer' => ['field' => 'guest_messages', 'setting' => ProcessSetting::ReviewRequestSender]],
|
||||
];
|
||||
|
||||
public function __construct(private ProcessCatalogue $catalogue, private TemplateComposer $composer) {}
|
||||
@@ -98,7 +98,8 @@ public function modelOptions(Channel $channel, IntakeKind $intake, ?array $capab
|
||||
$capabilities = app(ChannelCapabilities::class)->resolve($channel, $capabilityDraft);
|
||||
$options = [];
|
||||
foreach ($this->catalogue->admissible($intake) as $key => $model) {
|
||||
if ($channel->isWebsite() !== str_starts_with($key, 'a1.')) {
|
||||
// The archetypes of the other way (website: A1, portal: A2) are not offered; the base process fits both.
|
||||
if (($channel->isWebsite() && str_starts_with($key, 'a2.')) || (! $channel->isWebsite() && str_starts_with($key, 'a1.'))) {
|
||||
continue;
|
||||
}
|
||||
$restrictions = [];
|
||||
@@ -152,6 +153,12 @@ public function templateOptions(Channel $channel, ProcessModel $model, ?array $c
|
||||
foreach ($model->slots() as $area) {
|
||||
foreach ($this->catalogue->templates($area) as $key => $class) {
|
||||
$restrictions = $hints = $unconfirmed = [];
|
||||
if (isset($model::templateRestrictions()[$key])) {
|
||||
$restrictions[] = new Restriction(Restriction::BUSINESS, '„'.$class::label().'“ passt nicht zu „'.$model::label().'“: '.$model::templateRestrictions()[$key]);
|
||||
}
|
||||
if ($channel->isWebsite() && in_array(true, $class::capabilityRequirements(), true)) {
|
||||
$restrictions[] = new Restriction(Restriction::BUSINESS, '„'.$class::label().'“ setzt ein Portal voraus; die eigene Webseite hat keines.');
|
||||
}
|
||||
foreach ($class::capabilityRequirements() as $capability => $required) {
|
||||
$actual = $capabilities[$capability] ?? null;
|
||||
$definition = ChannelCapabilities::definitions()[$capability];
|
||||
@@ -197,7 +204,9 @@ public function currentTemplates(Channel $channel, IntakeKind $intake): array
|
||||
return $this->composer->resolve($model, $current['templates']);
|
||||
}
|
||||
|
||||
return $model::presetTemplates() === [] ? [] : $this->composer->resolve($this->catalogue->model(ExternalBookingModel::key()), $model::presetTemplates());
|
||||
$base = $model::composedBy();
|
||||
|
||||
return $base === null || $model::presetTemplates() === [] ? [] : $this->composer->resolve($this->catalogue->model($base), $model::presetTemplates());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -260,10 +269,12 @@ public function conflicts(Channel $channel, IntakeKind $intake, string $modelKey
|
||||
|
||||
// A model with slots does not narrow the guest communication itself: the portal's capability does.
|
||||
$messages = $model->slots() === [] ? null : (app(ChannelCapabilities::class)->resolve($channel)[ChannelCapabilities::MESSAGES_GUEST] ?? null);
|
||||
$storedMessages = ProcessSetting::GuestMessages->normalize($stored[ProcessSetting::GuestMessages->value] ?? null);
|
||||
if ($messages !== null && $messages->isKnown() && $messages->value === false && $storedMessages === Responsibility::Portal->value) {
|
||||
$conflicts[] = ['setting' => ProcessSetting::GuestMessages, 'stored' => ProcessSetting::GuestMessages->describe($storedMessages), 'fixed' => ProcessSetting::GuestMessages->describe(Responsibility::Landlord->value),
|
||||
'text' => ProcessSetting::GuestMessages->question().' Bisher eingestellt: „'.ProcessSetting::GuestMessages->describe($storedMessages).'“. Laut Fähigkeit des Portals schreibt es den Gast aber nicht an; künftig: „'.ProcessSetting::GuestMessages->describe(Responsibility::Landlord->value).'“.'];
|
||||
foreach ($model->slots() === [] ? [] : [ProcessSetting::GuestMessages, ProcessSetting::ArrivalInfoSender, ProcessSetting::ReviewRequestSender] as $sender) {
|
||||
$storedSender = $sender->normalize($stored[$sender->value] ?? null);
|
||||
if ($messages !== null && $messages->isKnown() && $messages->value === false && $storedSender === Responsibility::Portal->value) {
|
||||
$conflicts[] = ['setting' => $sender, 'stored' => $sender->describe($storedSender), 'fixed' => $sender->describe(Responsibility::Landlord->value),
|
||||
'text' => $sender->question().' Bisher eingestellt: „'.$sender->describe($storedSender).'“. Laut Fähigkeit des Portals schreibt es den Gast aber nicht an; künftig: „'.$sender->describe(Responsibility::Landlord->value).'“.'];
|
||||
}
|
||||
}
|
||||
|
||||
return $conflicts;
|
||||
@@ -382,11 +393,11 @@ public function preview(Channel $channel, IntakeKind $intake, array $draft): arr
|
||||
$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 === 'hold' && ! $profile->preReservation() => 'keine Reservierung bei der Anfrage',
|
||||
$key === 'offer.information' && $profile->inquiryAnswer() === InquiryAnswer::Offer => 'nicht bei verbindlichem Angebot',
|
||||
$key === 'offer.binding' && $profile->inquiryAnswer() === InquiryAnswer::Information => '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 === 'review.request' && $profile->reviewRequestSender() !== Responsibility::Landlord => 'die Bewertungsbitte kommt nicht von uns',
|
||||
$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,
|
||||
};
|
||||
@@ -394,7 +405,8 @@ public function preview(Channel $channel, IntakeKind $intake, array $draft): arr
|
||||
$performer = match ($key) {
|
||||
'documents.send' => $profile->documents()->value,
|
||||
'payments.monitor' => $profile->payments()->value,
|
||||
'arrival.info' => $profile->guestMessages()->value,
|
||||
'arrival.info' => $profile->arrivalInfoSender()->value,
|
||||
'review.request' => $profile->reviewRequestSender()->value,
|
||||
default => $definition->performers[0] ?? null,
|
||||
};
|
||||
$rows[] = ['module' => $key, 'label' => $definition->label, 'phase' => $definition->phase, 'on' => $on && $reason === null, 'reason' => $reason,
|
||||
@@ -486,15 +498,20 @@ private function templateProblems(Channel $channel, ProcessModel $model, array $
|
||||
foreach ($options[$area][$class::key()]['restrictions'] ?? [] as $restriction) {
|
||||
$problems[] = $restriction->text();
|
||||
}
|
||||
$setting = TemplateArea::from($area)->setting();
|
||||
$value = $setting->normalize($draft['settings'][$setting->value] ?? null);
|
||||
if ($value !== null && (string) $value !== $class::responsibility()->value) {
|
||||
$problems[] = $setting->question().' „'.$setting->describe($value).'“ widerspricht der Schablone „'.$class::label().'“ ('.$setting->describe($class::responsibility()->value).').';
|
||||
foreach ($class::fixes() as $key => $fixed) {
|
||||
$setting = ProcessSetting::tryFrom($key);
|
||||
$value = $setting?->normalize($draft['settings'][$key] ?? null);
|
||||
$fixedValue = $setting?->normalize($fixed) ?? $fixed;
|
||||
if ($setting !== null && $value !== null && (string) $value !== (string) $fixedValue) {
|
||||
$problems[] = $setting->question().' „'.$setting->describe($value).'“ widerspricht der Schablone „'.$class::label().'“ ('.$setting->describe($fixedValue).').';
|
||||
}
|
||||
}
|
||||
}
|
||||
$messages = app(ChannelCapabilities::class)->resolve($channel, $capabilities)[ChannelCapabilities::MESSAGES_GUEST] ?? null;
|
||||
if (($draft['settings'][ProcessSetting::GuestMessages->value] ?? null) === Responsibility::Portal->value && $messages !== null && $messages->isKnown() && $messages->value === false) {
|
||||
$problems[] = 'Gastkommunikation durch das Portal ist eingestellt, das Portal schreibt den Gast laut bestätigter Fähigkeit aber nicht an.';
|
||||
foreach ([ProcessSetting::GuestMessages, ProcessSetting::ArrivalInfoSender, ProcessSetting::ReviewRequestSender] as $sender) {
|
||||
if (($draft['settings'][$sender->value] ?? null) === Responsibility::Portal->value && $messages !== null && $messages->isKnown() && $messages->value === false) {
|
||||
$problems[] = $sender->question().' „Das Portal“ ist eingestellt, das Portal schreibt den Gast laut Fähigkeit aber nicht an.';
|
||||
}
|
||||
}
|
||||
|
||||
return $problems;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Models\Channel;
|
||||
use App\Process\Modules\ModuleDefinition;
|
||||
use App\Process\Templates\TemplateComposer;
|
||||
@@ -95,7 +96,23 @@ public function ofTemplates(Channel $channel, IntakeKind $intake, array $draft):
|
||||
$after = $toClass::modules();
|
||||
$removed = array_values(array_diff($before, $after));
|
||||
$setting = $area->setting();
|
||||
$storedValue = $setting->normalize($stored[$setting->value] ?? null);
|
||||
$changedFixes = [];
|
||||
$replaced = [];
|
||||
foreach ([...array_keys($toClass::fixes()), ...array_keys($toClass::defaults())] as $key) {
|
||||
$changed = ProcessSetting::tryFrom($key);
|
||||
$wanted = $toClass::fixes()[$key] ?? $toClass::defaults()[$key];
|
||||
$previous = $fromClass === null ? null : ($fromClass::fixes()[$key] ?? $fromClass::defaults()[$key] ?? null);
|
||||
if ($changed === null) {
|
||||
continue;
|
||||
}
|
||||
if ($previous !== null && (string) $changed->normalize($previous) !== (string) $changed->normalize($wanted)) {
|
||||
$changedFixes[] = $changed->question().' '.$changed->describe($changed->normalize($previous)).' → '.$changed->describe($changed->normalize($wanted)).(array_key_exists($key, $toClass::fixes()) ? '' : ' (nur ein Vorschlag – ausdrücklich gesetzte Werte bleiben)');
|
||||
}
|
||||
$storedValue = $changed->normalize($stored[$key] ?? null);
|
||||
if (array_key_exists($key, $toClass::fixes()) && $storedValue !== null && (string) $storedValue !== (string) $changed->normalize($wanted)) {
|
||||
$replaced[] = $changed->question().' Bisher gespeichert: „'.$changed->describe($storedValue).'“, künftig durch die Schablone: „'.$changed->describe($changed->normalize($wanted)).'“. Der gespeicherte Wert muss beim Speichern ausdrücklich entfernt werden.';
|
||||
}
|
||||
}
|
||||
|
||||
$impacts[] = [
|
||||
'area' => $area->label(),
|
||||
@@ -107,10 +124,9 @@ public function ofTemplates(Channel $channel, IntakeKind $intake, array $draft):
|
||||
'responsibility' => $fromClass !== null && $fromClass::responsibility() !== $toClass::responsibility()
|
||||
? ['from' => $setting->describe($fromClass::responsibility()->value), 'to' => $setting->describe($toClass::responsibility()->value)]
|
||||
: null,
|
||||
'changed_settings' => $changedFixes,
|
||||
'switches_lost' => array_map($labelOf, array_values(array_filter($removed, fn (string $module): bool => ($stored['steps'][$module]['on'] ?? true) === false))),
|
||||
'settings_replaced' => $storedValue !== null && (string) $storedValue !== $toClass::responsibility()->value
|
||||
? [$setting->question().' Bisher gespeichert: „'.$setting->describe($storedValue).'“, künftig durch die Schablone: „'.$setting->describe($toClass::responsibility()->value).'“. Der gespeicherte Wert muss beim Speichern ausdrücklich entfernt werden.']
|
||||
: [],
|
||||
'settings_replaced' => $replaced,
|
||||
'needs' => array_map(fn (string $result): string => 'Voraussetzung: '.$result, $toClass::requires()),
|
||||
'extensions' => $toClass::extensions(),
|
||||
];
|
||||
|
||||
@@ -34,6 +34,21 @@ public static function caseTypes(): array
|
||||
return [CaseType::A1];
|
||||
}
|
||||
|
||||
public static function isLegacy(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function composedBy(): ?string
|
||||
{
|
||||
return 'inquiry.request';
|
||||
}
|
||||
|
||||
public static function presetTemplates(): array
|
||||
{
|
||||
return ['inquiry_answer' => 'inquiry.information'];
|
||||
}
|
||||
|
||||
public static function fixes(): array
|
||||
{
|
||||
return ['pre_reservation' => false];
|
||||
|
||||
@@ -34,6 +34,21 @@ public static function caseTypes(): array
|
||||
return [CaseType::A1];
|
||||
}
|
||||
|
||||
public static function isLegacy(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function composedBy(): ?string
|
||||
{
|
||||
return 'inquiry.request';
|
||||
}
|
||||
|
||||
public static function presetTemplates(): array
|
||||
{
|
||||
return ['inquiry_answer' => 'inquiry.binding_offer'];
|
||||
}
|
||||
|
||||
public static function fixes(): array
|
||||
{
|
||||
return ['pre_reservation' => true];
|
||||
|
||||
@@ -35,6 +35,21 @@ public static function caseTypes(): array
|
||||
return [CaseType::A2];
|
||||
}
|
||||
|
||||
public static function isLegacy(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function composedBy(): ?string
|
||||
{
|
||||
return 'inquiry.request';
|
||||
}
|
||||
|
||||
public static function presetTemplates(): array
|
||||
{
|
||||
return ['inquiry_answer' => 'inquiry.information'];
|
||||
}
|
||||
|
||||
public static function fixes(): array
|
||||
{
|
||||
return ['pre_reservation' => false];
|
||||
|
||||
@@ -35,6 +35,21 @@ public static function caseTypes(): array
|
||||
return [CaseType::A2];
|
||||
}
|
||||
|
||||
public static function isLegacy(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function composedBy(): ?string
|
||||
{
|
||||
return 'inquiry.request';
|
||||
}
|
||||
|
||||
public static function presetTemplates(): array
|
||||
{
|
||||
return ['inquiry_answer' => 'inquiry.binding_offer'];
|
||||
}
|
||||
|
||||
public static function fixes(): array
|
||||
{
|
||||
return ['pre_reservation' => true];
|
||||
|
||||
@@ -53,6 +53,11 @@ public static function isLegacy(): bool
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function composedBy(): ?string
|
||||
{
|
||||
return 'external.booking';
|
||||
}
|
||||
|
||||
public static function presetTemplates(): array
|
||||
{
|
||||
return ['collection' => 'collection.own', 'contract_documents' => 'contract_docs.own'];
|
||||
|
||||
@@ -53,6 +53,11 @@ public static function isLegacy(): bool
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function composedBy(): ?string
|
||||
{
|
||||
return 'external.booking';
|
||||
}
|
||||
|
||||
public static function presetTemplates(): array
|
||||
{
|
||||
return ['collection' => 'collection.portal', 'contract_documents' => 'contract_docs.own'];
|
||||
|
||||
@@ -53,6 +53,11 @@ public static function isLegacy(): bool
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function composedBy(): ?string
|
||||
{
|
||||
return 'external.booking';
|
||||
}
|
||||
|
||||
public static function presetTemplates(): array
|
||||
{
|
||||
return ['collection' => 'collection.portal', 'contract_documents' => 'contract_docs.external'];
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
class ExternalBookingModel extends ProcessModel
|
||||
{
|
||||
/** Results the base process provides to the templates. */
|
||||
public const PROVIDES = ['case.recorded', 'guest.identified', 'binding.portal_total'];
|
||||
public const PROVIDES = ['case.recorded', 'guest.identified', 'binding.portal_total', 'price.known'];
|
||||
|
||||
public static function key(): string
|
||||
{
|
||||
@@ -76,6 +76,7 @@ public static function defaultTemplates(): array
|
||||
return [
|
||||
TemplateArea::Collection->value => 'collection.own',
|
||||
TemplateArea::ContractDocuments->value => 'contract_docs.own',
|
||||
TemplateArea::GuestCommunication->value => 'guest_comm.own',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -93,8 +94,7 @@ public function steps(): array
|
||||
Step::slot(TemplateArea::Collection),
|
||||
Step::module('case.tasks'),
|
||||
Step::module('change.proposal'),
|
||||
Step::module('arrival.details'),
|
||||
Step::module('arrival.info'),
|
||||
Step::slot(TemplateArea::GuestCommunication),
|
||||
Step::module('guest.data_request'),
|
||||
Step::point(Point::BeforeStay),
|
||||
Step::module('stay'),
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Models;
|
||||
|
||||
use App\Enums\CaseType;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\Responsibility;
|
||||
use App\Process\Templates\TemplateArea;
|
||||
|
||||
/**
|
||||
* The base process of a request (own website, portal inquiry, phone, e-mail) – the one course A1 and A2 shared, with
|
||||
* slots for how it is answered (information or binding offer), the contract documentation, the collection and the
|
||||
* guest communication. A1/A2 stay as presets, classification and for historical cases. The reservation is not part
|
||||
* of the answer template: the hold module and the reservation setting stay independent of it (docs/Prozessarchitektur/
|
||||
* SCHABLONENKATALOG.md §4.3).
|
||||
*/
|
||||
class InquiryRequestModel extends ProcessModel
|
||||
{
|
||||
/** Results the base process provides to the templates. */
|
||||
public const PROVIDES = ['case.recorded', 'guest.identified', 'availability.checked', 'price.known'];
|
||||
|
||||
public static function key(): string
|
||||
{
|
||||
return 'inquiry.request';
|
||||
}
|
||||
|
||||
public static function version(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Anfrage';
|
||||
}
|
||||
|
||||
public static function description(): string
|
||||
{
|
||||
return 'Eine Anfrage – von der eigenen Webseite oder einem Portal. Sie wählen, womit Sie antworten (Auskunft oder verbindliches Angebot) und wer wem schreibt; Datenbeschaffung und Reservierung laufen unabhängig davon.';
|
||||
}
|
||||
|
||||
public static function caseTypes(): array
|
||||
{
|
||||
return [CaseType::A1, CaseType::A2];
|
||||
}
|
||||
|
||||
public static function intakes(): array
|
||||
{
|
||||
return [IntakeKind::Inquiry];
|
||||
}
|
||||
|
||||
public static function responsibilities(): Responsibilities
|
||||
{
|
||||
return Responsibilities::of(
|
||||
fixed: ['contract' => Responsibility::Landlord, 'collection' => Responsibility::Landlord, 'contract_documents' => Responsibility::Landlord],
|
||||
variable: [
|
||||
'guest_messages' => [Responsibility::Landlord, Responsibility::Portal],
|
||||
'supplementary_documents' => [Responsibility::Landlord, Responsibility::Nobody],
|
||||
'local_services' => [Responsibility::Landlord],
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
public static function providedResults(): array
|
||||
{
|
||||
return self::PROVIDES;
|
||||
}
|
||||
|
||||
public static function templateRestrictions(): array
|
||||
{
|
||||
return [
|
||||
'collection.portal' => 'Bei einer Anfrage schließen wir den Vertrag selbst (Annahme des Angebots) und kassieren selbst; Inkasso beim Portal gibt es nur bei bereits verbindlich gebuchten Portalbuchungen.',
|
||||
'contract_docs.external' => 'Bei einer Anfrage entsteht der Vertrag erst durch unser Angebot und die Annahme des Gastes; das Portal kann keine Vertragsunterlagen dafür bereitstellen.',
|
||||
];
|
||||
}
|
||||
|
||||
public static function defaultTemplates(): array
|
||||
{
|
||||
return [
|
||||
TemplateArea::InquiryAnswer->value => 'inquiry.binding_offer',
|
||||
TemplateArea::ContractDocuments->value => 'contract_docs.own',
|
||||
TemplateArea::Collection->value => 'collection.own',
|
||||
TemplateArea::GuestCommunication->value => 'guest_comm.own',
|
||||
];
|
||||
}
|
||||
|
||||
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::slot(TemplateArea::InquiryAnswer),
|
||||
Step::point(Point::BeforePriceFixing),
|
||||
Step::module('offer.binding'),
|
||||
Step::point(Point::BeforeBindingOffer),
|
||||
Step::module('offer.acceptance'),
|
||||
Step::point(Point::AfterBinding),
|
||||
Step::slot(TemplateArea::ContractDocuments),
|
||||
Step::module('channels.block'),
|
||||
Step::slot(TemplateArea::Collection),
|
||||
Step::module('case.tasks'),
|
||||
Step::module('change.proposal'),
|
||||
Step::slot(TemplateArea::GuestCommunication),
|
||||
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'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* The extension variants of the architecture proof (tester only), as on the former offer model.
|
||||
*
|
||||
* @return list<Variant>
|
||||
*/
|
||||
public function variants(): array
|
||||
{
|
||||
return [
|
||||
Variant::make('standard', 'Standard'),
|
||||
Variant::make('loyalty', 'Mit Stammgastrabatt (Architekturnachweis, nur im Prozess-Tester)')
|
||||
->testerOnly()
|
||||
->insert(Point::AfterGuestIdentified, 'guest.loyalty_status')
|
||||
->insert(Point::BeforePriceFixing, 'pricing.loyalty_discount'),
|
||||
Variant::make('address_check', 'Mit Anschriftsprüfung (Zusatzschritt, nur im Prozess-Tester)')
|
||||
->testerOnly()
|
||||
->insert(Point::AfterGuestIdentified, 'guest.address_check'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -85,6 +85,24 @@ public function slots(): array
|
||||
return array_values(array_map(fn (Step $step): TemplateArea => $step->slot, array_filter($this->steps(), fn (Step $step): bool => $step->isSlot())));
|
||||
}
|
||||
|
||||
/**
|
||||
* Templates a model does not take, with the business reason (template key => reason). Everything not listed fits.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function templateRestrictions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* For a legacy model: the key of the base process whose template combination it reproduces.
|
||||
*/
|
||||
public static function composedBy(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The results the base course provides to the templates of its slots (see FunctionTemplate::requires()).
|
||||
*
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\InquiryAnswer;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Enums\Responsibility;
|
||||
use App\Models\DataRequest;
|
||||
@@ -49,7 +50,7 @@ public function applies(CaseContext $case): bool
|
||||
{
|
||||
$profile = $case->profile;
|
||||
|
||||
return $case->inquiry || $profile->documents() === Responsibility::Landlord || $profile->guestMessages() === Responsibility::Landlord || $profile->payments() === Responsibility::Landlord;
|
||||
return $case->inquiry || $profile->documents() === Responsibility::Landlord || $profile->guestMessages() === Responsibility::Landlord || $profile->arrivalInfoSender() === Responsibility::Landlord || $profile->reviewRequestSender() === Responsibility::Landlord || $profile->payments() === Responsibility::Landlord;
|
||||
}
|
||||
|
||||
public function activities(CaseContext $case): array
|
||||
@@ -58,7 +59,7 @@ public function activities(CaseContext $case): array
|
||||
$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;
|
||||
$action = $profile->inquiryAnswer() === InquiryAnswer::Offer || $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();
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\InquiryAnswer;
|
||||
use App\Enums\ProcessingMode;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Process\Activity;
|
||||
@@ -59,7 +60,7 @@ public static function definition(): ModuleDefinition
|
||||
/** The binding way: the request reserves (pre-reservation) or an offer was made anyway. */
|
||||
public function applies(CaseContext $case): bool
|
||||
{
|
||||
return $case->inquiry && ! ($case->profile->preReservation() === false && $case->booking->offer_version === 0);
|
||||
return $case->inquiry && ! ($case->profile->inquiryAnswer() === InquiryAnswer::Information && $case->booking->offer_version === 0);
|
||||
}
|
||||
|
||||
public function activities(CaseContext $case): array
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\InquiryAnswer;
|
||||
use App\Enums\ProcessingMode;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Process\Activity;
|
||||
@@ -49,7 +50,7 @@ public static function definition(): ModuleDefinition
|
||||
|
||||
public function applies(CaseContext $case): bool
|
||||
{
|
||||
return $case->inquiry && ! $case->profile->preReservation() && $case->booking->offer_version === 0;
|
||||
return $case->inquiry && $case->profile->inquiryAnswer() === InquiryAnswer::Information && $case->booking->offer_version === 0;
|
||||
}
|
||||
|
||||
public function activities(CaseContext $case): array
|
||||
|
||||
@@ -34,7 +34,7 @@ public static function definition(): ModuleDefinition
|
||||
effects: ['guest_mail'],
|
||||
waits: ['time', 'portal'],
|
||||
triggers: ['schedule:reminders'],
|
||||
parameters: [ProcessSetting::GuestMessages, ProcessSetting::ArrivalInfoDaysBefore],
|
||||
parameters: [ProcessSetting::ArrivalInfoSender, ProcessSetting::ArrivalInfoDaysBefore],
|
||||
performers: ['system', 'portal', 'service_provider'],
|
||||
events: ['document', 'mail'],
|
||||
);
|
||||
@@ -45,7 +45,7 @@ public function activities(CaseContext $case): array
|
||||
$booking = $case->booking;
|
||||
$profile = $case->profile;
|
||||
|
||||
return [$profile->guestMessages() === Responsibility::Portal
|
||||
return [$profile->arrivalInfoSender() === 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')];
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\Execution;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Enums\Responsibility;
|
||||
use App\Process\Activity;
|
||||
use App\Process\CaseContext;
|
||||
@@ -35,6 +36,7 @@ public static function definition(): ModuleDefinition
|
||||
waits: ['time'],
|
||||
triggers: ['schedule:reviews'],
|
||||
toggle: ModuleDefinition::TOGGLE_OPTIONAL,
|
||||
parameters: [ProcessSetting::ReviewRequestSender],
|
||||
performers: ['system'],
|
||||
events: ['mail'],
|
||||
);
|
||||
@@ -42,7 +44,7 @@ public static function definition(): ModuleDefinition
|
||||
|
||||
public function applies(CaseContext $case): bool
|
||||
{
|
||||
return $case->profile->guestMessages() === Responsibility::Landlord && ! $case->booking->isInternal();
|
||||
return $case->profile->reviewRequestSender() === Responsibility::Landlord && ! $case->booking->isInternal();
|
||||
}
|
||||
|
||||
public function activities(CaseContext $case): array
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Process;
|
||||
|
||||
use App\Enums\CaseType;
|
||||
use App\Enums\InquiryAnswer;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Process\Models\ProcessModel;
|
||||
use App\Process\Modules\ProcessModule;
|
||||
@@ -154,7 +155,7 @@ 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::Inquiry => ($profile->caseType === CaseType::A2 ? 'a2' : 'a1').($profile->inquiryAnswer() === InquiryAnswer::Offer ? '.offer' : '.information'),
|
||||
IntakeKind::Booking => match ($profile->caseType) {
|
||||
CaseType::A5 => 'a5.portal_booking',
|
||||
CaseType::A4 => 'a4.portal_booking',
|
||||
@@ -213,8 +214,14 @@ public function problems(): array
|
||||
if (! in_array($class::area()->result(), $class::provides(), true)) {
|
||||
$problems[] = "Schablone {$class::reference()}: liefert das Ergebnis ihres Bereichs ({$class::area()->result()}) nicht.";
|
||||
}
|
||||
if ($class::fixes() === [] || array_keys($class::fixes()) !== [$class::area()->setting()->value]) {
|
||||
$problems[] = "Schablone {$class::reference()}: darf nur die Verantwortlichkeit ihres Bereichs festlegen.";
|
||||
$allowed = array_map(fn ($setting): string => $setting->value, $class::area()->settings());
|
||||
if (array_diff([...array_keys($class::fixes()), ...array_keys($class::defaults())], $allowed) !== []) {
|
||||
$problems[] = "Schablone {$class::reference()}: darf nur Einstellungen ihres Bereichs ({$class::area()->label()}) festlegen oder vorschlagen.";
|
||||
}
|
||||
foreach ($class::configures() as $module) {
|
||||
if (! $this->hasModule($module)) {
|
||||
$problems[] = "Schablone {$class::reference()}: konfiguriertes Modul {$module} ist nicht registriert.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process;
|
||||
|
||||
use App\Process\Modules\ModuleDefinition;
|
||||
|
||||
/**
|
||||
* The course of a resolved plan as the runner executes it: which steps start at once and run in parallel, which wait
|
||||
* for others, which are conditional, event-driven or time-driven. Derived only from the same facts the
|
||||
* {@see ProcessRunner} uses – the hard dependencies among the steps that are in the plan and apply, `applies()` (as the
|
||||
* preview row's reason), the trigger kinds and what a step waits for. No grouping by phase, no hand-written text.
|
||||
* Pure: it reads, it never changes anything.
|
||||
*/
|
||||
final class ProcessLanes
|
||||
{
|
||||
public function __construct(private ProcessCatalogue $catalogue) {}
|
||||
|
||||
/**
|
||||
* @param list<array{module: string, label: string, on: bool, reason: ?string}> $rows the preview rows of a draft (ChannelProcessConfiguration::preview)
|
||||
* @return array{parallel: list<array{module: string, label: string, note: ?string}>, waiting: list<array{module: string, label: string, note: ?string, after: list<string>}>, event: list<array{module: string, label: string, note: ?string}>, later: list<array{module: string, label: string, note: ?string}>, off: list<array{module: string, label: string, note: ?string}>}
|
||||
*/
|
||||
public function of(array $rows): array
|
||||
{
|
||||
$active = [];
|
||||
foreach ($rows as $row) {
|
||||
if ($row['on']) {
|
||||
$active[$row['module']] = $row['label'];
|
||||
}
|
||||
}
|
||||
$lanes = ['parallel' => [], 'waiting' => [], 'event' => [], 'later' => [], 'off' => []];
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$definition = $this->catalogue->modules()[$row['module']]::definition();
|
||||
if (! $row['on']) {
|
||||
$lanes['off'][] = ['module' => $row['module'], 'label' => $row['label'], 'note' => $row['reason']];
|
||||
|
||||
continue;
|
||||
}
|
||||
if ($row['module'] === 'intake.record') {
|
||||
continue;
|
||||
}
|
||||
$hard = array_values(array_map(fn ($dependency): string => $active[$dependency->module], array_filter($definition->requires, fn ($dependency): bool => $dependency->hard && $dependency->module !== 'intake.record' && isset($active[$dependency->module]))));
|
||||
$item = ['module' => $row['module'], 'label' => $row['label'], 'note' => $this->note($definition)];
|
||||
|
||||
$lanes[match (true) {
|
||||
$hard !== [] => 'waiting',
|
||||
$definition->toggle === ModuleDefinition::TOGGLE_EVENT_DRIVEN => 'event',
|
||||
$definition->triggers !== [] && collect($definition->triggers)->every(fn (string $trigger): bool => str_starts_with($trigger, 'schedule:')) => 'later',
|
||||
default => 'parallel',
|
||||
}][] = $hard !== [] ? [...$item, 'after' => $hard] : $item;
|
||||
}
|
||||
|
||||
return $lanes;
|
||||
}
|
||||
|
||||
private function note(ModuleDefinition $definition): ?string
|
||||
{
|
||||
$waits = array_map(fn (string $wait): string => ['guest' => 'den Gast', 'portal' => 'das Portal', 'landlord' => 'Sie', 'time' => 'eine Frist'][$wait] ?? $wait, $definition->waits);
|
||||
|
||||
return $waits === [] ? null : 'kann warten auf '.implode(', ', $waits);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
use App\Enums\CaseType;
|
||||
use App\Enums\ContractDelivery;
|
||||
use App\Enums\DataRequestMode;
|
||||
use App\Enums\InquiryAnswer;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\ProcessingMode;
|
||||
use App\Enums\ProcessSetting;
|
||||
@@ -35,6 +36,12 @@ final class ProcessProfile
|
||||
/** Fixed by a function template chosen for the channel (Schablonenkomposition). */
|
||||
public const TEMPLATE = 'template';
|
||||
|
||||
/** Suggested by a function template (lowest level above the built-in default; every explicit level wins). */
|
||||
public const TEMPLATE_DEFAULT = 'template_default';
|
||||
|
||||
/** Not set anywhere: derived from a related setting (the answer from the reservation, a sender from guest_messages). */
|
||||
public const DERIVED = 'derived';
|
||||
|
||||
/** Fixed by the case type (A6), not settable. */
|
||||
public const CASE_TYPE = 'case_type';
|
||||
|
||||
@@ -108,6 +115,27 @@ public function payments(): Responsibility
|
||||
return Responsibility::tryFrom((string) $this->value(ProcessSetting::Payments)) ?? Responsibility::Landlord;
|
||||
}
|
||||
|
||||
/**
|
||||
* How a request is answered first. Profiles frozen before the setting existed derive it from the reservation (an
|
||||
* information reserved nothing, an offer did) – exactly the former behaviour.
|
||||
*/
|
||||
public function inquiryAnswer(): InquiryAnswer
|
||||
{
|
||||
return InquiryAnswer::tryFrom((string) ($this->values[ProcessSetting::InquiryAnswer->value] ?? '')) ?? ($this->preReservation() ? InquiryAnswer::Offer : InquiryAnswer::Information);
|
||||
}
|
||||
|
||||
/** Who sends the arrival information; not set: whoever writes to the guest (guest_messages). */
|
||||
public function arrivalInfoSender(): Responsibility
|
||||
{
|
||||
return Responsibility::tryFrom((string) ($this->values[ProcessSetting::ArrivalInfoSender->value] ?? '')) ?? $this->guestMessages();
|
||||
}
|
||||
|
||||
/** Who asks for the review; not set: whoever writes to the guest (guest_messages). */
|
||||
public function reviewRequestSender(): Responsibility
|
||||
{
|
||||
return Responsibility::tryFrom((string) ($this->values[ProcessSetting::ReviewRequestSender->value] ?? '')) ?? $this->guestMessages();
|
||||
}
|
||||
|
||||
public function guestMessages(): Responsibility
|
||||
{
|
||||
return Responsibility::tryFrom((string) $this->value(ProcessSetting::GuestMessages)) ?? Responsibility::Landlord;
|
||||
@@ -199,6 +227,8 @@ public static function sourceLabel(string $source): string
|
||||
self::CASE_TYPE => 'fest für diese Vorgangsart',
|
||||
self::MODEL => 'festgelegt durch das gewählte Ablaufmodell',
|
||||
self::TEMPLATE => 'festgelegt durch die gewählte Funktionsschablone',
|
||||
self::TEMPLATE_DEFAULT => 'Vorschlag der gewählten Funktionsschablone',
|
||||
self::DERIVED => 'abgeleitet aus einer verwandten Einstellung',
|
||||
'migration' => 'aus dem bisherigen Stand übernommen',
|
||||
default => 'Grundeinstellung',
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Process;
|
||||
|
||||
use App\Enums\ChannelBookingModel;
|
||||
use App\Enums\InquiryAnswer;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Enums\Responsibility;
|
||||
@@ -34,11 +35,23 @@ public function resolve(Property $property, ?Channel $channel, IntakeKind $intak
|
||||
($channel?->isWebsite() ? ProcessProfile::WEBSITE : ProcessProfile::CHANNEL) => $intake === IntakeKind::Internal || $channel === null ? [] : (array) (($channel->process_overrides ?? [])[$intake->value] ?? []),
|
||||
];
|
||||
|
||||
$model = $this->chosenModel($channel, $intake);
|
||||
$templates = $this->chosenTemplates($channel, $intake, $model);
|
||||
$suggested = [];
|
||||
foreach ($templates as $class) {
|
||||
$suggested = [...$suggested, ...$class::defaults()];
|
||||
}
|
||||
|
||||
$values = [];
|
||||
$sources = [];
|
||||
foreach (ProcessSetting::cases() as $setting) {
|
||||
$values[$setting->value] = $setting->default();
|
||||
$sources[$setting->value] = ProcessProfile::SYSTEM;
|
||||
// A function template only suggests: below every level the landlord can set.
|
||||
if (($suggestion = $setting->normalize($suggested[$setting->value] ?? null)) !== null) {
|
||||
$values[$setting->value] = $suggestion;
|
||||
$sources[$setting->value] = ProcessProfile::TEMPLATE_DEFAULT;
|
||||
}
|
||||
|
||||
foreach ($levels as $level => $settings) {
|
||||
if (in_array($level, [ProcessProfile::CHANNEL, ProcessProfile::WEBSITE], true) && ! in_array($intake, $setting->channelIntakes(), true)) {
|
||||
@@ -54,7 +67,6 @@ 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) {
|
||||
@@ -64,9 +76,9 @@ public function resolve(Property $property, ?Channel $channel, IntakeKind $intak
|
||||
}
|
||||
|
||||
// Function templates chosen for the model's slots fix the responsibility of their area.
|
||||
foreach ($this->chosenTemplates($channel, $intake, $model) as $class) {
|
||||
foreach ($templates as $class) {
|
||||
foreach ($class::fixes() as $key => $fixed) {
|
||||
$values[$key] = $fixed;
|
||||
$values[$key] = ProcessSetting::tryFrom($key)?->normalize($fixed) ?? $fixed;
|
||||
$sources[$key] = ProcessProfile::TEMPLATE;
|
||||
}
|
||||
}
|
||||
@@ -84,6 +96,18 @@ public function resolve(Property $property, ?Channel $channel, IntakeKind $intak
|
||||
$sources[ProcessSetting::Documents->value] = ProcessProfile::SYSTEM;
|
||||
}
|
||||
|
||||
// What was set nowhere follows the related setting, as it always did.
|
||||
foreach ([ProcessSetting::ArrivalInfoSender, ProcessSetting::ReviewRequestSender] as $sender) {
|
||||
if ($values[$sender->value] === null && $intake !== IntakeKind::Internal) {
|
||||
$values[$sender->value] = $values[ProcessSetting::GuestMessages->value];
|
||||
$sources[$sender->value] = ProcessProfile::DERIVED;
|
||||
}
|
||||
}
|
||||
if ($values[ProcessSetting::InquiryAnswer->value] === null && $intake === IntakeKind::Inquiry) {
|
||||
$values[ProcessSetting::InquiryAnswer->value] = $values[ProcessSetting::PreReservation->value] ? InquiryAnswer::Offer->value : InquiryAnswer::Information->value;
|
||||
$sources[ProcessSetting::InquiryAnswer->value] = ProcessProfile::DERIVED;
|
||||
}
|
||||
|
||||
$documents = Responsibility::from((string) $values[ProcessSetting::Documents->value]);
|
||||
$payments = Responsibility::from((string) $values[ProcessSetting::Payments->value]);
|
||||
|
||||
|
||||
@@ -30,8 +30,11 @@ abstract public static function purpose(): string;
|
||||
*/
|
||||
abstract public static function modules(): array;
|
||||
|
||||
/** Who answers for the result of the area. It becomes the value of the area's responsibility setting. */
|
||||
abstract public static function responsibility(): Responsibility;
|
||||
/** Who answers for the result of the area (we, unless the template hands it to the portal). */
|
||||
public static function responsibility(): Responsibility
|
||||
{
|
||||
return Responsibility::Landlord;
|
||||
}
|
||||
|
||||
/**
|
||||
* The portal capability that must hold for the template to fit: capability key => required value (the channel's
|
||||
@@ -64,6 +67,27 @@ public static function provides(): array
|
||||
return [static::area()->result()];
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard configuration the template suggests (setting key => value). It sits below every level the landlord can set
|
||||
* – landlord, property, channel – so it never overrides an explicit value, and every module stays configurable.
|
||||
*
|
||||
* @return array<string, string|int|bool>
|
||||
*/
|
||||
public static function defaults(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Modules outside the template's own slot that its defaults or fixes configure (shown with the template).
|
||||
*
|
||||
* @return list<string>
|
||||
*/
|
||||
public static function configures(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Templates (keys) that must not be combined with this one, with the reason.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Templates;
|
||||
|
||||
/**
|
||||
* A request is answered with a non-binding information; the guest can ask for the booking from it, we check again and
|
||||
* confirm. By definition (DocumentKind::Information) an information reserves nothing, so this template – and only
|
||||
* this one – fixes the reservation to "no". Everything else (processing mode, deadlines, data request) stays free.
|
||||
*/
|
||||
final class InformationAnswer extends FunctionTemplate
|
||||
{
|
||||
public static function key(): string
|
||||
{
|
||||
return 'inquiry.information';
|
||||
}
|
||||
|
||||
public static function version(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static function area(): TemplateArea
|
||||
{
|
||||
return TemplateArea::InquiryAnswer;
|
||||
}
|
||||
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Unverbindliche Auskunft';
|
||||
}
|
||||
|
||||
public static function purpose(): string
|
||||
{
|
||||
return 'Der Gast erhält Preis und Verfügbarkeit zum Stand der Prüfung, ohne Reservierung und ohne Zusage. Er kann daraus die Buchung anfragen; verbindlich wird sie erst mit unserer Bestätigung nach erneuter Prüfung.';
|
||||
}
|
||||
|
||||
public static function modules(): array
|
||||
{
|
||||
return ['offer.information'];
|
||||
}
|
||||
|
||||
public static function requires(): array
|
||||
{
|
||||
return ['guest.identified', 'availability.checked'];
|
||||
}
|
||||
|
||||
public static function fixes(): array
|
||||
{
|
||||
return ['inquiry_answer' => 'information', 'pre_reservation' => false];
|
||||
}
|
||||
|
||||
public static function dimensions(): array
|
||||
{
|
||||
return [
|
||||
'Verbindlichkeit' => 'Keine; der Vertrag entsteht erst nach dem Buchungswunsch und unserer Bestätigung.',
|
||||
'Reservierung' => 'Keine (Festlegung der Auskunft, nicht des Prozesses).',
|
||||
'Ausführung' => 'Automatisch, nach Freigabe oder von Hand (Modul „Unverbindliche Auskunft“).',
|
||||
'Nachweis' => 'Versendete Auskunft mit Version und Stand der Prüfung.',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Templates;
|
||||
|
||||
/**
|
||||
* A request is answered with a binding offer (contract draft, signed link) the guest accepts. The reservation strategy
|
||||
* is not part of the template: it only suggests to reserve at the request (clarification hold, offer hold). Whoever
|
||||
* prefers to offer without holding the dates at the request sets the reservation to "no" – the offer itself still
|
||||
* holds the dates for its validity, and availability is checked before it goes out.
|
||||
*/
|
||||
final class OfferAnswer extends FunctionTemplate
|
||||
{
|
||||
public static function key(): string
|
||||
{
|
||||
return 'inquiry.binding_offer';
|
||||
}
|
||||
|
||||
public static function version(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static function area(): TemplateArea
|
||||
{
|
||||
return TemplateArea::InquiryAnswer;
|
||||
}
|
||||
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Verbindliches Angebot';
|
||||
}
|
||||
|
||||
public static function purpose(): string
|
||||
{
|
||||
return 'Der Gast erhält ein verbindliches Angebot mit Vertragsentwurf und nimmt es mit einem Klick an. Danach ist die Buchung verbindlich.';
|
||||
}
|
||||
|
||||
public static function modules(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public static function requires(): array
|
||||
{
|
||||
return ['guest.identified', 'availability.checked'];
|
||||
}
|
||||
|
||||
public static function fixes(): array
|
||||
{
|
||||
return ['inquiry_answer' => 'offer'];
|
||||
}
|
||||
|
||||
public static function defaults(): array
|
||||
{
|
||||
return ['pre_reservation' => true];
|
||||
}
|
||||
|
||||
public static function dimensions(): array
|
||||
{
|
||||
return [
|
||||
'Verbindlichkeit' => 'Mit der Annahme des Gastes (Annahmeprotokoll).',
|
||||
'Reservierung' => 'Vorschlag: Zeitraum schon bei der Anfrage reservieren; frei einstellbar. Das Angebot hält den Zeitraum in jedem Fall für seine Gültigkeit.',
|
||||
'Ausführung' => 'Automatisch, nach Freigabe oder von Hand; Preisänderungen nur als Anpassungszeile.',
|
||||
'Nachweis' => 'Angebotsversion, Annahme mit Zeitstempel und Prüfsumme.',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public static function capabilityRequirements(): array
|
||||
|
||||
public static function requires(): array
|
||||
{
|
||||
return ['binding.portal_total'];
|
||||
return ['price.known'];
|
||||
}
|
||||
|
||||
public static function provides(): array
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Templates;
|
||||
|
||||
/**
|
||||
* Standard: we write to the guest. It only suggests; each occasion (arrival information, review request) has its own
|
||||
* sender setting and stays individually configurable – there is no all-or-nothing responsibility for guest messages.
|
||||
*/
|
||||
final class OwnGuestCommunication extends FunctionTemplate
|
||||
{
|
||||
public static function key(): string
|
||||
{
|
||||
return 'guest_comm.own';
|
||||
}
|
||||
|
||||
public static function version(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static function area(): TemplateArea
|
||||
{
|
||||
return TemplateArea::GuestCommunication;
|
||||
}
|
||||
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Gastkommunikation durch uns';
|
||||
}
|
||||
|
||||
public static function purpose(): string
|
||||
{
|
||||
return 'Anreise-Informationen und Bewertungsbitte gehen von uns an den Gast. Einzelne Anlässe lassen sich trotzdem dem Portal zuweisen.';
|
||||
}
|
||||
|
||||
public static function modules(): array
|
||||
{
|
||||
return ['arrival.details', 'arrival.info'];
|
||||
}
|
||||
|
||||
public static function configures(): array
|
||||
{
|
||||
return ['review.request'];
|
||||
}
|
||||
|
||||
public static function fixes(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public static function defaults(): array
|
||||
{
|
||||
return ['guest_messages' => 'landlord'];
|
||||
}
|
||||
|
||||
public static function dimensions(): array
|
||||
{
|
||||
return [
|
||||
'Anreise-Information' => 'Von uns, N Tage vor Anreise (einstellbar).',
|
||||
'Bewertungsbitte' => 'Von uns nach dem Aufenthalt.',
|
||||
'Medium' => 'E-Mail (über das Mail-Tor; weitere Medien sind nicht angebunden).',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public static function capabilityRequirements(): array
|
||||
|
||||
public static function requires(): array
|
||||
{
|
||||
return ['binding.portal_total'];
|
||||
return ['price.known'];
|
||||
}
|
||||
|
||||
public static function provides(): array
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Templates;
|
||||
|
||||
use App\Enums\Responsibility;
|
||||
|
||||
/**
|
||||
* Standard: the portal writes to the guest (e.g. FeWo-direkt). Suggests the portal as sender of the arrival information
|
||||
* and the review request; each occasion can still be taken back by us individually. Needs the portal to write to guests.
|
||||
*/
|
||||
final class PortalGuestCommunication extends FunctionTemplate
|
||||
{
|
||||
public static function key(): string
|
||||
{
|
||||
return 'guest_comm.portal';
|
||||
}
|
||||
|
||||
public static function version(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static function area(): TemplateArea
|
||||
{
|
||||
return TemplateArea::GuestCommunication;
|
||||
}
|
||||
|
||||
public static function label(): string
|
||||
{
|
||||
return 'Gastkommunikation durch das Portal';
|
||||
}
|
||||
|
||||
public static function purpose(): string
|
||||
{
|
||||
return 'Das Portal schreibt dem Gast zu Anreise und Bewertung. Wir halten fest, dass es angekündigt ist – eine Zustellung gilt damit nicht als nachgewiesen. Einzelne Anlässe lassen sich trotzdem von uns übernehmen.';
|
||||
}
|
||||
|
||||
public static function modules(): array
|
||||
{
|
||||
return ['arrival.details', 'arrival.info'];
|
||||
}
|
||||
|
||||
public static function configures(): array
|
||||
{
|
||||
return ['review.request'];
|
||||
}
|
||||
|
||||
public static function responsibility(): Responsibility
|
||||
{
|
||||
return Responsibility::Portal;
|
||||
}
|
||||
|
||||
public static function capabilityRequirements(): array
|
||||
{
|
||||
return ['messages_guest' => true];
|
||||
}
|
||||
|
||||
public static function fixes(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public static function defaults(): array
|
||||
{
|
||||
return ['guest_messages' => 'portal', 'arrival_info_sender' => 'portal', 'review_request_sender' => 'portal'];
|
||||
}
|
||||
|
||||
public static function dimensions(): array
|
||||
{
|
||||
return [
|
||||
'Anreise-Information' => 'Durch das Portal (angekündigt, nicht nachgewiesen).',
|
||||
'Bewertungsbitte' => 'Durch das Portal.',
|
||||
'Medium' => 'Das des Portals.',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -12,12 +12,16 @@ enum TemplateArea: string
|
||||
{
|
||||
case Collection = 'collection';
|
||||
case ContractDocuments = 'contract_documents';
|
||||
case InquiryAnswer = 'inquiry_answer';
|
||||
case GuestCommunication = 'guest_communication';
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Collection => 'Finanzabwicklung (Inkasso)',
|
||||
self::ContractDocuments => 'Vertragsdokumentation',
|
||||
self::InquiryAnswer => 'Beantwortung der Anfrage',
|
||||
self::GuestCommunication => 'Gastkommunikation',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -26,6 +30,8 @@ public function question(): string
|
||||
return match ($this) {
|
||||
self::Collection => 'Wer zieht das Geld des Gastes ein?',
|
||||
self::ContractDocuments => 'Wer stellt dem Gast die Vertragsunterlagen bereit?',
|
||||
self::InquiryAnswer => 'Womit antworten wir zuerst auf eine Anfrage?',
|
||||
self::GuestCommunication => 'Wer schreibt dem Gast zu welchem Anlass? (Standard – jeder Anlass bleibt einzeln einstellbar)',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -35,6 +41,8 @@ public function result(): string
|
||||
return match ($this) {
|
||||
self::Collection => 'money.collection_handled',
|
||||
self::ContractDocuments => 'contract.documented',
|
||||
self::InquiryAnswer => 'inquiry.answered',
|
||||
self::GuestCommunication => 'guest.communication_assigned',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -44,6 +52,23 @@ public function setting(): ProcessSetting
|
||||
return match ($this) {
|
||||
self::Collection => ProcessSetting::Payments,
|
||||
self::ContractDocuments => ProcessSetting::Documents,
|
||||
self::InquiryAnswer => ProcessSetting::InquiryAnswer,
|
||||
self::GuestCommunication => ProcessSetting::GuestMessages,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Every setting a template of this area may fix or suggest – nothing else (no hidden coupling to other areas).
|
||||
*
|
||||
* @return list<ProcessSetting>
|
||||
*/
|
||||
public function settings(): array
|
||||
{
|
||||
return match ($this) {
|
||||
self::Collection, self::ContractDocuments => [$this->setting()],
|
||||
// An information reserves nothing by definition; for an offer the reservation is only suggested.
|
||||
self::InquiryAnswer => [ProcessSetting::InquiryAnswer, ProcessSetting::PreReservation],
|
||||
self::GuestCommunication => [ProcessSetting::GuestMessages, ProcessSetting::ArrivalInfoSender, ProcessSetting::ReviewRequestSender],
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,11 @@ public function problems(ProcessModel $model, array $chosen, string $variant = '
|
||||
$classes = [];
|
||||
foreach ($resolved as $area => $reference) {
|
||||
$class = $this->catalogue->templateClass($reference);
|
||||
if ($class !== null && isset($model::templateRestrictions()[$class::key()])) {
|
||||
$problems[] = '„'.$class::label().'“ passt nicht zu „'.$model::label().'“: '.$model::templateRestrictions()[$class::key()];
|
||||
|
||||
continue;
|
||||
}
|
||||
if ($class === null) {
|
||||
$problems[] = 'Die Schablone „'.$reference.'“ gibt es nicht.';
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
use App\Actions\AcceptOffer;
|
||||
use App\Actions\SendOffer;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\InquiryAnswer;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Process\Tester\SandboxContext;
|
||||
|
||||
@@ -40,7 +41,7 @@ public function events(array $inputs): array
|
||||
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()) {
|
||||
if ($booking->status === BookingStatus::Reserved && $booking->offer_version === 0 && $booking->process()->inquiryAnswer() === InquiryAnswer::Offer) {
|
||||
app(SendOffer::class)->handle($booking);
|
||||
}
|
||||
}),
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Actions\SendOffer;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\InquiryAnswer;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Models\Booking;
|
||||
use App\Models\Guest;
|
||||
@@ -55,7 +56,7 @@ public function events(array $inputs): array
|
||||
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()) {
|
||||
if ($booking->status === BookingStatus::Reserved && $booking->offer_version === 0 && $booking->process()->inquiryAnswer() === InquiryAnswer::Offer) {
|
||||
app(SendOffer::class)->handle($booking);
|
||||
}
|
||||
}),
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
'a6.internal' => [1 => Models\A6InternalModel::class],
|
||||
// Base process with slots for function templates; A3–A5 above are its presets (compatibility).
|
||||
'external.booking' => [1 => Models\ExternalBookingModel::class],
|
||||
'inquiry.request' => [1 => Models\InquiryRequestModel::class],
|
||||
],
|
||||
|
||||
/*
|
||||
@@ -86,5 +87,9 @@
|
||||
'collection.portal' => [1 => Templates\PortalCollection::class],
|
||||
'contract_docs.own' => [1 => Templates\OwnContractDocumentation::class],
|
||||
'contract_docs.external' => [1 => Templates\ExternalContractDocuments::class],
|
||||
'inquiry.information' => [1 => Templates\InformationAnswer::class],
|
||||
'inquiry.binding_offer' => [1 => Templates\OfferAnswer::class],
|
||||
'guest_comm.own' => [1 => Templates\OwnGuestCommunication::class],
|
||||
'guest_comm.portal' => [1 => Templates\PortalGuestCommunication::class],
|
||||
],
|
||||
];
|
||||
@@ -2,33 +2,33 @@ # 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 | external.booking | 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` |
|
||||
| `portal.confirmation` | 1 | P02 | conditional | production | intake.record | | | | | ● | ● | ● | | ● | `module:portal.confirmation` |
|
||||
| `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` | 2 | P03 | mandatory | production | guest.details, portal.confirmation | ● | ● | ● | ● | ● | ● | ● | | ● | `module:documents.send` |
|
||||
| `documents.booking_notice` | 1 | P03 | conditional | production | portal.confirmation, guest.details | | | | | ● | ● | ● | | ● | `module:documents.booking_notice` |
|
||||
| `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.address_check` | 1 | P01 | optional | tester_only | guest.details | V | | | | | | | | | `module:guest.address_check` |
|
||||
| `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` |
|
||||
| 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 | external.booking | inquiry.request | 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` |
|
||||
| `portal.confirmation` | 1 | P02 | conditional | production | intake.record | | | | | ● | ● | ● | | ● | | `module:portal.confirmation` |
|
||||
| `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` | 2 | P03 | mandatory | production | guest.details, portal.confirmation | ● | ● | ● | ● | ● | ● | ● | | ● | ● | `module:documents.send` |
|
||||
| `documents.booking_notice` | 1 | P03 | conditional | production | portal.confirmation, guest.details | | | | | ● | ● | ● | | ● | ● | `module:documents.booking_notice` |
|
||||
| `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.address_check` | 1 | P01 | optional | tester_only | guest.details | V | | | | | | | | | V | `module:guest.address_check` |
|
||||
| `guest.loyalty_status` | 1 | P01 | optional | tester_only | guest.details | V | | | | | | | | | V | `module:guest.loyalty_status` |
|
||||
| `pricing.loyalty_discount` | 1 | P02 | optional | tester_only | guest.loyalty_status | V | | | | | | | | | V | `module:pricing.loyalty_discount` |
|
||||
@@ -1,6 +1,6 @@
|
||||
# Schablonenkatalog – alle Geschäftsvorfälle aus Basisprozess, Schablonen und Fachmodulen
|
||||
|
||||
Stand: 05.11.2026 · Grundlage: Prozesslandkarte P01–P05, `MODUL_KONFIGURATIONSMATRIX.md`, Modelle A1–A6, `external.booking@1` ([SCHABLONEN.md](SCHABLONEN.md)), `ProcessRunner`, Prozess-Tester, `CommunicationRules`. Kein Code, keine neue Engine, kein neuer Archetyp. **Gebaut** heißt: im Code vorhanden und getestet; **vorgesehen** heißt: aus vorhandenen Modulen bildbar, aber noch nicht im Code.
|
||||
Stand: 05.11.2026 (Umsetzungsstand siehe Abschnitt 10) · Grundlage: Prozesslandkarte P01–P05, `MODUL_KONFIGURATIONSMATRIX.md`, Modelle A1–A6, `external.booking@1` ([SCHABLONEN.md](SCHABLONEN.md)), `ProcessRunner`, Prozess-Tester, `CommunicationRules`. Kein Code, keine neue Engine, kein neuer Archetyp. **Gebaut** heißt: im Code vorhanden und getestet; **vorgesehen** heißt: aus vorhandenen Modulen bildbar, aber noch nicht im Code.
|
||||
|
||||
## 1. Vier Achsen statt „Kanal = Prozess“
|
||||
|
||||
@@ -153,6 +153,24 @@ ### Referenzfälle
|
||||
- **Website – allgemeine Informationsfrage:** keine Ablaufkarte. Hauptansicht zeigt unter „Nachrichten“: Absicht *Allgemeine Frage* → Antwort mit Information + Prüfung durch Sie; kein Vorgang. (Lücke 7.4.)
|
||||
- **Website – Buchungsanfrage:** Anfrage + `inquiry.binding_offer` (oder *Auskunft*) + `collection.own` + `contract_docs.own` + `guest_comm.own`; Spuren: *sofort parallel* Reservierung (`hold`, überwacht Ablauf) und Datenbeschaffung (wartet auf Gast, Folgefragen, Klärungsfrist); *wartet auf Gast* Angebotsannahme; *danach* Dokumente/Zahlung. Reservierungsüberwachung und Datenbeschaffung blockieren sich nicht, weil beide nur hart an `intake.record` hängen.
|
||||
|
||||
## 9. Ergebnis
|
||||
## 9. Präzisierungen (umgesetzt)
|
||||
|
||||
- **Kommunikation je Anlass, nicht global:** Statt einer Entweder-oder-Zuständigkeit gibt es je Anlass eine eigene Einstellung (`arrival_info_sender`, `review_request_sender`; Datenanfrage und Buchungsinformation hatten ihren eigenen Modus schon). Nicht gesetzt folgen sie dem bisherigen Sammelwert `guest_messages` – so verhalten sich Altfälle und Altkanäle wie zuvor. Die Schablonen `guest_comm.own` / `guest_comm.portal` liefern nur **Standardwerte** (unterste Ebene, jede ausdrücklich gesetzte Einstellung gewinnt) und setzen nichts fest.
|
||||
- **Antwort ≠ Reservierung:** Neu ist die Einstellung `inquiry_answer` (Auskunft/Angebot), gesetzt von der Anfrageschablone. `pre_reservation` bleibt die Reservierungsstrategie (Klärungs- und Anfragereservierung) und ist unabhängig: *Verbindliches Angebot* schlägt „reservieren“ vor, erlaubt aber auch „nicht schon bei der Anfrage reservieren“ (das Angebot hält den Zeitraum trotzdem für seine Gültigkeit; Verfügbarkeit wird vor dem Versand geprüft). *Auskunft* legt „keine Reservierung“ fest – das ist die dokumentierte Definition einer Auskunft (`DocumentKind::Information`), nicht eine Prozessvorgabe.
|
||||
- **Finanz/Dokumente:** unverändert unabhängig; nur Zuständigkeit wird festgelegt, Modus, Versand und Vorlage bleiben am Modul. Im Anfrage-Basisprozess sind Portal-Inkasso und externe Unterlagen mit Begründung ausgeschlossen (`ProcessModel::templateRestrictions`).
|
||||
- **Darstellung aus dem Plan:** `ProcessLanes` leitet „läuft sofort / wartet auf / ereignisgesteuert / zeitgesteuert / entfällt“ aus den tatsächlichen harten Abhängigkeiten, den Auslösern und `applies()` des aufgelösten Plans ab – nicht aus Phasen oder Texten (Test vergleicht mit `ProcessRunner::unmetHardDependencies`).
|
||||
|
||||
## 10. Umsetzungsstand (Branch `feature/anfrage-basisprozess`)
|
||||
|
||||
| Punkt | Stand |
|
||||
|---|---|
|
||||
| Anfrage-Basisprozess `inquiry.request@1` (A1/A2 als Voreinstellung/Klassifikation/Altfassung) | gebaut |
|
||||
| Schablonen `inquiry.information`, `inquiry.binding_offer`, `guest_comm.own`, `guest_comm.portal` | gebaut; `external.booking` hat jetzt ebenfalls den Kommunikationsplatz |
|
||||
| Zulässigkeit je Basisprozess (Lücke 7.2) | gebaut (`templateRestrictions`) |
|
||||
| Nachrichtenregeln im Kanalkonfigurator sichtbar (7.4) | gebaut, nur Anzeige |
|
||||
| Ablaufspuren aus dem Plan (7.6) | gebaut |
|
||||
| Medium je Kanal (7.5), Dienstleister-Zustellung, Zahlungsplan/Mahnung | offen, unverändert |
|
||||
|
||||
## 11. Ergebnis
|
||||
|
||||
Alle bisherigen Vorfälle lassen sich aus **drei Basisprozessen** und **vier Schablonenbereichen** (zwei gebaut, zwei vorgesehen) plus unabhängigen Modulparametern zusammensetzen; A1–A6 bleiben Voreinstellungen und Klassifikation. Zur Umsetzung fehlen nur die Punkte in 7.1–7.3 und die Anzeige 7.4/7.6 – kein neuer Prozess pro Variante.
|
||||
@@ -1,5 +1,14 @@
|
||||
# Projektstand
|
||||
|
||||
## Nachtrag (05.11.2026): Anfrage-Basisprozess und Schablonen für alle Vorfälle
|
||||
|
||||
**Branch `feature/anfrage-basisprozess`** – [SCHABLONENKATALOG.md](Prozessarchitektur/SCHABLONENKATALOG.md) §9–10.
|
||||
|
||||
- Basisprozess `inquiry.request@1` für Webseite und Portalanfragen mit Schablonen für Antwort (Auskunft/verbindliches Angebot), Vertragsdokumentation, Finanz und Gastkommunikation; A1/A2 bleiben Voreinstellungen und Altfassungen. Altfälle lesen ihr eingefrorenes Profil unverändert (neue Einstellungen werden abgeleitet).
|
||||
- Antwortart und Reservierungsstrategie sind entkoppelt (`inquiry_answer` / `pre_reservation`); Gastkommunikation wird je Anlass zugewiesen (`arrival_info_sender`, `review_request_sender`). Schablonen liefern Standardwerte unterhalb aller einstellbaren Ebenen.
|
||||
- Kanalkonfigurator für Webseite, Portalanfrage und feste Buchung einheitlich: Eingang und Nachrichtenregeln, Entscheidungen, „Ablauf im Zusammenhang“ aus dem Plan, Auswirkungen, Einzelschritte (eingeklappt), Tester.
|
||||
- Keine Migration. Betroffen sind neue Vorgänge; laufende behalten Profil und Plan.
|
||||
|
||||
## Nachtrag (05.11.2026): Schablonenkomposition für extern verbindliche Buchungen
|
||||
|
||||
**Branch `feature/schablonenkomposition`** – Details, Zuordnung und Grenzen: [SCHABLONEN.md](Prozessarchitektur/SCHABLONEN.md).
|
||||
|
||||
@@ -21,6 +21,20 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@php($entry = $this->entry())
|
||||
<x-filament::section heading="1 · So kommt es an" :description="$entry['event']">
|
||||
<p style="font-size:.9rem">{{ $entry['binding'] }}</p>
|
||||
<p style="{{ $muted }}">Eingangswege, die hier angeschaltet sind: {{ implode(', ', $entry['media']) }}. Das Medium bestimmt nur, wie etwas ankommt – nicht den Ablauf.</p>
|
||||
<details style="margin-top:.5rem"><summary style="cursor:pointer;font-size:.9rem">Was eine Nachricht auslöst (Nachrichtenregeln)</summary>
|
||||
<table style="font-size:.85rem;margin-top:.4rem;border-collapse:collapse">
|
||||
@foreach ($this->messageRules() as $rule)
|
||||
<tr><td style="padding:.15rem .8rem .15rem 0"><strong>{{ $rule['intent'] }}</strong></td><td>{{ implode(' · ', $rule['effects']) }}</td></tr>
|
||||
@endforeach
|
||||
</table>
|
||||
<p style="{{ $muted }};margin-top:.3rem">Eine allgemeine Frage legt keinen Vorgang an. Nachrichten zu einem Vorgang werden nur über einen sicheren Bezug zugeordnet. Die Regeln gelten für den ganzen Betrieb und lassen sich nur einschränken (System › Betrieb).</p>
|
||||
</details>
|
||||
</x-filament::section>
|
||||
|
||||
@if (! $this->record->isWebsite())
|
||||
@php($capabilities = $this->capabilities())
|
||||
<x-filament::section heading="Was kann dieses Portal für Ihr Konto?" description="Davon hängt ab, welche Abläufe passen. Mit dem Speichern bestätigen Sie die hier gezeigten Angaben. Geben Sie nur an, was Sie wissen – „unbekannt“ sperrt nichts.">
|
||||
@@ -160,6 +174,25 @@
|
||||
</x-filament::section>
|
||||
@endif
|
||||
|
||||
@php($lanes = $this->lanes())
|
||||
<x-filament::section heading="4 · Ablauf im Zusammenhang" description="Aus den tatsächlichen Abhängigkeiten dieses Ablaufs – so führt ihn das System aus.">
|
||||
@php($laneTitles = ['parallel' => 'Läuft sofort, unabhängig voneinander', 'waiting' => 'Wartet auf andere Schritte', 'event' => 'Ereignisgesteuert (reagiert, wenn etwas eintrifft)', 'later' => 'Zeitgesteuert (zu seiner Zeit)', 'off' => 'Entfällt hier'])
|
||||
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(16rem,1fr));gap:.6rem">
|
||||
@foreach ($laneTitles as $lane => $title)
|
||||
@if ($lanes[$lane] !== [])
|
||||
<div style="{{ $card }}">
|
||||
<strong style="font-size:.85rem">{{ $title }}</strong>
|
||||
<ul style="font-size:.85rem;list-style:disc;padding-left:1.1rem;margin-top:.3rem">
|
||||
@foreach ($lanes[$lane] as $item)
|
||||
<li>{{ $item['label'] }}@if (! empty($item['after'])) <span style="{{ $muted }}">– nach: {{ implode(', ', $item['after']) }}</span>@endif @if ($item['note']) <span style="{{ $muted }}">({{ $item['note'] }})</span>@endif</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
</x-filament::section>
|
||||
|
||||
<div style="display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);gap:1rem;align-items:start">
|
||||
<details @if (! $composable) open @endif>
|
||||
<summary style="cursor:pointer;font-weight:600;margin-bottom:.4rem">Einzelschritte einstellen ({{ count($steps) }} Schritte)</summary>
|
||||
|
||||
@@ -71,12 +71,12 @@ public function test_only_admissible_models_per_channel_and_intake_are_offered()
|
||||
$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(['a2.offer', 'a2.information', 'inquiry.request'], array_keys($configuration->admissibleModels($fewo, IntakeKind::Inquiry)));
|
||||
$this->assertSame(['a4.portal_booking', 'external.booking'], array_keys($configuration->admissibleModels($fewo, IntakeKind::Booking)), 'O2: of the archetypes only A4 fits FeWo-direkt; the base process is open and restricts per template');
|
||||
$this->assertSame(['a3.portal_booking', 'external.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)));
|
||||
$this->assertSame(['a2.offer', 'a2.information', 'inquiry.request'], array_keys($configuration->admissibleModels($listing, IntakeKind::Inquiry)));
|
||||
$this->assertSame(['a1.offer', 'a1.information', 'inquiry.request'], 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']]);
|
||||
|
||||
@@ -45,7 +45,7 @@ public function test_case_h_an_optional_address_check_is_added_at_an_extension_p
|
||||
$catalogue = app(ProcessCatalogue::class);
|
||||
$using = array_keys(array_filter($catalogue->models(), fn ($model): bool => collect($model->variants())->contains(fn ($variant): bool => in_array('guest.address_check', $model->modules($variant->key), true))));
|
||||
|
||||
$this->assertSame(['a1.offer'], $using);
|
||||
$this->assertSame(['a1.offer', 'inquiry.request'], $using, 'the former offer model and the request base process that replaces it');
|
||||
$this->assertSame([], $catalogue->problems());
|
||||
foreach ($catalogue->models() as $key => $model) {
|
||||
$this->assertNotContains('guest.address_check', $model->modules('standard'), "{$key}: standard course unchanged");
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Process;
|
||||
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Models\Booking;
|
||||
use App\Models\Channel;
|
||||
use App\Models\Property;
|
||||
use App\Models\User;
|
||||
use App\Process\Tester\ProcessSandbox;
|
||||
use App\Support\Content;
|
||||
use App\Support\Settings;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Database\Seeders\PropertySeeder;
|
||||
use Database\Seeders\SiteSeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* The relevant request variants played through the isolated tester: general question without a case, information,
|
||||
* binding offer with acceptance, request with independent data collection and reservation (with and without early
|
||||
* reservation), portal request with the portal as standard sender. The report shows the templates and what waits.
|
||||
*/
|
||||
#[Group('sandbox')]
|
||||
class InquiryProcessTesterTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private Property $property;
|
||||
|
||||
private User $user;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->travelTo(CarbonImmutable::parse('2026-10-23 10:00'));
|
||||
$this->seed([PropertySeeder::class, SiteSeeder::class]);
|
||||
$this->property = Property::sole();
|
||||
Content::save(['contract.terms' => '<p>Echte Bedingungen</p>', 'stay.cancellation' => '<p>Echtes Storno</p>']);
|
||||
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();
|
||||
ProcessTesterTest::template();
|
||||
}
|
||||
|
||||
public function test_a_general_question_creates_no_booking_case(): void
|
||||
{
|
||||
$report = $this->play(Channel::websiteOf($this->property), 'general_question_message', ['model' => 'inquiry.request'], 1);
|
||||
|
||||
$this->assertNull($report['aborted'] ?? null, json_encode($report));
|
||||
$this->assertNull($report['plan'], 'no case, so no plan');
|
||||
$this->assertSame([], $report['violations']);
|
||||
$this->assertSame(0, Booking::query()->count());
|
||||
}
|
||||
|
||||
public function test_the_binding_offer_is_sent_and_accepted(): void
|
||||
{
|
||||
$report = $this->play(Channel::websiteOf($this->property), 'complete_request', ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => 'inquiry.binding_offer']], 3);
|
||||
|
||||
$this->assertNull($report['aborted'] ?? null, json_encode($report));
|
||||
$this->assertContains('inquiry.binding_offer@1', array_column($report['plan']['templates'], 'reference'));
|
||||
[$sent, , $accepted] = $report['timeline'];
|
||||
$this->assertSame('Angebot gesendet', $sent['status']);
|
||||
$this->assertTrue($sent['calendar']['occupying'], 'the offer holds the dates');
|
||||
$this->assertSame('Bestätigt', $accepted['status']);
|
||||
$this->assertContains('Gast nimmt das Angebot an', $sent['waiting']);
|
||||
$this->assertSame(0, Booking::query()->count());
|
||||
}
|
||||
|
||||
public function test_the_information_reserves_nothing(): void
|
||||
{
|
||||
$report = $this->play(Channel::websiteOf($this->property), 'complete_request', ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => 'inquiry.information']], 2);
|
||||
|
||||
$this->assertNull($report['aborted'] ?? null, json_encode($report));
|
||||
$this->assertContains('inquiry.information@1', array_column($report['plan']['templates'], 'reference'));
|
||||
$first = $report['timeline'][0];
|
||||
$this->assertFalse($first['calendar']['occupying']);
|
||||
$this->assertNull($first['calendar']['hold_until']);
|
||||
$this->assertContains('Unverbindliche Auskunft senden (automatisch)', array_column($first['activities'], 'label'));
|
||||
}
|
||||
|
||||
public function test_data_collection_and_reservation_run_independently_and_the_strategy_is_free(): void
|
||||
{
|
||||
$website = Channel::websiteOf($this->property);
|
||||
|
||||
$reserving = $this->play($website, 'missing_address', ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => 'inquiry.binding_offer']], 3);
|
||||
$early = $reserving['timeline'][0];
|
||||
$this->assertTrue($early['calendar']['occupying'], 'suggested strategy: the dates are held at once');
|
||||
$this->assertNotNull($early['calendar']['hold_until']);
|
||||
$this->assertContains('Angaben für das Angebot vervollständigen', $early['waiting'], 'the details are missing – evidence is open');
|
||||
$this->assertStringContainsString('Bitte ergänzen Sie Ihre Angaben', implode(' ', array_column($early['mails'], 'subject')), 'the data request goes out although the offer waits');
|
||||
$this->assertSame('Angebot gesendet', $reserving['timeline'][2]['status']);
|
||||
|
||||
$free = $this->play($website, 'missing_address', ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => 'inquiry.binding_offer'], 'settings' => ['pre_reservation' => '0']], 3);
|
||||
$this->assertFalse($free['timeline'][0]['calendar']['occupying'], 'same answer, other strategy: nothing held at the request');
|
||||
$this->assertStringContainsString('Bitte ergänzen Sie Ihre Angaben', implode(' ', array_column($free['timeline'][0]['mails'], 'subject')), 'the data collection does not depend on the reservation');
|
||||
$this->assertSame('Angebot gesendet', $free['timeline'][2]['status'], 'and the offer still goes out once the details are there');
|
||||
$this->assertTrue($free['timeline'][2]['calendar']['occupying'], 'the offer itself holds the dates');
|
||||
$this->assertSame(0, Booking::query()->count());
|
||||
}
|
||||
|
||||
public function test_a_portal_request_with_the_portal_as_standard_sender_shows_the_unconfirmed_capability(): void
|
||||
{
|
||||
$portal = Channel::factory()->for($this->property)->create(['name' => 'Anfrageportal', 'booking_model' => 'inquiry', 'status' => 'setup', 'is_active' => false, 'import_enabled' => false, 'settings' => ['import_url' => 'https://anfrage.example/a.ics', 'portal_profile' => 'generic']]);
|
||||
|
||||
$report = $this->play($portal, 'portal_inquiry', ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => 'inquiry.binding_offer', 'guest_communication' => 'guest_comm.portal']], 3);
|
||||
|
||||
$this->assertNull($report['aborted'] ?? null, json_encode($report));
|
||||
$communication = collect($report['plan']['templates'])->firstWhere('reference', 'guest_comm.portal@1');
|
||||
$this->assertNotNull($communication);
|
||||
$this->assertFalse($communication['capabilities'][0]['confirmed'], 'the portal writing to guests is not shown as proven');
|
||||
$sender = collect($report['plan']['configuration'])->firstWhere('question', 'Wer schickt dem Gast die Anreise-Informationen?');
|
||||
$this->assertSame(['Das Portal', 'Vorschlag der gewählten Funktionsschablone'], [$sender['value'], $sender['source']]);
|
||||
$this->assertSame(0, Booking::query()->count());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $draft
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function play(Channel $channel, string $scenario, array $draft, int $steps): array
|
||||
{
|
||||
return app(ProcessSandbox::class)->run($channel, IntakeKind::Inquiry, $draft, $scenario, ['arrival' => '2026-11-07', 'nights' => 3, 'guests' => 2, 'text' => 'question'], $steps, $this->user)->report;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,306 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Process;
|
||||
|
||||
use App\Actions\ConfigureChannelProcess;
|
||||
use App\Actions\CreateReservation;
|
||||
use App\Actions\TakeOverExternalBooking;
|
||||
use App\Actions\TakeOverPortalInquiry;
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\InquiryAnswer;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Enums\Responsibility;
|
||||
use App\Models\Booking;
|
||||
use App\Models\Channel;
|
||||
use App\Models\Property;
|
||||
use App\Pricing\StayRequest;
|
||||
use App\Process\CaseActivities;
|
||||
use App\Process\CaseContext;
|
||||
use App\Process\ChannelProcessConfiguration;
|
||||
use App\Process\ProcessCatalogue;
|
||||
use App\Process\ProcessLanes;
|
||||
use App\Process\ProcessPlan;
|
||||
use App\Process\ProcessProfile;
|
||||
use App\Process\ProcessRunner;
|
||||
use App\Process\Templates\TemplateComposer;
|
||||
use App\Support\Content;
|
||||
use App\Support\Settings;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Database\Seeders\PropertySeeder;
|
||||
use Database\Seeders\SiteSeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Mail\MailManager;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* The request base process (`inquiry.request`): the same principle as the externally binding booking – base process,
|
||||
* combinable function templates, individually configurable modules – for the own website and portal requests. Covers
|
||||
* the equivalence with A1/A2, the decoupling of the answer from the reservation, guest communication per occasion and
|
||||
* that the displayed dependencies are the executed ones.
|
||||
*/
|
||||
#[Group('configurator')]
|
||||
class InquiryTemplateTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private Property $property;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->travelTo(CarbonImmutable::parse('2026-10-23 10:00'));
|
||||
$this->seed([PropertySeeder::class, SiteSeeder::class]);
|
||||
$this->property = Property::sole();
|
||||
Storage::fake('local');
|
||||
Content::save(['contract.terms' => '<p>Echte Bedingungen</p>', 'stay.cancellation' => '<p>Echtes Storno</p>']);
|
||||
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_the_catalogue_with_the_request_base_process_is_consistent(): void
|
||||
{
|
||||
$this->assertSame([], app(ProcessCatalogue::class)->problems());
|
||||
$model = app(ProcessCatalogue::class)->model('inquiry.request');
|
||||
$this->assertEqualsCanonicalizing(['inquiry_answer', 'contract_documents', 'collection', 'guest_communication'], array_map(fn ($area): string => $area->value, $model->slots()));
|
||||
foreach (['a1.offer', 'a1.information', 'a2.offer', 'a2.information'] as $legacy) {
|
||||
$archetype = app(ProcessCatalogue::class)->model($legacy);
|
||||
$this->assertTrue($archetype::isLegacy());
|
||||
$this->assertSame([], app(TemplateComposer::class)->problems($model, $archetype::presetTemplates()), $legacy.' is a valid combination of the base process');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, array{0: string, 1: string, 2: bool}> archetype, answer template, whether the portal sends the request
|
||||
*/
|
||||
public static function archetypes(): array
|
||||
{
|
||||
return [
|
||||
'A1 offer' => ['a1.offer', 'inquiry.binding_offer', false],
|
||||
'A1 information' => ['a1.information', 'inquiry.information', false],
|
||||
'A2 offer' => ['a2.offer', 'inquiry.binding_offer', true],
|
||||
'A2 information' => ['a2.information', 'inquiry.information', true],
|
||||
];
|
||||
}
|
||||
|
||||
#[DataProvider('archetypes')]
|
||||
public function test_the_base_process_behaves_like_the_archetype_it_replaces(string $legacy, string $answer, bool $viaPortal): void
|
||||
{
|
||||
$channel = $viaPortal ? $this->portal() : Channel::websiteOf($this->property);
|
||||
|
||||
$this->configure($channel, ['model' => $legacy]);
|
||||
$old = $this->request($channel->fresh(), $viaPortal, '2026-11-07');
|
||||
$this->configure($channel->fresh(), ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => $answer]]);
|
||||
$new = $this->request($channel->fresh(), $viaPortal, '2026-12-07');
|
||||
|
||||
$oldValues = $old->process()->values;
|
||||
$newValues = $new->process()->values;
|
||||
unset($oldValues['contract_template_id'], $newValues['contract_template_id']);
|
||||
$this->assertEquals($oldValues, $newValues, 'identical effective configuration');
|
||||
$this->assertSame($old->case_type, $new->case_type);
|
||||
$this->assertSame($old->hold_purpose, $new->hold_purpose);
|
||||
$this->assertSame($old->hold_expires_at === null, $new->hold_expires_at === null, 'the same reservation behaviour');
|
||||
|
||||
$summarise = fn (Booking $booking): array => collect(CaseActivities::for($booking->fresh()))->map(fn ($activity): array => [$activity->key, $activity->label, $activity->state->value])->all();
|
||||
$this->assertSame($summarise($old), $summarise($new), 'identical activities and states');
|
||||
$this->assertSame('inquiry.request', ProcessPlan::of($new)->model);
|
||||
$this->assertArrayHasKey('guest_communication', ProcessPlan::of($new)->templates);
|
||||
}
|
||||
|
||||
public function test_the_answer_template_does_not_force_a_reservation_strategy(): void
|
||||
{
|
||||
$website = Channel::websiteOf($this->property);
|
||||
$configuration = app(ChannelProcessConfiguration::class);
|
||||
|
||||
// Binding offer: reservation at the request is a suggestion – both strategies are admissible.
|
||||
foreach ([null, '1', '0'] as $reservation) {
|
||||
$draft = ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => 'inquiry.binding_offer'], 'settings' => $reservation === null ? [] : ['pre_reservation' => $reservation]];
|
||||
$this->assertSame([], $configuration->problems($website, IntakeKind::Inquiry, $draft), 'binding offer with reservation setting '.var_export($reservation, true));
|
||||
}
|
||||
$this->assertTrue($configuration->profileWith($website, IntakeKind::Inquiry, ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => 'inquiry.binding_offer']])->preReservation());
|
||||
$this->assertSame(ProcessProfile::TEMPLATE_DEFAULT, $configuration->profileWith($website, IntakeKind::Inquiry, ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => 'inquiry.binding_offer']])->source(ProcessSetting::PreReservation));
|
||||
|
||||
// Information: by definition nothing is reserved – the documented rule, with its reason.
|
||||
$problems = $configuration->problems($website, IntakeKind::Inquiry, ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => 'inquiry.information'], 'settings' => ['pre_reservation' => '1']]);
|
||||
$this->assertStringContainsString('widerspricht der Schablone', implode(' ', $problems));
|
||||
|
||||
// Offer without early reservation: no hold at an incomplete request, the offer itself holds later.
|
||||
$this->configure($website, ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => 'inquiry.binding_offer'], 'settings' => ['pre_reservation' => '0']]);
|
||||
$incomplete = $this->request($website->fresh(), false, '2026-11-07', street: '');
|
||||
$this->assertNull($incomplete->hold_expires_at, 'no reservation at the request');
|
||||
$this->assertSame(InquiryAnswer::Offer, $incomplete->process()->inquiryAnswer());
|
||||
$this->assertFalse(Booking::query()->occupying()->whereKey($incomplete->id)->exists());
|
||||
|
||||
$this->configure($website->fresh(), ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => 'inquiry.binding_offer'], 'settings' => ['pre_reservation' => null]]);
|
||||
$held = $this->request($website->fresh(), false, '2026-12-07', street: '');
|
||||
$this->assertNotNull($held->hold_expires_at, 'the suggested strategy: clarification hold at the request');
|
||||
}
|
||||
|
||||
public function test_switching_the_answer_keeps_explicit_module_parameters_and_asks_before_dropping_a_contradicting_one(): void
|
||||
{
|
||||
$website = Channel::websiteOf($this->property);
|
||||
$this->configure($website, ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => 'inquiry.binding_offer'], 'settings' => ['hold_hours' => '24', 'processing' => 'automatic', 'guest_link_valid_days' => '7']]);
|
||||
|
||||
$this->configure($website->fresh(), ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => 'inquiry.information'], 'settings' => ['hold_hours' => '24', 'processing' => 'automatic', 'guest_link_valid_days' => '7']]);
|
||||
$saved = $website->fresh()->process_overrides['inquiry'];
|
||||
$this->assertEquals(['24', 'automatic'], [(string) $saved['hold_hours'], $saved['processing']], 'explicit parameters survive the switch');
|
||||
$this->assertSame('inquiry.information', $saved['templates']['inquiry_answer']);
|
||||
|
||||
// An explicitly stored reservation contradicts the information: it must be confirmed before it goes.
|
||||
$website->fresh()->update(['process_overrides' => ['inquiry' => [...$saved, 'pre_reservation' => true]]]);
|
||||
$conflicts = app(ChannelProcessConfiguration::class)->conflicts($website->fresh(), IntakeKind::Inquiry, 'inquiry.request', ['inquiry_answer' => 'inquiry.information']);
|
||||
$this->assertSame([ProcessSetting::PreReservation], array_column($conflicts, 'setting'));
|
||||
$this->expectException(ValidationException::class);
|
||||
app(ConfigureChannelProcess::class)->handle($website->fresh(), IntakeKind::Inquiry, ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => 'inquiry.information']]);
|
||||
}
|
||||
|
||||
public function test_requests_take_no_portal_collection_and_no_external_documents(): void
|
||||
{
|
||||
$website = Channel::websiteOf($this->property);
|
||||
$configuration = app(ChannelProcessConfiguration::class);
|
||||
$options = $configuration->templateOptions($website, app(ProcessCatalogue::class)->model('inquiry.request'));
|
||||
|
||||
$this->assertFalse($options['collection']['collection.portal']['admissible']);
|
||||
$this->assertStringContainsString('Annahme des Angebots', $options['collection']['collection.portal']['restrictions'][0]->reason);
|
||||
$this->assertFalse($options['contract_documents']['contract_docs.external']['admissible']);
|
||||
$this->assertFalse($options['guest_communication']['guest_comm.portal']['admissible'], 'the own website has no portal');
|
||||
$this->assertNotSame([], $configuration->problems($website, IntakeKind::Inquiry, ['model' => 'inquiry.request', 'templates' => ['collection' => 'collection.portal']]));
|
||||
}
|
||||
|
||||
public function test_guest_communication_is_assigned_per_occasion_without_touching_other_tasks(): void
|
||||
{
|
||||
$channel = $this->bookingPortal();
|
||||
$this->configure($channel, ['model' => 'external.booking', 'templates' => ['collection' => 'collection.own', 'contract_documents' => 'contract_docs.own']], IntakeKind::Booking);
|
||||
$baseline = $this->takeOver($channel->fresh(), 'KOM-1', '2027-07-10');
|
||||
|
||||
$this->configure($channel->fresh(), ['model' => 'external.booking', 'templates' => ['collection' => 'collection.own', 'contract_documents' => 'contract_docs.own'], 'settings' => ['arrival_info_sender' => 'portal']], IntakeKind::Booking);
|
||||
$changed = $this->takeOver($channel->fresh(), 'KOM-2', '2027-08-10');
|
||||
|
||||
$activities = fn (Booking $booking): array => collect(CaseActivities::for($booking->fresh()))->keyBy('key')->all();
|
||||
[$before, $after] = [$activities($baseline), $activities($changed)];
|
||||
$this->assertSame(ActivityState::External, $after['arrival_info']->state, 'the arrival information is now the portal’s');
|
||||
$this->assertNotSame(ActivityState::External, $before['arrival_info']->state);
|
||||
$this->assertArrayHasKey('review', $after, 'the review request stays with us');
|
||||
$this->assertSame(array_keys($before), array_keys($after), 'no other task appears or disappears');
|
||||
foreach (array_diff(array_keys($before), ['arrival_info']) as $key) {
|
||||
$this->assertSame($before[$key]->state, $after[$key]->state, $key.' is unchanged');
|
||||
}
|
||||
$profile = $changed->process();
|
||||
$this->assertSame([Responsibility::Portal, Responsibility::Landlord, Responsibility::Landlord], [$profile->arrivalInfoSender(), $profile->reviewRequestSender(), $profile->payments()]);
|
||||
$this->assertSame(Responsibility::Landlord, $profile->guestMessages(), 'the umbrella setting is untouched');
|
||||
|
||||
// And the other way round: the review request goes to the portal, the arrival information stays ours.
|
||||
$this->configure($channel->fresh(), ['model' => 'external.booking', 'templates' => ['collection' => 'collection.own', 'contract_documents' => 'contract_docs.own'], 'settings' => ['arrival_info_sender' => null, 'review_request_sender' => 'portal']], IntakeKind::Booking);
|
||||
$other = $this->takeOver($channel->fresh(), 'KOM-3', '2027-09-10');
|
||||
$this->assertArrayNotHasKey('review', $activities($other));
|
||||
$this->assertNotSame(ActivityState::External, $activities($other)['arrival_info']->state);
|
||||
}
|
||||
|
||||
public function test_a_portal_inquiry_gets_the_portal_as_standard_sender_that_each_occasion_can_take_back(): void
|
||||
{
|
||||
$portal = $this->portal();
|
||||
$this->configure($portal, ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => 'inquiry.binding_offer', 'guest_communication' => 'guest_comm.portal']]);
|
||||
$case = $this->request($portal->fresh(), true, '2027-01-12');
|
||||
$this->assertEquals(['guest_communication' => 'guest_comm.portal@1'], array_intersect_key(ProcessPlan::of($case)->templates, ['guest_communication' => 1]));
|
||||
$this->assertSame([Responsibility::Portal, Responsibility::Portal], [$case->process()->arrivalInfoSender(), $case->process()->reviewRequestSender()]);
|
||||
$this->assertSame(ProcessProfile::TEMPLATE_DEFAULT, $case->process()->source(ProcessSetting::ArrivalInfoSender));
|
||||
|
||||
$this->configure($portal->fresh(), ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => 'inquiry.binding_offer', 'guest_communication' => 'guest_comm.portal'], 'settings' => ['review_request_sender' => 'landlord']]);
|
||||
$mixed = $this->request($portal->fresh(), true, '2027-02-12');
|
||||
$this->assertSame([Responsibility::Portal, Responsibility::Landlord], [$mixed->process()->arrivalInfoSender(), $mixed->process()->reviewRequestSender()], 'the explicit value wins over the template suggestion');
|
||||
}
|
||||
|
||||
public function test_cases_frozen_before_the_new_settings_read_exactly_as_before(): void
|
||||
{
|
||||
$website = Channel::websiteOf($this->property);
|
||||
$this->configure($website, ['model' => 'a1.information']);
|
||||
$case = $this->request($website->fresh(), false, '2026-11-07');
|
||||
$profile = $case->profile;
|
||||
foreach (['inquiry_answer', 'arrival_info_sender', 'review_request_sender'] as $key) {
|
||||
unset($profile['values'][$key], $profile['sources'][$key]);
|
||||
}
|
||||
$case->forceFill(['profile' => $profile])->saveQuietly();
|
||||
|
||||
$old = $case->fresh()->process();
|
||||
$this->assertSame(InquiryAnswer::Information, $old->inquiryAnswer(), 'derived from the reservation, as before');
|
||||
$this->assertSame([$old->guestMessages(), $old->guestMessages()], [$old->arrivalInfoSender(), $old->reviewRequestSender()]);
|
||||
$this->assertSame('a1.information', ProcessPlan::of($case->fresh())->model);
|
||||
}
|
||||
|
||||
public function test_the_displayed_dependencies_are_the_executed_ones(): void
|
||||
{
|
||||
$website = Channel::websiteOf($this->property);
|
||||
$this->configure($website, ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => 'inquiry.binding_offer']]);
|
||||
$draft = ['model' => 'inquiry.request', 'templates' => ['inquiry_answer' => 'inquiry.binding_offer']];
|
||||
|
||||
$lanes = app(ProcessLanes::class)->of(app(ChannelProcessConfiguration::class)->preview($website->fresh(), IntakeKind::Inquiry, $draft));
|
||||
$labels = fn (string $lane): array => array_column($lanes[$lane], 'module');
|
||||
$this->assertContains('hold', $labels('parallel'), 'the reservation runs at once');
|
||||
$this->assertContains('guest.data_request', $labels('parallel'), 'so does the data collection – independent of each other');
|
||||
$this->assertContains('offer.binding', $labels('waiting'));
|
||||
$this->assertContains('documents.send', $labels('waiting'));
|
||||
$this->assertContains('case.tasks', $labels('event'));
|
||||
$this->assertContains('arrival.info', $labels('later'));
|
||||
$this->assertNotContains('offer.information', array_merge(...array_values(array_map(fn (array $lane): array => array_column($lane, 'module'), $lanes))), 'an offer needs no information step: it is not in the plan at all');
|
||||
|
||||
// The runner agrees: with missing details the offer is held back, the hold and the data request are not.
|
||||
$case = $this->request($website->fresh(), false, '2026-11-07', street: '');
|
||||
$context = CaseContext::of($case);
|
||||
$runner = app(ProcessRunner::class);
|
||||
$catalogue = app(ProcessCatalogue::class);
|
||||
foreach (array_column($lanes['waiting'], 'module') as $module) {
|
||||
if (in_array($module, ['offer.binding', 'offer.acceptance'], true) && $context->plan->enabled($module)) {
|
||||
$this->assertNotSame([], $runner->unmetHardDependencies($catalogue->module($module), $context), $module.' waits in the plan as shown');
|
||||
}
|
||||
}
|
||||
foreach (['hold', 'guest.data_request'] as $module) {
|
||||
$this->assertSame([], $runner->unmetHardDependencies($catalogue->module($module), $context), $module.' does not wait');
|
||||
}
|
||||
$waitingFor = collect($lanes['waiting'])->firstWhere('module', 'offer.binding')['after'];
|
||||
$this->assertContains('Angaben des Gastes', $waitingFor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $draft
|
||||
*/
|
||||
private function configure(Channel $channel, array $draft, IntakeKind $intake = IntakeKind::Inquiry): void
|
||||
{
|
||||
app(ConfigureChannelProcess::class)->handle($channel, $intake, $draft, acknowledgeConflicts: true);
|
||||
}
|
||||
|
||||
private function request(Channel $channel, bool $viaPortal, string $arrival, string $street = 'Weg 1'): Booking
|
||||
{
|
||||
$arrival = CarbonImmutable::parse($arrival);
|
||||
if ($viaPortal) {
|
||||
return app(TakeOverPortalInquiry::class)->handle($channel, $arrival, $arrival->addDays(3), 'ANF-'.$arrival->format('md'))->fresh();
|
||||
}
|
||||
|
||||
return app(CreateReservation::class)->handle($this->property->fresh(), new StayRequest($arrival, $arrival->addDays(3), 2), ['first_name' => 'Gesa', 'last_name' => 'Gast', 'email' => 'gesa@example.org', 'street' => $street, 'postal_code' => '10115', 'city' => 'Berlin', 'country' => 'DE'])->fresh();
|
||||
}
|
||||
|
||||
private function takeOver(Channel $channel, string $reference, string $arrival): Booking
|
||||
{
|
||||
$arrival = CarbonImmutable::parse($arrival);
|
||||
|
||||
return app(TakeOverExternalBooking::class)->handle($this->property, $channel, $arrival, $arrival->addDays(7), ['portal_reference' => $reference]);
|
||||
}
|
||||
|
||||
private function portal(): Channel
|
||||
{
|
||||
return Channel::factory()->for($this->property)->create(['name' => 'Anfrageportal', 'booking_model' => 'inquiry', 'import_enabled' => false, 'settings' => ['import_url' => 'https://anfrage.example/a.ics', 'portal_profile' => 'generic']]);
|
||||
}
|
||||
|
||||
private function bookingPortal(): Channel
|
||||
{
|
||||
return Channel::factory()->for($this->property)->create(['name' => 'Buchungsportal', 'booking_model' => 'portal_booking', 'import_enabled' => false, 'settings' => ['import_url' => 'https://buchung.example/a.ics', 'portal_profile' => 'generic']]);
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public function test_loyalty_cannot_reach_a_real_case_and_leaves_the_other_model
|
||||
$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(['a1.offer', 'inquiry.request'], $using, 'only the A1 offer model and the request base process have the variant');
|
||||
$this->assertSame([], $catalogue->problems());
|
||||
foreach ($catalogue->models() as $key => $model) {
|
||||
$this->assertNotContains('guest.loyalty_status', $model->modules('standard'), "{$key}: standard course unchanged");
|
||||
|
||||
@@ -100,7 +100,7 @@ public function test_every_combination_is_composed_into_a_valid_versioned_plan(s
|
||||
$plan = ProcessPlan::of($booking);
|
||||
|
||||
$this->assertSame(['external.booking', 1], [$plan->model, $plan->modelVersion]);
|
||||
$this->assertEquals(['collection' => $collection.'@1', 'contract_documents' => $documents.'@1'], $plan->templates);
|
||||
$this->assertEquals(['collection' => $collection.'@1', 'contract_documents' => $documents.'@1', 'guest_communication' => 'guest_comm.own@1'], $plan->templates);
|
||||
$this->assertSame($payout, array_key_exists('portal.payout', $plan->modules));
|
||||
$this->assertArrayHasKey('payments.monitor', $plan->modules);
|
||||
$this->assertArrayHasKey('documents.send', $plan->modules);
|
||||
@@ -263,7 +263,7 @@ public function test_the_base_process_cannot_be_saved_with_templates_the_portal_
|
||||
$this->assertNull(($channel->fresh()->process_overrides ?? [])['booking'] ?? null, 'nothing saved');
|
||||
|
||||
$configure->handle($channel, IntakeKind::Booking, [...$draft, 'templates' => ['collection' => 'collection.portal', 'contract_documents' => 'contract_docs.own']]);
|
||||
$this->assertEquals(['collection' => 'collection.portal', 'contract_documents' => 'contract_docs.own'], $channel->fresh()->process_overrides['booking']['templates']);
|
||||
$this->assertEquals(['collection' => 'collection.portal', 'contract_documents' => 'contract_docs.own', 'guest_communication' => 'guest_comm.own'], $channel->fresh()->process_overrides['booking']['templates']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -87,10 +87,10 @@ public function test_an_archetype_moves_to_the_base_process_with_the_same_combin
|
||||
|
||||
$page->call('save')->assertNotified('Ablauf gespeichert');
|
||||
$this->assertSame('external.booking', $fewo->fresh()->process_overrides['booking']['model']);
|
||||
$this->assertEquals(['collection' => 'collection.portal', 'contract_documents' => 'contract_docs.own'], $fewo->fresh()->process_overrides['booking']['templates']);
|
||||
$this->assertEquals(['collection' => 'collection.portal', 'contract_documents' => 'contract_docs.own', 'guest_communication' => 'guest_comm.own'], $fewo->fresh()->process_overrides['booking']['templates']);
|
||||
|
||||
$booking = $this->takeOver($fewo->fresh(), 'FD-1');
|
||||
$this->assertEquals(['collection' => 'collection.portal@1', 'contract_documents' => 'contract_docs.own@1'], ProcessPlan::of($booking)->templates);
|
||||
$this->assertEquals(['collection' => 'collection.portal@1', 'contract_documents' => 'contract_docs.own@1', 'guest_communication' => 'guest_comm.own@1'], ProcessPlan::of($booking)->templates);
|
||||
$this->assertSame('A4', strtoupper($booking->case_type->value));
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ public function test_switching_the_collection_template_shows_every_consequence_a
|
||||
$this->assertSame('manual', $saved['contract_delivery'], 'parameters of the kept modules survive');
|
||||
$this->assertSame(['review.request' => ['on' => false]], $saved['steps'], 'so does a switched-off optional step');
|
||||
$this->assertStringContainsString('Bisher eingestellt', $ds->fresh()->settings['process_history'][0]['removed_settings'][0]);
|
||||
$this->assertEquals(['collection' => 'collection.own', 'contract_documents' => 'contract_docs.own'], $saved['templates']);
|
||||
$this->assertEquals(['collection' => 'collection.own', 'contract_documents' => 'contract_docs.own', 'guest_communication' => 'guest_comm.own'], $saved['templates']);
|
||||
}
|
||||
|
||||
public function test_the_impact_of_a_template_change_names_modules_responsibility_and_open_ends(): void
|
||||
|
||||
@@ -71,10 +71,12 @@ public function test_every_combination_runs_in_the_tester_and_differs_as_its_tem
|
||||
$this->assertNull($report['aborted'] ?? null, json_encode($report));
|
||||
$this->assertSame([], $report['violations']);
|
||||
$this->assertSame(['external.booking', 1], [$report['plan']['model'], $report['plan']['version']]);
|
||||
$this->assertEqualsCanonicalizing([$collection.'@1', $documents.'@1'], array_column($report['plan']['templates'], 'reference'), 'the report names the templates used');
|
||||
$this->assertEqualsCanonicalizing([$collection.'@1', $documents.'@1', 'guest_comm.own@1'], array_column($report['plan']['templates'], 'reference'), 'the report names the templates used');
|
||||
foreach ($report['plan']['templates'] as $template) {
|
||||
$this->assertNotEmpty($template['modules']);
|
||||
$this->assertFalse($template['capabilities'][0]['confirmed'], 'a capability nobody confirmed is not shown as proven');
|
||||
foreach ($template['capabilities'] as $capability) {
|
||||
$this->assertFalse($capability['confirmed'], 'a capability nobody confirmed is not shown as proven');
|
||||
}
|
||||
}
|
||||
|
||||
[$known, , $confirmed] = $report['timeline'];
|
||||
|
||||
Reference in new issue
Block a user