public async Task <JsonResult> OnPostAccount([FromBody] TuFactoringModels.nuevaVersion.Account param)
        {
            var respuesta = await _peopleService.ConsultaAccount(param.Id, param.AccountNumber);

            try
            {
                return(new JsonResult(respuesta));
            }
            catch { return(null); }
        }
        private void RellenarPerfil()
        {
            if (registrarClienteTF.Perfil.Documents != null && registrarClienteTF.Perfil.Documents.Count > 0)
            {
                registrarClienteTF.Registrarse.Document = registrarClienteTF.Perfil.Documents[0];
            }
            if (registrarClienteTF.Perfil.Addresses != null && registrarClienteTF.Perfil.Addresses.Count > 0)
            {
                registrarClienteTF.Registrarse.Address = registrarClienteTF.Perfil.Addresses[0];
            }
            if (registrarClienteTF.Perfil.Phones != null && registrarClienteTF.Perfil.Phones.Count > 0)
            {
                registrarClienteTF.Registrarse.Phone = registrarClienteTF.Perfil.Phones[0];
            }
            if (registrarClienteTF.Perfil.Emails != null && registrarClienteTF.Perfil.Emails.Count > 0)
            {
                registrarClienteTF.Registrarse.Email = registrarClienteTF.Perfil.Emails[0];
            }
            ;
            registrarClienteTF.Registrarse.Discriminator = registrarClienteTF.Perfil.Discriminator;
            registrarClienteTF.Registrarse.Company       = registrarClienteTF.Perfil.Company;
            registrarClienteTF.Registrarse.FirstName     = registrarClienteTF.Perfil.FirstName;
            registrarClienteTF.Registrarse.LastName      = registrarClienteTF.Perfil.LastName;
            registrarClienteTF.Registrarse.Category      = registrarClienteTF.Perfil.Category;
            registrarClienteTF.Registrarse.Country       = registrarClienteTF.Perfil.Country;
            if (registrarClienteTF.Perfil.Accounts == null)
            {
                registrarClienteTF.Registrarse.Accounts = new List <Account>();
            }
            else
            {
                foreach (var cuenta in registrarClienteTF.Perfil.Accounts)
                {
                    Account newAccount = new Account();
                    newAccount.Id            = cuenta.Id;
                    newAccount.Entity        = cuenta.Entity.Id;
                    newAccount.AccountNumber = cuenta.AccountNumber;
                    newAccount.AccountType   = cuenta.AccountType;
                    newAccount.Currency      = cuenta.Currency;
                    newAccount.Default       = cuenta.Default;
                    newAccount.Status        = cuenta.Status;

                    registrarClienteTF.Registrarse.Accounts.Add(newAccount);
                }
            }
        }
        public async Task <JsonResult> OnPostVerificarDoc([FromBody] Persons comprobarDoc)
        {
            Prospecto regsitro       = null;
            Persons   PeopleRegisted = new Persons();

            HttpContext.Session.SetString("registroDesemascarado", "");
            HttpContext.Session.SetString("registroDesemascaradoError", "");
            var respuesta = await _peopleService.RegisterByDocument(new ParamProspecto {
                Document = new DocumentIdentification {
                    Country        = Int32.Parse(Request.Cookies["Country"]),
                    Identification = comprobarDoc.Document.Identification,
                    Prefix         = comprobarDoc.Document.Prefix,
                    Number         = comprobarDoc.Document.Number,
                }
            });

            try
            {
                filterInvoice PeopleId = new filterInvoice();
                PeopleId.Id = respuesta.Person;
                regsitro    = await _peopleService.RegisterById(new ParamProspecto { Filter = PeopleId, Country = Int32.Parse(Request.Cookies["Country"]) });

                if (regsitro.Documents != null && regsitro.Documents.Count > 0)
                {
                    PeopleRegisted.Document = regsitro.Documents[0];
                }
                if (regsitro.Addresses != null && regsitro.Addresses.Count > 0)
                {
                    PeopleRegisted.Address = regsitro.Addresses[0];
                }
                if (regsitro.Phones != null && regsitro.Phones.Count > 0)
                {
                    PeopleRegisted.Phone = regsitro.Phones[0];
                }
                if (regsitro.Emails != null && regsitro.Emails.Count > 0)
                {
                    PeopleRegisted.Email = regsitro.Emails[0];
                }
                ;
                PeopleRegisted.Discriminator = regsitro.Discriminator;
                PeopleRegisted.Company       = regsitro.Company;
                PeopleRegisted.FirstName     = regsitro.FirstName;
                PeopleRegisted.LastName      = regsitro.LastName;
                PeopleRegisted.Category      = regsitro.Category;
                PeopleRegisted.Country       = regsitro.Country;
                PeopleRegisted.Contacts      = regsitro.Contacts;
                if (regsitro.Entities != null)
                {
                    PeopleRegisted.Routing_number = regsitro.Entities[0].Routing_number;
                }
                if (regsitro.Accounts == null)
                {
                    PeopleRegisted.Accounts = new List <TuFactoringModels.nuevaVersion.Account>();
                }
                else
                {
                    foreach (var cuenta in regsitro.Accounts)
                    {
                        TuFactoringModels.nuevaVersion.Account newAccount = new TuFactoringModels.nuevaVersion.Account();
                        newAccount.Entity        = cuenta.Entity.Id;
                        newAccount.AccountNumber = cuenta.AccountNumber;
                        newAccount.AccountType   = cuenta.AccountType;
                        newAccount.Currency      = cuenta.Currency;

                        PeopleRegisted.Accounts.Add(newAccount);
                    }
                }

                HttpContext.Session.SetString("People", JsonConvert.SerializeObject(regsitro));
                HttpContext.Session.SetString("registroDesemascarado", JsonConvert.SerializeObject(PeopleRegisted));
                HttpContext.Session.SetString("registroDesemascaradoError", JsonConvert.SerializeObject(PeopleRegisted));
                PeopleRegisted.Contacts = new List <TuFactoringModels.nuevaVersion.Contact>();
                //HttpContext.Session.SetString("registroDesemascarado", JsonConvert.SerializeObject(PeopleRegisted));
                return(new JsonResult(new { registro = PeopleRegisted, contacts = regsitro.Contacts, contratos = regsitro.Agreements }));
            }
            catch { return(null); }
        }