V2.1: Kanalfähigkeiten, Ausführungsvarianten, Dokumentenentkopplung, Portalbestätigung

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>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-05 07:54:11 +01:00
1 parent ef1635e59a
commit 8442d0a3d8
62 files changed
+1818 -69

No files matched your search

+19
View File
@@ -12,9 +12,11 @@
use App\Enums\TenantServiceKey;
use App\Mail\PortalMailNotification;
use App\Models\BlockedPeriod;
use App\Models\Booking;
use App\Models\Channel;
use App\Models\IntakeObservation;
use App\Models\PortalEmail;
use App\Process\ProcessRunner;
use App\Support\Settings;
use App\Tenancy\TenantFeatures;
use Carbon\CarbonInterface;
@@ -79,6 +81,7 @@ public function handle(PortalMail $mail): ?PortalEmail
// One intake for all channels (package 4): bookings, requests and cancellations reach their case.
rescue(fn () => $this->intake($channel, $parsed, $record));
rescue(fn () => $this->resume($channel, $parsed, $record));
if (in_array($record->status, [PortalEmailStatus::Blocked, PortalEmailStatus::Released, PortalEmailStatus::NeedsReview], true)) {
rescue(fn () => Mail::to(Settings::notificationRecipients())->send(new PortalMailNotification($record)));
@@ -91,6 +94,22 @@ public function handle(PortalMail $mail): ?PortalEmail
return $record;
}
/**
* A booking mail of the portal can be the confirmation a case waits for (V2.1, docs/Prozessarchitektur/V2.1/02 §5): the
* case is evaluated again. Only cases whose channel makes them wait are touched – everything else stays as it was.
*/
private function resume(Channel $channel, ParsedPortalMail $parsed, PortalEmail $record): void
{
if ($parsed->type !== PortalEmailType::Booking) {
return;
}
$case = $record->blocked_period_id !== null ? Booking::query()->find(BlockedPeriod::withTrashed()->whereKey($record->blocked_period_id)->value('linked_booking_id')) : null;
$case ??= $parsed->reference !== null ? app(PortalIntake::class)->caseByReference($channel, $parsed->reference) : null;
if ($case !== null && $case->isBinding() && $case->process()->awaitsPortalConfirmation()) {
app(ProcessRunner::class)->advance($case, 'portal.mail');
}
}
private function intake(Channel $channel, ParsedPortalMail $parsed, PortalEmail $record): void
{
$intake = app(PortalIntake::class);