U-A/U-B: Prozesskern mit Fachmodulen, versionierten Modellen, eingefrorenem Prozessplan, ProcessRunner (harte/weiche Abhängigkeiten), CasePricing, Loyalty nur im Tester
CaseActivities/CaseAutomation sind Fassaden über ProcessRunner. Verhaltensvergleich v0.11: 11 Abläufe und 198 Konstellationen gleich, beabsichtigte Abweichungen I-004/I-005 (F-001/F-002). Volle Suite vor U-B: 785/785. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
98df5e9e3b
commit
7e22e12cac
80 files changed
+4628
-445
No files matched your search
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Modules\Offer;
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Enums\ProcessingMode;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Process\Activity;
|
||||
use App\Process\CaseContext;
|
||||
use App\Process\Modules\Dependency;
|
||||
use App\Process\Modules\Module;
|
||||
use App\Process\Modules\ModuleDefinition;
|
||||
use App\Process\Modules\RunsAutomatically;
|
||||
|
||||
/**
|
||||
* P02 (package 7): a request without a hold is answered with an information "unter Vorbehalt"; the guest asks for
|
||||
* the booking (wish) and we check again and confirm bindingly.
|
||||
*/
|
||||
final class Information extends Module implements RunsAutomatically
|
||||
{
|
||||
use AnswersRequest;
|
||||
|
||||
public static function key(): string
|
||||
{
|
||||
return 'offer.information';
|
||||
}
|
||||
|
||||
public static function definition(): ModuleDefinition
|
||||
{
|
||||
return new ModuleDefinition(
|
||||
label: 'Unverbindliche Auskunft und Buchungswunsch',
|
||||
purpose: 'Beantwortet die Anfrage mit einer unverbindlichen Auskunft ohne Reservierung; fragt der Gast die Buchung an, wird erneut geprüft und verbindlich bestätigt.',
|
||||
phase: 'P02',
|
||||
requires: [Dependency::hard('intake.record'), Dependency::soft('guest.data_request')],
|
||||
effects: ['case_write', 'guest_mail', 'landlord_mail', 'document'],
|
||||
waits: ['guest', 'landlord'],
|
||||
triggers: ['automation', 'request.created', 'schedule:bookings:auto-offers'],
|
||||
parameters: [ProcessSetting::Processing, ProcessSetting::GuestLinkValidDays],
|
||||
performers: ['system', 'landlord', 'guest'],
|
||||
modes: ['automatic', 'manual'],
|
||||
events: ['information', 'mail', 'hold', 'wish', 'status'],
|
||||
);
|
||||
}
|
||||
|
||||
public function applies(CaseContext $case): bool
|
||||
{
|
||||
return $case->inquiry && ! $case->profile->preReservation() && $case->booking->offer_version === 0;
|
||||
}
|
||||
|
||||
public function activities(CaseContext $case): array
|
||||
{
|
||||
$booking = $case->booking;
|
||||
$binding = $case->binding;
|
||||
$informed = $booking->information_version > 0 || $binding;
|
||||
|
||||
return [
|
||||
new Activity('information', $booking->processingMode() === ProcessingMode::Automatic ? 'Unverbindliche Auskunft senden (automatisch)' : 'Unverbindliche Auskunft prüfen und senden', $case->later(match (true) {
|
||||
$booking->information_version > 0 => ActivityState::Done,
|
||||
$binding => ActivityState::NotApplicable,
|
||||
$booking->status === BookingStatus::Reserved && filled($booking->guest?->email) => ActivityState::Open,
|
||||
default => ActivityState::Later,
|
||||
}), $booking->information_version > 0 ? 'Version '.$booking->information_version.' vom '.$booking->information_sent_at?->format('d.m.Y').' · ohne Reservierung' : 'der Zeitraum wird nicht reserviert', $informed ? null : 'sendInformation'),
|
||||
new Activity('wish', 'Gast fragt die Buchung an', $case->later(match (true) {
|
||||
$booking->wish_at !== null => ActivityState::Done,
|
||||
$binding => ActivityState::NotApplicable,
|
||||
$booking->information_version > 0 && $booking->information_valid_until?->isFuture() => ActivityState::Waiting,
|
||||
default => ActivityState::Later,
|
||||
}), match (true) {
|
||||
$booking->wish_at !== null => 'angefragt am '.$booking->wish_at->format('d.m.Y, H:i').' Uhr',
|
||||
$booking->information_version > 0 => 'möglich bis '.$booking->information_valid_until?->format('d.m.Y, H:i').' Uhr',
|
||||
default => null,
|
||||
}),
|
||||
new Activity('wish_check', 'Erneut prüfen und verbindlich bestätigen', $case->later(match (true) {
|
||||
$binding => ActivityState::Done,
|
||||
$booking->wish_at !== null && $booking->status === BookingStatus::Reserved => ActivityState::Waiting,
|
||||
default => ActivityState::Later,
|
||||
}), match (true) {
|
||||
$booking->accepted_at !== null && ($booking->acceptance['via'] ?? null) === 'booking_wish' => 'bestätigt am '.$booking->confirmed_at?->format('d.m.Y').' ('.($booking->acceptance['confirmed_by'] ?? '').')',
|
||||
$booking->wish_at !== null && $booking->status === BookingStatus::Reserved => 'siehe Aufgabe „Buchungswunsch bestätigen?“',
|
||||
$binding => 'direkt verbindlich bestätigt (ohne Buchungswunsch)',
|
||||
default => $booking->processingMode() === ProcessingMode::Automatic ? 'automatisch, wenn alles passt' : 'durch Sie',
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user