Files
fewo-stommer/app/Actions/SendPaymentReminder.php
T
LarsandClaude Sonnet 5.5 a73b164ea1
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m36s
Zahlungsaufgaben, Freigabe-/Storno-Link, Vertragsvorlagen, Anreise-Mail
- Zahlungen werden nicht mehr automatisch angemahnt: faellige Anzahlung/Restzahlung werden Aufgaben
  (Zahlungen & Wuensche, Tages-/Wochenuebersicht); Mail nur per Klick; je Portal und Buchungstyp abschaltbar
- Freigabe-Link in der Eingangsbestaetigung, Storno-Link in der Buchungsbestaetigung; je Wohnung
  Wunsch / sofort / sofort bis Frist; Stornowuensche und Kosten bleiben Aufgabe des Gastgebers
- Vertragsvorlagen mit Versionen (je Angebot, Portal oder Wohnung waehlbar), benutzte Versionen gesperrt;
  Angebot und finaler Vertrag als unveraenderliche PDF mit SHA-256, Vertrag wird nie neu geschrieben
- Anreise-Mail je Wohnung einstellbar (Standard 3 Tage), neue Textfelder Schluessel/Parken/Ankunftstag

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 12:46:29 +01:00

40 lines
1.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Actions;
use App\Exceptions\ReservationException;
use App\Mail\PaymentReminder;
use App\Models\BookingTask;
use Illuminate\Support\Facades\Mail;
/**
* Sends the payment mail belonging to a task – only when the landlord decides to, after checking the payment.
* The task is completed and the dispatch is recorded on the booking; a failing mail server leaves the task open.
*/
class SendPaymentReminder
{
/**
* @throws ReservationException
*/
public function handle(BookingTask $task, string $by): void
{
$reminder = $task->kind->reminder();
$booking = $task->booking->loadMissing(['guest', 'property', 'payments']);
if ($reminder === null) {
throw new ReservationException('Zu dieser Aufgabe gibt es keine Zahlungs-E-Mail.');
}
if (blank($booking->guest?->email)) {
throw new ReservationException('Der Gast hat keine E-Mail-Adresse.');
}
if ($booking->openAmount() <= 0) {
throw new ReservationException('Die Buchung ist bereits vollständig bezahlt.');
}
[$kind, $column] = $reminder;
Mail::to($booking->guest->email, $booking->guest->full_name)->send(new PaymentReminder($booking, $kind));
$booking->update([$column => now()]);
$task->complete($by);
}
}