Histórico de mensagens sobre credentials em bolix

EXIBINDO CONVERSAS RECENTES:

Texto: credentials
Canal: bolix
Avatar discord do usuario acmedeiros

acmedeiros

Bom dia, estou com problema na autenticação:
"Could not authenticate. Please make sure you are using correct credentials and if you are using then in the correct environment

Avatar discord do usuario _alexandrehenrique

_alexandrehenrique

@sejaefi meu codigo

import { Request, Response } from "express";
import EfiPay from 'gn-api-sdk-typescript';
import Option from '../../../../certificate/credentials'


/
Create a banking billet for a CNPJ customer using EfiPay API.

@param req - The request object.
@param res - The response object.
/
export const CreatePgBoletoCNPJ = async (req: Request, res: Response) => {
// Get request body
const Dados = req.body;

console.log('CNPJ', Dados);

// Create request body
const body = {
payment: {
banking_billet: {
expire_at: Dados.vencimento,
customer: {
name: Dados.nome,
cpf: Dados.cpf,
juridical_person: {
corporate_name: Dados.razaosocial,
cnpj: Dados.cnpj
}
}
}
},

items: [{
name: Dados.produto,
value: parseInt(Dados.valor),
amount: 1
}],

metadata: {
notification_url: 'http://localhost:3041/notificacao/boleto/cnpj',
},
}

// Create EfiPay instance
const efipay = new EfiPay(Option);

// Call createOneStepCharge method
efipay
.createOneStepCharge([], body)
.then((resposta: Promise) => {
console.log(resposta);
res.json(resposta)
})
.catch((error: Promise) => {
console.log(error);
res.json(error)
});
}

Avatar discord do usuario _alexandrehenrique

_alexandrehenrique

Ver Respostas

outra coisa ve se entendi corretamente

/ eslint-disable import/extensions /
import EfiPay from 'gn-api-sdk-typescript';
import options from '../../credentials';

const body = {
payment: {
banking_billet: {
expire_at: '2024-09-20',
customer: {
name: 'Gorbadoc Oldbuck',
email: '[email protected]',
cpf: '94271564656',
birth: '1977-01-15',
phone_number: '5144916523',
},
},
},

items: [
{
name: 'Product 1',
value: 500,
amount: 1,
},
],
notification_url: 'http://your_domain.com/notification',
};

const efipay = new EfiPay(options);

efipay
.createOneStepCharge([], body)
.then((resposta: Promise) => {
console.log(resposta);
})
.catch((error: Promise) => {
console.log(error);
});
posso fazer dessa forma?

Avatar discord do usuario lukreitor

lukreitor

tentei criar a chave aleatoria e obtive o conection reset no response: package br.com.Gabriel.APIPaymentsEFI.gerencianet.pix.service;

//import gerencia net credentials, gerencia net sdk, gerencia net exceptions, json object, spring service
import br.com.Gabriel.APIPaymentsEFI.gerencianet.Credentials;
import br.com.gerencianet.gnsdk.Gerencianet;
import br.com.gerencianet.gnsdk.exceptions.GerencianetException;

import java.io.FileNotFoundException;
import java.util.HashMap;

import org.json.JSONObject;
import org.springframework.stereotype.Service;

public class PixCreateEvp {
public static void main(String[] args) throws FileNotFoundException {
Credentials credentials = new Credentials();

JSONObject options = new JSONObject();
options.put("client_id", credentials.getClientId());
options.put("client_secret", credentials.getClientSecret());
options.put("pix_cert", credentials.getCertificate());
options.put("sandbox", credentials.isSandbox());

try {
Gerencianet gn = new Gerencianet(options);
JSONObject response = gn.call("pixCreateEvp", new HashMap(), new JSONObject());
System.out.println(response);
} catch (GerencianetException e) {
System.out.println(e.getError());
System.out.println(e.getErrorDescription());
} catch (Exception e) {
System.out.println(e.getMessage());
}

}

}