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
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Actions\RecordPayment;
|
||||
use App\Enums\BookingStatus;
|
||||
use App\Models\Booking;
|
||||
use App\Models\Tenant;
|
||||
use App\Process\CaseLog;
|
||||
use App\Tenancy\TenantRunner;
|
||||
use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
#[Signature('cases:recheck-payment-status
|
||||
{--apply : Wirklich korrigieren (ohne: nur Vorschau)}')]
|
||||
#[Description('Zahlungsstatus bestehender Vorgänge nach der neuen Regel prüfen: nur Geld des Gastes auf unserem Konto zählt als „Anzahlung erhalten“/„Bezahlt“, nicht „laut Portal bezahlt“ (Vorschau, Korrektur nur mit --apply und mit Eintrag im Verlauf)')]
|
||||
class RecheckPaymentStatus extends Command
|
||||
{
|
||||
public function handle(TenantRunner $runner): int
|
||||
{
|
||||
$apply = (bool) $this->option('apply');
|
||||
$rows = [];
|
||||
|
||||
$succeeded = $runner->each(function (Tenant $tenant) use ($apply, &$rows): void {
|
||||
$cases = Booking::query()->with(['payments', 'property', 'importChannel', 'originChannel'])
|
||||
->whereIn('status', [BookingStatus::Confirmed, BookingStatus::DepositPaid, BookingStatus::Paid])->get();
|
||||
|
||||
foreach ($cases as $booking) {
|
||||
$target = RecordPayment::statusFor($booking);
|
||||
if ($target === null || $target === $booking->status) {
|
||||
continue;
|
||||
}
|
||||
$rows[] = [$tenant->name, $booking->reference, $booking->status->getLabel(), $target->getLabel(), $apply ? 'korrigiert' : 'Vorschau'];
|
||||
if ($apply) {
|
||||
CaseLog::context(fn () => $booking->update(['status' => $target]), actor: CaseLog::SYSTEM, reason: 'Zahlungsstatus nach neuer Regel: „laut Portal bezahlt“ ist kein Eingang auf unserem Konto (cases:recheck-payment-status).');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if ($rows === []) {
|
||||
$this->info('Kein Vorgang mit abweichendem Zahlungsstatus.');
|
||||
} else {
|
||||
$this->table(['Vermieter', 'Vorgang', 'bisher', 'nach neuer Regel', 'Ergebnis'], $rows);
|
||||
if (! $apply) {
|
||||
$this->comment('Nur Vorschau. Mit --apply werden die Status korrigiert und im Verlauf vermerkt.');
|
||||
}
|
||||
}
|
||||
|
||||
if ($succeeded < $runner->tenants()->count()) {
|
||||
$this->error('Für mindestens einen Vermieter ist die Prüfung fehlgeschlagen (siehe Log).');
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -25,10 +25,13 @@ public function handle(AutoOffer $autoOffer, TenantRunner $runner): int
|
||||
$pending = Booking::query()
|
||||
->where('status', BookingStatus::Reserved)
|
||||
->where('offer_version', 0)
|
||||
->where('hold_expires_at', '>', now())
|
||||
->where('information_version', 0)
|
||||
// Held requests while their hold runs; requests without a hold (information, package 7) for two weeks.
|
||||
->where(fn ($query) => $query->where('hold_expires_at', '>', now())->orWhere(fn ($open) => $open->whereNull('hold_expires_at')->where('created_at', '>', now()->subDays(14))))
|
||||
->where(fn ($query) => $query->whereNull('intake')->orWhere('intake', 'inquiry'))
|
||||
->with(['property', 'guest', 'importChannel', 'originChannel'])
|
||||
->get()
|
||||
->filter(fn (Booking $booking): bool => $autoOffer->applies($booking) && $booking->process()->preReservation());
|
||||
->filter(fn (Booking $booking): bool => $autoOffer->applies($booking) && ($booking->isHoldActive() || ! $booking->process()->preReservation()));
|
||||
|
||||
$sent = 0;
|
||||
foreach ($pending as $booking) {
|
||||
|
||||
Reference in new issue
Block a user