Compare commits

..

1 Commits

Author SHA1 Message Date
root
0cfb371051 moar debug logging 2026-06-03 14:13:41 -03:00

View File

@@ -15,9 +15,6 @@ from eth_utils import to_wei
# Load environment variables from .env file # Load environment variables from .env file
load_dotenv() load_dotenv()
ENVIRONMENT = getenv('ENVIRONMENT', 'dev')
dotenv_path = f'.env.{ENVIRONMENT}'
load_dotenv(dotenv_path)
app = Flask(__name__) app = Flask(__name__)
CORS(app, origins=['https://p2pix.co']) CORS(app, origins=['https://p2pix.co'])
@@ -54,8 +51,7 @@ class BBPay(Resource):
class Register(BBPay): class Register(BBPay):
def post(self): def post(self):
data = request.get_json(force=True) data = request.get_json()
app.logger.debug(data)
body = { body = {
'numeroConvenio': getenv("BBPAY_CONVENIO"), 'numeroConvenio': getenv("BBPAY_CONVENIO"),
'nomeParticipante': data['chainID'], 'nomeParticipante': data['chainID'],
@@ -80,15 +76,14 @@ class Register(BBPay):
class Request(BBPay): class Request(BBPay):
def post(self): def post(self):
data = request.get_json(force=True) data = request.get_json()
app.logger.debug(data)
body = { body = {
"geral": { "geral": {
"numeroConvenio": getenv("BBPAY_CONVENIO"), "numeroConvenio": getenv("BBPAY_CONVENIO"),
"pagamentoUnico": True, "pagamentoUnico": True,
"descricaoSolicitacao": "P2Pix", "descricaoSolicitacao": "P2Pix",
"valorSolicitacao": data['amount'], "valorSolicitacao": data['amount'],
#"codigoConciliacaoSolicitacao": data['lockid'] "codigoConciliacaoSolicitacao": data['lockid']
}, },
# "devedor": { # "devedor": {
# "tipoDocumento": 1, # "tipoDocumento": 1,
@@ -117,7 +112,6 @@ class Request(BBPay):
class Release(BBPay): class Release(BBPay):
def get(self, numeroSolicitacao): def get(self, numeroSolicitacao):
app.logger.debug(request.get_data(as_text=True))
response = self.oauth.get( response = self.oauth.get(
self.baseUrl+f"/solicitacoes/{numeroSolicitacao}", self.baseUrl+f"/solicitacoes/{numeroSolicitacao}",
params=self.params, params=self.params,
@@ -167,7 +161,7 @@ api.add_resource(Release, '/release/<int:numeroSolicitacao>')
if __name__ == '__main__': if __name__ == '__main__':
if getenv("DEBUG"): if getenv("DEBUG"):
disable_warnings() disable_warnings()
app.run(host='::1', debug=True, port=getenv("PORT",5000)) app.run(host='::1',debug=True)
else: else:
from waitress import serve from waitress import serve
serve(app, host=getenv("HOST","::1"), port=getenv("PORT",5000)) serve(app, host=getenv("HOST","::1"), port=getenv("PORT",5000))