Compare commits
No commits in common. "6092541f5d9c6d92255b3776f372bdefae209bb9" and "94cee1fa5ebf4e551dfeec95e852364d96bc6d02" have entirely different histories.
6092541f5d
...
94cee1fa5e
10
bbpay.py
10
bbpay.py
@ -8,9 +8,7 @@ from flask_restful import Resource, Api
|
||||
from eth_abi.packed import encode_packed
|
||||
import eth_account
|
||||
from eth_hash.auto import keccak
|
||||
from base64 import b85decode
|
||||
from urllib3 import disable_warnings
|
||||
from eth_utils import to_wei
|
||||
|
||||
# Load environment variables from .env file
|
||||
load_dotenv()
|
||||
@ -111,20 +109,20 @@ class Release(BBPay):
|
||||
verify=self.verify_ssl)
|
||||
data = response.json()
|
||||
numeroParticipante = data['repasse']['recebedores'][0]['identificadorRecebedor']
|
||||
pixTimestamp = b85decode(data['informacoesPix']['txId'])
|
||||
valorSolicitacao = to_wei(data['valorSolicitacao'], 'ether')
|
||||
valorSolicitacao = data['valorSolicitacao']
|
||||
pixTimestamp = data['timestampCriacaoSolicitacao']
|
||||
codigoEstadoSolicitacao = data['codigoEstadoSolicitacao']
|
||||
if codigoEstadoSolicitacao != 0:
|
||||
return 'Pix not paid', 204
|
||||
packed = encode_packed(['bytes32','uint80','bytes32'],
|
||||
(str(numeroParticipante).encode(), int(valorSolicitacao), pixTimestamp) )
|
||||
(str(numeroParticipante).encode(), int(valorSolicitacao), pixTimestamp.encode()) )
|
||||
|
||||
signable = eth_account.messages.encode_defunct(keccak(packed))
|
||||
signature = eth_account.account.Account.sign_message(signable, private_key=getenv('PRIVATE_KEY')).signature.hex()
|
||||
return {
|
||||
'pixTarget': numeroParticipante,
|
||||
'amount': valorSolicitacao,
|
||||
'pixTimestamp': pixTimestamp.hex(),
|
||||
'pixTimestamp': pixTimestamp,
|
||||
'signature': signature }
|
||||
|
||||
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
python-dotenv
|
||||
oauthlib
|
||||
requests-oauthlib
|
||||
flask
|
||||
flask-restful
|
||||
eth-abi
|
||||
eth-account
|
||||
eth-hash[pycryptodome]
|
||||
eth-utils
|
||||
base64
|
||||
urllib3
|
||||
waitress
|
||||
Loading…
x
Reference in New Issue
Block a user