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

Criação de transferência em lotes pelo PIX #54

Open
wants to merge 142 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 99 commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
9fbd40b
criar transferencia pix
peidrao Apr 20, 2023
2306997
testes de transferencias pix
peidrao Apr 20, 2023
e1c6b24
exemplo de transferencia pix
peidrao Apr 20, 2023
5121f2d
formatacao e remocao de pdb
peidrao Apr 20, 2023
cbcc864
Update tests/wrapper/test_pagamentos.py
peidrao Apr 20, 2023
dca8256
Update tests/wrapper/test_pagamentos.py
peidrao Apr 20, 2023
33b6c34
Update tests/wrapper/test_pagamentos.py
peidrao Apr 20, 2023
216dd29
fmt
peidrao Apr 20, 2023
cec80e5
adicao de novos escopo de autorizacao do pix
peidrao Apr 20, 2023
dbf4d76
fix testes
peidrao Apr 20, 2023
558871d
fmt
peidrao Apr 20, 2023
e9d83cc
Update tests/wrapper/test_pagamentos.py
peidrao Apr 20, 2023
f088f9e
adicao de exemplo de trasnferencia usando cpf
peidrao Apr 20, 2023
7168239
adicao de wrapper para consulta de pix
peidrao Apr 20, 2023
08b50a6
testes no service de pix
peidrao Apr 20, 2023
18a7e8b
testes na funcao para criar body da transferencia pix
peidrao Apr 22, 2023
8ab341d
atualizacao de modelo e service transferencia pix
peidrao Apr 22, 2023
3a7e9de
refatorando servico de transferencia pix em lote
peidrao Apr 22, 2023
191b492
refatorando examplo de transferencia pix usando cpf
peidrao Apr 22, 2023
7d8f3d7
servico para verificar se email eh valido
peidrao Apr 23, 2023
5b97b46
testes em DocumentService
peidrao Apr 24, 2023
dede79a
fmt em DocumentService
peidrao Apr 24, 2023
01a6dab
Update bb_wrapper/services/pix.py
peidrao Apr 24, 2023
4f0166c
Update bb_wrapper/services/pix.py
peidrao Apr 24, 2023
e14abe7
ajustes em testes
peidrao Apr 24, 2023
4c43560
correcoes em teste
peidrao Apr 25, 2023
a6e746b
mock em test_retry_request
peidrao Apr 26, 2023
2846d7b
fmt
peidrao Apr 26, 2023
f9cff49
atualizacao da versao do py-bdd-context
peidrao Apr 26, 2023
298faf0
adicao de novos testes
peidrao Apr 26, 2023
4f77340
update lock file
peidrao Apr 26, 2023
14e2564
fmt
peidrao Apr 26, 2023
e54c317
Update tests/wrapper/test_pagamentos.py
peidrao Apr 27, 2023
857f9a3
refatoracao de testes
peidrao Apr 27, 2023
8947873
fmt
peidrao Apr 27, 2023
19c63e0
Update tests/utils.py
peidrao Apr 28, 2023
585508b
Update examples/lotes_pagamento/consultar_transferencia_pix.py
peidrao Apr 28, 2023
b3aa363
Update tests/wrapper/test_request.py
peidrao Apr 28, 2023
fdc0250
BDD em PixServiceTesteCase
peidrao Apr 28, 2023
8408423
fmt
peidrao Apr 28, 2023
993dda4
espaco branco no final do arquivo json
peidrao Apr 28, 2023
b130142
adicionando bdd em testes
peidrao May 2, 2023
6a86e7c
Update tests/services/test_documento.py
peidrao May 2, 2023
1afda49
Update tests/services/test_documento.py
peidrao May 2, 2023
4b02e21
Update tests/services/test_identify_key_type.py
peidrao May 2, 2023
4355f03
Update tests/services/test_identify_key_type.py
peidrao May 2, 2023
7b5a905
Update tests/wrapper/test_request.py
peidrao May 2, 2023
b0575e6
Update tests/services/test_identify_key_type.py
peidrao May 2, 2023
100bb9e
ajustes na descricao dos testes
peidrao May 2, 2023
dbc034f
Update tests/services/test_identify_key_type.py
peidrao May 3, 2023
7a13a25
Update tests/wrapper/test_request.py
peidrao May 3, 2023
12f174b
Update tests/utils.py
peidrao May 3, 2023
0d40ce7
ajustes em test
peidrao May 3, 2023
f16bd69
Update tests/services/test_identify_key_type.py
peidrao May 4, 2023
471d83d
Update tests/services/test_identify_key_type.py
peidrao May 4, 2023
5ebe8ce
Update tests/services/test_identify_key_type.py
peidrao May 4, 2023
f18f7da
Update tests/services/test_identify_key_type.py
peidrao May 4, 2023
146b1ec
Update tests/services/test_identify_key_type.py
peidrao May 4, 2023
83c5f1e
Update tests/services/test_documento.py
peidrao May 4, 2023
d50dfa3
Update tests/services/test_documento.py
peidrao May 4, 2023
014bff8
Update tests/services/test_documento.py
peidrao May 4, 2023
32a309d
Update bb_wrapper/models/pagamentos.py
peidrao May 4, 2023
e331ce3
ajuste em espaco de teste
peidrao May 4, 2023
ae5e6d9
Update tests/services/test_identify_key_type.py
peidrao May 4, 2023
17faf03
Update tests/services/test_documento.py
peidrao May 4, 2023
55103b0
Update tests/services/test_documento.py
peidrao May 4, 2023
18f6ad6
Update tests/services/test_documento.py
peidrao May 4, 2023
5964dd3
Update tests/services/test_identify_key_type.py
peidrao May 4, 2023
59228f8
Update tests/services/test_documento.py
peidrao May 4, 2023
545d9a4
Update tests/services/test_documento.py
peidrao May 4, 2023
33f4c66
Update tests/services/test_identify_key_type.py
peidrao May 4, 2023
3b1c761
Update tests/services/test_identify_key_type.py
peidrao May 4, 2023
398adc9
Update tests/services/test_identify_key_type.py
peidrao May 4, 2023
a7f99e6
Update tests/services/test_identify_key_type.py
peidrao May 4, 2023
f7a03da
Update tests/services/test_documento.py
peidrao May 4, 2023
14bdb29
Update tests/services/test_identify_key_type.py
peidrao May 4, 2023
3e2fc28
Update tests/services/test_identify_key_type.py
peidrao May 4, 2023
5f13d75
Update bb_wrapper/models/pagamentos.py
peidrao May 4, 2023
f7c8c76
Melhorar comentários em testes e remoção de método para buscar transf…
peidrao May 5, 2023
002c065
Atualizacao de requests
peidrao May 5, 2023
605729e
Atualizacao de poetry.lock
peidrao May 5, 2023
30bb589
update requests
peidrao May 5, 2023
07ee192
atualizacao do poetry.lock
peidrao May 5, 2023
03aac77
utilizando requests 2.29.0
peidrao May 5, 2023
9f15f13
ajuste no actions
peidrao May 5, 2023
c1b1472
Debugando CI, ls -al
PedroRegisPOAR May 5, 2023
24d7128
Debugando CI, ls -al
PedroRegisPOAR May 5, 2023
d5316a6
Debugando CI, remove .native -> .venv
PedroRegisPOAR May 5, 2023
f0f7e3a
Debugando CI, poetry show --tree
PedroRegisPOAR May 5, 2023
1d2f8f9
Debugando CI, poetry show --tree
PedroRegisPOAR May 5, 2023
f9f5bed
Update .github/workflows/pypi.yml
PedroRegisPOAR May 7, 2023
86da7f5
Update .github/workflows/tests.yml
PedroRegisPOAR May 7, 2023
88d6b8e
Update .github/workflows/tests.yml
PedroRegisPOAR May 7, 2023
a05ddce
Update .github/workflows/tests.yml
PedroRegisPOAR May 7, 2023
c9295fb
Fixa requests = "2.30.0"
PedroRegisPOAR May 7, 2023
a2f84be
Fixa urllib3 = "1.26.15"
PedroRegisPOAR May 7, 2023
d6243ca
Atualiza poetry da Action
PedroRegisPOAR May 7, 2023
c5f9ed9
fmt
PedroRegisPOAR May 7, 2023
304d4ab
Atualiza poetry usado localmente para 1.4.2
PedroRegisPOAR May 7, 2023
d5c37ce
Update tests/wrapper/test_pagamentos.py
peidrao May 8, 2023
b3fd154
atualizacao de nomes cpf e cnpj
peidrao May 8, 2023
5174020
alterando nomeacao de pix para PIX em comentarios
peidrao May 8, 2023
756df5f
Remove result-bin
PedroRegisPOAR May 8, 2023
e183604
consultar pix
peidrao May 8, 2023
07b044e
teste de consulta de pix
peidrao May 8, 2023
a158a01
fmt
peidrao May 8, 2023
3c23d45
fmt
peidrao May 8, 2023
0df0a6f
consultar pix exemplo
peidrao May 8, 2023
28796a4
refatoracao de testes usando o bdd
peidrao May 9, 2023
bc13ca3
alteracao do readme, com novos recursos
peidrao May 10, 2023
3767851
Merge branch 'imopix' of github.com:imobanco/bb-wrapper into imopix
peidrao May 10, 2023
9a30c81
ajustando comentarios nos testes do BaseBBWrapper
peidrao May 10, 2023
2cce1ec
Merge branch 'imopix' of github.com:imobanco/bb-wrapper into imopix
peidrao May 10, 2023
e3c5b70
adicionando campo de documento para enviar cpf/cnpj
peidrao May 10, 2023
b2a6a2d
adicionando classmethod em verifica_documento
peidrao May 10, 2023
720d3e6
criacao de pasta certs com nix
peidrao May 11, 2023
c38445b
Update bb_wrapper/wrapper/pagamento_lote.py
peidrao May 12, 2023
6691f0c
Update bb_wrapper/models/pagamentos.py
peidrao May 12, 2023
7af9f63
ajustes na interface do transferencia pix
peidrao May 12, 2023
f48d900
Update bb_wrapper/models/pagamentos.py
peidrao May 15, 2023
eedcbe5
ajustes em testes e ajustes na documentacao
peidrao May 15, 2023
2e8895b
merge com main
peidrao Jan 25, 2024
9925265
adiciona pequenas mudanças em nomes de métodos e classes
peidrao Jan 29, 2024
6e4c515
remover tipo de chave pix da docsstring TipoChavePIX
peidrao Jan 29, 2024
9db1079
adiciona verificador de documento no serviço destinado ao pix
peidrao Jan 30, 2024
219ae20
adiciona modelo para transferencia pix via dados bancários
peidrao Jan 30, 2024
e58dd32
adiciona serviço de transferencia pix via dados bancários no bb-wrapper
peidrao Jan 30, 2024
012dccc
adiciona testes unitários
peidrao Jan 30, 2024
31cc8ae
adiciona example de chamada de requisição
peidrao Jan 30, 2024
c2ff8f4
adiciona numero ISPB
peidrao Jan 30, 2024
f59ddc5
adiciona valores bancários como opcionais
peidrao Jan 30, 2024
8934d56
cria exemplo de transferencia pix via dados bancários apenas pela con…
peidrao Jan 30, 2024
310a6e8
Apply suggestions from code review
peidrao Jan 30, 2024
a81a5b3
ajustes
peidrao Jan 30, 2024
446e6df
ajustar modelos
peidrao Jan 31, 2024
e462efa
ajustar testes em wrapper
peidrao Jan 31, 2024
3ef005e
ajustar testes
peidrao Jan 31, 2024
ded5afb
adiciona logging no exemplo!
rodrigondec Feb 1, 2024
d1ea125
ajustes
peidrao Feb 1, 2024
9f62125
removendo valores nulos
peidrao Feb 2, 2024
45f0277
adiciona tratamento do COMPE e cpf/cnpj dos dados.
rodrigondec Feb 6, 2024
28f6829
ajustes
rodrigondec May 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Poetry
uses: Gr1N/setup-poetry@v7
with:
poetry-version: 1.1.8
poetry-version: 1.4.2

