From 7d14af832f1fe72043801216b7cb6408c1a41a3e Mon Sep 17 00:00:00 2001 From: rafaelreuber Date: Sat, 21 Sep 2019 15:33:48 -0300 Subject: [PATCH 1/7] Adicionado .idea ao .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 93c111b..6eae579 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,5 @@ venv .cache .pytest_cache + +.idea \ No newline at end of file From 15052e2a25b799dd76d17acac375c7a5ef3b6ddd Mon Sep 17 00:00:00 2001 From: rafaelreuber Date: Sat, 21 Sep 2019 15:34:20 -0300 Subject: [PATCH 2/7] =?UTF-8?q?Removendo=20refer=C3=AAncia=20ao=20banco=20?= =?UTF-8?q?Real?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/html_pyboleto_sample.py | 40 ------------------------------- bin/pdf_pyboleto_sample.py | 48 ------------------------------------- pyboleto/bank/__init__.py | 2 +- 3 files changed, 1 insertion(+), 89 deletions(-) diff --git a/bin/html_pyboleto_sample.py b/bin/html_pyboleto_sample.py index a518a6e..fa59014 100644 --- a/bin/html_pyboleto_sample.py +++ b/bin/html_pyboleto_sample.py @@ -6,7 +6,6 @@ from pyboleto.bank.bradesco import BoletoBradesco from pyboleto.bank.caixa import BoletoCaixa from pyboleto.bank.itau import BoletoItau -from pyboleto.bank.real import BoletoReal from pyboleto.bank.santander import BoletoSantander from pyboleto.html import BoletoHTML import datetime @@ -57,44 +56,6 @@ def get_data_bb(): return listaDados -def get_data_real(): - listaDados = [] - for i in range(2): - d = BoletoReal() - d.carteira = '57' # Contrato firmado com o Banco Real - d.cedente = 'Empresa ACME LTDA' - d.cedente_documento = "102.323.777-01" - d.cedente_endereco = "Rua Acme, 123 - Centro - Sao Paulo/SP - \ - CEP: 12345-678" - d.agencia_cedente = '0531' - d.conta_cedente = '5705853' - - d.data_vencimento = datetime.date(2010, 3, 27) - d.data_documento = datetime.date(2010, 2, 12) - d.data_processamento = datetime.date(2010, 2, 12) - - d.instrucoes = [ - "- Linha 1", - "- Sr Caixa, cobrar multa de 2% após o vencimento", - "- Receber até 10 dias após o vencimento", - ] - d.demonstrativo = [ - "- Serviço Teste R$ 5,00", - "- Total R$ 5,00", - ] - d.valor_documento = 5.00 - - d.nosso_numero = "%d" % (i + 2) - d.numero_documento = "%d" % (i + 2) - d.sacado = [ - "Cliente Teste %d" % (i + 1), - "Rua Desconhecida, 00/0000 - Não Sei - Cidade - Cep. 00000-000", - "" - ] - listaDados.append(d) - return listaDados - - def get_data_bradesco(): listaDados = [] for i in range(2): @@ -255,7 +216,6 @@ def print_all(): # "itau": "Itau", "bb": "Banco do Brasil", "caixa": "Caixa", - "real": "Real", "santander": "Santander", "bradesco": "Bradesco", } diff --git a/bin/pdf_pyboleto_sample.py b/bin/pdf_pyboleto_sample.py index 962f400..a334375 100644 --- a/bin/pdf_pyboleto_sample.py +++ b/bin/pdf_pyboleto_sample.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- import pyboleto -from pyboleto.bank.real import BoletoReal from pyboleto.bank.bradesco import BoletoBradesco from pyboleto.bank.caixa import BoletoCaixa from pyboleto.bank.bancodobrasil import BoletoBB @@ -57,50 +56,6 @@ def print_bb(): boleto.save() -def print_real(): - listaDadosReal = [] - for i in range(2): - d = BoletoReal() - d.carteira = '57' # Contrato firmado com o Banco Real - d.cedente = 'Empresa ACME LTDA' - d.cedente_documento = "102.323.777-01" - d.cedente_endereco = ("Rua Acme, 123 - Centro - Sao Paulo/SP - " + - "CEP: 12345-678") - d.agencia_cedente = '0531' - d.conta_cedente = '5705853' - - d.data_vencimento = datetime.date(2010, 3, 27) - d.data_documento = datetime.date(2010, 2, 12) - d.data_processamento = datetime.date(2010, 2, 12) - - d.instrucoes = [ - "- Linha 1", - "- Sr Caixa, cobrar multa de 2% após o vencimento", - "- Receber até 10 dias após o vencimento", - ] - d.demonstrativo = [ - "- Serviço Teste R$ 5,00", - "- Total R$ 5,00", - ] - d.valor_documento = 5.00 - - d.nosso_numero = "%d" % (i + 2) - d.numero_documento = "%d" % (i + 2) - d.sacado = [ - "Cliente Teste %d" % (i + 1), - "Rua Desconhecida, 00/0000 - Não Sei - Cidade - Cep. 00000-000", - "" - ] - listaDadosReal.append(d) - - # Real Formato normal - uma pagina por folha A4 - boleto = BoletoPDF('boleto-real-formato-normal-teste.pdf') - for i in range(len(listaDadosReal)): - boleto.drawBoleto(listaDadosReal[i]) - boleto.nextPage() - boleto.save() - - def print_bradesco(): listaDadosBradesco = [] for i in range(2): @@ -276,9 +231,6 @@ def print_all(): print("Caixa") print_caixa() - print("Real") - print_real() - print("Santander") print_santander() diff --git a/pyboleto/bank/__init__.py b/pyboleto/bank/__init__.py index 48dc5e1..659c59a 100644 --- a/pyboleto/bank/__init__.py +++ b/pyboleto/bank/__init__.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- from ..data import BoletoException + BANCOS_IMPLEMENTADOS = { '001': 'bancodobrasil.BoletoBB', '041': 'banrisul.BoletoBanrisul', @@ -7,7 +8,6 @@ '104': 'caixa.BoletoCaixa', '399': 'hsbc.BoletoHsbc', '341': 'itau.BoletoItau', - '356': 'real.BoletoReal', '033': 'santander.BoletoSantander', '748': 'sicredi.BoletoSicredi', '756': 'sicoob.BoletoSicoob', From 3e9402ab5a3838344cea8259bdfa3e6953d75dd4 Mon Sep 17 00:00:00 2001 From: rafaelreuber Date: Sat, 21 Sep 2019 15:38:05 -0300 Subject: [PATCH 3/7] Imports no topo do arquivo (PEP-8) --- bin/pdf_pyboleto_in_memory_sample.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/pdf_pyboleto_in_memory_sample.py b/bin/pdf_pyboleto_in_memory_sample.py index 0f73622..9ab9de4 100644 --- a/bin/pdf_pyboleto_in_memory_sample.py +++ b/bin/pdf_pyboleto_in_memory_sample.py @@ -1,7 +1,11 @@ + +import io +import datetime + import pyboleto from pyboleto.bank.sicredi import BoletoSicredi from pyboleto.pdf import BoletoPDF -import datetime + d = BoletoSicredi() d.aceite = 'Sim' @@ -44,7 +48,6 @@ "" ] -import io buf = io.BytesIO() boleto = BoletoPDF(buf) From faf50e840a3735129314ba17c28ba85a8d2edc4a Mon Sep 17 00:00:00 2001 From: rafaelreuber Date: Sat, 21 Sep 2019 15:53:05 -0300 Subject: [PATCH 4/7] Corrige erro ao gerar exemplo de boleto do banco Caixa --- bin/pdf_pyboleto_sample.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/pdf_pyboleto_sample.py b/bin/pdf_pyboleto_sample.py index a334375..30b8b88 100644 --- a/bin/pdf_pyboleto_sample.py +++ b/bin/pdf_pyboleto_sample.py @@ -1,12 +1,14 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- + +import datetime + import pyboleto from pyboleto.bank.bradesco import BoletoBradesco from pyboleto.bank.caixa import BoletoCaixa from pyboleto.bank.bancodobrasil import BoletoBB from pyboleto.bank.santander import BoletoSantander from pyboleto.pdf import BoletoPDF -import datetime def print_bb(): @@ -159,7 +161,7 @@ def print_caixa(): listaDadosCaixa = [] for i in range(2): d = BoletoCaixa() - d.carteira = 'SR' # Contrato firmado com o Banco Bradesco + d.carteira = '1' d.cedente = 'Empresa ACME LTDA' d.cedente_documento = "102.323.777-01" d.cedente_endereco = ("Rua Acme, 123 - Centro - Sao Paulo/SP - " + From eebc022016660ca1be877c54362ecbdca00988f0 Mon Sep 17 00:00:00 2001 From: rafaelreuber Date: Sat, 21 Sep 2019 15:55:00 -0300 Subject: [PATCH 5/7] Adicionado pattern bin/*.pdf para ignorar exemplos gerados pelo script bin/pdf_pyboleto_sample.py --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6eae579..144e323 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,5 @@ venv .cache .pytest_cache -.idea \ No newline at end of file +.idea +bin/*.pdf \ No newline at end of file From 1a9e4c80ece29fced81851c00d7c779bb946db45 Mon Sep 17 00:00:00 2001 From: rafaelreuber Date: Sat, 21 Sep 2019 15:55:00 -0300 Subject: [PATCH 6/7] Adicionado pattern para ignorar arquivos pdf e html gerado pelos scripta contidos na pasta bin --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6eae579..201a718 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,6 @@ venv .cache .pytest_cache -.idea \ No newline at end of file +.idea +bin/*.pdf +bin/*.html \ No newline at end of file From 2e6724eeb323c27bd1a75b4247a91443195df182 Mon Sep 17 00:00:00 2001 From: rafaelreuber Date: Sat, 21 Sep 2019 15:59:54 -0300 Subject: [PATCH 7/7] =?UTF-8?q?Corre=C3=A7=C3=A3o=20do=20erro=20ao=20gerar?= =?UTF-8?q?=20exempla=20da=20fatura=20de=20caixa=20gerado=20pelo=20script?= =?UTF-8?q?=20html=5Fpyboleto=5Fsample.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/html_pyboleto_sample.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/html_pyboleto_sample.py b/bin/html_pyboleto_sample.py index fa59014..3f706a5 100644 --- a/bin/html_pyboleto_sample.py +++ b/bin/html_pyboleto_sample.py @@ -138,7 +138,7 @@ def get_data_caixa(): listaDados = [] for i in range(2): d = BoletoCaixa() - d.carteira = 'SR' # Contrato firmado com o Banco Bradesco + d.carteira = '1' d.cedente = 'Empresa ACME LTDA' d.cedente_documento = "102.323.777-01" d.cedente_endereco = "Rua Acme, 123 - Centro - Sao Paulo/SP - \ @@ -227,6 +227,7 @@ def print_all(): if sys.version_info < (3,): boleto_PDF = BoletoPDF('boleto-' + bank + '-normal-teste.pdf') boleto_HTML = BoletoHTML('boleto-' + bank + '-normal-teste.html') + for boleto_data in boleto_datas: if sys.version_info < (3,): boleto_PDF.drawBoleto(boleto_data)