-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy path__init__.py
More file actions
34 lines (29 loc) · 1.03 KB
/
__init__.py
File metadata and controls
34 lines (29 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# -*- coding: utf-8 -*-
from ..data import BoletoException
BANCOS_IMPLEMENTADOS = {
'001': 'bancodobrasil.BoletoBB',
'041': 'banrisul.BoletoBanrisul',
'237': 'bradesco.BoletoBradesco',
'104': 'caixa_sigcb.BoletoCaixaSigcb',
'399': 'hsbc.BoletoHsbc',
'341': 'itau.BoletoItau',
'356': 'real.BoletoReal',
'033': 'santander.BoletoSantander',
'748': 'sicredi.BoletoSicredi',
'756': 'sicoob.BoletoSicoob',
'0851': 'cecred.BoletoCecred',
}
def get_class_for_codigo(banco_codigo):
"""Retorna a classe que implementa o banco
:param banco_codigo:
:type banco_codigo: string
:return: Classo do Banco subclasse de :class:`pyboleto.data.BoletoData`
:rtype: :class:`pyboleto.data.BoletoData`
"""
try:
banco = BANCOS_IMPLEMENTADOS[banco_codigo].split('.')
except KeyError:
raise(BoletoException(u'Este banco não é suportado.'))
mod = __import__('pyboleto.bank.' + banco[0],
globals(), locals(), [banco[1]])
return getattr(mod, banco[1])