@@ -285,7 +285,7 @@ var constants = {
285
285
method : 'get'
286
286
} ,
287
287
pixSend : {
288
- route : '/v2 /gn/pix/:idEnvio' ,
288
+ route : '/v3 /gn/pix/:idEnvio' ,
289
289
method : 'put'
290
290
} ,
291
291
pixSendDetail : {
@@ -495,6 +495,10 @@ var constants = {
495
495
ofDevolutionRecurrencyPix : {
496
496
route : '/pagamentos-recorrentes/pix/:identificadorPagamento/devolver' ,
497
497
method : 'post'
498
+ } ,
499
+ ofReplaceRecurrencyPixParcel : {
500
+ route : '/pagamentos-recorrentes/pix/:identificadorPagamento/substituir/:endToEndId' ,
501
+ method : 'patch'
498
502
}
499
503
}
500
504
} ,
@@ -579,7 +583,7 @@ var exports$1 = {
579
583
}
580
584
} ;
581
585
var description = "Module for integration with Efi Bank API" ;
582
- var version = "1.2.3 " ;
586
+ var version = "1.2.4 " ;
583
587
var deprecated = "Este pacote será descontinuado. Use o 'sdk-node-apis-efi' no lugar." ;
584
588
var author = "Efi Bank - Consultoria Técnica | João Vitor Oliveira | João Lucas" ;
585
589
var license = "MIT" ;
@@ -694,14 +698,14 @@ class Endpoints {
694
698
}
695
699
} catch ( error ) {
696
700
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 } `) ;
698
702
} 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 } `) ;
700
704
}
701
705
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` ) ;
703
707
} 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` ) ;
705
709
}
706
710
}
707
711
}
@@ -737,7 +741,18 @@ class Endpoints {
737
741
return res . data ;
738
742
} ) . catch ( error => {
739
743
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
+ }
741
756
} else {
742
757
switch ( this . baseUrl ) {
743
758
case this . constants . APIS . DEFAULT . URL . PRODUCTION :
@@ -888,7 +903,7 @@ class CobrancasMethods {
888
903
* shippings?: Array<{
889
904
* name: string,
890
905
* value: number,
891
- * payee_code: string
906
+ * payee_code? : string
892
907
* }>,
893
908
* metadata?: {
894
909
* custom_id?: string,
@@ -1027,7 +1042,7 @@ class CobrancasMethods {
1027
1042
* shippings?: Array<{
1028
1043
* name: string,
1029
1044
* value: number,
1030
- * payee_code: string
1045
+ * payee_code? : string
1031
1046
* }>,
1032
1047
* metadata?: {
1033
1048
* custom_id?: string,
@@ -1304,8 +1319,8 @@ class CobrancasMethods {
1304
1319
* begin_date: string,
1305
1320
* end_date: string,
1306
1321
* 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 ',
1309
1324
* customer_document?: string,
1310
1325
* custom_id?: string,
1311
1326
* value?: number,
@@ -1316,105 +1331,60 @@ class CobrancasMethods {
1316
1331
*
1317
1332
* @returns {Promise<{
1318
1333
* code: number,
1319
- * data: Arrat <{
1320
- * charge_id : number,
1334
+ * data: Array <{
1335
+ * id : number,
1321
1336
* total: number,
1322
1337
* status: string,
1323
- * reason?: string,
1324
1338
* custom_id: string | null,
1325
1339
* 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
1356
1346
* },
1357
1347
* 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?: {
1362
1355
* barcode: string,
1363
- * pix?: {
1364
- * qrcode: string,
1365
- * qrcode_image: string
1366
- * },
1367
1356
* link: string,
1357
+ * expire_at: string
1368
1358
* pdf: {
1369
1359
* 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
1385
1360
* }
1386
1361
* },
1387
1362
* carnet?: {
1388
1363
* parcel: number,
1389
1364
* 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
- * },
1399
1365
* expire_at: string,
1400
- * configurations?: {
1401
- * days_to_write_off?: number,
1366
+ * link: string,
1367
+ * configurations: {
1368
+ * days_to_write_off: number,
1402
1369
* interest_type?: 'monthly' | 'daily',
1403
- * interest? : number,
1404
- * fine? : number
1370
+ * interest: number,
1371
+ * fine: number
1405
1372
* }
1373
+ * pdf: {
1374
+ * charge: string
1375
+ * },
1406
1376
* }
1407
1377
* },
1408
1378
* link?: {
1409
1379
* billet_discount: number | null,
1410
1380
* card_discount: number | null,
1411
1381
* conditional_discount_value: number | null,
1412
- * conditional_discount_type: string | null,
1382
+ * conditional_discount_type: 'percentage' | 'currency' | null,
1413
1383
* conditional_discount_date: string | null,
1414
1384
* message: string | null,
1415
1385
* expire_at: string,
1416
1386
* request_delivery_address: boolean,
1417
- * payment_method: string ,
1387
+ * payment_method: 'banking_billet' | 'credit_card' | 'all' ,
1418
1388
* payment_url: string
1419
1389
* }
1420
1390
* }>
@@ -2093,7 +2063,7 @@ class CobrancasMethods {
2093
2063
* shippings?: Array<{
2094
2064
* name: string,
2095
2065
* value: number,
2096
- * payee_code: string
2066
+ * payee_code? : string
2097
2067
* }>,
2098
2068
* metadata?: {
2099
2069
* custom_id?: string,
@@ -2229,7 +2199,7 @@ class CobrancasMethods {
2229
2199
* shippings?: Array<{
2230
2200
* name: string,
2231
2201
* value: number,
2232
- * payee_code: string
2202
+ * payee_code? : string
2233
2203
* }>,
2234
2204
* metadata?: {
2235
2205
* custom_id?: string,
@@ -2438,7 +2408,7 @@ class CobrancasMethods {
2438
2408
* shippings?: Array<{
2439
2409
* name: string,
2440
2410
* value: number,
2441
- * payee_code: string
2411
+ * payee_code? : string
2442
2412
* }>,
2443
2413
* metadata?: {
2444
2414
* custom_id?: string,
@@ -3486,7 +3456,7 @@ class PixMethods extends CobrancasMethods {
3486
3456
pixListDueCharges ( params ) { }
3487
3457
3488
3458
/**
3489
- * **PUT /v2 /gn/pix/:idEnvio**
3459
+ * **PUT /v3 /gn/pix/:idEnvio**
3490
3460
*
3491
3461
* Realiza o envio de Pix.
3492
3462
*
@@ -4895,7 +4865,9 @@ class OpenFinanceMethods extends PixMethods {
4895
4865
*
4896
4866
* @param { {
4897
4867
* nome?: string,
4898
- * organizacao?: boolean
4868
+ * organizacao?: boolean,
4869
+ * modalidade?: 'imediato' | 'recorrente' | 'agendado',
4870
+ * tipoPessoa?: 'PJ' | 'PF'
4899
4871
* } } params
4900
4872
*
4901
4873
* @returns { Promise<{
@@ -5244,7 +5216,7 @@ class OpenFinanceMethods extends PixMethods {
5244
5216
/**
5245
5217
* **PATCH /v1/pagamentos-recorrentes/pix/:identificadorPagamento/cancelar**
5246
5218
*
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.
5248
5220
*
5249
5221
* Para capturar uma falha utilize o `catch`, os campos disponíveis no objeto serão `nome` e `mensagem`.
5250
5222
*
@@ -5265,7 +5237,7 @@ class OpenFinanceMethods extends PixMethods {
5265
5237
/**
5266
5238
* **POST /v1/pagamentos-recorrentes/pix/:identificadorPagamento/devolver**
5267
5239
*
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.
5269
5241
*
5270
5242
* Para capturar uma falha utilize o `catch`, os campos disponíveis no objeto serão `nome` e `mensagem`.
5271
5243
*
@@ -5284,6 +5256,28 @@ class OpenFinanceMethods extends PixMethods {
5284
5256
* }>>}
5285
5257
*/
5286
5258
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 ) { }
5287
5281
}
5288
5282
5289
5283
// @ts -nocheck
@@ -5683,9 +5677,7 @@ class EfiPay extends AllMethods {
5683
5677
constructor ( options ) {
5684
5678
super ( ) ;
5685
5679
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.' ) ;
5689
5681
options . certificate = options . pix_cert ;
5690
5682
}
5691
5683
let methods = { } ;
0 commit comments