feat: unify pickup selection
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user