- name: Install dependencies
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Set up Poetry
uses: Gr1N/setup-poetry@v7
with:
poetry-version: 1.1.8
poetry-version: 1.4.2

- name: Install dependencies
run: |
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Set up Poetry
uses: Gr1N/setup-poetry@v7
with:
poetry-version: 1.1.8
poetry-version: 1.4.2

- name: Install dependencies
run: |
Expand All @@ -79,7 +79,7 @@ jobs:
- name: Set up Poetry
uses: Gr1N/setup-poetry@v7
with:
poetry-version: 1.1.8
poetry-version: 1.4.2

- name: Install dependencies
run: |
Expand Down
25 changes: 14 additions & 11 deletions bb_wrapper/models/pagamentos.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ class TransferenciaPIX(BaseModel):
valor: float
chave: str
formaIdentificacao: Optional[TipoChavePIX]
dddTelefone: Optional[int]
telefone: Optional[int]
descricaoPagamento: Optional[str]
dddTelefone: Optional[str]
telefone: Optional[str]
email: Optional[str]
cpf: Optional[int]
cnpj: Optional[int]
cpf: Optional[str]
cnpj: Optional[str]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

se não me engano tem que ser int mesmo!

Sim, a API BB é horrível nesse nível. Precisa transformar em int mesmo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ainda está como "str"!

