IryoConnector HTTP Wrapper Code
IryoConnector HTTP Wrapper Code
(sin asunto)
Enric Jimenez <ejimenez@[Link]> 24 de octubre de 2024, 8:18
Borrador
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
namespace [Link]
{
public class HttpWrapper
{
private static readonly HttpClient _client = new HttpClient
{
Timeout = [Link](5) // Configuro un timeout de 5 minutos
};
if ([Link])
{
var resp = [Link]<JourneySearchRS>(strResponse);
return resp;
}
else
{
throw new Exception($"Error HTTP - Code: {[Link]}, Message: {strResponse}");
}
}
}
catch (Exception ex)
{
[Link] 1/13
24/10/24, 8:18 Correo de EMOVEERE CONSULTING - (sin asunto)
throw new Exception($"Error in SearchAsync: {[Link]}", ex);
}
}
if ([Link])
{
var resp = [Link]<CreateBookingRS>(strResponse);
return resp;
}
else
{
throw new Exception($"Error HTTP - Code: {[Link]}, Message: {strResponse}");
}
}
}
catch (Exception ex)
{
throw new Exception($"Error in CreateBookingAsync: {[Link]}", ex);
}
}
if ([Link])
{
var resp = [Link]<SearchBookingsRS>(strResponse);
return resp;
[Link] 2/13
24/10/24, 8:18 Correo de EMOVEERE CONSULTING - (sin asunto)
}
else
{
throw new Exception($"Error HTTP - Code: {[Link]}, Message: {strResponse}");
}
}
}
catch (Exception ex)
{
throw new Exception($"Error in SearchBookingsAsync: {[Link]}", ex);
}
}
if ([Link])
{
var resp = [Link]<ConfirmBookingRS>(strResponse);
return resp;
}
else
{
throw new Exception($"Error HTTP - Code: {[Link]}, Message: {strResponse}");
}
}
}
catch (Exception ex)
{
throw new Exception($"Error in ConfirmBookingAsync: {[Link]}", ex);
}
}
[Link] 3/13
24/10/24, 8:18 Correo de EMOVEERE CONSULTING - (sin asunto)
var strResponse = await [Link]();
[Link]([Link], "UpdatePassenger", "", strResponse);
if ([Link])
{
var resp = [Link]<UpdatePassengerRS>(strResponse);
result = resp;
}
else
{
throw new Exception($"Error HTTP - Code: {[Link]}, Message: {strResponse}");
}
}
}
return result;
}
catch (Exception ex)
{
throw new Exception($"Error in UpdatePassengerAsync: {[Link]}", ex);
}
}
if ([Link])
{
var resp = [Link]<ProcessPaymentRS>(strResponse);
return resp;
}
else
{
throw new Exception($"Error HTTP - Code: {[Link]}, Message: {strResponse}");
}
}
}
catch (Exception ex)
{
throw new Exception($"Error in ProcessPaymentAsync: {[Link]}", ex);
}
}
[Link] 4/13
24/10/24, 8:18 Correo de EMOVEERE CONSULTING - (sin asunto)
if ([Link])
{
var resp = [Link]<RetrieveBookingRS>(strResponse);
return resp;
}
else
{
throw new Exception($"Error HTTP - Code: {[Link]}, Message: {strResponse}");
}
}
}
catch (Exception ex)
{
throw new Exception($"Error in RetrieveBookingAsync: {[Link]}", ex);
}
}
if ([Link])
{
var resp = [Link]<CancelBookingRS>(strResponse);
return resp;
}
else
{
throw new Exception($"Error HTTP - Code: {[Link]}, Message: {strResponse}");
}
}
}
catch (Exception ex)
{
throw new Exception($"Error in CancelBookingAsync: {[Link]}", ex);
}
[Link] 5/13
24/10/24, 8:18 Correo de EMOVEERE CONSULTING - (sin asunto)
}
if ([Link])
{
var methodsArray = [Link]<RefundMethod[]>(strResponse);
var resp = new RefundMethodsRS { RefundMethods = methodsArray };
return resp;
}
else
{
throw new Exception($"Error HTTP - Code: {[Link]}, Message: {strResponse}");
}
}
}
catch (Exception ex)
{
throw new Exception($"Error in RefundMethodsAsync: {[Link]}", ex);
}
}
[Link] 6/13
24/10/24, 8:18 Correo de EMOVEERE CONSULTING - (sin asunto)
}
}
public async Task<List<Products>> GetProductsAsync()
{
try
{
ConfigureHeaders();
_client.[Link]("Accept-Language", "es-ES");
[Link] 7/13
24/10/24, 8:18 Correo de EMOVEERE CONSULTING - (sin asunto)
// Configurar los encabezados de la solicitud, agregando lo necesario para autenticación
ConfigureHeaders();
_client.[Link]("Accept-Language", "es-ES");
[Link] 8/13
24/10/24, 8:18 Correo de EMOVEERE CONSULTING - (sin asunto)
[Link] 9/13
24/10/24, 8:18 Correo de EMOVEERE CONSULTING - (sin asunto)
return resp;
}
else
{
throw new Exception($"Error HTTP - Code: {[Link]}, Message: {await
[Link]()}");
}
}
}
catch (Exception ex)
{
throw new Exception($"Error in GetAuthorisationTokenAsync: {[Link]}", ex);
}
}
[Link] 10/13
24/10/24, 8:18 Correo de EMOVEERE CONSULTING - (sin asunto)
Content = new StringContent(strContent, Encoding.UTF8, "application/json"),
};
if ([Link])
{
var resp = [Link]<VoucherPaymentRS>(strResponse);
return resp;
}
else
{
throw new Exception($"Error HTTP - Code: {[Link]}, Message: {strResponse}");
}
}
}
catch (Exception ex)
{
throw new Exception($"Error in VoucherPaymentAsync: {[Link]}", ex);
}
}
if ([Link])
{
var resp = [Link]<Card3DsPaymentRS>(strResponse);
return resp;
}
else
{
throw new Exception($"Error HTTP - Code: {[Link]}, Message: {strResponse}");
}
}
}
catch (Exception ex)
{
throw new Exception($"Error in Card3DsPaymentAsync: {[Link]}", ex);
}
}
[Link] 11/13
24/10/24, 8:18 Correo de EMOVEERE CONSULTING - (sin asunto)
ConfigureHeaders();
if ([Link])
{
var methodsArray = [Link]<PaymenMethod[]>(strResponse);
var resp = new PaymentMethodsRS
{
Methods = methodsArray
};
return resp;
}
else
{
throw new Exception($"Error HTTP - Code: {[Link]}, Message: {strResponse}");
}
}
}
catch (Exception ex)
{
throw new Exception($"Error in PaymentMethodsAsync: {[Link]}", ex);
}
}
if ([Link])
{
var resp = [Link]<PaymentAccountRS>(strResponse);
return resp;
}
else
{
throw new Exception($"Error HTTP - Code: {[Link]}, Message: {strResponse}");
}
}
}
catch (Exception ex)
[Link] 12/13
24/10/24, 8:18 Correo de EMOVEERE CONSULTING - (sin asunto)
{
throw new Exception($"Error in PaymentAccountAsync: {[Link]}", ex);
}
}
[Link] 13/13