Files
fewo-stommer/app/Process/Tester/Scenarios/PortalInquiry.php
T

48 lines
1.9 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\ContributeCaseFacts;
use App\Actions\TakeOverPortalInquiry;
use App\Enums\FactSource;
use App\Enums\IntakeKind;
use App\Process\Tester\SandboxContext;
/**
* A2: a request of the portal – taken over like the portal's request mail, contact details from the portal, the
* address from the guest; then our own offer or information as the chosen model says.
*/
final class PortalInquiry extends Scenario
{
public static function key(): string
{
return 'portal_inquiry';
}
public static function label(): string
{
return 'Anfrage über das Portal';
}
public static function description(): string
{
return 'Das Portal leitet eine Anfrage weiter; Kontaktdaten kommen vom Portal, die Anschrift vom Gast.';
}
public static function intakes(): array
{
return [IntakeKind::Inquiry];
}
public function events(array $inputs): array
{
return [
new ScenarioEvent('Portal leitet eine Anfrage weiter', function (SandboxContext $context): void {
$context->booking = app(TakeOverPortalInquiry::class)->handle($context->channel, $context->arrival(), $context->departure(), 'ANF-'.$context->arrival()->format('md'));
}),
new ScenarioEvent('Kontaktdaten laut Portal', fn (SandboxContext $context) => app(ContributeCaseFacts::class)->handle($context->booking->fresh(), ['guest.first_name' => 'Testgast', 'guest.last_name' => 'Anfrage', 'guest.email' => 'anfrage@tester.invalid', 'booking.guests' => (string) $context->guests()], FactSource::PortalMail)),
new ScenarioEvent('Gast ergänzt seine Anschrift', fn (SandboxContext $context) => app(ContributeCaseFacts::class)->handle($context->booking->fresh(), ['guest.street' => 'Teststraße 1', 'guest.postal_code' => '18225', 'guest.city' => 'Kühlungsborn', 'guest.country' => 'DE'], FactSource::GuestLink)),
];
}
}