identificacaoAleatoria: Optional[str]

# noinspection PyMethodParameters
Expand All @@ -74,23 +75,25 @@ def _set_data(cls, values):
from ..services.pix import PixService

key = values.get("chave")

key_type = PixService().identify_key_type(key)
values["formaIdentificacao"] = key_type
values["formaIdentificacao"] = key_type.value

if key_type == TipoChavePIX.telefone:
values["dddTelefone"] = int(key[:2])
values["telefone"] = int(key[2:])
values["dddTelefone"] = key[:2]
values["telefone"] = key[2:]
elif key_type == TipoChavePIX.email:
PixService().verify_email(key)
values["email"] = key
elif key_type == TipoChavePIX.uuid:
values["identificacaoAleatoria"] = key
elif key_type == TipoChavePIX.documento:
key_value = cpfcnpj.clear_punctuation(key)
if len(key_value) == 1:
values["cpf"] = int(key_value)
if len(key_value) == 11:
values["cpf"] = key_value
else:
values["cnpj"] = int(key_value)
values["cnpj"] = key_value

values.pop("chave")
return values


Expand Down
1 change: 1 addition & 0 deletions bb_wrapper/services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from .barcode import BarcodeService
from .mod import ModService # noqa: F401
from .pixcode import PixCodeService # noqa: F401
from .pix import PixService # noqa: F401


