Compare commits
6 Commits
0cfb371051
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e8792bc5c | ||
|
|
98707fce2b | ||
|
|
b2ee0fe37f | ||
|
|
b16b9d4fb2 | ||
|
|
925002c572 | ||
|
|
e05f46a987 |
14
bbpay.py
14
bbpay.py
@@ -15,6 +15,9 @@ 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'])
|
||||||
@@ -51,7 +54,8 @@ class BBPay(Resource):
|
|||||||
|
|
||||||
class Register(BBPay):
|
class Register(BBPay):
|
||||||
def post(self):
|
def post(self):
|
||||||
data = request.get_json()
|
data = request.get_json(force=True)
|
||||||
|
app.logger.debug(data)
|
||||||
body = {
|
body = {
|
||||||
'numeroConvenio': getenv("BBPAY_CONVENIO"),
|
'numeroConvenio': getenv("BBPAY_CONVENIO"),
|
||||||
'nomeParticipante': data['chainID'],
|
'nomeParticipante': data['chainID'],
|
||||||
@@ -76,14 +80,15 @@ class Register(BBPay):
|
|||||||
|
|
||||||
class Request(BBPay):
|
class Request(BBPay):
|
||||||
def post(self):
|
def post(self):
|
||||||
data = request.get_json()
|
data = request.get_json(force=True)
|
||||||
|
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,
|
||||||
@@ -112,6 +117,7 @@ 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,
|
||||||
@@ -161,7 +167,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)
|
app.run(host='::1', debug=True, port=getenv("PORT",5000))
|
||||||
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))
|
||||||
|
|||||||
Reference in New Issue
Block a user