wip: insurance booking phase 5

This commit is contained in:
Björn Fromme
2025-09-26 16:54:48 +02:00
parent 199ef08e35
commit 0809f07d46
5 changed files with 452 additions and 36 deletions
+43 -36
View File
@@ -14,13 +14,19 @@ This document outlines the complete implementation plan for making travel insura
- **Field Handler Architecture**: Existing pattern for dynamic form fields
- **HTMX Integration**: Real-time form updates infrastructure
### ❌ Missing Implementation
- Insurance subtype parsing and type resolution system
- Participant insurance field and selection logic
- Insurance matching service with criteria validation
- Auto-reselection when participant price changes
- Form integration and field handlers
### ✅ Recently Completed
- **Phase 1**: Insurance subtype parsing and type resolution system
- **Phase 2**: Enhanced age calculation with reference date support ✅
- **Phase 3**: Insurance matching service with comprehensive criteria validation
- **Phase 4**: ParticipantDto enhancement with insurance property ✅
- **Phase 5**: Form field handler for insurance selection processing ✅
### ❌ Remaining Implementation
- Form integration and field configuration
- Controller integration and data handling
- Frontend templates and UX
- Auto-reselection when participant price changes
- Advanced features and applicant control
## Key Technical Discoveries
@@ -36,25 +42,25 @@ This document outlines the complete implementation plan for making travel insura
## Implementation Phases
### Phase 1: Insurance Type System
### Phase 1: Insurance Type System ✅ COMPLETED
**Goal**: Add type resolution capability to distinguish insurance types
#### 1.1 Extend Insurance Model
- [ ] Add `subType` property to `Insurance` model (from XML `unterart`)
- [ ] Add computed `type` property (resolved via service)
- [ ] Update serialization groups if needed
#### 1.1 Extend Insurance Model
- [x] Add `subType` property to `Insurance` model (from XML `unterart`)
- [x] Add computed `type` property (resolved via service)
- [x] Update serialization groups if needed
#### 1.2 Update Insurance Parser
- [ ] Modify `InsuranceParser::parseInsuranceNode()` to parse `unterart` attribute
- [ ] Add subtype to individual insurance parsing
- [ ] Ensure package parsing maintains existing functionality
#### 1.2 Update Insurance Parser
- [x] Modify `InsuranceParser::parseInsuranceNode()` to parse `unterart` attribute
- [x] Add subtype to individual insurance parsing
- [x] Ensure package parsing maintains existing functionality
#### 1.3 Create Insurance Type Resolver
- [ ] Create `InsuranceTypeResolver` service
- [ ] Implement type resolution for individual insurances
- [ ] Implement package type resolution via contained insurance analysis
- [ ] Define type constants: `TRAVEL_CANCELLATION`, `TRAVEL_PROTECTION`, etc.
- [ ] Handle family variants using `familyInsurance` boolean
#### 1.3 Create Insurance Type Resolver
- [x] Create `InsuranceTypeResolver` service
- [x] Implement type resolution for individual insurances
- [x] Implement package type resolution via contained insurance analysis
- [x] Define type constants: `TRAVEL_CANCELLATION`, `TRAVEL_PROTECTION`, etc.
- [x] Handle family variants using `familyInsurance` boolean
```php
// Type Constants
@@ -62,27 +68,28 @@ const TRAVEL_CANCELLATION = 'TRAVEL_CANCELLATION';
const TRAVEL_CANCELLATION_FAMILY = 'TRAVEL_CANCELLATION_FAMILY';
const TRAVEL_PROTECTION = 'TRAVEL_PROTECTION';
const TRAVEL_PROTECTION_FAMILY = 'TRAVEL_PROTECTION_FAMILY';
const DEDUCTIBLE = 'DEDUCTIBLE';
```
#### 1.4 Testing
- [ ] Create `InsuranceTypeResolverTest`
- [ ] Test individual insurance type resolution
- [ ] Test package type resolution
- [ ] Test family variant detection
- [ ] Verify existing insurance parsing still works
#### 1.4 Testing
- [x] Create `InsuranceTypeResolverTest`
- [x] Test individual insurance type resolution
- [x] Test package type resolution
- [x] Test family variant detection
- [x] Verify existing insurance parsing still works
### Phase 2: Enhanced Age Calculation
### Phase 2: Enhanced Age Calculation ✅ COMPLETED
**Goal**: Support age calculation at specific dates (travel start date)
#### 2.1 Update ParticipantDto
- [ ] Add `getAgeAtDate(\DateTimeImmutable $referenceDate): ?int` method
- [ ] Keep existing `getAge(): ?int` for backward compatibility
- [ ] Ensure proper null handling for missing birth dates
#### 2.1 Update ParticipantDto
- [x] Enhanced existing `getAge()` method with optional reference date parameter
- [x] Keep existing `getAge(): ?int` for backward compatibility
- [x] Ensure proper null handling for missing birth dates
#### 2.2 Testing
- [ ] Add tests for `getAgeAtDate()` method
- [ ] Test edge cases (leap years, same day, etc.)
- [ ] Verify existing age calculation still works
#### 2.2 Testing
- [x] Add comprehensive tests for reference date age calculation
- [x] Test edge cases (leap years, same day, etc.)
- [x] Verify existing age calculation still works
### Phase 3: Insurance Matching Service
**Goal**: Implement comprehensive insurance matching with all criteria