Пример #1
0
        public RetornoGenerico LerArquivoRetorno(List <string> linhasArquivo)
        {
            if (linhasArquivo == null || linhasArquivo.Any() == false)
            {
                throw new ApplicationException("Arquivo informado é inválido/Não existem títulos no retorno.");
            }

            /* Identifica o layout: 240 ou 400 */
            if (linhasArquivo.First().Length == 240)
            {
                var leitor            = new LeitorRetornoCnab240Cef(linhasArquivo);
                var retornoProcessado = leitor.ProcessarRetorno();

                var objRetornar = new RetornoGenerico(retornoProcessado);
                return(objRetornar);
            }
            if (linhasArquivo.First().Length == 400)
            {
                var leitor            = new LeitorRetornoCnab400Cef(linhasArquivo);
                var retornoProcessado = leitor.ProcessarRetorno();

                var objRetornar = new RetornoGenerico(retornoProcessado);
                return(objRetornar);
            }

            throw new Exception("Arquivo de RETORNO com " + linhasArquivo.First().Length + " posições, não é suportado.");
        }
Пример #2
0
        public void TestHeaderArquivoRetornoCnab400BancoCef()
        {
            LeitorRetornoCnab400Cef leitor = new LeitorRetornoCnab400Cef(null);

            string valorTesteRegistro =
                "10400000         2106230130001700000000000000000000001839220301600000000RMEX CONSTRUTORA E INCORPORADOC ECON FEDERAL                          22507201400562700036204000000                    RETORNO-PRODUCAO                  000         ";

            var resultado = leitor.ObterHeader(valorTesteRegistro);

            Assert.AreEqual(resultado.NomeDoBeneficiario, "RMEX CONSTRUTORA E INCORPORADO");
        }
Пример #3
0
        public RetornoGenerico LerArquivoRetorno(List<string> linhasArquivo)
        {
            if (linhasArquivo == null || linhasArquivo.Any() == false)
                throw new ApplicationException("Arquivo informado é inválido.");

            /* Identifica o layout: 240 ou 400 */
            if (linhasArquivo.First().Length == 240)
            {
                var leitor = new LeitorRetornoCnab240Cef(linhasArquivo);
                var retornoProcessado = leitor.ProcessarRetorno();

                var objRetornar = new RetornoGenerico(retornoProcessado);
                return objRetornar;
            }
            if (linhasArquivo.First().Length == 400)
            {
                var leitor = new LeitorRetornoCnab400Cef(linhasArquivo);
                var retornoProcessado = leitor.ProcessarRetorno();

                var objRetornar = new RetornoGenerico(retornoProcessado);
                return objRetornar;
            }

            throw new Exception("Arquivo de RETORNO com " + linhasArquivo.First().Length + " posições, não é suportado.");
        }