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,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Actions\SubmitBookingWish;
|
||||
use App\Exceptions\ReservationException;
|
||||
use App\Models\Booking;
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
/**
|
||||
* The guest's page of an information "unter Vorbehalt" (package 7, signed link from the mail): shows price and conditions
|
||||
* as checked when it was sent, says plainly that nothing is reserved or binding, and lets the guest ask for the booking.
|
||||
*/
|
||||
class InformationController extends Controller
|
||||
{
|
||||
public function show(Request $request, Booking $booking, SubmitBookingWish $wish): View
|
||||
{
|
||||
$booking->loadMissing(['guest', 'property']);
|
||||
$version = (int) $request->query('v');
|
||||
|
||||
$problem = null;
|
||||
try {
|
||||
$wish->ensureCurrent($booking, $version);
|
||||
} catch (ReservationException $exception) {
|
||||
$problem = $exception->getMessage();
|
||||
}
|
||||
|
||||
return view('information', [
|
||||
'booking' => $booking,
|
||||
'problem' => $problem,
|
||||
'canAsk' => $problem === null,
|
||||
'wishUrl' => $this->signed($booking, 'information.wish', $booking->information_valid_until?->isFuture() ? $booking->information_valid_until : now()->addHour(), $version),
|
||||
]);
|
||||
}
|
||||
|
||||
public function wish(Request $request, Booking $booking, SubmitBookingWish $wish): RedirectResponse
|
||||
{
|
||||
$request->validate(['terms' => ['accepted']], ['terms.accepted' => 'Bitte bestätigen Sie, dass Sie die Angaben und Bedingungen gelesen haben.']);
|
||||
$version = (int) $request->query('v');
|
||||
$back = $this->signed($booking, 'information.show', now()->addDays(30), $version);
|
||||
|
||||
try {
|
||||
$outcome = $wish->handle($booking, $version, $request->ip());
|
||||
} catch (ReservationException $exception) {
|
||||
return redirect()->to($back)->with('information.error', $exception->getMessage());
|
||||
}
|
||||
|
||||
$booking->refresh();
|
||||
|
||||
return redirect()->to($back)->with('information.success', match ($outcome) {
|
||||
SubmitBookingWish::CONFIRMED => $booking->confirmation_sent_at !== null
|
||||
? 'Vielen Dank! Wir haben Verfügbarkeit und Preis geprüft – Ihre Buchung ist verbindlich bestätigt. Die Bestätigung mit dem Mietvertrag haben wir Ihnen per E-Mail gesendet.'
|
||||
: 'Vielen Dank! Ihre Buchung ist verbindlich bestätigt. Die Bestätigung mit dem Mietvertrag erhalten Sie in Kürze per E-Mail.',
|
||||
SubmitBookingWish::PENDING => 'Vielen Dank – Ihr Buchungswunsch ist eingegangen. Wir prüfen ihn und melden uns in Kürze. Die Buchung ist noch nicht verbindlich; sie wird es erst mit unserer Buchungsbestätigung.',
|
||||
SubmitBookingWish::UNAVAILABLE => 'Leider ist der Zeitraum inzwischen vergeben. Es ist keine Buchung zustande gekommen. Vielleicht passt ein anderer Termin?',
|
||||
default => 'Ihr Buchungswunsch liegt uns bereits vor – Sie müssen nichts weiter tun.',
|
||||
});
|
||||
}
|
||||
|
||||
private function signed(Booking $booking, string $name, DateTimeInterface $expiration, int $version): string
|
||||
{
|
||||
$parameters = ['booking' => $booking, 'v' => $version];
|
||||
|
||||
return $booking->website()?->temporarySignedRoute($name, $expiration, $parameters)
|
||||
?? URL::temporarySignedRoute($name, $expiration, $parameters);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user