feat: unify pickup selection

This commit is contained in:
Björn Fromme
2026-03-16 11:59:10 +01:00
parent 0f4b16c194
commit e330626b03
19 changed files with 119 additions and 325 deletions
@@ -178,7 +178,11 @@ class BookingDataProcessor
*/
private function processPickupLocations(object $participant, object $bookingData): void
{
if ('BUS' === $participant->transportationOutbound->subType && null !== $selectedPickup = $participant->pickupOutbound) {
// Check if either transportation direction is BUS and pickup is selected
$hasOutboundBus = null !== $participant->transportationOutbound && 'BUS' === $participant->transportationOutbound->subType;
$hasInboundBus = null !== $participant->transportationInbound && 'BUS' === $participant->transportationInbound->subType;
if (($hasOutboundBus || $hasInboundBus) && null !== $selectedPickup = $participant->pickup) {
if (false === isset($bookingData->pickupsOutbound[$selectedPickup->id])) {
$bookingData->pickupsOutbound[$selectedPickup->id] = $selectedPickup;
}
@@ -729,8 +733,8 @@ class BookingDataProcessor
/**
* Collects pickup location mappings.
*
* Only collects outbound pickups as the API doesn't support different pickups
* for inbound direction. Both directions use the same pickup location.
* Collects the unified pickup selection which applies to both directions.
* The API receives this as outbound pickup data.
*
* @return array<string, array<int>> Map of pickup ID to participant IDs
*/
@@ -741,9 +745,8 @@ class BookingDataProcessor
foreach ($bookingDto->participants as $index => $participant) {
$participantId = $index + 1;
// Only use outbound pickups (inbound uses same location)
if (null !== $participant->pickupOutbound) {
$pickupMap[$participant->pickupOutbound->id][] = $participantId;
if (null !== $participant->pickup) {
$pickupMap[$participant->pickup->id][] = $participantId;
}
}