v0.11 U2: Angebots-Gate, gemeinsamer Fakteneingang mit Herkunft
- CaseRequirements: Vor einem eigenen verbindlichen Angebot und vor der verbindlichen Bestätigung eines Buchungswunsches müssen Vor- und Nachname, E-Mail, vollständige Anschrift mit Land, Personenzahl und Zeitraum vorliegen – harter Blocker, auch von Hand (G2a, B3). Die Auskunft unter Vorbehalt bleibt ohne dieses Gate. - ContributeCaseFacts (S5): jede Angabe mit Herkunft und Ergebnis in case_facts; fehlend → übernommen, gleich → bestätigt, abweichend vom Gast → Prüfaufgabe (Kartei bleibt), Vermieterin maßgeblich, Zeitraum und Personen → Änderungswunsch; idempotent; danach einmal CaseAutomation. - ProvideGuestContact und Webformular nutzen den Fakteneingang. - Land als ISO-Code mit „Deutschland“ als änderbarem Formularstandard; guests.country ohne stillen Standardwert (B4). - Testdaten bestehender Tests um Anschriften ergänzt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
799869c6a4
commit
ccac78a6c9
33 files changed
+1041
-47
No files matched your search
@@ -64,14 +64,29 @@ public static function for(Booking $booking): array
|
||||
$needsContact = $inquiry || $profile->documents() === Responsibility::Landlord || $profile->guestMessages() === Responsibility::Landlord || $profile->payments() === Responsibility::Landlord;
|
||||
if ($needsContact) {
|
||||
$hasEmail = filled($booking->guest?->email);
|
||||
// v0.11 (G2a): before the own binding offer – or the binding confirmation of a wish – every required detail.
|
||||
$action = $profile->preReservation() || $booking->offer_version > 0 ? CaseRequirements::OFFER : CaseRequirements::WISH_CONFIRMATION;
|
||||
$needsDetails = $inquiry && ! $binding && $booking->offer_version === 0 && ($action === CaseRequirements::OFFER || $booking->wish_at !== null);
|
||||
$missing = $hasEmail && $needsDetails ? CaseRequirements::missing($booking, $action) : [];
|
||||
$asked = $booking->contact_requested_at !== null;
|
||||
$state = match (true) {
|
||||
$hasEmail => ActivityState::Done,
|
||||
$booking->contact_requested_at !== null => ActivityState::Waiting,
|
||||
$hasEmail && $missing === [] => ActivityState::Done,
|
||||
$asked => ActivityState::Waiting,
|
||||
default => ActivityState::Open,
|
||||
};
|
||||
$activities[] = new Activity('contact', $booking->guest === null ? 'Name und Kontaktdaten des Gastes eintragen' : 'E-Mail-Adresse des Gastes eintragen', $later($state),
|
||||
$hasEmail ? $booking->guestName() : ($booking->contact_requested_at ? 'beim Gast erfragt am '.$booking->contact_requested_at->format('d.m.Y') : 'fehlt noch'),
|
||||
$hasEmail ? null : 'provideContact');
|
||||
$title = match (true) {
|
||||
$booking->guest === null => 'Name und Kontaktdaten des Gastes eintragen',
|
||||
! $hasEmail => 'E-Mail-Adresse des Gastes eintragen',
|
||||
$missing !== [] => $action === CaseRequirements::OFFER ? 'Angaben für das Angebot vervollständigen' : 'Angaben für die Bestätigung vervollständigen',
|
||||
default => 'Kontaktdaten des Gastes',
|
||||
};
|
||||
$detail = match (true) {
|
||||
$state === ActivityState::Done => $booking->guestName(),
|
||||
$missing !== [] => 'fehlt: '.implode(', ', CaseRequirements::labels($missing)).($asked ? ' · beim Gast angefragt' : ''),
|
||||
$booking->contact_requested_at !== null => 'beim Gast erfragt am '.$booking->contact_requested_at->format('d.m.Y'),
|
||||
default => 'fehlt noch',
|
||||
};
|
||||
$activities[] = new Activity('contact', $title, $later($state), $detail, $state === ActivityState::Done ? null : 'provideContact');
|
||||
}
|
||||
|
||||
if ($inquiry && ! $profile->preReservation() && $booking->offer_version === 0) {
|
||||
@@ -322,6 +337,7 @@ private static function task(BookingTask $task): Activity
|
||||
BookingTaskKind::BookingWish => 'decideWish',
|
||||
BookingTaskKind::ArrivalDetails => 'arrivalDetails',
|
||||
BookingTaskKind::CancellationRequest => 'end',
|
||||
BookingTaskKind::FactConflict => 'provideContact',
|
||||
default => $task->kind->isPayment() ? null : 'completeTask',
|
||||
};
|
||||
$today = CarbonImmutable::today();
|
||||
|
||||
Reference in new issue
Block a user