diff --git a/.env b/.env index e12f3d2..70d80fd 100644 --- a/.env +++ b/.env @@ -58,6 +58,11 @@ APP_WEBSITE_BASE_URL="https://www.ep-reisen.de/" APP_TRAVEL_PREFER_REMOTE=false APP_TRAVEL_ENABLE_FALLBACK=true +# Booking Configuration +# Status for new bookings: 'F' (Fixed/Final), 'O' (Option - requires agency confirmation) +# Use 'O' during beta phase, switch to 'F' for production +DEFAULT_BOOKING_STATUS=F + API_KEYS= XML_EXPORT_PATH="%kernel.project_dir%/var/xmlexport" diff --git a/config/services.yaml b/config/services.yaml index 2f4de95..51f5ba0 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -8,6 +8,7 @@ parameters: terms_and_conditions_url: '%env(APP_TERMS_AND_CONDITIONS_URL)%' path_to_keys: '%kernel.project_dir%/config/secret' bpn_debug: '%env(APP_BPN_DEBUG)%' + default_booking_status: '%env(DEFAULT_BOOKING_STATUS)%' # Body dimensions choices for BodyDimensionsType body_dimensions.height_choices: diff --git a/src/Service/BookingService.php b/src/Service/BookingService.php index ac0b406..fc7757e 100644 --- a/src/Service/BookingService.php +++ b/src/Service/BookingService.php @@ -10,6 +10,7 @@ use App\Exception\NoRoomsAvailableException; use App\Form\Model\BookingDto; use App\Form\Model\ParticipantDto; use App\Form\Model\RoomSelectionDto; +use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -27,6 +28,8 @@ class BookingService private readonly TravelDataService $travelDataService, private readonly BookingPriceCalculatorService $priceCalculator, private readonly ParticipantEligibilityService $participantEligibilityService, + #[Autowire('%default_booking_status%')] + private readonly string $defaultBookingStatus, ) { } @@ -522,13 +525,16 @@ class BookingService * Determines the initial booking status based on travel configuration. * * This method implements a multi-stage check to determine if a booking - * should start as inquiry ('A') or final ('F') booking: + * should start as inquiry ('A') or use the configured default status: * 1. Checks if final bookings are allowed via buchungstatusmoeglich attribute from API * 2. Checks if only inquiry rooms are available (no Frei rooms with available > 0) * + * The default status is configured via DEFAULT_BOOKING_STATUS env variable. + * Use 'O' (Option) during beta for agency confirmation, 'F' (Final) for production. + * * @param Travel $travelData The travel data to evaluate * - * @return string 'A' for inquiry booking, 'F' for final booking + * @return string 'A' for inquiry booking, or the configured default status */ private function determineInitialBookingStatus(Travel $travelData): string { @@ -544,7 +550,7 @@ class BookingService return 'A'; } - return 'F'; + return $this->defaultBookingStatus; } /**