feat: consolidated insurance service
This commit is contained in:
@@ -22,8 +22,7 @@ class BookingPriceCalculatorService
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ParticipantEligibilityService $participantEligibilityService,
|
||||
private readonly InsuranceTypeFilterService $insuranceTypeFilterService,
|
||||
private readonly InsuranceEligibilityService $insuranceEligibilityService,
|
||||
private readonly InsuranceService $insuranceService,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -772,22 +771,20 @@ class BookingPriceCalculatorService
|
||||
|
||||
// For dependent participants: calculate price-tier-adjusted insurance
|
||||
// This mirrors the logic in BookingDataProcessor::applyBulkInsuranceIfActive()
|
||||
$availableInsurances = $bookingDto->travel->insurances;
|
||||
|
||||
// Exclude complementary insurances (only available as part of packages)
|
||||
$availableInsurances = $this->insuranceTypeFilterService->filterNonComplementary($availableInsurances);
|
||||
// Get selectable (non-complementary) insurances with caching
|
||||
$selectableInsurances = $this->insuranceService->getSelectableInsurances($bookingDto->travel);
|
||||
|
||||
// Get insurances of the same type as applicant's selection
|
||||
$sameTypeInsurances = $this->insuranceTypeFilterService->filterByType(
|
||||
$availableInsurances,
|
||||
$sameTypeInsurances = $this->insuranceService->filterByType(
|
||||
$selectableInsurances,
|
||||
$applicant->insurance
|
||||
);
|
||||
|
||||
// Calculate participant's travel price (excluding insurance)
|
||||
// Calculate travel price for eligibility checks
|
||||
$travelPrice = $this->calculateIndividualParticipantPriceExcludingInsurance($bookingDto, $participant->index);
|
||||
|
||||
// Get eligible insurances for THIS participant (price tier adjusted)
|
||||
$eligibleInsurances = $this->insuranceEligibilityService->getEligibleInsurances(
|
||||
$eligibleInsurances = $this->insuranceService->getEligibleInsurances(
|
||||
$sameTypeInsurances,
|
||||
$participant,
|
||||
$bookingDto,
|
||||
|
||||
Reference in New Issue
Block a user