feat: stop booking flow when BusPro is unreachable
This commit is contained in:
1 parent
ac23baf625
commit
55378b2bbc
9 files changed
+249
-43
No files matched your search
@@ -10,6 +10,7 @@ use App\BusProNet\Model\Service;
|
||||
use App\BusProNet\Model\Travel;
|
||||
use App\BusProNet\Service\BookingStatusRuleRegistry;
|
||||
use App\BusProNet\XmlLoader\AgencyLoader;
|
||||
use App\Exception\BookingBackendUnavailableException;
|
||||
use App\Exception\NoRoomsAvailableException;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
@@ -46,6 +47,11 @@ class BookingConfigurator
|
||||
* - 'Frei': Regular booking with availability checks
|
||||
* - 'Option': Create-flow override from specific rules
|
||||
* - 'Anfrage': Inquiry booking, allows booking even with 0 availability
|
||||
*
|
||||
* The availability call doubles as the health check for the whole flow: if BusPro cannot be
|
||||
* reached now, the inquiry in step 3 would fail after the customer typed in every participant.
|
||||
*
|
||||
* @throws BookingBackendUnavailableException When BusPro cannot be reached
|
||||
*/
|
||||
public function startFreshBooking(Request $request, int $dateId, int $hotelId, ?int $agencyId = null): BookingDto
|
||||
{
|
||||
@@ -56,7 +62,7 @@ class BookingConfigurator
|
||||
|
||||
// Fetch and patch availability data (includes allowedBookingStatus from API)
|
||||
// Force refresh ensures fresh data at booking start, then populates cache for subsequent loads
|
||||
$availabilities = $this->travelDataService->getAvailabilityData($dateId, cached: true, forceRefresh: true);
|
||||
$availabilities = $this->travelDataService->getAvailabilityData($dateId, cached: true, forceRefresh: true, requireReachable: true);
|
||||
if (null !== $availabilities) {
|
||||
$this->travelDataService->patchAvailabilities($travelData, $availabilities);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user