Modellwahl über Kanalfähigkeiten mit erklärten Einschränkungen, Abgleich alter Werte, Ausführungsvarianten je Modul, getrennte Vertrags-/Buchungsinformation, Warten auf die Portalbestätigung mit Eskalation und Wiederaufnahme (Fälle C und D getestet). 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\Modules\Intake;
|
||
|
||
use App\Enums\ActivityState;
|
||
use App\Enums\Execution;
|
||
use App\Process\Activity;
|
||
use App\Process\CaseContext;
|
||
use App\Process\Modules\Dependency;
|
||
use App\Process\Modules\Module;
|
||
use App\Process\Modules\ModuleDefinition;
|
||
use App\Support\Money;
|
||
|
||
/**
|
||
* P02 for A3–A5: the booking is binding at the portal (E-036) – no second acceptance, no own price. The guest's total
|
||
* comes "laut Portal" (RecordPortalAmounts) and is never recalculated.
|
||
*/
|
||
final class PortalBinding extends Module
|
||
{
|
||
public static function key(): string
|
||
{
|
||
return 'binding.portal';
|
||
}
|
||
|
||
public static function definition(): ModuleDefinition
|
||
{
|
||
return new ModuleDefinition(
|
||
label: 'Verbindlichkeit beim Portal',
|
||
purpose: 'Stellt fest, dass die Buchung beim Portal verbindlich ist, und übernimmt den Gesamtpreis laut Portal.',
|
||
phase: 'P02',
|
||
executions: [Execution::Portal, Execution::Manual],
|
||
condition: 'bei einer Buchung, die beim Portal schon verbindlich ist',
|
||
why: 'Die Buchung ist beim Portal verbindlich und bleibt es (E-036); der Gesamtpreis laut Portal wird übernommen.',
|
||
requires: [Dependency::hard('intake.record')],
|
||
effects: ['case_write'],
|
||
waits: ['portal', 'landlord'],
|
||
triggers: ['intake', 'portal.amounts'],
|
||
performers: ['portal', 'landlord'],
|
||
events: ['status', 'portal_signal', 'price', 'amount'],
|
||
readsContractData: true,
|
||
);
|
||
}
|
||
|
||
public function applies(CaseContext $case): bool
|
||
{
|
||
return ! $case->inquiry;
|
||
}
|
||
|
||
public function activities(CaseContext $case): array
|
||
{
|
||
$booking = $case->booking;
|
||
|
||
return [
|
||
new Activity('binding', 'Beim Portal fest gebucht', $case->binding || $case->closed ? ActivityState::External : ActivityState::Open, $booking->portal_reference ? 'Buchungsnummer '.$booking->portal_reference : null, $case->binding ? null : 'confirm'),
|
||
new Activity('price', 'Gesamtpreis laut Portal eintragen', $case->later($booking->total === null ? ActivityState::Open : ActivityState::Done), $booking->total === null ? 'noch nicht bekannt' : Money::format($booking->total), $booking->total === null ? 'portalPrice' : null),
|
||
];
|
||
}
|
||
}
|