Example #1
0
 public ServicioToken.TokenValida RecuperarInfToken(string token, string canal, string app, out string codigoRetorno)
 {
     ServicioToken.TokenValida tokenValida = null;
     codigoRetorno = "000";
     try
     {
         ServicioToken.TokenServiceClient _servicioToken = new ServicioToken.TokenServiceClient();
         tokenValida = _servicioToken.RecuperarInfToken(token, canal, app);
     }
     catch (Exception e)
     {
         codigoRetorno = "503";
     }
     return(tokenValida);
 }
        public ActionResult Index(DataToken data)
        {
            if (data.IsAnyNullOrEmpty())
            {
                return(RedirectToAction("Notificacion", "ErrorHandler", new { id = "401" }));
            }

            Session.Clear();

            string codigoRetorno;

            ServicioToken.TokenValida tokenValida = _tokenRepo.RecuperarInfToken(data.token, data.canal, data.aplicacion, out codigoRetorno);

            if (tokenValida.meta.Code == "000")
            {
                string   str_json = tokenValida.data.metajson;
                InfToken json     = JsonConvert.DeserializeObject <InfToken>(str_json);

                DatosCliente datosCliente = new DatosCliente();
                datosCliente.Cedula = json.identificacion;

                if (json.producto == _settings.ProductoSG.IdProductoNeo.ToString())
                {
                    Session["datosCliente"] = datosCliente;
                    return(RedirectToAction("Solicitud", "SobreGiro"));
                }

                if (json.producto == _settings.ProductoCP.IdProductoNeo.ToString())
                {
                    var obj = new DatosClientePy(); obj.Cedula = json.identificacion;
                    Session["datosClienteCP"] = obj;
                    return(RedirectToAction("Simulador", "CreditoPyme"));
                }
            }


            return(RedirectToAction("Notificacion", "ErrorHandler", new { id = codigoRetorno }));
        }