wip: bulk insurance refactoring

This commit is contained in:
Björn Fromme
2026-03-16 11:59:11 +01:00
parent a3d7ee63d3
commit 1f5c835f8a
9 changed files with 359 additions and 51 deletions
@@ -15,6 +15,7 @@ use App\Form\Model\BankAccountDto;
use App\Form\Model\BookingDto;
use App\Form\Model\ParticipantDto;
use App\Service\InsuranceMatchingService;
use App\Service\InsuranceTypeFilterService;
/**
* Processes booking form data and converts it into BusProNet API payload format.
@@ -29,6 +30,7 @@ class BookingDataProcessor
{
public function __construct(
private readonly InsuranceMatchingService $insuranceMatchingService,
private readonly InsuranceTypeFilterService $insuranceTypeFilterService,
) {
}
@@ -1112,10 +1114,8 @@ class BookingDataProcessor
// Get all available insurances from travel data
$availableInsurances = $bookingDto->travel->insurances;
// Exclude complementary insurances from bulk assignment logic
// They are only available as part of packages and cannot be directly selected
$availableInsurances = array_filter($availableInsurances, fn ($insurance) => !$insurance->complementary);
$availableInsurances = array_values($availableInsurances);
// Exclude complementary insurances (only available as part of packages)
$availableInsurances = $this->insuranceTypeFilterService->filterNonComplementary($availableInsurances);
// Use InsuranceMatchingService for proper type-based assignment with price tier matching
$assignments = $this->insuranceMatchingService->batchAssignInsuranceToParticipants(