feat: move scope of enforced 'option' status to full booking

addresses #869chtfeq
This commit is contained in:
Björn Fromme
2026-03-19 16:15:07 +01:00
parent 45d05786da
commit df8566e1b5
19 changed files with 388 additions and 329 deletions
+16
View File
@@ -8,6 +8,7 @@ use App\BusProNet\Constants;
use App\BusProNet\Model\Room;
use App\BusProNet\Model\Service;
use App\BusProNet\Model\Travel;
use App\BusProNet\Service\BookingStatusRuleRegistry;
use App\BusProNet\XmlLoader\AgencyLoader;
use App\Exception\BookingSessionNotFoundException;
use App\Exception\NoRoomsAvailableException;
@@ -31,6 +32,7 @@ class BookingService
private readonly TravelDataService $travelDataService,
private readonly BookingPriceCalculatorService $priceCalculator,
private readonly ParticipantEligibilityService $participantEligibilityService,
private readonly BookingStatusRuleRegistry $bookingStatusRuleRegistry,
private readonly AgencyLoader $agencyLoader,
#[Autowire('%default_booking_status%')]
private readonly string $defaultBookingStatus,
@@ -982,6 +984,20 @@ class BookingService
}
}
/**
* Applies booking-level status rules in create flow.
*
* Inquiry bookings always win and are never overridden.
*/
public function applyCreateBookingStatusRules(BookingDto $bookingDto): void
{
if (Constants::BOOKING_STATUS_INQUIRY === $bookingDto->bookingStatus) {
return;
}
$bookingDto->bookingStatus = $this->bookingStatusRuleRegistry->evaluateStatus($bookingDto);
}
/**
* Ensures the booking DTO has the correct number of participant objects.
*