wip: insurance booking

This commit is contained in:
Björn Fromme
2025-09-30 14:37:49 +02:00
parent 90ae78262a
commit a5dce776de
11 changed files with 131 additions and 475 deletions
+20
View File
@@ -19,11 +19,31 @@ final class Constants
public const TOKEN_INSURANCES = ['RRV', 'PAK', 'OHN', 'PKG'];
public const TOKEN_PARKING = 'PAR';
// Insurance subtype labels for display
public const INSURANCE_LABELS = [
'RRV' => 'Reiserücktrittsversicherung',
'PAK' => 'Reiseschutz',
'OHN' => 'Selbstbehalt',
];
// Normalized service group keys for pricing display
public const GROUP_TRANSPORTATION = 'transportation';
public const GROUP_RENTALS = 'rentals';
public const GROUP_INSURANCE = 'insurance';
// Service type display labels (German) - used in pricing calculator
public const SERVICE_LABELS = [
self::TOKEN_COURSES => 'Kurse',
self::TOKEN_SKI_PASS => 'Skipässe',
self::TOKEN_ADDITIONAL => 'Zusatzleistungen',
self::TOKEN_BOARD => 'Verpflegung',
self::TOKEN_RENTAL_INSURANCE => 'Leihmaterial-Versicherung',
self::TOKEN_PARKING => 'Parkplatz',
self::GROUP_TRANSPORTATION => 'Beförderung',
self::GROUP_RENTALS => 'Leihmaterial',
self::GROUP_INSURANCE => 'Reiseversicherungen',
];
public const STATUS_AVAILABLE = 'Frei';
public const STATUS_BLOCKED = 'Buchungsstop';
public const STATUS_ON_REQUEST = 'Anfrage';
@@ -44,33 +44,6 @@ class InsuranceLoader extends AbstractLoader
return $insurances[$id] ?? null;
}
/**
* Loads all insurances with resolved package relationships.
*
* @param string|null $filename The XML filename to load from
* @return array<string|int, Insurance> Array of Insurance objects with resolved relationships
*/
public function loadAllWithRelationships(?string $filename = 'versicherungen.xml'): array
{
$insurances = $this->loadAll($filename);
// Resolve package relationships
foreach ($insurances as $insurance) {
if ($insurance->package && !empty($insurance->containedInsuranceIds)) {
foreach ($insurance->containedInsuranceIds as $containedId) {
if (isset($insurances[$containedId])) {
$insurance->containedInsurances[] = $insurances[$containedId];
} else {
// Log missing insurance reference for debugging
error_log("Insurance package {$insurance->id} references missing insurance {$containedId}");
}
}
}
}
return $insurances;
}
private function loadXml(?string $filename = 'versicherungen.xml'): Crawler
{
$xml = $this->xmlExport->read($filename);