wip: insurance booking
This commit is contained in:
@@ -8,8 +8,6 @@ use App\BusProNet\Model\Insurance;
|
||||
use App\Form\Model\BookingCreateDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Model\InsuranceEligibilityCriteria;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\InsuranceTypeResolver;
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
@@ -23,9 +21,9 @@ class InsuranceMatchingService
|
||||
{
|
||||
public function __construct(
|
||||
private readonly BookingPriceCalculatorService $priceCalculatorService,
|
||||
private readonly InsuranceTypeResolver $insuranceTypeResolver
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters insurances based on participant and booking criteria.
|
||||
*
|
||||
@@ -78,6 +76,10 @@ class InsuranceMatchingService
|
||||
/**
|
||||
* Batch-assigns insurances of the same type to all participants based on individual pricing.
|
||||
*
|
||||
* FUTURE FEATURE: This method will be used when implementing the "applicant assigns
|
||||
* insurance to all participants" feature. The applicant's selection will be propagated
|
||||
* to all participants with automatic price tier adjustment based on individual prices.
|
||||
*
|
||||
* This method takes the applicant's insurance selection and assigns the same insurance type
|
||||
* (subType + familyInsurance) to all participants, but selects the appropriate price tier
|
||||
* based on each participant's individual travel price.
|
||||
@@ -87,6 +89,8 @@ class InsuranceMatchingService
|
||||
* @param BookingCreateDto $booking The booking with all participants
|
||||
*
|
||||
* @return array<int, Insurance|null> Array indexed by participant index with assigned insurances
|
||||
*
|
||||
* @internal Reserved for future feature implementation
|
||||
*/
|
||||
public function batchAssignInsuranceToParticipants(array $availableInsurances, Insurance $selectedInsurance, BookingCreateDto $booking): array
|
||||
{
|
||||
@@ -106,9 +110,13 @@ class InsuranceMatchingService
|
||||
|
||||
/**
|
||||
* Creates eligibility criteria from participant and booking data.
|
||||
*
|
||||
* This method performs early validation before creating the criteria object
|
||||
* to avoid unnecessary object instantiation when criteria cannot be satisfied.
|
||||
*/
|
||||
private function createEligibilityCriteria(ParticipantDto $participant, BookingCreateDto $booking): ?InsuranceEligibilityCriteria
|
||||
{
|
||||
// Early return if travel dates are missing - cannot evaluate any criteria
|
||||
$travelStartDate = $booking->travel->dateFrom;
|
||||
$travelEndDate = $booking->travel->dateTo;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user