CaseActivities/CaseAutomation sind Fassaden über ProcessRunner. Verhaltensvergleich v0.11: 11 Abläufe und 198 Konstellationen gleich, beabsichtigte Abweichungen I-004/I-005 (F-001/F-002). Volle Suite vor U-B: 785/785. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Process\Modules\Offer;
|
|
|
|
use App\Actions\AutoOffer;
|
|
use App\Enums\BookingStatus;
|
|
use App\Enums\IntakeKind;
|
|
use App\Enums\ProcessingMode;
|
|
use App\Process\CaseContext;
|
|
use App\Process\StepResult;
|
|
|
|
/**
|
|
* The automatic answer of a request (binding offer or information "unter Vorbehalt"): due while the request waits for
|
|
* its first answer and the case is handled automatically; carried out by {@see AutoOffer}, which checks every release
|
|
* rule (dates, contract texts, calendar clearance, document composition) itself.
|
|
*/
|
|
trait AnswersRequest
|
|
{
|
|
public function due(CaseContext $case): bool
|
|
{
|
|
$booking = $case->booking;
|
|
|
|
return $booking->processingMode() === ProcessingMode::Automatic
|
|
&& $booking->status === BookingStatus::Reserved && $booking->offer_version === 0 && $booking->information_version === 0
|
|
&& $booking->intake !== IntakeKind::Booking;
|
|
}
|
|
|
|
public function blockers(CaseContext $case): array
|
|
{
|
|
return app(AutoOffer::class)->blockers($case->booking);
|
|
}
|
|
|
|
public function run(CaseContext $case): StepResult
|
|
{
|
|
$reasons = app(AutoOffer::class)->handle($case->booking);
|
|
|
|
return $reasons === [] ? StepResult::ran() : StepResult::blocked($reasons);
|
|
}
|
|
|
|
public function isOutward(): bool
|
|
{
|
|
return true;
|
|
}
|
|
}
|