parse_unicode_to_alphanumeric = UnicodeService().parse_unicode_to_alphanumeric
Expand Down
5 changes: 3 additions & 2 deletions bb_wrapper/services/document.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pycpfcnpj import cpfcnpj
from bb_wrapper.models.perfis import TipoInscricaoEnum


class DocumentoService:
Expand All @@ -12,9 +13,9 @@ def identifica_tipo(self, documento):
"""
documento = self.valida(documento)
if len(documento) == 11:
return 1
return TipoInscricaoEnum.cpf
else:
return 2
return TipoInscricaoEnum.cnpj

def valida(self, documento):
"""
Expand Down
14 changes: 13 additions & 1 deletion bb_wrapper/services/pix.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import uuid
import re

from pycpfcnpj import cpfcnpj

Expand Down Expand Up @@ -36,7 +37,7 @@ def identify_key_type(self, key: str):

# 4
try:
is_uuid = uuid.UUID(key)
is_uuid = bool(uuid.UUID(key))
except ValueError:
is_uuid = False

Expand All @@ -52,3 +53,14 @@ def identify_key_type(self, key: str):
return TipoChavePIX.uuid
else:
raise ValueError("Tipo de chave não identificado")

def verify_email(self, email: str, raise_exception=True):
regex = re.compile(
r"([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+"
PedroRegisPOAR marked this conversation as resolved.
Show resolved Hide resolved
)

is_email_valid = re.fullmatch(regex, email)

