public void TestArquivoRetornoCnab400Sicredi() { List <string> list = new List <string>(); list.Add("02RETORNO01COBRANCA 2055313562237000108 748BANSICREDI 20210415 0000003 1.00000001"); list.Add("1 A06P67000002 212000180 0214042118 2704210000000000200 A000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000 000002"); list.Add("1 A06P68000002 212000198 0214042119 2704210000000000200 A000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000 000003"); list.Add("1 A06P5C000002 211000011 1414042101 1604210000000049000 A000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000 000004"); list.Add("1 A06P67000002 212000180 0614042118 010117 2704210000000000200 A000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000 000000000020210415 000005"); list.Add("1 A06P67000002 212000180 0714042118 2704210000000000200 A000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000 0000000000 000006"); list.Add("1 A06P67000002 212000180 2814042118 2704210000000000200 A000000000015000000000000000000000000000000000000000000000000000000000000000000000000000015000000000000000000000000000 B30000000020210414 000007"); list.Add("1 A06P68000002 212000198 2814042119 2704210000000000200 A000000000015000000000000000000000000000000000000000000000000000000000000000000000000000015000000000000000000000000000 B30000000020210414 000008"); list.Add("9274820553 000009"); LeitorRetornoCnab400Sicredi leitor = new LeitorRetornoCnab400Sicredi(list); var resultado = leitor.ProcessarRetorno(); }
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) { } if (linhasArquivo.First().Length == 400) { var leitor = new LeitorRetornoCnab400Sicredi(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."); }