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>
59 lines
2.3 KiB
PHP
59 lines
2.3 KiB
PHP
<?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))),
|
||
];
|
||
}
|
||
}
|