public string GerarDetalheRemessa(TipoArquivo tipoArquivo, Boleto boleto, ref int numeroRegistro) { try { var detalhe = string.Empty; var strline = string.Empty; switch (tipoArquivo) { case TipoArquivo.CNAB400: // Registro 1 - Obrigatório detalhe += GerarDetalheRemessaCNAB400Registro1(boleto, ref numeroRegistro); // Registro 1 Adicional - Registro Opcional strline = GerarDetalheRemessaCNAB400Registro1Mensagem(boleto, ref numeroRegistro); if (!string.IsNullOrWhiteSpace(strline)) { detalhe += Environment.NewLine; detalhe += strline; } break; default: throw new Exception("Tipo de arquivo inexistente."); } return detalhe; } catch (Exception ex) { throw Boleto2NetException.ErroAoGerarRegistroDetalheDoArquivoRemessa(ex); } }
public string GerarTrailerRemessa(TipoArquivo tipoArquivo, int numeroArquivoRemessa, ref int numeroRegistroGeral, decimal valorBoletoGeral, int numeroRegistroCobrancaSimples, decimal valorCobrancaSimples, int numeroRegistroCobrancaVinculada, decimal valorCobrancaVinculada, int numeroRegistroCobrancaCaucionada, decimal valorCobrancaCaucionada, int numeroRegistroCobrancaDescontada, decimal valorCobrancaDescontada) { try { var trailer = Empty; switch (tipoArquivo) { case TipoArquivo.CNAB400: trailer = GerarTrailerRemessaCNAB400(ref numeroRegistroGeral); break; default: throw new Exception("Tipo de arquivo inexistente."); } return(trailer); } catch (Exception ex) { throw Boleto2NetException.ErroAoGerrarRegistroTrailerDoArquivoRemessa(ex); } }
public string GerarHeaderRemessa(TipoArquivo tipoArquivo, int numeroArquivoRemessa, ref int numeroRegistroGeral) { try { var header = Empty; switch (tipoArquivo) { case TipoArquivo.CNAB240: // Cabeçalho do Arquivo header += GerarHeaderRemessaCNAB240SIGCB(numeroArquivoRemessa, ref numeroRegistroGeral); // Cabeçalho do Lote header += Environment.NewLine; header += GerarHeaderLoteRemessaCNAB240SIGCB(numeroArquivoRemessa, ref numeroRegistroGeral); break; default: throw new Exception("Header - Tipo de arquivo inexistente."); } return(header); } catch (Exception ex) { throw Boleto2NetException.ErroAoGerarRegistroHeaderDoArquivoRemessa(ex); } }
public string GerarDetalheRemessa(TipoArquivo tipoArquivo, Boleto boleto, ref int numeroRegistro) { try { string detalhe = Empty, strline = Empty; switch (tipoArquivo) { case TipoArquivo.CNAB400: detalhe += GerarDetalheRemessaCNAB400Registro1(boleto, ref numeroRegistro); strline = GerarDetalheRemessaCNAB400Registro2(boleto, ref numeroRegistro); if (!IsNullOrWhiteSpace(strline)) { detalhe += Environment.NewLine; detalhe += strline; } strline = GerarDetalheRemessaCNAB400Registro5(boleto, ref numeroRegistro); if (!IsNullOrWhiteSpace(strline)) { detalhe += Environment.NewLine; detalhe += strline; } break; default: throw new Exception("Tipo de arquivo inexistente."); } return(detalhe); } catch (Exception ex) { throw Boleto2NetException.ErroAoGerarRegistroDetalheDoArquivoRemessa(ex); } }
public void FormatarDados(string localPagamento, int digitosConta) { var agencia = Agencia; Agencia = agencia.Length <= 4 ? agencia.PadLeft(4, '0') : throw Boleto2NetException.AgenciaInvalida(agencia, 4); var conta = Conta; Conta = conta.Length <= digitosConta?conta.PadLeft(digitosConta, '0') : throw Boleto2NetException.ContaInvalida(conta, digitosConta); LocalPagamento = localPagamento; }
public void FormatarDados(string localPagamento = "PAGÁVEL EM QUALQUER BANCO ATÉ A DATA DE VENCIMENTO.", int digitosConta = 8) { var agencia = Agencia; Agencia = agencia.Length <= 4 ? agencia.PadLeft(4, '0') : throw Boleto2NetException.AgenciaInvalida(agencia); var conta = Conta; Conta = conta.Length <= digitosConta?conta.PadLeft(digitosConta, '0') : throw Boleto2NetException.ContaInvalida(conta); LocalPagamento = localPagamento; }
public void FormataCedente() { var contaBancaria = Cedente.ContaBancaria; if (!CarteiraFactory<BancoBanrisul>.CarteiraEstaImplementada(contaBancaria.CarteiraComVariacaoPadrao)) throw Boleto2NetException.CarteiraNaoImplementada(contaBancaria.CarteiraComVariacaoPadrao); contaBancaria.FormatarDados("PAGÁVEL EM QUALQUER BANCO ATÉ O VENCIMENTO.", "SAC BANRISUL: 0800 646 1515<br>OUVIDORIA BANRISUL: 0800 644 2200", "", 8); Cedente.CodigoFormatado = $"{contaBancaria.Agencia} {contaBancaria.Conta}{contaBancaria.DigitoConta}"; }
public void FormataCedente() { var contaBancaria = Cedente.ContaBancaria; if (!CarteiraFactory <BancoItau> .CarteiraEstaImplementada(contaBancaria.CarteiraComVariacaoPadrao)) { throw Boleto2NetException.CarteiraNaoImplementada(contaBancaria.CarteiraComVariacaoPadrao); } contaBancaria.FormatarDados("ATÉ O VENCIMENTO EM QUALQUER BANCO. APÓS O VENCIMENTO SOMENTE NO ITAÚ.", "", "", 5); Cedente.CodigoFormatado = $"{contaBancaria.Agencia} / {contaBancaria.Conta}-{contaBancaria.DigitoConta}"; }
public void FormataCedente() { var contaBancaria = Cedente.ContaBancaria; if (!CarteiraFactory <BancoSicredi> .CarteiraEstaImplementada(contaBancaria.CarteiraComVariacaoPadrao)) { throw Boleto2NetException.CarteiraNaoImplementada(contaBancaria.CarteiraComVariacaoPadrao); } contaBancaria.FormatarDados("PAGÁVEL EM QUALQUER BANCO ATÉ O VENCIMENTO.", "", "", 9); Cedente.CodigoFormatado = $"{contaBancaria.Agencia}.{contaBancaria.OperacaoConta}.{Cedente.Codigo}"; }
} // Safra repete o número do arquivo remessa na linha de detalhe (CNAB 400) public void FormataCedente() { var contaBancaria = Cedente.ContaBancaria; if (!CarteiraFactory <BancoSafra> .CarteiraEstaImplementada(contaBancaria.CarteiraComVariacaoPadrao)) { throw Boleto2NetException.CarteiraNaoImplementada(contaBancaria.CarteiraComVariacaoPadrao); } contaBancaria.FormatarDados("Pagável em qualquer Banco do Sistema de Compensação", "", "", 6); Cedente.CodigoFormatado = $"{contaBancaria.Agencia}-{contaBancaria.DigitoAgencia} / {contaBancaria.Conta}-{contaBancaria.DigitoConta}"; }
public void FormataCedente() { var contaBancaria = Cedente.ContaBancaria; if (!CarteiraFactory <BancoItau> .CarteiraEstaImplementada(contaBancaria.CarteiraComVariacaoPadrao)) { throw Boleto2NetException.CarteiraNaoImplementada(contaBancaria.CarteiraComVariacaoPadrao); } contaBancaria.FormatarDados("Pagável em qualquer banco ou correspondente não bancário mesmo após o vencimento.", "", "", 5); Cedente.CodigoFormatado = $"{contaBancaria.Agencia} / {contaBancaria.Conta}-{contaBancaria.DigitoConta}"; }
public void FormataCedente() { var contaBancaria = Cedente.ContaBancaria; if (!CarteiraFactory <BancoBradesco> .CarteiraEstaImplementada(contaBancaria.CarteiraComVariacao)) { throw Boleto2NetException.CarteiraNaoImplementada(contaBancaria.CarteiraComVariacao); } contaBancaria.FormatarDados("ATÉ O VENCIMENTO EM QUALQUER BANCO. APÓS O VENCIMENTO SOMENTE NO BRADESCO.", digitosConta: 7); var codigoCedente = Cedente.Codigo; Cedente.Codigo = codigoCedente.Length <= 20 ? codigoCedente.PadLeft(20, '0') : throw Boleto2NetException.CodigoCedenteInvalido(codigoCedente, 20); Cedente.CodigoFormatado = $"{contaBancaria.Agencia}-{contaBancaria.DigitoAgencia} / {contaBancaria.Conta}-{contaBancaria.DigitoConta}"; }
public string GerarDetalheRemessa(TipoArquivo tipoArquivo, Boleto boleto, ref int numeroRegistro) { try { var detalhe = Empty; var strline = ""; //base.GerarDetalheRemessa(boleto, numeroRegistro, tipoArquivo); switch (tipoArquivo) { case TipoArquivo.CNAB240: // Segmento P (Obrigatório) detalhe += GerarDetalheSegmentoPRemessaCNAB240SIGCB(boleto, ref numeroRegistro); // Segmento Q (Obrigatório) detalhe += Environment.NewLine; detalhe += GerarDetalheSegmentoQRemessaCNAB240SIGCB(boleto, ref numeroRegistro); // Segmento R (Opcional) strline = GerarDetalheSegmentoRRemessaCNAB240SIGCB(boleto, ref numeroRegistro); if (!IsNullOrWhiteSpace(strline)) { detalhe += Environment.NewLine; detalhe += strline; } // Segmento S (Opcional) strline = GerarDetalheSegmentoSRemessaCNAB240SIGCB(boleto, ref numeroRegistro); if (!IsNullOrWhiteSpace(strline)) { detalhe += Environment.NewLine; detalhe += strline; } break; default: throw new Exception("Caixa Econômica Federal - Detalhe - Tipo de arquivo inexistente."); } return(detalhe); } catch (Exception ex) { throw Boleto2NetException.ErroAoGerarRegistroDetalheDoArquivoRemessa(ex); } }
public void FormataCedente() { var contaBancaria = Cedente.ContaBancaria; if (!CarteiraFactory <BancoSantander> .CarteiraEstaImplementada(contaBancaria.CarteiraComVariacaoPadrao)) { throw Boleto2NetException.CarteiraNaoImplementada(contaBancaria.CarteiraComVariacaoPadrao); } contaBancaria.FormatarDados("ATÉ O VENCIMENTO EM QUALQUER BANCO. APÓS O VENCIMENTO SOMENTE NO SANTANDER.", "", digitosConta: 9); var codigoCedente = Cedente.Codigo; Cedente.Codigo = codigoCedente.Length <= 7 ? codigoCedente.PadLeft(7, '0') : throw Boleto2NetException.CodigoCedenteInvalido(codigoCedente, 7); Cedente.CodigoFormatado = $"{contaBancaria.Agencia} / {Cedente.Codigo}"; }
public string GerarHeaderRemessa(TipoArquivo tipoArquivo, int numeroArquivoRemessa, ref int numeroRegistroGeral) { try { var header = string.Empty; switch (tipoArquivo) { case TipoArquivo.CNAB400: header += GerarHeaderRemessaCNAB400(numeroArquivoRemessa, ref numeroRegistroGeral); break; default: throw new Exception("Header - Tipo de arquivo inexistente."); } return header; } catch (Exception ex) { throw Boleto2NetException.ErroAoGerarRegistroHeaderDoArquivoRemessa(ex); } }
public string GerarDetalheRemessa(TipoArquivo tipoArquivo, Boleto boleto, ref int numeroRegistro) { try { string detalhe = Empty, strline = Empty; switch (tipoArquivo) { case TipoArquivo.CNAB400: detalhe += GerarDetalheRemessaCNAB400Registro1(boleto, ref numeroRegistro); break; default: throw new Exception("Tipo de arquivo inexistente."); } return(detalhe); } catch (Exception ex) { throw Boleto2NetException.ErroAoGerarRegistroDetalheDoArquivoRemessa(ex); } }
public void FormataCedente() { var contaBancaria = Cedente.ContaBancaria; if (!CarteiraFactory <BancoCaixa> .CarteiraEstaImplementada(contaBancaria.CarteiraComVariacaoPadrao)) { throw Boleto2NetException.CarteiraNaoImplementada(contaBancaria.CarteiraComVariacaoPadrao); } var codigoCedente = Cedente.Codigo; Cedente.Codigo = codigoCedente.Length <= 6 ? codigoCedente.PadLeft(6, '0') : throw Boleto2NetException.CodigoCedenteInvalido(codigoCedente, 6); if (Cedente.CodigoDV == Empty) { throw new Exception($"Dígito do código do cedente ({codigoCedente}) não foi informado."); } Cedente.CodigoFormatado = $"{contaBancaria.Agencia} / {codigoCedente}-{Cedente.CodigoDV}"; contaBancaria.LocalPagamento = "ATÉ O VENCIMENTO EM QUALQUER BANCO. APÓS O VENCIMENTO SOMENTE NA CAIXA ECONÔMICA FEDERAL."; }
internal static ICarteira <T> ObterCarteira(string identificacao) => Carteiras.ContainsKey(identificacao) ? Carteiras[identificacao].Value : throw Boleto2NetException.CarteiraNaoImplementada(identificacao);