if raise_exception and not is_email_valid:
raise ValueError("Email inválido!")
return is_email_valid
79 changes: 78 additions & 1 deletion bb_wrapper/wrapper/pagamento_lote.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
LoteData,
LoteTransferenciaData,
LiberarPagamentos,
TransferenciaPIX,
)
from ..services.document import DocumentoService
from ..services.barcode import BarcodeService
Expand All @@ -16,7 +17,8 @@ class PagamentoLoteBBWrapper(BaseBBWrapper):
Wrapper da API Pagamentos em Lote
"""

SCOPE = "pagamentos-lote.lotes-requisicao pagamentos-lote.transferencias-info pagamentos-lote.transferencias-requisicao pagamentos-lote.cancelar-requisicao pagamentos-lote.devolvidos-info pagamentos-lote.lotes-info pagamentos-lote.pagamentos-guias-sem-codigo-barras-info pagamentos-lote.pagamentos-info pagamentos-lote.pagamentos-guias-sem-codigo-barras-requisicao pagamentos-lote.pagamentos-codigo-barras-info pagamentos-lote.boletos-requisicao pagamentos-lote.guias-codigo-barras-info pagamentos-lote.guias-codigo-barras-requisicao pagamentos-lote.transferencias-pix-info pagamentos-lote.transferencias-pix-requisicao pagamentos-lote.pix-info pagamentos-lote.boletos-info" # noqa
brenomfviana marked this conversation as resolved.
Show resolved Hide resolved
SCOPE = "pagamentos-lote.lotes-requisicao pagamentos-lote.transferencias-info pagamentos-lote.transferencias-requisicao pagamentos-lote.cancelar-requisicao pagamentos-lote.devolvidos-info pagamentos-lote.lotes-info pagamentos-lote.pagamentos-guias-sem-codigo-barras-info pagamentos-lote.pagamentos-info pagamentos-lote.pagamentos-guias-sem-codigo-barras-requisicao pagamentos-lote.pagamentos-codigo-barras-info pagamentos-lote.boletos-requisicao pagamentos-lote.guias-codigo-barras-info pagamentos-lote.guias-codigo-barras-requisicao pagamentos-lote.boletos-info pagamentos-lote.transferencias-pix-requisicao pagamentos-lote.transferencias-pix-info pagamentos-lote.pix-info" # noqa

BASE_PROD_ADDITION = "-ip"
BASE_DOMAIN = ".bb.com.br/pagamentos-lote/v1"

Expand Down Expand Up @@ -481,3 +483,78 @@ def consultar_pagamento_tributo(self, _id):
response = self._get(url)

return response

################
# PIX #
################

def _criar_dados_transferencia_pix(
self,
n_requisicao,
agencia,
conta,
dv_conta,
data_transferencia,
valor_transferencia,
chave,
descricao,
tipo_pagamento,
):
lote_data = {
"numeroRequisicao": n_requisicao,
"agenciaDebito": agencia,
"contaCorrenteDebito": conta,
"digitoVerificadorContaCorrente": dv_conta,
"tipoPagamento": tipo_pagamento,
}

transferencia_data = {
"data": data_transferencia,
"valor": valor_transferencia,
"descricaoPagamento": descricao,
"chave": chave,
}
transferencia_data = TransferenciaPIX(**transferencia_data).dict()
return {**lote_data, "listaTransferencias": [transferencia_data]}

def criar_transferencia_pix(
self,
n_requisicao,
agencia,
conta,
dv_conta,
data_transferencia,
valor_transferencia,
chave,
descricao="",
tipo_pagamento=128,
):
"""
Efetua pagamentos em lote via tranferência PIX

