public override ViewsResponse GetViewsByBankId(string bank_id)
        {
            ViewsResponse result = new ViewsResponse();

            try {
                LoginBindResponse loginData = doLogin();
                string            urlData   = String.Format("banks/{0}/accounts", bank_id);

                string JsonResult = new FluentClient(config.Url)
                                    .GetAsync(urlData)
                                    .WithHeader("Authorization", "JWT " + loginData.token)
                                    .WithOptions(true)
                                    .AsString().Result;

                result.views = JsonConvert.DeserializeObject <List <View> >(JsonResult);

                result.executeStatus = getExecuteStatus(JsonResult, urlData);
            } catch (CustomException cEx) {
                result.executeStatus = cEx.convertToCustomStatus();
            } catch (Exception ex) {
                result.executeStatus = new CustomException(ExceptionsCodes.UnexpectedException, "", ex.Message).convertToCustomStatus();
            }

            return(result);
        }
        public override Person GetPersonByCUIT(string cuit)
        {
            Person result = new Person();

            try {
                LoginBindResponse loginData = doLogin();

                string urlData = String.Format("persons/{0}/banks", cuit);

                string JsonResult = new FluentClient(config.Url)
                                    .GetAsync(urlData)
                                    .WithHeader("Authorization", "JWT " + loginData.token)
                                    .WithOptions(true)
                                    .AsString().Result;

                result = JsonConvert.DeserializeObject <Person>(JsonResult);
                CustomStatus bindException;

                result.executeStatus = getExecuteStatus(JsonResult, urlData);
            } catch (CustomException cEx) {
                result.executeStatus = cEx.convertToCustomStatus();
            } catch (Exception ex) {
                result.executeStatus = new CustomException(ExceptionsCodes.UnexpectedException, "", ex.Message).convertToCustomStatus();
            }
            return(result);
        }
        public override AccountsResponse GetAccount(string AccountId, string bank_id, string view_id)
        {
            AccountsResponse result = new AccountsResponse();

            try {
                LoginBindResponse loginData = doLogin();
                //banks/322/accounts/21-1-99999-4-6/owner
                string urlData = String.Format("banks/{0}/accounts/{1}/{2}", bank_id, AccountId, view_id);

                string JsonResult = new FluentClient(config.Url)
                                    .GetAsync(urlData)
                                    .WithHeader("Authorization", "JWT " + loginData.token)
                                    .WithOptions(true)
                                    .AsString().Result;

                result.accounts = new List <Account>();
                result.accounts.Add(JsonConvert.DeserializeObject <Account>(JsonResult));

                result.executeStatus = getExecuteStatus(JsonResult, urlData);
            } catch (CustomException cEx) {
                result.executeStatus = cEx.convertToCustomStatus();
            } catch (Exception ex) {
                result.executeStatus = new CustomException(ExceptionsCodes.UnexpectedException, "", ex.Message).convertToCustomStatus();
            }

            return(result);
        }
        public override MovementsResponse GetMovements(MovementsRequest request)
        {
            MovementsResponse result = new MovementsResponse();

            try {
                LoginBindResponse loginData = doLogin();
                //banks/:bank_id/accounts/:account_id/:view_id/transactions
                string urlData = String.Format("banks/{0}/accounts/{1}/{2}/transactions", request.bank_id, request.AccountId, request.view_id);

                DateTime dt = DateTime.ParseExact(request.finalDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                request.finalDate = dt.ToString("yyyy-MM-dd");

                dt = DateTime.ParseExact(request.initialDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                request.initialDate = dt.ToString("yyyy-MM-dd");

                string JsonResult = new FluentClient(config.Url)
                                    .GetAsync(urlData)
                                    .WithHeader("Authorization", "JWT " + loginData.token)
                                    .WithHeader("obp_from_date", request.initialDate)
                                    .WithHeader("obp_to_date", request.finalDate)
                                    .WithOptions(true)
                                    .AsString().Result;

                try {
                    result.transactions = JsonConvert.DeserializeObject <List <Transactions> >(JsonResult);
                } catch {
                }

                result.executeStatus = getExecuteStatus(JsonResult, urlData);
            } catch (CustomException cEx) {
                result.executeStatus = cEx.convertToCustomStatus();
            } catch (Exception ex) {
                result.executeStatus = new CustomException(ExceptionsCodes.UnexpectedException, "", ex.Message).convertToCustomStatus();
            }

            return(result);
        }