travel_date ?? '')); $booking_date_formatted = \Yatra\Helpers\FormatHelper::formatDateTime((string) ($booking->created_at ?? '')); // "Balance just paid" context detection. // A `?balance=paid` query arg is appended by the remaining-payment flows // (see PaymentGatewayController::create_remaining_balance_intent and // BookingSessionController::process_remaining_payment). We only render the // "balance paid" copy when BOTH the flag is present AND the booking actually // reports a paid status — that way a stale bookmarked URL or a tampered // query string can't show misleading content if a balance is still due. $is_balance_paid_request = isset($_GET['balance']) && sanitize_key((string) $_GET['balance']) === 'paid'; $booking_payment_status = (string) ($booking->payment_status ?? ''); $booking_amount_due = (float) ($booking->amount_due ?? 0); $booking_is_fully_paid = $booking_payment_status === 'paid' || $booking_amount_due <= 0.01; $show_balance_paid_banner = $is_balance_paid_request && $booking_is_fully_paid; // A gateway may redirect back here with `?payment=cancelled` (user aborted the // payment at the provider) or `?payment=failed`. Show an informative notice only // when the booking is not already fully paid, so a genuinely-paid booking that // happens to carry a stale query arg never shows a misleading "cancelled" message. $payment_result_flag = isset($_GET['payment']) ? sanitize_key((string) $_GET['payment']) : ''; $show_payment_cancelled_notice = in_array($payment_result_flag, ['cancelled', 'failed'], true) && !$booking_is_fully_paid; // Resolve the most recent gateway used on this booking. // `$booking->payment_gateway` is the *initial* method chosen at booking time // (e.g. Pay Later), which is misleading when the customer later settled the // balance via a different gateway (e.g. Stripe). Show the latest payment's // gateway in the Payment Method line; fall back to the booking's stored // gateway when no payment row exists yet. $display_payment_gateway = (string) ($booking->payment_gateway ?? ''); if (!empty($booking->id)) { try { $latest_payment = (new \Yatra\Repositories\PaymentRepository())->findLatestByBookingId((int) $booking->id); if ($latest_payment) { $latest_gateway = (string) ($latest_payment->payment_gateway ?? $latest_payment->gateway ?? ''); if ($latest_gateway !== '') { $display_payment_gateway = $latest_gateway; } } } catch (\Throwable $e) { // Repository unavailable for some reason — keep the booking's stored gateway. } } // Resolved customer account URL (configurable via Settings → Permalink → Account base). $yatra_account_url = home_url('/' . \Yatra\Services\SettingsService::getAccountBase()); // Get status color $status_colors = [ 'pending' => ['bg' => '#fef3c7', 'text' => '#d97706', 'label' => 'Pending'], 'confirmed' => ['bg' => '#d1fae5', 'text' => '#059669', 'label' => 'Confirmed'], 'processing' => ['bg' => '#dbeafe', 'text' => '#2563eb', 'label' => 'Processing'], 'completed' => ['bg' => '#d1fae5', 'text' => '#059669', 'label' => 'Completed'], 'cancelled' => ['bg' => '#fee2e2', 'text' => '#dc2626', 'label' => 'Cancelled'], 'refunded' => ['bg' => '#fce7f3', 'text' => '#db2777', 'label' => 'Refunded'], 'on_hold' => ['bg' => '#e5e7eb', 'text' => '#6b7280', 'label' => 'On Hold'], ]; $status_style = $status_colors[$booking->status] ?? $status_colors['pending']; // Ensure Font Awesome CSS is available for icon-picker rendered icons (fa-solid/fa-regular). // This template can be displayed outside normal "trip page" contexts, so we explicitly // register/enqueue the shared stylesheet dependencies before printing the header. if (class_exists(\Yatra\Providers\FrontendAssetsProvider::class)) { \Yatra\Providers\FrontendAssetsProvider::registerCoreFrontendStylesheets(); if (wp_style_is('yatra-fontawesome-6', 'registered')) { wp_enqueue_style('yatra-fontawesome-6'); } if (wp_style_is('yatra-common', 'registered')) { wp_enqueue_style('yatra-common'); } } yatra_get_header(); // Hook for Pro modules to add custom scripts (Facebook Pixel, etc.) do_action('yatra_booking_confirmation_header', $booking); ?>
status === 'confirmed') { esc_html_e('Thank you for your booking. We look forward to hosting you!', 'yatra'); } elseif ($booking->status === 'pending') { esc_html_e('Thank you for your booking. Your booking is pending confirmation.', 'yatra'); } elseif ($booking->status === 'cancelled') { esc_html_e('This booking has been cancelled.', 'yatra'); } else { esc_html_e('Thank you for your booking submission.', 'yatra'); } ?>
starting_location); ?> ending_location) && $booking->ending_location !== $booking->starting_location) : ?> → ending_location); ?>
trip_destinations_list)) : ?> trip_activities_list)) : ?> trip_categories_list)) : ?>