fix: exclude cancelled participants' services from price breakdown
This commit is contained in:
1 parent
553ec901f3
commit
849a19b67a
4 files changed
+74
-4
No files matched your search
@@ -63,7 +63,8 @@ class BookingPricingAssembler
|
||||
/**
|
||||
* Calculates pricing for all selected services across all participants, grouped by subtype.
|
||||
*
|
||||
* Only includes services from eligible participants (those with available skipasses for their age).
|
||||
* Only includes services from billed participants: not cancelled, and eligible (those with available
|
||||
* skipasses for their age).
|
||||
*
|
||||
* @return array<int, array<string, mixed>>
|
||||
*/
|
||||
@@ -78,7 +79,7 @@ class BookingPricingAssembler
|
||||
$serviceAggregation = [];
|
||||
|
||||
foreach ($participants as $participantIndex => $participant) {
|
||||
if (false === $this->participantEligibilityChecker->isParticipantEligible($bookingDto, $participantIndex)) {
|
||||
if (false === $this->isParticipantBilled($bookingDto, $participantIndex, $participant)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -142,7 +143,7 @@ class BookingPricingAssembler
|
||||
$parkingParticipants = 0;
|
||||
|
||||
foreach ($participants as $participantIndex => $participant) {
|
||||
if (false === $this->participantEligibilityChecker->isParticipantEligible($bookingDto, $participantIndex)) {
|
||||
if (false === $this->isParticipantBilled($bookingDto, $participantIndex, $participant)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -306,6 +307,18 @@ class BookingPricingAssembler
|
||||
return $groupedServices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the participant's services count towards the breakdown.
|
||||
*
|
||||
* A cancelled participant is billed only through BusPro's Stornokosten surcharge. Their services
|
||||
* are never sent back to BusPro, so counting them would put the breakdown above BusPro's total.
|
||||
*/
|
||||
private function isParticipantBilled(BookingDto $bookingDto, int $participantIndex, ParticipantDto $participant): bool
|
||||
{
|
||||
return false === $participant->isCanceled()
|
||||
&& true === $this->participantEligibilityChecker->isParticipantEligible($bookingDto, $participantIndex);
|
||||
}
|
||||
|
||||
private function getGroupNameForSubtype(string $subType): string
|
||||
{
|
||||
if (true === in_array($subType, Constants::TOKEN_RENTALS, true)) {
|
||||
|
||||
Reference in new issue
Block a user