Skip to content

Commit dc78cc3

Browse files
Release 1.2.4
1 parent 46d4345 commit dc78cc3

File tree

15 files changed

+416
-468
lines changed

15 files changed

+416
-468
lines changed

dist/cjs/index.cjs

Lines changed: 84 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ var constants = {
285285
method: 'get'
286286
},
287287
pixSend: {
288-
route: '/v2/gn/pix/:idEnvio',
288+
route: '/v3/gn/pix/:idEnvio',
289289
method: 'put'
290290
},
291291
pixSendDetail: {
@@ -495,6 +495,10 @@ var constants = {
495495
ofDevolutionRecurrencyPix: {
496496
route: '/pagamentos-recorrentes/pix/:identificadorPagamento/devolver',
497497
method: 'post'
498+
},
499+
ofReplaceRecurrencyPixParcel: {
500+
route: '/pagamentos-recorrentes/pix/:identificadorPagamento/substituir/:endToEndId',
501+
method: 'patch'
498502
}
499503
}
500504
},
@@ -579,7 +583,7 @@ var exports$1 = {
579583
}
580584
};
581585
var description = "Module for integration with Efi Bank API";
582-
var version = "1.2.3";
586+
var version = "1.2.4";
583587
var deprecated = "Este pacote será descontinuado. Use o 'sdk-node-apis-efi' no lugar.";
584588
var author = "Efi Bank - Consultoria Técnica | João Vitor Oliveira | João Lucas";
585589
var license = "MIT";
@@ -694,14 +698,14 @@ class Endpoints {
694698
}
695699
} catch (error) {
696700
if (this.options.pemKey && (this.options.cert_base64 === undefined || this.options.cert_base64 === false)) {
697-
throw `FALHA AO LER O CERTIFICADO OU A CHAVE, VERIFIQUE O CAMINHO INFORMADO:\n CAMINHO DO CERTIFICADO: ${this.options.certificate} \n CAMINHO DA CHAVE: ${this.options.pemKey}`;
701+
console.error(`Falha ao ler o certificado ou a chave, verifique o caminho informado:\nCaminho do certificado: ${this.options.certificate}\nCaminho da chave: ${this.options.pemKey}`);
698702
} else if (this.options.cert_base64 === undefined || this.options.cert_base64 === false) {
699-
throw `FALHA AO LER O CERTIFICADO, VERIFIQUE O CAMINHO INFORMADO: ${this.options.certificate}`;
703+
console.error(`Falha ao ler o certificado, verifique o caminho informado: ${this.options.certificate}`);
700704
}
701705
if (this.options.pemKey && this.options.cert_base64 === true) {
702-
throw `FALHA AO LER O CERTIFICADO OU A CHAVE, VERIFIQUE O CONTEÚDO INFORMADO DO CERTIFICADO E DA CHAVE`;
706+
console.error(`Falha ao ler o certificado ou a chave, verifique o conteúdo informado do certificado e da chave`);
703707
} else if (this.options.cert_base64 === true) {
704-
throw `FALHA AO LER O CERTIFICADO, VERIFIQUE O CONTEÚDO INFORMADO`;
708+
console.error(`Falha ao ler o certificado, verifique o conteúdo informado`);
705709
}
706710
}
707711
}
@@ -737,7 +741,18 @@ class Endpoints {
737741
return res.data;
738742
}).catch(error => {
739743
if (this.authError) {
740-
throw this.authError.response.data;
744+
const error = this.authError?.response?.data || this.authError?.cause || this.authError;
745+
switch (error.message) {
746+
case 'socket hang up':
747+
throw 'Verifique o atributo sandbox e certificate, e garanta que eles estejam corretamente atribuidos para o ambiente desejado';
748+
case 'header too long':
749+
throw 'Verifique se o certificado foi enviado no formato correto';
750+
case 'wrong tag':
751+
case 'error:0909006C:PEM routines:get_name:no start line':
752+
throw 'Foi enviando um certificado .pem porém não foi enviado o atributo pemKey corretamente, tente enviar o mesmo valor para ambos';
753+
default:
754+
throw error;
755+
}
741756
} else {
742757
switch (this.baseUrl) {
743758
case this.constants.APIS.DEFAULT.URL.PRODUCTION:
@@ -888,7 +903,7 @@ class CobrancasMethods {
888903
* shippings?: Array<{
889904
* name: string,
890905
* value: number,
891-
* payee_code: string
906+
* payee_code?: string
892907
* }>,
893908
* metadata?: {
894909
* custom_id?: string,
@@ -1027,7 +1042,7 @@ class CobrancasMethods {
10271042
* shippings?: Array<{
10281043
* name: string,
10291044
* value: number,
1030-
* payee_code: string
1045+
* payee_code?: string
10311046
* }>,
10321047
* metadata?: {
10331048
* custom_id?: string,
@@ -1304,8 +1319,8 @@ class CobrancasMethods {
13041319
* begin_date: string,
13051320
* end_date: string,
13061321
* charge_type: 'billet' | 'card' | 'carnet' | 'subscription',
1307-
* status?: 'new' | 'waiting' | 'link' | 'paid' | 'unpaid' | 'canceled' | 'identified',
1308-
* date_of?: 'creation' | 'payment' | 'due',
1322+
* status?: 'new' | 'waiting' | 'link' | 'paid' | 'unpaid' | 'canceled' | 'identified' | 'settled'
1323+
* date_of?: 'creation' | 'payment' | 'expired',
13091324
* customer_document?: string,
13101325
* custom_id?: string,
13111326
* value?: number,
@@ -1316,105 +1331,60 @@ class CobrancasMethods {
13161331
*
13171332
* @returns {Promise<{
13181333
* code: number,
1319-
* data: Arrat<{
1320-
* charge_id: number,
1334+
* data: Array<{
1335+
* id: number,
13211336
* total: number,
13221337
* status: string,
1323-
* reason?: string,
13241338
* custom_id: string | null,
13251339
* created_at: string,
1326-
* notification_url: string | null,
1327-
* items: Array<{
1328-
* name: string,
1329-
* value: number,
1330-
* amount: number
1331-
* }>,
1332-
* shippings?: Array<{
1333-
* name: string,
1334-
* value: number,
1335-
* payee_code: string
1336-
* }>,
1337-
* history: Array<{
1338-
* message: string,
1339-
* created_at: string
1340-
* }>,
1341-
* customer?: {
1342-
* name: string | null,
1343-
* cpf: string | null,
1344-
* birth?: string,
1345-
* email?: string,
1346-
* phone_number?: string,
1347-
* address?: {
1348-
* street: string,
1349-
* number: string,
1350-
* complement: string | null,
1351-
* neighborhood: string,
1352-
* city: string,
1353-
* state: string,
1354-
* zipcode: string
1355-
* }
1340+
* customer: {
1341+
* phone_number: string | null,
1342+
* cnpj?: string,
1343+
* cpf?: string
1344+
* name?: string
1345+
* corporate_name?: string
13561346
* },
13571347
* payment?: {
1358-
* method: string,
1359-
* created_at: string,
1360-
* message: string | null,
1361-
* banking_billet?: {
1348+
* payment_method: string,
1349+
* paid_at: string | null,
1350+
* pix?: {
1351+
* qrcode: string,
1352+
* qrcode_image: string
1353+
* }
1354+
* banking_billet?: {
13621355
* barcode: string,
1363-
* pix?: {
1364-
* qrcode: string,
1365-
* qrcode_image: string
1366-
* },
13671356
* link: string,
1357+
* expire_at: string
13681358
* pdf: {
13691359
* charge: string
1370-
* },
1371-
* expire_at: string
1372-
* },
1373-
* credit_card?: {
1374-
* mask: string,
1375-
* installments: number,
1376-
* installment_value: number,
1377-
* address: {
1378-
* street: string,
1379-
* number: string,
1380-
* complement: string | null,
1381-
* neighborhood: string,
1382-
* city: string,
1383-
* state: string,
1384-
* zipcode: string
13851360
* }
13861361
* },
13871362
* carnet?: {
13881363
* parcel: number,
13891364
* barcode: string,
1390-
* pix?: {
1391-
* qrcode: string,
1392-
* qrcode_image: string
1393-
* },
1394-
* url: string,
1395-
* parcel_link: string,
1396-
* pdf: {
1397-
* charge: string
1398-
* },
13991365
* expire_at: string,
1400-
* configurations?: {
1401-
* days_to_write_off?: number,
1366+
* link: string,
1367+
* configurations: {
1368+
* days_to_write_off: number,
14021369
* interest_type?: 'monthly' | 'daily',
1403-
* interest?: number,
1404-
* fine?: number
1370+
* interest: number,
1371+
* fine: number
14051372
* }
1373+
* pdf: {
1374+
* charge: string
1375+
* },
14061376
* }
14071377
* },
14081378
* link?: {
14091379
* billet_discount: number | null,
14101380
* card_discount: number | null,
14111381
* conditional_discount_value: number | null,
1412-
* conditional_discount_type: string | null,
1382+
* conditional_discount_type: 'percentage' | 'currency' | null,
14131383
* conditional_discount_date: string | null,
14141384
* message: string | null,
14151385
* expire_at: string,
14161386
* request_delivery_address: boolean,
1417-
* payment_method: string,
1387+
* payment_method: 'banking_billet' | 'credit_card' | 'all',
14181388
* payment_url: string
14191389
* }
14201390
* }>
@@ -2093,7 +2063,7 @@ class CobrancasMethods {
20932063
* shippings?: Array<{
20942064
* name: string,
20952065
* value: number,
2096-
* payee_code: string
2066+
* payee_code?: string
20972067
* }>,
20982068
* metadata?: {
20992069
* custom_id?: string,
@@ -2229,7 +2199,7 @@ class CobrancasMethods {
22292199
* shippings?: Array<{
22302200
* name: string,
22312201
* value: number,
2232-
* payee_code: string
2202+
* payee_code?: string
22332203
* }>,
22342204
* metadata?: {
22352205
* custom_id?: string,
@@ -2438,7 +2408,7 @@ class CobrancasMethods {
24382408
* shippings?: Array<{
24392409
* name: string,
24402410
* value: number,
2441-
* payee_code: string
2411+
* payee_code?: string
24422412
* }>,
24432413
* metadata?: {
24442414
* custom_id?: string,
@@ -3486,7 +3456,7 @@ class PixMethods extends CobrancasMethods {
34863456
pixListDueCharges(params) {}
34873457

34883458
/**
3489-
* **PUT /v2/gn/pix/:idEnvio**
3459+
* **PUT /v3/gn/pix/:idEnvio**
34903460
*
34913461
* Realiza o envio de Pix.
34923462
*
@@ -4895,7 +4865,9 @@ class OpenFinanceMethods extends PixMethods {
48954865
*
48964866
* @param { {
48974867
* nome?: string,
4898-
* organizacao?: boolean
4868+
* organizacao?: boolean,
4869+
* modalidade?: 'imediato' | 'recorrente' | 'agendado',
4870+
* tipoPessoa?: 'PJ' | 'PF'
48994871
* } } params
49004872
*
49014873
* @returns { Promise<{
@@ -5244,7 +5216,7 @@ class OpenFinanceMethods extends PixMethods {
52445216
/**
52455217
* **PATCH /v1/pagamentos-recorrentes/pix/:identificadorPagamento/cancelar**
52465218
*
5247-
* Cancelar um pagamento recorrente
5219+
* Este endpoint é utilizado para cancelar um pagamento recorrente. Deve receber como entrada um identificadorPagamento ou EndToEndId válido no parametro.
52485220
*
52495221
* Para capturar uma falha utilize o `catch`, os campos disponíveis no objeto serão `nome` e `mensagem`.
52505222
*
@@ -5265,7 +5237,7 @@ class OpenFinanceMethods extends PixMethods {
52655237
/**
52665238
* **POST /v1/pagamentos-recorrentes/pix/:identificadorPagamento/devolver**
52675239
*
5268-
* Efetuar uma devolução de um pagamento recorrente
5240+
* Este endpoint é utilizado para realizar a devolução de um pagamento recorrente. Deve receber como entrada um endToEndId válido e o valor a ser devolvido no corpo da requisição.
52695241
*
52705242
* Para capturar uma falha utilize o `catch`, os campos disponíveis no objeto serão `nome` e `mensagem`.
52715243
*
@@ -5284,6 +5256,28 @@ class OpenFinanceMethods extends PixMethods {
52845256
* }>>}
52855257
*/
52865258
ofDevolutionRecurrencyPix(params, body) {}
5259+
5260+
/**
5261+
* **PATCH /v1/pagamentos-recorrentes/pix/:identificadorPagamento/substituir/:endToEndId**
5262+
*
5263+
* Este endpoint é uma ferramenta para substituição de parcelas para pagamentos recorrentes. Este endpoint deve receber um identificadorPagamento e um endToEndId válido como parâmetros. Também é possivel informar o campo valor no body da requisição para especificar um valor para a nova parcela, se não informado o sistema entende que a nova parcela terá o mesmo valor da pacela anterior.
5264+
*
5265+
* Para capturar uma falha utilize o `catch`, os campos disponíveis no objeto serão `nome` e `mensagem`.
5266+
*
5267+
* @param {{
5268+
* identificadorPagamento: string
5269+
* endToEndId: string
5270+
* }} params
5271+
* @param {{
5272+
* valor: string
5273+
* }} body
5274+
*
5275+
* @returns { Promise<{
5276+
* identificadorPagamento: string,
5277+
* redirectURI: string,
5278+
* }>}
5279+
*/
5280+
ofReplaceRecurrencyPixParcel(params, body) {}
52875281
}
52885282

52895283
// @ts-nocheck
@@ -5683,9 +5677,7 @@ class EfiPay extends AllMethods {
56835677
constructor(options) {
56845678
super();
56855679
if (options.pix_cert) {
5686-
console.warn('');
5687-
console.warn('O parâmetro "pix_cert" foi preterido, utilize "certificate" no lugar');
5688-
console.warn('');
5680+
console.warn('⚠️ WARNING:\nO parâmetro "pix_cert" foi preterido, utilize "certificate" no lugar.');
56895681
options.certificate = options.pix_cert;
56905682
}
56915683
let methods = {};

0 commit comments

Comments
 (0)