IryoConnector HTTP Wrapper Code
IryoConnector HTTP Wrapper Code
(sin asunto)
Enric Jimenez <ejimenez@[Link]> 24 de octubre de 2024, 8:04
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
{
public JourneySearchRS Search(JourneySearchRQ query)
{
HttpClient client = new HttpClient();
try
{
[Link](new MediaTypeWithQualityHeaderValue("application/json"));
[Link]("Content-Type", "application/json");
[Link]("Ocp-Apim-Subscription-Key", IryoCredentials.
SubscriptionKey);
//[Link]("Accept-Language", "es-ES");
[Link] = new AuthenticationHeaderValue("Bearer", IryoCredentials.
AuthorisationToken.access_token);
[Link] = [Link];
if ([Link])
{
var resp = [Link]<JourneySearchRS>(strResponse);
return resp;
}
else
[Link] 1/15
24/10/24, 8:05 Correo de EMOVEERE CONSULTING - (sin asunto)
{
throw new Exception("Error HTTP- Code: " + [Link] + " Message: " + strResponse);
}
};
}
finally
{
[Link]();
};
}
if ([Link])
{
var resp = [Link]<CreateBookingRS>(strResponse);
return resp;
}
else
{
throw new Exception("Error HTTP- Code: " + [Link] + " Message: " + strResponse);
}
};
}
finally
{
[Link]();
};
}
[Link] 2/15
24/10/24, 8:05 Correo de EMOVEERE CONSULTING - (sin asunto)
var strContent = [Link]();
var uri = [Link] + "/conecta/manage/bookings/search";
if ([Link])
{
var resp = [Link]<SearchBookingsRS>(strResponse);
return resp;
}
else
{
throw new Exception("Error HTTP- Code: " + [Link] + " Message: " +
[Link]().Result);
}
};
}
finally
{
[Link]();
};
}
if ([Link])
{
var resp = [Link]<UpdatePassengerRS>(strResponse);
result = resp;
}
else
{
[Link] 3/15
24/10/24, 8:05 Correo de EMOVEERE CONSULTING - (sin asunto)
throw new Exception("Error HTTP- Code: " + [Link] + " Message: " +
[Link]().Result);
}
};
};
return result;
}
finally
{
[Link]();
};
}
if ([Link])
{
var methodsArray = [Link]<PaymenMethod[]>(strResponse);
return resp;
}
else
{
throw new Exception("Error HTTP- Code: " + [Link] + " Message: " +
[Link]().Result);
}
};
}
finally
{
[Link]();
};
}
[Link] 4/15
24/10/24, 8:05 Correo de EMOVEERE CONSULTING - (sin asunto)
[Link]("Content-Type", "application/json");
[Link]("Ocp-Apim-Subscription-Key", IryoCredentials.
SubscriptionKey);
[Link] = new AuthenticationHeaderValue("Bearer", IryoCredentials.
AuthorisationToken.access_token);
if ([Link])
{
var resp = [Link]<PaymentAccountRS>(strResponse);
return resp;
}
else
{
throw new Exception("Error HTTP- Code: " + [Link] + " Message: " +
[Link]().Result);
}
};
}
finally
{
[Link]();
};
}
if ([Link])
{
var resp = [Link]<Card3DsPaymentRS>(strResponse);
[Link] 5/15
24/10/24, 8:05 Correo de EMOVEERE CONSULTING - (sin asunto)
return resp;
}
else
{
throw new Exception("Error HTTP- Code: " + [Link] + " Message: " +
[Link]().Result);
}
};
}
finally
{
[Link]();
};
}
if ([Link])
{
var resp = [Link]<ProcessPaymentRS>(strResponse);
return resp;
}
else
{
throw new Exception("Error HTTP- Code: " + [Link] + " Message: " +
[Link]().Result);
}
};
}
finally
{
[Link]();
};
}
[Link] 6/15
24/10/24, 8:05 Correo de EMOVEERE CONSULTING - (sin asunto)
SubscriptionKey);
[Link] = new AuthenticationHeaderValue("Bearer", IryoCredentials.
AuthorisationToken.access_token);
if ([Link])
{
var resp = [Link]<VoucherPaymentRS>(strResponse);
return resp;
}
else
{
throw new Exception("Error HTTP- Code: " + [Link] + " Message: " +
[Link]().Result);
}
};
}
finally
{
[Link]();
};
}
if ([Link])
{
var resp = [Link]<ConfirmBookingRS>(strResponse);
return resp;
}
else
{
throw new Exception("Error HTTP- Code: " + [Link] + " Message: " +
[Link]().Result);
}
};
[Link] 7/15
24/10/24, 8:05 Correo de EMOVEERE CONSULTING - (sin asunto)
}
finally
{
[Link]();
};
}
if ([Link])
{
var resp = [Link]<RetrieveBookingRS>(strResponse);
return resp;
}
else
{
throw new Exception("Error HTTP- Code: " + [Link] + " Message: " +
[Link]().Result);
}
};
}
finally
{
[Link]();
};
}
try
{
[Link](new MediaTypeWithQualityHeaderValue("application/json"));
[Link]("Content-Type", "application/json");
[Link]("Ocp-Apim-Subscription-Key", IryoCredentials.
SubscriptionKey);
[Link] = new AuthenticationHeaderValue("Bearer", IryoCredentials.
AuthorisationToken.access_token);
if (twoStep)
[Link] 8/15
24/10/24, 8:05 Correo de EMOVEERE CONSULTING - (sin asunto)
{
strContent = [Link]();
};
if ([Link])
{
var resp = [Link]<CancelBookingRS>(strResponse);
return resp;
}
else
{
throw new Exception("Error HTTP- Code: " + [Link] + " Message: " +
[Link]().Result);
}
};
}
finally
{
[Link]();
};
}
if ([Link])
{
var methodsArray = [Link]<RefundMethod[]>(strResponse);
[Link] 9/15
24/10/24, 8:05 Correo de EMOVEERE CONSULTING - (sin asunto)
return resp;
}
else
{
throw new Exception("Error HTTP- Code: " + [Link] + " Message: " +
[Link]().Result);
}
};
}
finally
{
[Link]();
};
}
try
{
[Link](new MediaTypeWithQualityHeaderValue("application/json"));
[Link]("Content-Type", "application/json");
[Link]("Ocp-Apim-Subscription-Key", IryoCredentials.
SubscriptionKey);
[Link] = new AuthenticationHeaderValue("Bearer", IryoCredentials.
AuthorisationToken.access_token);
if (![Link])
{
throw new Exception("Error HTTP- Code: " + [Link] + " Message: " +
[Link]().Result);
}
};
}
finally
{
[Link]();
};
}
[Link] 10/15
24/10/24, 8:05 Correo de EMOVEERE CONSULTING - (sin asunto)
[Link]("Ocp-Apim-Subscription-Key", IryoCredentials.
SubscriptionKey);
[Link]("Accept-Language", "es-ES");
[Link] = new AuthenticationHeaderValue("Bearer", IryoCredentials.
AuthorisationToken.access_token);
[Link] 11/15
24/10/24, 8:05 Correo de EMOVEERE CONSULTING - (sin asunto)
if ([Link])
{
var resp = [Link]<SalesChannelRS>(strResponse);
return resp;
}
else
{
throw new Exception("Error HTTP- Code: " + [Link] + " Message: " +
[Link]().Result);
}
};
}
finally
{
[Link]();
}
}
if ([Link])
{
var resp = [Link]<PassengerRulesRS>(strResponse);
return resp;
}
[Link] 12/15
24/10/24, 8:05 Correo de EMOVEERE CONSULTING - (sin asunto)
else
{
throw new Exception("Error HTTP- Code: " + [Link] + " Message: " +
[Link]().Result);
}
};
}
finally
{
[Link]();
};
}
if ([Link])
{
var resp = [Link]<RoutesRS>(strResponse);
return [Link]();
}
else
{
throw new Exception("Error HTTP- Code: " + [Link] + " Message: " +
[Link]().Result);
}
};
}
finally
{
[Link]();
};
}
try
{
[Link](new MediaTypeWithQualityHeaderValue("application/json"));
[Link]("Content-Type", "application/json");
[Link] 13/15
24/10/24, 8:05 Correo de EMOVEERE CONSULTING - (sin asunto)
[Link](new KeyValuePair<string, string>("scope", "openid"));
[Link](new KeyValuePair<string, string>("username", userName)); //username
[Link] 14/15
24/10/24, 8:05 Correo de EMOVEERE CONSULTING - (sin asunto)
}
[Link] 15/15