- 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>
39 lines
1.4 KiB
PHP
39 lines
1.4 KiB
PHP
<?php
|
||
|
||
namespace App\Actions;
|
||
|
||
use App\Enums\BookingStatus;
|
||
use App\Mail\ReservationExpired;
|
||
use App\Models\Booking;
|
||
use App\Support\Settings;
|
||
use Illuminate\Support\Facades\Mail;
|
||
|
||
/**
|
||
* Marks reservations whose hold time is over – and information without a hold whose link expired unanswered – as
|
||
* expired and tells the landlord.
|
||
* The calendar already treats them as free once the hold time is over; this only updates the status.
|
||
*/
|
||
class ExpireReservations
|
||
{
|
||
public function handle(): int
|
||
{
|
||
$expired = Booking::query()
|
||
->whereIn('status', BookingStatus::holding())
|
||
->where(fn ($query) => $query
|
||
->where('hold_expires_at', '<=', now())
|
||
// An information without a hold (package 7) ends when its link expires and the guest did not ask for the booking.
|
||
->orWhere(fn ($information) => $information->where('status', BookingStatus::Reserved)->whereNull('hold_expires_at')
|
||
->where('information_valid_until', '<=', now())->whereNull('wish_at')))
|
||
->with(['guest', 'property'])
|
||
->get();
|
||
|
||
foreach ($expired as $booking) {
|
||
$booking->update(['status' => BookingStatus::Expired]);
|
||
|
||
Mail::to(Settings::notificationRecipients())->send(new ReservationExpired($booking));
|
||
}
|
||
|
||
return $expired->count();
|
||
}
|
||
}
|