Histórico

EXIBINDO CONVERSAS RECENTES:

Texto: certificate
# pix
Avatar discord do usuario kaykyramos

kaykyramos

Ver no Discord

import as EfiPay from 'sdk-node-apis-efi'

import { Injectable } from '@nestjs/common'

import 'dotenv/config'

@Injectable()
export class PixService {
private efiPay = new EfiPay({
sandbox: false,
client_id: process.env.EFIPAY_CLIENT_ID,
client_secret: process.env.EFIPAY_CLIENT_SECRET,
certificate: './certs/producao-453290-LinkZap-v2.p12',
})

constructor() {
//
}

public async getBalance() {
const { saldo } = await this.efiPay.getAccountBalance()
return Number(saldo)
}

public async payPix(pixCode: string, amount: number) {
const balance = await this.getBalance()
if (balance < amount) {
throw new Error('Saldo insuficiente')
}

try {
const response = await this.efiPay.pixSend(
{ idEnvio: '01' },
{
valor: amount,
pagador: {
chave: 'a4c3dcd3-0005-454e-957f-df416a63c4ed',
},
favorecido: {
chave: pixCode,
},
},
)
return response
} catch (error) {
console.log(error)
}
}
}

# pix
Avatar discord do usuario rubenskuhl

rubenskuhl

Ver RespostasVer no Discord

A API é aberta e descrita nos endpoints, não precisa usar SDK... nós não usamos na nossa integração, apesar deles terem um SDK Golang.
Aonde colocar o certificado é uma questão do seu ambiente local, pq o certificado é usado para estabelecer a conexão... mas sim, se seu ambiente tem uma opção certificate no payload, tem grande cara de ser aí mesmo.

E sim, sem o certificado nem fecha a conexão, então nem vai ter mensagem de erro da Efí, só do seu ambiente local.

# pix
Avatar discord do usuario yurikfernandes

yurikfernandes

Ver no Discord

Estou tentando gerar o OAuthToken por meio da URL https://api-pix-h.gerencianet.com.br/oauth/token" class="link-msg" >https://api-pix-h.gerencianet.com.br/oauth/token mas sempre retornando um erro: Exception: Address unavailable: https://api-pix-h.gerencianet.com.br/oauth/token.

Acredito que tenha a ver com o certificado, se eu convertesse ele para Bas64, poderia adicioná-lo no payload dentro da chave "certificate"? Ou teria outro lugar?

# pix
Avatar discord do usuario ronaldo_pertec

ronaldo_pertec

Ver no Discord

processing: https://pix.api.efipay.com.br/oauth/token
Trying 52.3.67.197:443...
Connected to pix.api.efipay.com.br (52.3.67.197) port 443
CAfile: none
CApath: none
ALPN: offers http/1.1
NSS: client certificate from file
subject: C=BR,CN=301970
start date: May 19 20:28:50 2021 GMT
expire date: May 19 20:28:50 2024 GMT
common name: 301970
issuer: [email protected],CN=api-pix.gerencianet.com.br,OU=Infraestrutura,O=Gerencianet Pagamentos do Brasil Ltda,ST=Minas Gerais,C=BR
ALPN: server accepted http/1.1
SSL connection using TLS_AES_256_GCM_SHA384
Server certificate:
subject: CN=.api.efipay.com.br,O=EFI S.A. - INSTITUICAO DE PAGAMENTO,L=OURO PRETO,ST=MINAS GERAIS,C=BR
start date: May 17 19:31:27 2023 GMT
expire date: Jun 17 19:31:26 2024 GMT
common name: .api.efipay.com.br
issuer: CN=GlobalSign RSA OV SSL CA 2018,O=GlobalSign nv-sa,C=BE
using HTTP/1.1
> POST /oauth/token HTTP/1.1
Host: pix.api.efipay.com.br
api-sdk: efi-php-1.8.0
User-Agent: GuzzleHttp/7
Content-Type: application/json
Authorization: Basic Q2xpZW50X0lkXzcwMWE0OGU2ZWExMDM0ODk5NjAxNTIzY2VmZjY5ZTZlM2M4OGVjMDA6Q2xpZW50X1NlY3JldF9hMDYyZmU5OWE0NjhmYjViZjIzZmE0YzgwMTUyZDFlM2RhNWIzNjFj
Content-Length: 35

Empty reply from server
Closing connection

# pix
Avatar discord do usuario ronaldo_pertec

ronaldo_pertec

Ver no Discord

Agora estou recebendo a seguinte mensagem:
processing: https://pix.api.efipay.com.br/oauth/token
Trying 35.170.124.249:443...
Connected to pix.api.efipay.com.br (35.170.124.249) port 443
CAfile: none
CApath: none
ALPN: offers http/1.1
NSS: client certificate from file
subject: C=BR,CN=301970
start date: May 02 14:50:05 2024 GMT
expire date: May 02 14:50:05 2027 GMT
common name: 301970
issuer: [email protected],CN=apis.efipay.com.br,OU=Infraestrutura,O=Efi S.A. - Instituicao de Pagamento,ST=Minas Gerais,C=BR
ALPN: server accepted http/1.1
SSL connection using TLS_AES_256_GCM_SHA384
Server certificate:
subject: CN=.api.efipay.com.br,O=EFI S.A. - INSTITUICAO DE PAGAMENTO,L=OURO PRETO,ST=MINAS GERAIS,C=BR
start date: May 17 19:31:27 2023 GMT
expire date: Jun 17 19:31:26 2024 GMT
common name: .api.efipay.com.br
issuer: CN=GlobalSign RSA OV SSL CA 2018,O=GlobalSign nv-sa,C=BE
using HTTP/1.1
> POST /oauth/token HTTP/1.1
Host: pix.api.efipay.com.br
api-sdk: efi-php-1.8.0
User-Agent: GuzzleHttp/7
Content-Type: application/json
Authorization: Basic Q2xpZW50X0lkXzcwMWE0OGU2ZWExMDM0ODk5NjAxNTIzY2VmZjY5ZTZlM2M4OGVjMDA6Q2xpZW50X1NlY3JldF9hMDYyZmU5OWE0NjhmYjViZjIzZmE0YzgwMTUyZDFlM2RhNWIzNjFj
Content-Length: 35

Empty reply from server
Closing connection

# pix
Avatar discord do usuario ronaldo_pertec

ronaldo_pertec

Ver RespostasVer no Discord

processing: https://pix.api.efipay.com.br/oauth/token
Trying 52.5.41.74:443...
Connected to pix.api.efipay.com.br (52.5.41.74) port 443
CAfile: none
CApath: none
ALPN: offers http/1.1
NSS: client certificate from file
subject: C=BR,CN=301970
start date: May 02 14:50:05 2024 GMT
expire date: May 02 14:50:05 2027 GMT
common name: 301970
issuer: [email protected],CN=apis.efipay.com.br,OU=Infraestrutura,O=Efi S.A. - Instituicao de Pagamento,ST=Minas Gerais,C=BR
NSS error -8191 (SEC_ERROR_LIBRARY_FAILURE)
security library failure.
Closing connection