<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Component\HttpFoundation\Request; // Add this import
use Symfony\Component\HttpFoundation\JsonResponse; // Also add this if not present
class MondeController extends AbstractController
{
#[Route('/monde', name: 'blt_monde_all')]
public function monde(): Response
{
$apiUrlCountries = 'https://static-api.didatravel.com/api/v1/region/countries';
$apiUrlDestinations = 'https://static-api.didatravel.com/api/v1/region/destinations';
$username = 'DidaApiTestID';
$password = 'TestKey';
$httpClient = HttpClient::create();
// Step 1: Get all countries
$response = $httpClient->request('GET', $apiUrlCountries, [
'auth_basic' => [$username, $password],
]);
$countriesData = [];
$allDestinations = [];
if ($response->getStatusCode() === 200) {
$data = $response->toArray();
// Check if data is in the 'data' key or directly in response
$countries = isset($data['data']) ? $data['data'] : $data;
// Step 2: For each country, get its destinations
foreach ($countries as $country) {
$countryCode = $country['code'];
// Make API call for destinations of this specific country
$destResponse = $httpClient->request('GET', $apiUrlDestinations, [
'query' => [
'countryCode' => $countryCode,
'language' => 'en-US'
],
'auth_basic' => [$username, $password],
]);
$countryDestinations = [];
if ($destResponse->getStatusCode() === 200) {
$destData = $destResponse->toArray();
$countryDestinations = isset($destData['data']) ? $destData['data'] : $destData;
}
// Store country with its destinations
$countriesData[] = [
'country_code' => $countryCode,
'country_name' => $country['name'],
'destinations' => $countryDestinations,
'destination_count' => count($countryDestinations)
];
// Add all destinations to the combined list
foreach ($countryDestinations as $destination) {
$destination['country_code'] = $countryCode;
$destination['country_name'] = $country['name'];
$allDestinations[] = $destination;
}
}
}
//dd($countriesData);
return $this->render('blt/monde.html.twig', [
'countries' => $countriesData,
'all_destinations' => $allDestinations,
'total_countries' => count($countriesData),
'total_destinations' => count($allDestinations)
]);
}
#[Route('/monde/pays', name: 'blt_monde')]
public function pays(): Response
{
$apiUrlCountries = 'https://static-api.didatravel.com/api/v1/region/countries';
$username = 'DidaApiTestID';
$password = 'TestKey';
$httpClient = HttpClient::create();
// Get all countries
$response = $httpClient->request('GET', $apiUrlCountries, [
'auth_basic' => [$username, $password],
]);
$countriesData = [];
if ($response->getStatusCode() === 200) {
$data = $response->toArray();
$countriesData = isset($data['data']) ? $data['data'] : $data;
}
return $this->render('blt/pays.html.twig', [
'countries' => $countriesData,
'total_countries' => count($countriesData)
]);
}
#[Route('/monde/pays/{code}', name: 'blt_monde_pays_details')]
public function paysDetails(string $code): Response
{
$apiUrlCountries = 'https://static-api.didatravel.com/api/v1/region/countries';
$apiUrlDestinations = 'https://static-api.didatravel.com/api/v1/region/destinations';
$username = 'DidaApiTestID';
$password = 'TestKey';
$httpClient = HttpClient::create();
$countryData = null;
$countryDestinations = [];
// First, try to get the specific country if you want to verify it exists
// (The API might not have a single country endpoint, so we'll get all and filter)
$response = $httpClient->request('GET', $apiUrlCountries, [
'auth_basic' => [$username, $password],
]);
if ($response->getStatusCode() === 200) {
$data = $response->toArray();
$allCountries = isset($data['data']) ? $data['data'] : $data;
// Find the specific country
foreach ($allCountries as $country) {
if ($country['code'] === strtoupper($code)) {
$countryData = $country;
break;
}
}
}
// If country not found, show 404
if (!$countryData) {
throw $this->createNotFoundException('Pays non trouvé: ' . $code);
}
// Get destinations for this specific country
$destResponse = $httpClient->request('GET', $apiUrlDestinations, [
'query' => [
'countryCode' => strtoupper($code),
'language' => 'en-US'
],
'auth_basic' => [$username, $password],
]);
if ($destResponse->getStatusCode() === 200) {
$destData = $destResponse->toArray();
$countryDestinations = isset($destData['data']) ? $destData['data'] : $destData;
}
//dd($countryDestinations);
return $this->render('blt/pays_details.html.twig', [
'country' => $countryData,
'destinations' => $countryDestinations,
'destination_count' => count($countryDestinations)
]);
}
#[Route('/monde/hotel/details/{id}', name: 'blt_monde_hotel_details')]
public function hotelDetails(int $id): Response
{
$apiUrlHotelDetails = 'https://static-api.didatravel.com/api/v1/hotel/details';
$username = 'DidaApiTestID';
$password = 'TestKey';
$httpClient = HttpClient::create();
// Prepare the POST request body
$requestData = [
'language' => 'en-US',
'hotelIds' => [$id]
];
// Make POST request to get hotel details
$response = $httpClient->request('POST', $apiUrlHotelDetails, [
'auth_basic' => [$username, $password],
'headers' => [
'Content-Type' => 'application/json',
],
'json' => $requestData,
]);
$hotelDetails = null;
if ($response->getStatusCode() === 200) {
$data = $response->toArray();
$hotelDetails = isset($data['data']) ? $data['data'] : $data;
// If it's an array with one hotel, extract it
if (is_array($hotelDetails) && count($hotelDetails) === 1 && isset($hotelDetails[0])) {
$hotelDetails = $hotelDetails[0];
}
}
if (!$hotelDetails) {
throw $this->createNotFoundException('Détails de l\'hôtel non trouvés pour ID: ' . $id);
}
//dd($hotelDetails);
return $this->render('blt/hotel_details.html.twig', [
'hotel' => $hotelDetails,
'hotel_id' => $id
]);
}
#[Route('/monde/hotel/{code}', name: 'blt_monde_hotel')]
public function hotelParPays(string $code): Response
{
$apiUrlCountries = 'https://static-api.didatravel.com/api/v1/region/countries';
$apiUrlHotels = 'https://static-api.didatravel.com/api/v1/hotel/list';
$username = 'DidaApiTestID';
$password = 'TestKey';
$httpClient = HttpClient::create();
$countryData = null;
$hotelIds = [];
$hotelDetails = [];
$hotelPrices = [];
// First, verify the country exists
$response = $httpClient->request('GET', $apiUrlCountries, [
'auth_basic' => [$username, $password],
]);
if ($response->getStatusCode() === 200) {
$data = $response->toArray();
$allCountries = isset($data['data']) ? $data['data'] : $data;
// Find the specific country
foreach ($allCountries as $country) {
if ($country['code'] === strtoupper($code)) {
$countryData = $country;
break;
}
}
}
// If country not found, show 404
if (!$countryData) {
throw $this->createNotFoundException('Pays non trouvé: ' . $code);
}
// Get hotel list for this specific country
$hotelResponse = $httpClient->request('GET', $apiUrlHotels, [
'query' => [
'countryCode' => strtoupper($code),
'language' => 'en-US'
],
'auth_basic' => [$username, $password],
]);
if ($hotelResponse->getStatusCode() === 200) {
$hotelData = $hotelResponse->toArray();
$hotelIds = isset($hotelData['data']) ? $hotelData['data'] : $hotelData;
}
// Limit hotel IDs for testing (API may have rate limits)
//dd($hotelIds);
// Fetch hotel details for limited hotel IDs
if (!empty($hotelIds)) {
$hotelDetails = $this->fetchHotelDetails($hotelIds, $httpClient, $username, $password);
$hotelPrices = $this->fetchHotelPrices($hotelIds, $httpClient, $username, $password);
}
//dd($hotelDetails, $hotelPrices,$hotelIds);
return $this->render('blt/hotelListMonde.html.twig', [
'country' => $countryData,
'hotel_ids' => $hotelIds,
'hotel_details' => $hotelDetails,
'hotel_prices' => $hotelPrices,
'hotel_count' => count($hotelIds)
]);
}
#[Route('/monde/destinations/{destinationId}', name: 'blt_monde_destination_hotels')]
public function hotelsParDestination(int $destinationId): Response
{
$apiUrlPriceSearch = 'https://apiint.didatravel.com/api/rate/pricesearch?$format=json';
$username = 'DidaApiTestID';
$password = 'TestKey';
$httpClient = HttpClient::create();
// Use default dates (next 2 days)
$checkInDate = (new \DateTime('+1 day'))->format('Y-m-d');
$checkOutDate = (new \DateTime('+2 days'))->format('Y-m-d');
// Prepare the POST request body for destination search
$requestData = [
'Header' => [
'ClientID' => $username,
'LicenseKey' => $password
],
'CheckInDate' => $checkInDate,
'CheckOutDate' => $checkOutDate,
'Destination' => [
'CityCode' => (string)$destinationId
],
'LowestPriceOnly' => true,
'Nationality' => 'FR',
'Currency' => 'EUR'
];
try {
$response = $httpClient->request('POST', $apiUrlPriceSearch, [
'headers' => [
'Content-Type' => 'application/json',
],
'json' => $requestData,
'timeout' => 30
]);
$hotelIds = [];
$hotelPrices = [];
if ($response->getStatusCode() === 200) {
$data = $response->toArray();
if (isset($data['Success']) && isset($data['Success']['PriceDetails']) && isset($data['Success']['PriceDetails']['HotelList'])) {
$hotelsData = $data['Success']['PriceDetails']['HotelList'];
// Extract hotel IDs and organize prices
foreach ($hotelsData as $hotel) {
if (isset($hotel['HotelID'])) {
$hotelId = $hotel['HotelID'];
$hotelIds[] = $hotelId;
// Store price information
$hotelPrices[$hotelId] = [
'LowestPrice' => $hotel['LowestPrice']['Value'] ?? null,
'Currency' => $hotel['LowestPrice']['Currency'] ?? 'EUR',
'CheckInDate' => $checkInDate,
'CheckOutDate' => $checkOutDate,
'HotelName' => $hotel['HotelName'] ?? null,
'ExcludedFeeList' => $hotel['ExcludedFeeList'] ?? []
];
}
}
}
}
// Fetch hotel details for limited hotel IDs
$hotelDetails = [];
if (!empty($hotelIds)) {
$hotelDetails = $this->fetchHotelDetails($hotelIds, $httpClient, $username, $password);
//dd($hotelIds,$hotelDetails,$hotelPrices);
}
// Create a dummy country object for the template
$countryData = [
'name' => 'Destination #' . $destinationId,
'code' => 'DEST' . $destinationId
];
return $this->render('blt/hotelListMonde.html.twig', [
'country' => $countryData,
'hotel_ids' => $hotelIds,
'hotel_details' => $hotelDetails,
'hotel_prices' => $hotelPrices, // This already has prices from the first API call!
'hotel_count' => count($hotelIds)
]);
} catch (\Exception $e) {
// Handle error
error_log('Error fetching hotels for destination: ' . $e->getMessage());
// Create a dummy country object for the template
$countryData = [
'name' => 'Destination #' . $destinationId,
'code' => 'DEST' . $destinationId
];
return $this->render('blt/hotelListMonde.html.twig', [
'country' => $countryData,
'hotel_ids' => [],
'hotel_details' => [],
'hotel_prices' => [],
'hotel_count' => 0,
'error' => $e->getMessage()
]);
}
}
#[Route('/monde/test', name: 'monde_test')]
public function test(): Response
{
return new Response('Monde controller is working!');
}
/**
* Fetch hotel details from DidaTravel API
*/
private function fetchHotelDetails(array $hotelIds, HttpClientInterface $httpClient, string $username, string $password): array
{
$apiUrlHotelDetails = 'https://static-api.didatravel.com/api/v1/hotel/details';
// Prepare the POST request body
$requestData = [
'language' => 'en-US',
'hotelIds' => $hotelIds
];
try {
$response = $httpClient->request('POST', $apiUrlHotelDetails, [
'auth_basic' => [$username, $password],
'headers' => [
'Content-Type' => 'application/json',
],
'json' => $requestData,
'timeout' => 30 // Increase timeout for multiple hotels
]);
if ($response->getStatusCode() === 200) {
$data = $response->toArray();
$hotelDetails = isset($data['data']) ? $data['data'] : $data;
// Organize by hotel ID for easy access
$organizedDetails = [];
foreach ($hotelDetails as $detail) {
if (isset($detail['id'])) {
$organizedDetails[$detail['id']] = $detail;
}
}
return $organizedDetails;
}
} catch (\Exception $e) {
// Log error and return empty array
// error_log('Error fetching hotel details: ' . $e->getMessage());
}
return [];
}
/**
* Fetch hotel prices from DidaTravel API
*/
/**
* Fetch hotel prices from DidaTravel API
*/
private function fetchHotelPrices(array $hotelIds, HttpClientInterface $httpClient, string $username, string $password): array
{
$apiUrlPriceSearch = 'https://apiint.didatravel.com/api/rate/pricesearch?$format=json';
// Use default dates (next 2 days)
$checkInDate = (new \DateTime('+1 day'))->format('Y-m-d');
$checkOutDate = (new \DateTime('+2 days'))->format('Y-m-d');
// Prepare the POST request body
$requestData = [
'Header' => [
'ClientID' => $username,
'LicenseKey' => $password
],
'CheckInDate' => $checkInDate,
'CheckOutDate' => $checkOutDate,
'HotelIDList' => $hotelIds,
'LowestPriceOnly' => true,
'Nationality' => 'FR', // Default to France
'Currency' => 'EUR' // Default to Euro
];
try {
$response = $httpClient->request('POST', $apiUrlPriceSearch, [
'headers' => [
'Content-Type' => 'application/json',
],
'json' => $requestData,
'timeout' => 30
]);
if ($response->getStatusCode() === 200) {
$data = $response->toArray();
// Debug: Check the actual response structure
// dd($data);
// Organize by hotel ID for easy access
$organizedPrices = [];
// Check the actual response structure
if (isset($data['Success']) && isset($data['Success']['PriceDetails']) && isset($data['Success']['PriceDetails']['HotelList'])) {
foreach ($data['Success']['PriceDetails']['HotelList'] as $hotelRate) {
if (isset($hotelRate['HotelID'])) {
$organizedPrices[$hotelRate['HotelID']] = [
'HotelID' => $hotelRate['HotelID'],
'HotelName' => $hotelRate['HotelName'] ?? null,
'LowestPrice' => $hotelRate['LowestPrice']['Value'] ?? null,
'Currency' => $hotelRate['LowestPrice']['Currency'] ?? 'EUR',
'CheckInDate' => $checkInDate,
'CheckOutDate' => $checkOutDate,
'ExcludedFeeList' => $hotelRate['ExcludedFeeList'] ?? []
];
}
}
}
return $organizedPrices;
}
} catch (\Exception $e) {
// Log error and return empty array
error_log('Error fetching hotel prices: ' . $e->getMessage());
}
return [];
}
#[Route('/monde/recherche-hotels', name: 'blt_monde_hotel_search')]
public function hotelSearch(): Response
{
$apiUrlCountries = 'https://static-api.didatravel.com/api/v1/region/countries';
$username = 'DidaApiTestID';
$password = 'TestKey';
$httpClient = HttpClient::create();
// Get all countries for the dropdown
$response = $httpClient->request('GET', $apiUrlCountries, [
'auth_basic' => [$username, $password],
]);
$countriesData = [];
if ($response->getStatusCode() === 200) {
$data = $response->toArray();
$countriesData = isset($data['data']) ? $data['data'] : $data;
}
return $this->render('blt/hotel_search.html.twig', [
'countries' => $countriesData,
'total_countries' => count($countriesData),
'total_destinations' => 0 // You can calculate this if needed
]);
}
#[Route('/monde/destinationssearch/{countryCode}', name: 'blt_monde_destinations_ajax')]
public function getDestinationsByCountry(string $countryCode): JsonResponse
{
$apiUrlDestinations = 'https://static-api.didatravel.com/api/v1/region/destinations';
$username = 'DidaApiTestID';
$password = 'TestKey';
$httpClient = HttpClient::create();
try {
$response = $httpClient->request('GET', $apiUrlDestinations, [
'query' => [
'countryCode' => strtoupper($countryCode),
'language' => 'en-US'
],
'auth_basic' => [$username, $password],
]);
if ($response->getStatusCode() === 200) {
$data = $response->toArray();
// Check the actual structure of the response
if (isset($data['Header'])) {
// This seems to be an error response format
return $this->json([
'success' => false,
'message' => 'API returned unexpected format',
'data' => []
]);
}
$destinations = isset($data['data']) ? $data['data'] : $data;
// Format for JSON response
$formattedDestinations = [];
foreach ($destinations as $destination) {
$formattedDestinations[] = [
'id' => $destination['id'] ?? null,
'name' => $destination['name'] ?? 'Unknown Destination',
'type' => $destination['type'] ?? null,
'code' => $destination['code'] ?? null
];
}
return $this->json([
'success' => true,
'data' => $formattedDestinations
]);
}
return $this->json([
'success' => false,
'message' => 'Failed to fetch destinations',
'data' => []
]);
} catch (\Exception $e) {
return $this->json([
'success' => false,
'message' => 'Error: ' . $e->getMessage(),
'data' => []
]);
}
}
#[Route('/monde/recherche-hotels/resultats', name: 'blt_monde_hotel_search_results')]
public function hotelSearchResults(Request $request): Response
{
$searchType = $request->query->get('searchType', 'country');
$countryCode = $request->query->get('countryCode');
$destinationId = $request->query->get('destinationId');
$checkInDate = $request->query->get('checkInDate');
$checkOutDate = $request->query->get('checkOutDate');
$nationality = $request->query->get('nationality', 'FR');
$currency = $request->query->get('currency', 'EUR');
$username = 'DidaApiTestID';
$password = 'TestKey';
$httpClient = HttpClient::create();
$hotelIds = [];
$hotelDetails = [];
$hotelPrices = [];
$countryData = null;
$destinationData = null;
// If searching by country
if ($searchType === 'country' && $countryCode) {
// First get country info
$apiUrlCountries = 'https://static-api.didatravel.com/api/v1/region/countries';
$countryResponse = $httpClient->request('GET', $apiUrlCountries, [
'auth_basic' => [$username, $password],
]);
if ($countryResponse->getStatusCode() === 200) {
$data = $countryResponse->toArray();
$allCountries = isset($data['data']) ? $data['data'] : $data;
foreach ($allCountries as $country) {
if ($country['code'] === strtoupper($countryCode)) {
$countryData = $country;
break;
}
}
}
// Get hotel IDs for country
$apiUrlHotels = 'https://static-api.didatravel.com/api/v1/hotel/list';
$hotelResponse = $httpClient->request('GET', $apiUrlHotels, [
'query' => [
'countryCode' => strtoupper($countryCode),
'language' => 'en-US'
],
'auth_basic' => [$username, $password],
]);
if ($hotelResponse->getStatusCode() === 200) {
$hotelData = $hotelResponse->toArray();
$hotelIds = isset($hotelData['data']) ? $hotelData['data'] : $hotelData;
}
}
// If searching by destination
elseif ($searchType === 'destination' && $destinationId) {
// Get destination details first
$apiUrlDestinations = 'https://static-api.didatravel.com/api/v1/region/destinations';
$destResponse = $httpClient->request('GET', $apiUrlDestinations, [
'query' => [
'countryCode' => 'ALL', // Or you might need to pass specific country
'language' => 'en-US'
],
'auth_basic' => [$username, $password],
]);
if ($destResponse->getStatusCode() === 200) {
$destData = $destResponse->toArray();
$allDestinations = isset($destData['data']) ? $destData['data'] : $destData;
// Find the specific destination
foreach ($allDestinations as $dest) {
if (isset($dest['id']) && $dest['id'] == $destinationId) {
$destinationData = $dest;
break;
}
}
}
// Get hotels by destination using price search API
$apiUrlPriceSearch = 'https://apiint.didatravel.com/api/rate/pricesearch?$format=json';
$requestData = [
'Header' => [
'ClientID' => $username,
'LicenseKey' => $password
],
'CheckInDate' => $checkInDate,
'CheckOutDate' => $checkOutDate,
'Destination' => [
'CityCode' => (string)$destinationId
],
'LowestPriceOnly' => true,
'Nationality' => $nationality,
'Currency' => $currency
];
try {
$response = $httpClient->request('POST', $apiUrlPriceSearch, [
'headers' => [
'Content-Type' => 'application/json',
],
'json' => $requestData,
'timeout' => 30
]);
if ($response->getStatusCode() === 200) {
$data = $response->toArray();
if (isset($data['Success']) && isset($data['Success']['PriceDetails']) && isset($data['Success']['PriceDetails']['HotelList'])) {
$hotelsData = $data['Success']['PriceDetails']['HotelList'];
foreach ($hotelsData as $hotel) {
if (isset($hotel['HotelID'])) {
$hotelId = $hotel['HotelID'];
$hotelIds[] = $hotelId;
// Store price information
$hotelPrices[$hotelId] = [
'HotelID' => $hotelId,
'LowestPrice' => $hotel['LowestPrice']['Value'] ?? null,
'Currency' => $hotel['LowestPrice']['Currency'] ?? $currency,
'CheckInDate' => $checkInDate,
'CheckOutDate' => $checkOutDate,
'HotelName' => $hotel['HotelName'] ?? null,
'ExcludedFeeList' => $hotel['ExcludedFeeList'] ?? []
];
}
}
}
}
} catch (\Exception $e) {
// Handle error
error_log('Error in destination search: ' . $e->getMessage());
}
// Create dummy country data for destination
if ($destinationData) {
$countryData = [
'name' => $destinationData['name'] ?? 'Destination #' . $destinationId,
'code' => 'DEST' . $destinationId
];
} else {
$countryData = [
'name' => 'Destination #' . $destinationId,
'code' => 'DEST' . $destinationId
];
}
}
// Fetch hotel details and prices (if not already fetched for destination search)
if (!empty($hotelIds)) {
if (empty($hotelPrices)) {
// Only fetch prices if not already done (for destination search)
$hotelPrices = $this->fetchHotelPricesWithDates(
$hotelIds,
$httpClient,
$username,
$password,
$checkInDate,
$checkOutDate,
$nationality,
$currency
);
}
$hotelDetails = $this->fetchHotelDetails($hotelIds, $httpClient, $username, $password);
}
return $this->render('blt/hotel_search_results.html.twig', [
'search_type' => $searchType,
'country' => $countryData,
'destination' => $destinationData,
'hotel_ids' => $hotelIds,
'hotel_details' => $hotelDetails,
'hotel_prices' => $hotelPrices,
'hotel_count' => count($hotelIds),
'check_in_date' => $checkInDate,
'check_out_date' => $checkOutDate,
'nationality' => $nationality,
'currency' => $currency,
'search_params' => $request->query->all()
]);
}
/**
* Fetch hotel prices with specific dates
*/
private function fetchHotelPricesWithDates(
array $hotelIds,
HttpClientInterface $httpClient,
string $username,
string $password,
string $checkInDate,
string $checkOutDate,
string $nationality = 'FR',
string $currency = 'EUR'
): array {
$apiUrlPriceSearch = 'https://apiint.didatravel.com/api/rate/pricesearch?$format=json';
// Limit hotel IDs to avoid timeout (API might have limits)
$limitedHotelIds = array_slice($hotelIds, 0, 10);
$requestData = [
'Header' => [
'ClientID' => $username,
'LicenseKey' => $password
],
'CheckInDate' => $checkInDate,
'CheckOutDate' => $checkOutDate,
'HotelIDList' => $limitedHotelIds,
'LowestPriceOnly' => true,
'Nationality' => $nationality,
'Currency' => $currency
];
try {
$response = $httpClient->request('POST', $apiUrlPriceSearch, [
'headers' => [
'Content-Type' => 'application/json',
],
'json' => $requestData,
'timeout' => 30
]);
if ($response->getStatusCode() === 200) {
$data = $response->toArray();
$organizedPrices = [];
if (isset($data['Success']) && isset($data['Success']['PriceDetails']) && isset($data['Success']['PriceDetails']['HotelList'])) {
foreach ($data['Success']['PriceDetails']['HotelList'] as $hotelRate) {
if (isset($hotelRate['HotelID'])) {
$organizedPrices[$hotelRate['HotelID']] = [
'HotelID' => $hotelRate['HotelID'],
'HotelName' => $hotelRate['HotelName'] ?? null,
'LowestPrice' => $hotelRate['LowestPrice']['Value'] ?? null,
'Currency' => $hotelRate['LowestPrice']['Currency'] ?? $currency,
'CheckInDate' => $checkInDate,
'CheckOutDate' => $checkOutDate,
'ExcludedFeeList' => $hotelRate['ExcludedFeeList'] ?? [],
'Nationality' => $nationality
];
}
}
}
return $organizedPrices;
}
} catch (\Exception $e) {
error_log('Error fetching hotel prices with dates: ' . $e->getMessage());
}
return [];
}
}