Beispiel #1
0
        public async Task <ActionResult <ControllerMultipleResponse> > PostConsulta(DesembolsoRequest request)
        {
            ControllerMultipleResponse result = new ControllerMultipleResponse();

            manager = new DesembolsoManager(proxyConfig);
            var authentication = AuthenticationHeaderValue.Parse(Request.Headers[HeaderNames.Authorization]);

            result = await manager.PostRequestDesembolso(request, authentication.Parameter);

            return(result);
        }
Beispiel #2
0
        public async Task <ControllerMultipleResponse> PostRequestDesembolso(DesembolsoRequest request, string token = null)
        {
            ControllerMultipleResponse result = new ControllerMultipleResponse();

            if (request != null)
            {
                HttpSoaClient desW = new HttpSoaClient(proxyConfig.ServiceUrl);

                try
                {
                    string content = JsonConvert.SerializeObject(request, new JsonSerializerSettings()
                    {
                        ContractResolver = new CamelCasePropertyNamesContractResolver()
                    });

                    var response = await desW.PostContentAsyncBase <ControllerMultipleResponse>("/desembolso/consulta", token,
                                                                                                new StringContent(content, System.Text.Encoding.UTF8, "application/json"));

                    if (response.data != null && response.data != null)
                    {
                        result.errorCode    = response.errorCode;
                        result.errorMessage = response.errorMessage;
                        result.data         = response.data;
                    }
                }
                catch (Exception ex)
                {
                    result.errorCode    = 500;
                    result.errorMessage = string.Format("Ha ocurrido un error inesperado" + ex);
                }
            }
            else
            {
                result.errorCode    = 400;
                result.errorMessage = "Debe completar la información de la solicitud. Por favor verifique la documentacion.";
            }
            return(result);
        }