wip: bulk insurance refactoring

This commit is contained in:
Björn Fromme
2025-10-18 16:39:57 +02:00
parent 08210b8e52
commit 479b177e90
9 changed files with 359 additions and 51 deletions
@@ -13,8 +13,8 @@ use App\Form\Model\BookingDto;
use App\Form\Service\Abstract\AbstractFieldOptionsProvider;
use App\Form\Service\Factory\ParticipantRoomChoiceLoaderFactory;
use App\Service\InsuranceMatchingService;
use App\Service\InsuranceTypeFilterService;
use App\Service\ServiceAvailabilityCalculator;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
/**
* Provides dynamic field options for participant form fields.
@@ -51,6 +51,7 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
private readonly ParticipantRoomChoiceLoaderFactory $roomChoiceLoaderFactory,
private readonly ServiceAvailabilityCalculator $serviceAvailabilityCalculator,
private readonly InsuranceMatchingService $insuranceMatchingService,
private readonly InsuranceTypeFilterService $insuranceTypeFilterService,
) {
parent::__construct();
}
@@ -757,9 +758,8 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
$availableInsurances = $bookingDto->travel->insurances ?? [];
// Exclude complementary insurances from standalone selection
// They are only available as part of packages
$availableInsurances = array_filter($availableInsurances, fn ($insurance) => !$insurance->complementary);
// Exclude complementary insurances (only available as part of packages)
$availableInsurances = $this->insuranceTypeFilterService->filterNonComplementary($availableInsurances);
// Use insurance matching service to filter based on eligibility criteria
return $this->insuranceMatchingService->getEligibleInsurances(