const certificado = await this.movimentoService.certificado_gn();
const client_id = await this.movimentoService.client_id_gn();
const client_secret = await this.movimentoService.client_secret_gn();
const base64 = Buffer.from(${client_id}:${client_secret}).toString("base64");
let https = require('https');
let agent = new https.Agent({
pfx: certificado,
passphrase: ''
})
var axios = require('axios');
var data = JSON.stringify({ grant_type: 'client_credentials'});
var config = {
method: 'post',
url: 'https://api-pix-h.gerencianet.com.br/oauth/token',
headers: {
'Authorization': Basic ${base64},
'Content-Type': 'application/json',
},
httpsAgent: agent,
data: data
};
console.log(config)
console.log('=======================================================================')
try {
const response = await axios.request(config);
return response.data
} catch (error) {
console.error(error);
}