dynamic environment loading
This commit is contained in:
@@ -4,6 +4,7 @@ PRIVATE_KEY=0xYOUR_PRIVATE_KEY
|
|||||||
CLIENT_ID=
|
CLIENT_ID=
|
||||||
CLIENT_SECRET=
|
CLIENT_SECRET=
|
||||||
DEV_APP_KEY=
|
DEV_APP_KEY=
|
||||||
|
CONVENIO=701
|
||||||
|
|
||||||
ITP_OAUTH_URL=https://oauth.hm.bb.com.br/oauth/token
|
ITP_OAUTH_URL=https://oauth.hm.bb.com.br/oauth/token
|
||||||
ITP_API_URL=https://checkout.mtls.api.bb.com.br
|
ITP_API_URL=https://checkout.mtls.api.bb.com.br
|
||||||
|
|||||||
10
bbpay.ts
10
bbpay.ts
@@ -1,5 +1,5 @@
|
|||||||
import PrimusNetwork from '@primuslabs/network-core-sdk';
|
import PrimusNetwork from '@primuslabs/network-core-sdk';
|
||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv-flow';
|
||||||
import express, { Request, Response } from 'express';
|
import express, { Request, Response } from 'express';
|
||||||
import cors from 'cors';
|
import cors from 'cors';
|
||||||
import axios, { AxiosInstance } from 'axios';
|
import axios, { AxiosInstance } from 'axios';
|
||||||
@@ -59,7 +59,7 @@ class BBPay {
|
|||||||
secret: process.env.CLIENT_SECRET,
|
secret: process.env.CLIENT_SECRET,
|
||||||
},
|
},
|
||||||
auth: {
|
auth: {
|
||||||
tokenHost: process.env.ITP_OAUTH_URL, // Ensure this is set to the correct token endpoint URL
|
tokenHost: process.env.ITP_OAUTH_URL,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ class BBPay {
|
|||||||
this.baseUrl = process.env.ITP_API_URL as string;
|
this.baseUrl = process.env.ITP_API_URL as string;
|
||||||
|
|
||||||
this.params = {
|
this.params = {
|
||||||
numeroConvenio: 701,
|
numeroConvenio: process.env.CONVENIO,
|
||||||
'gw-dev-app-key': process.env.DEV_APP_KEY,
|
'gw-dev-app-key': process.env.DEV_APP_KEY,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ class BBRegister extends BBPay {
|
|||||||
log('Registering participant...');
|
log('Registering participant...');
|
||||||
const data = req.body;
|
const data = req.body;
|
||||||
const body = {
|
const body = {
|
||||||
numeroConvenio: 701,
|
numeroConvenio: process.env.CONVENIO,
|
||||||
nomeParticipante: data.chainID,
|
nomeParticipante: data.chainID,
|
||||||
tipoDocumento: data.tipoDocumento,
|
tipoDocumento: data.tipoDocumento,
|
||||||
numeroDocumento: data.numeroDocumento,
|
numeroDocumento: data.numeroDocumento,
|
||||||
@@ -148,7 +148,7 @@ class BBRequest extends BBPay {
|
|||||||
const data = req.body;
|
const data = req.body;
|
||||||
const body = {
|
const body = {
|
||||||
geral: {
|
geral: {
|
||||||
numeroConvenio: 701,
|
numeroConvenio: process.env.CONVENIO,
|
||||||
pagamentoUnico: true,
|
pagamentoUnico: true,
|
||||||
descricaoSolicitacao: 'P2Pix',
|
descricaoSolicitacao: 'P2Pix',
|
||||||
valorSolicitacao: data.amount,
|
valorSolicitacao: data.amount,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
"axios-debug-log": "^1.0.0",
|
"axios-debug-log": "^1.0.0",
|
||||||
"bs58": "^6.0.0",
|
"bs58": "^6.0.0",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"dotenv": "^17.2.3",
|
"dotenv-flow": "^4.1.0",
|
||||||
"ethers": "^5.8.0",
|
"ethers": "^5.8.0",
|
||||||
"express": "^5.2.1",
|
"express": "^5.2.1",
|
||||||
"simple-oauth2": "^5.1.0",
|
"simple-oauth2": "^5.1.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user