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
@@ -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(