Files
fewo-stommer/app/Process/Tester/Scenarios/CompleteRequest.php
T
LarsandClaude Sonnet 5.5 221ce8ca81 Anfrage-Basisprozess inquiry.request mit Schablonen für Antwort und Gastkommunikation
Antwortart (Auskunft/Angebot) und Reservierung sind entkoppelt (neue Einstellung inquiry_answer;
pre_reservation bleibt die Reservierungsstrategie). Anlass-bezogene Absender für Anreise-Information
und Bewertungsbitte; Schablonen liefern Standardwerte unterhalb aller einstellbaren Ebenen.
A1/A2 bleiben Voreinstellungen und Altfassungen.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-05 12:40:22 +01:00

59 lines
2.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\Process\Tester\Scenarios;
use App\Actions\AcceptOffer;
use App\Actions\SendOffer;
use App\Enums\BookingStatus;
use App\Enums\InquiryAnswer;
use App\Enums\IntakeKind;
use App\Process\Tester\SandboxContext;
/**
* S01/S06/S11: a complete request – offer (automatic or by the landlord), acceptance, binding booking, arrival, after
* departure (review request, closing; a switched-off step is shown as skipped).
*/
final class CompleteRequest extends Scenario
{
public static function key(): string
{
return 'complete_request';
}
public static function label(): string
{
return 'Vollständige Anfrage bis zur Buchung';
}
public static function description(): string
{
return 'Ein Gast fragt mit allen Angaben an, erhält das Angebot und nimmt es an; danach Anreise und Abreise.';
}
public static function intakes(): array
{
return [IntakeKind::Inquiry];
}
public function events(array $inputs): array
{
return [
new ScenarioEvent('Gast fragt mit allen Angaben an', fn (SandboxContext $context) => $context->request(['street' => 'Teststraße 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn', 'country' => 'DE'])),
new ScenarioEvent('Sie senden das Angebot (falls es nicht automatisch ging)', function (SandboxContext $context): void {
$booking = $context->booking->fresh();
if ($booking->status === BookingStatus::Reserved && $booking->offer_version === 0 && $booking->process()->inquiryAnswer() === InquiryAnswer::Offer) {
app(SendOffer::class)->handle($booking);
}
}),
new ScenarioEvent('Gast nimmt das Angebot an', function (SandboxContext $context): void {
$booking = $context->booking->fresh();
if ($booking->status === BookingStatus::OfferSent) {
app(AcceptOffer::class)->handle($booking, $booking->offer_version);
}
}),
new ScenarioEvent('Zwei Tage vor der Anreise', fn (SandboxContext $context) => $context->travelTo($context->arrival()->subDays(2)->setTime(9, 0))),
new ScenarioEvent('Drei Tage nach der Abreise', fn (SandboxContext $context) => $context->travelTo($context->departure()->addDays(3)->setTime(9, 0))),
];
}
}