Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correção dos scripts de geração de exemplos e remoção de referências ao banco Real #32

Open
wants to merge 8 commits into
base: master3
Choose a base branch
from
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ venv

.cache
.pytest_cache

.idea
bin/*.pdf
bin/*.html
43 changes: 2 additions & 41 deletions bin/html_pyboleto_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -177,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 - \
Expand Down Expand Up @@ -255,7 +216,6 @@ def print_all():
# "itau": "Itau",
"bb": "Banco do Brasil",
"caixa": "Caixa",
"real": "Real",
"santander": "Santander",
"bradesco": "Bradesco",
}
Expand All @@ -267,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)
Expand Down
7 changes: 5 additions & 2 deletions bin/pdf_pyboleto_in_memory_sample.py
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -44,7 +48,6 @@
""
]

import io
buf = io.BytesIO()

boleto = BoletoPDF(buf)
Expand Down
54 changes: 4 additions & 50 deletions bin/pdf_pyboleto_sample.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import datetime

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
from pyboleto.bank.santander import BoletoSantander
from pyboleto.pdf import BoletoPDF
import datetime


def print_bb():
Expand Down Expand Up @@ -57,50 +58,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):
Expand Down Expand Up @@ -204,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 - " +
Expand Down Expand Up @@ -276,9 +233,6 @@ def print_all():
print("Caixa")
print_caixa()

print("Real")
print_real()

print("Santander")
print_santander()

Expand Down
2 changes: 1 addition & 1 deletion pyboleto/bank/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
from ..data import BoletoException

BANCOS_IMPLEMENTADOS = {
'001': 'bancodobrasil.BoletoBB',
'041': 'banrisul.BoletoBanrisul',
'237': 'bradesco.BoletoBradesco',
'104': 'caixa.BoletoCaixa',
'399': 'hsbc.BoletoHsbc',
'341': 'itau.BoletoItau',
'356': 'real.BoletoReal',
'033': 'santander.BoletoSantander',
'748': 'sicredi.BoletoSicredi',
'756': 'sicoob.BoletoSicoob',
Expand Down