# yatra/3.0.3/app/Core/Handlers/BookingConfirmationPageHandler.php

Yatra – Travel Booking &amp; Tour Operator Software, version 3.0.3. 78 lines.

- Page: https://pluginprobe.com/plugins/yatra/3.0.3/code/app/Core/Handlers/BookingConfirmationPageHandler.php
- Raw: https://pluginprobe.com/plugins/yatra/3.0.3/raw/app/Core/Handlers/BookingConfirmationPageHandler.php
- Modified: 2026-04-14T03:47:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/yatra/3.0.3/code/app/Core/Handlers/BookingConfirmationPageHandler.php#L10-L20`.

```php
<?php

declare(strict_types=1);

namespace Yatra\Core\Handlers;

use Yatra\Repositories\BookingRepository;

/**
 * Booking Confirmation Page Handler
 *
 * Handles booking confirmation page requests
 */
class BookingConfirmationPageHandler extends BasePageHandler
{
    /**
     * Handle booking confirmation page request
     *
     * @param array $route_data Route data from RouteMatcher
     * @return bool True if handled successfully
     */
    public function handle(array $route_data): bool
    {
        $confirmation_id = (string) ($route_data['confirmation_id'] ?? '');

        $bookingRepo = new BookingRepository();
        $booking = $bookingRepo->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;
    }
}

```
