feat: move scope of enforced 'option' status to full booking
addresses #869chtfeq
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user