Args:
n_requisicao: Nº da requisição a ser utilizado. Deve ser único
agencia: Agência da conta de origem do pagamento
conta: Nº da conta de origem do pagamento
dv_conta: DV da conta de origem do pagamento
tipo_pagamento: Tipo de pagamento a ser feito (126, 127 ou 128)
data_transferencia: Data do pagamento. No formato "ddmmyyyy"
valor_transferencia: Valor do pagamento
chave: Valor corresponde a chave que sera usada para tranferência # noqa: E501
descricao: Campo de uso livre pelo cliente
"""
data = self._criar_dados_transferencia_pix(
n_requisicao,
agencia,
conta,
dv_conta,
data_transferencia,
valor_transferencia,
chave,
descricao,
PedroRegisPOAR marked this conversation as resolved.
Show resolved Hide resolved
tipo_pagamento,
)
url = self._construct_url("lotes-transferencias-pix")
response = self._post(url, data)

return response
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"numeroRequisicao": 921347,
"estadoRequisicao": 1,
"quantidadeTransferencias": 1,
"valorTransferencias": 15.5,
"quantidadeTransferenciasValidas": 1,
"valorTransferenciasValidas": 15.5,
"listaTransferencias": [
{
"identificadorPagamento": 90921347731030000,
"data": 19042023,
"valor": 15.5,
"documentoDebito": 0,
"documentoCredito": 0,
"descricaoPagamento": "nova transferencia",
"descricaoPagamentoInstantaneo": "",
"formaIdentificacao": 4,
"dddTelefone": 0,
"telefone": 0,
"email": "",
"cpf": 0,
"cnpj": 0,
"identificacaoAleatoria": "d14d32de-b3b9-4c31-9f89-8df2cec92c50",
"numeroCOMPE": 0,
"numeroISPB": 0,
"tipoConta": 0,
"agencia": 0,
"conta": 0,
"digitoVerificadorConta": "",
"contaPagamento": "",
"indicadorMovimentoAceito": "S",
"erros": []
}
]
}
35 changes: 35 additions & 0 deletions examples/lotes_pagamento/data/transferencia_pix_cpf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"numeroRequisicao": 9221347,
"estadoRequisicao": 1,
"quantidadeTransferencias": 1,
"valorTransferencias": 7999.99,
"quantidadeTransferenciasValidas": 1,
"valorTransferenciasValidas": 7999.99,
"listaTransferencias": [
{
"identificadorPagamento": 99221347731030000,
"data": 20042023,
"valor": 7999.99,
"documentoDebito": 0,
"documentoCredito": 0,
"descricaoPagamento": "transferencia CPF",
"descricaoPagamentoInstantaneo": "",
"formaIdentificacao": 3,
"dddTelefone": 0,
"telefone": 0,
"email": "",
"cpf": 28779295827,
"cnpj": 0,
"identificacaoAleatoria": "",
"numeroCOMPE": 0,
"numeroISPB": 0,
"tipoConta": 0,
"agencia": 0,
"conta": 0,
"digitoVerificadorConta": "",
"contaPagamento": "",
"indicadorMovimentoAceito": "S",
"erros": []
PedroRegisPOAR marked this conversation as resolved.
Show resolved Hide resolved
}
]
}
31 changes: 31 additions & 0 deletions examples/lotes_pagamento/transferencia_pix_chave_aleatoria.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os
from datetime import date

from examples.utils import dump_response

from bb_wrapper.wrapper import PagamentoLoteBBWrapper

c = PagamentoLoteBBWrapper(cert=("./certs/cert.pem", "./certs/key.pem"))


today = date.today()
bb_fmt = "%d%m%Y"


lote_data = {
"n_requisicao": 921347,
"agencia": 1607,
"conta": 99738672,
"dv_conta": "X",
PedroRegisPOAR marked this conversation as resolved.
Show resolved Hide resolved
}

transferencia_data = {
"descricao": "nova transferencia",
"data_transferencia": today.strftime(bb_fmt),
"valor_transferencia": 15.50,
"forma_id": 4,
"chave_aleatoria": "d14d32de-b3b9-4c31-9f89-8df2cec92c50",
}

response = c.criar_transferencia_pix(**lote_data, **transferencia_data)
dump_response(response, os.path.realpath(__file__))
30 changes: 30 additions & 0 deletions examples/lotes_pagamento/transferencia_pix_cpf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import os
from datetime import date

from examples.utils import dump_response

from bb_wrapper.wrapper import PagamentoLoteBBWrapper

c = PagamentoLoteBBWrapper(cert=("./certs/cert.pem", "./certs/key.pem"))


today = date.today()
bb_fmt = "%d%m%Y"


lote_data = {
"n_requisicao": 9222347,
"agencia": 1607,
"conta": 99738672,
"dv_conta": "X",
}

transferencia_data = {
"descricao": "transferencia CPF",
"data_transferencia": today.strftime(bb_fmt),
"valor_transferencia": 7999.99,
"chave": "28779295827",
}

response = c.criar_transferencia_pix(**lote_data, **transferencia_data)
dump_response(response, os.path.realpath(__file__))
Loading