findByConfirmationSegment($confirmation_id); if (!$booking) { return false; } // Prevent 404 handling $this->prevent404(); // Load trip attributes for booking confirmation display if ($booking && !empty($booking->trip_id)) { try { $singleTripController = new \Yatra\Controllers\SingleTripController(); // Use reflection to access private method $reflection = new \ReflectionClass($singleTripController); $method = $reflection->getMethod('getTripAttributes'); $method->setAccessible(true); $attributes = $method->invoke($singleTripController, (int) $booking->trip_id); // Create a simple list of attribute names for tag display $booking->trip_attributes_list = array_map(function($attr) { return $attr['name']; }, $attributes); } catch (\Throwable $e) { $booking->trip_attributes_list = []; } } // Set up global booking object $this->setGlobal('yatra_booking', $booking); // Set up query vars for backward compatibility $this->setQueryVars([ 'yatra_booking_confirmation' => $confirmation_id, 'yatra_booking' => $booking, ]); // Load the booking confirmation template $template_path = YATRA_PLUGIN_PATH . 'templates/booking-confirmation.php'; if (!file_exists($template_path)) { $this->logError("Booking confirmation template not found: {$template_path}"); return false; } include $template_path; $this->exit(); return true; } }