Pakete 7 und 9: Auskunft und Buchungswunsch, Aufenthalt und Abschluss (Zwischenstand)
- Haltefrist 0: unverbindliche Auskunft mit signiertem Link "Buchung anfragen", erneute Prüfung unter Sperre, automatische oder manuelle Bestätigung, Absage bei vergebenem Zeitraum, Ablauf unbeantworteter Auskünfte - Aufenthalt: Anreisedaten, Aufgaben je Wohnung, gebuchte Leistungen, Abweichungen und Folgeaufgaben als Aufgaben am Vorgang - Abschluss getrennt: Aufenthalt abgeschlossen / kaufmännisch abgeschlossen, Nachläufer (Forderung, Auszahlung) bleiben sichtbar - Zahlungsstatus nur aus Geld auf unserem Konto; Altbestand per Vorschau-Befehl - Verlauf weist Testzustellungen als solche aus - Abnahmetests T16-T25, T23 über isolierten SMTP-Empfänger Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3bcfc09417
commit
40d20cb7d1
52 files changed
+3196
-89
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Documents;
|
||||
|
||||
use App\Actions\SendInformation;
|
||||
use App\Actions\SendOffer;
|
||||
use App\Availability\AvailabilityChecker;
|
||||
use App\Enums\BookingStatus;
|
||||
@@ -55,11 +56,12 @@ public function compose(Booking $booking, ?DocumentKind $kind = null, array $cha
|
||||
$draft = clone $booking;
|
||||
$draft->setRelation('guest', $booking->guest !== null ? (clone $booking->guest)->fill(self::guestChanges($changes)) : null);
|
||||
|
||||
if ($kind === DocumentKind::Offer) {
|
||||
$findings = [...$findings, ...$this->prepareOffer($booking, $draft, $changes)];
|
||||
$quoted = in_array($kind, [DocumentKind::Offer, DocumentKind::Information], true);
|
||||
if ($quoted) {
|
||||
$findings = [...$findings, ...$this->prepareOffer($booking, $draft, $changes, $kind)];
|
||||
}
|
||||
|
||||
$frozen = $kind !== DocumentKind::Offer && ($booking->contract_path !== null || ($booking->offer_version > 0 && is_array($booking->offer_terms)));
|
||||
$frozen = ! $quoted && ($booking->contract_path !== null || ($booking->offer_version > 0 && is_array($booking->offer_terms)));
|
||||
$explicitTemplate = ! $frozen && filled($changes['contract_template_id'] ?? null);
|
||||
$template = match (true) {
|
||||
$kind === DocumentKind::StayConfirmation => null,
|
||||
@@ -99,17 +101,19 @@ public function compose(Booking $booking, ?DocumentKind $kind = null, array $cha
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the offer adjustments to the copy and calculates its price exactly as {@see SendOffer} will.
|
||||
* Applies the offer adjustments to the copy and calculates its price exactly as {@see SendOffer} (and the information
|
||||
* of a request without a hold, {@see SendInformation}) will.
|
||||
*
|
||||
* @param array<string, mixed> $changes
|
||||
* @return list<DocumentFinding>
|
||||
*/
|
||||
private function prepareOffer(Booking $booking, Booking $draft, array $changes): array
|
||||
private function prepareOffer(Booking $booking, Booking $draft, array $changes, DocumentKind $kind = DocumentKind::Offer): array
|
||||
{
|
||||
$findings = [];
|
||||
$information = $kind === DocumentKind::Information;
|
||||
|
||||
if (! in_array($booking->status, [BookingStatus::Reserved, BookingStatus::OfferSent, BookingStatus::Expired], true)) {
|
||||
$findings[] = DocumentFinding::blocker('Für diesen Vorgang ist kein Angebot mehr möglich ('.$booking->status->getLabel().').');
|
||||
if (! in_array($booking->status, $information ? [BookingStatus::Reserved, BookingStatus::Expired] : [BookingStatus::Reserved, BookingStatus::OfferSent, BookingStatus::Expired], true)) {
|
||||
$findings[] = DocumentFinding::blocker('Für diesen Vorgang ist '.($information ? 'keine Auskunft' : 'kein Angebot').' mehr möglich ('.$booking->status->getLabel().').');
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -141,6 +145,20 @@ private function prepareOffer(Booking $booking, Booking $draft, array $changes):
|
||||
$findings[] = DocumentFinding::blocker('Bitte Anreise, Abreise und Personen angeben.');
|
||||
}
|
||||
|
||||
if ($information) {
|
||||
$draft->forceFill([
|
||||
'information_valid_until' => filled($changes['valid_until'] ?? null) ? CarbonImmutable::parse($changes['valid_until']) : now()->addHours($booking->process()->holdHours()),
|
||||
'information_version' => $booking->information_version + 1,
|
||||
'offer_message' => $changes['offer_message'] ?? $booking->offer_message,
|
||||
]);
|
||||
$findings[] = DocumentFinding::info('Unverbindliche Auskunft: Der Zeitraum wird nicht reserviert, und der Gast kann nicht direkt annehmen. Fragt er die Buchung an, wird erneut geprüft.');
|
||||
if ($booking->information_version > 0) {
|
||||
$findings[] = DocumentFinding::info('Ersetzt Auskunft Version '.$booking->information_version.'; deren Link wird ungültig.');
|
||||
}
|
||||
|
||||
return $findings;
|
||||
}
|
||||
|
||||
$draft->forceFill([
|
||||
'hold_expires_at' => filled($changes['valid_until'] ?? null) ? CarbonImmutable::parse($changes['valid_until']) : now()->addHours($booking->process()->holdHours()),
|
||||
'offer_version' => $booking->offer_version + 1,
|
||||
@@ -149,7 +167,7 @@ private function prepareOffer(Booking $booking, Booking $draft, array $changes):
|
||||
]);
|
||||
|
||||
if (! $booking->process()->preReservation()) {
|
||||
$findings[] = DocumentFinding::confirm('Nach Ihrer Einstellung reservieren Anfragen den Zeitraum nicht. Ein Angebot mit Annahmelink reserviert ihn trotzdem bis '.$draft->hold_expires_at->format('d.m.Y, H:i').' Uhr, und der Gast kann bis dahin verbindlich annehmen. Eine Auskunft ohne Reservierung gibt es erst in einem späteren Ausbauschritt.', DocumentFinding::HOLD_ZERO);
|
||||
$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) {
|
||||
$findings[] = DocumentFinding::info('Ersetzt Angebot Version '.$booking->offer_version.'; dessen Link wird ungültig.');
|
||||
@@ -176,7 +194,7 @@ private function commonFindings(Booking $booking, Booking $draft, DocumentKind $
|
||||
} elseif (blank($draft->guest->email)) {
|
||||
$findings[] = DocumentFinding::blocker('Die E-Mail-Adresse des Gastes fehlt.');
|
||||
}
|
||||
if ($kind !== DocumentKind::Offer && $booking->total === null) {
|
||||
if (! in_array($kind, [DocumentKind::Offer, DocumentKind::Information], true) && $booking->total === null) {
|
||||
$findings[] = DocumentFinding::blocker($booking->intake === IntakeKind::Booking ? 'Der Gesamtpreis (laut Portal) fehlt.' : 'Der Preis fehlt.');
|
||||
}
|
||||
if ($booking->confirmation_sent_at !== null && $kind !== DocumentKind::Offer) {
|
||||
@@ -249,7 +267,7 @@ private function priceSource(Booking $booking, Booking $draft, DocumentKind $kin
|
||||
return match (true) {
|
||||
$draft->total === null => 'noch nicht bekannt',
|
||||
($draft->quote['source'] ?? null) === 'portal' => 'laut '.($booking->processChannel()?->name ?? 'Portal').' übernommen, nicht neu berechnet',
|
||||
$kind === DocumentKind::Offer => 'aus Ihren Preisen berechnet',
|
||||
in_array($kind, [DocumentKind::Offer, DocumentKind::Information], true) => 'aus Ihren Preisen berechnet',
|
||||
$booking->accepted_at !== null => 'wie im angenommenen Angebot',
|
||||
default => 'aus Ihren Preisen berechnet',
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user