@@ -579,7 +579,7 @@ var exports$1 = {
579
579
}
580
580
} ;
581
581
var description = "Module for integration with Efi Bank API" ;
582
- var version = "1.2.2 " ;
582
+ var version = "1.2.3 " ;
583
583
var author = "Efi Bank - Consultoria Técnica | João Vitor Oliveira | João Lucas" ;
584
584
var license = "MIT" ;
585
585
var repository = "efipay/sdk-node-apis-efi" ;
@@ -692,14 +692,14 @@ class Endpoints {
692
692
}
693
693
} catch ( error ) {
694
694
if ( this . options . pemKey && ( this . options . cert_base64 === undefined || this . options . cert_base64 === false ) ) {
695
- 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 } `;
695
+ 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 } `) ;
696
696
} else if ( this . options . cert_base64 === undefined || this . options . cert_base64 === false ) {
697
- throw `FALHA AO LER O CERTIFICADO, VERIFIQUE O CAMINHO INFORMADO : ${ this . options . certificate } `;
697
+ console . error ( `Falha ao ler o certificado, verifique o caminho informado : ${ this . options . certificate } `) ;
698
698
}
699
699
if ( this . options . pemKey && this . options . cert_base64 === true ) {
700
- throw `FALHA AO LER O CERTIFICADO OU A CHAVE, VERIFIQUE O CONTEÚDO INFORMADO DO CERTIFICADO E DA CHAVE` ;
700
+ console . error ( `Falha ao ler o certificado ou a chave, verifique o conteúdo informado do certificado e da chave` ) ;
701
701
} else if ( this . options . cert_base64 === true ) {
702
- throw `FALHA AO LER O CERTIFICADO, VERIFIQUE O CONTEÚDO INFORMADO` ;
702
+ console . error ( `Falha ao ler o certificado, verifique o conteúdo informado` ) ;
703
703
}
704
704
}
705
705
}
@@ -735,7 +735,18 @@ class Endpoints {
735
735
return res . data ;
736
736
} ) . catch ( error => {
737
737
if ( this . authError ) {
738
- throw this . authError . response . data ;
738
+ const error = this . authError ?. response ?. data || this . authError ?. cause || this . authError ;
739
+ switch ( error . message ) {
740
+ case 'socket hang up' :
741
+ throw 'Verifique o atributo sandbox e certificate, e garanta que eles estejam corretamente atribuidos para o ambiente desejado' ;
742
+ case 'header too long' :
743
+ throw 'Verifique se o certificado foi enviado no formato correto' ;
744
+ case 'wrong tag' :
745
+ case 'error:0909006C:PEM routines:get_name:no start line' :
746
+ throw 'Foi enviando um certificado .pem porém não foi enviado o atributo pemKey corretamente, tente enviar o mesmo valor para ambos' ;
747
+ default :
748
+ throw error ;
749
+ }
739
750
} else {
740
751
switch ( this . baseUrl ) {
741
752
case this . constants . APIS . DEFAULT . URL . PRODUCTION :
@@ -886,7 +897,7 @@ class CobrancasMethods {
886
897
* shippings?: Array<{
887
898
* name: string,
888
899
* value: number,
889
- * payee_code: string
900
+ * payee_code? : string
890
901
* }>,
891
902
* metadata?: {
892
903
* custom_id?: string,
@@ -1025,7 +1036,7 @@ class CobrancasMethods {
1025
1036
* shippings?: Array<{
1026
1037
* name: string,
1027
1038
* value: number,
1028
- * payee_code: string
1039
+ * payee_code? : string
1029
1040
* }>,
1030
1041
* metadata?: {
1031
1042
* custom_id?: string,
@@ -1302,8 +1313,8 @@ class CobrancasMethods {
1302
1313
* begin_date: string,
1303
1314
* end_date: string,
1304
1315
* charge_type: 'billet' | 'card' | 'carnet' | 'subscription',
1305
- * status?: 'new' | 'waiting' | 'link' | 'paid' | 'unpaid' | 'canceled' | 'identified',
1306
- * date_of?: 'creation' | 'payment' | 'due ',
1316
+ * status?: 'new' | 'waiting' | 'link' | 'paid' | 'unpaid' | 'canceled' | 'identified' | 'settled'
1317
+ * date_of?: 'creation' | 'payment' | 'expired ',
1307
1318
* customer_document?: string,
1308
1319
* custom_id?: string,
1309
1320
* value?: number,
@@ -1315,104 +1326,59 @@ class CobrancasMethods {
1315
1326
* @returns {Promise<{
1316
1327
* code: number,
1317
1328
* data: Arrat<{
1318
- * charge_id : number,
1329
+ * id : number,
1319
1330
* total: number,
1320
1331
* status: string,
1321
- * reason?: string,
1322
1332
* custom_id: string | null,
1323
1333
* created_at: string,
1324
- * notification_url: string | null,
1325
- * items: Array<{
1326
- * name: string,
1327
- * value: number,
1328
- * amount: number
1329
- * }>,
1330
- * shippings?: Array<{
1331
- * name: string,
1332
- * value: number,
1333
- * payee_code: string
1334
- * }>,
1335
- * history: Array<{
1336
- * message: string,
1337
- * created_at: string
1338
- * }>,
1339
- * customer?: {
1340
- * name: string | null,
1341
- * cpf: string | null,
1342
- * birth?: string,
1343
- * email?: string,
1344
- * phone_number?: string,
1345
- * address?: {
1346
- * street: string,
1347
- * number: string,
1348
- * complement: string | null,
1349
- * neighborhood: string,
1350
- * city: string,
1351
- * state: string,
1352
- * zipcode: string
1353
- * }
1334
+ * customer: {
1335
+ * phone_number: string | null,
1336
+ * cnpj?: string,
1337
+ * cpf?: string
1338
+ * name?: string
1339
+ * corporate_name?: string
1354
1340
* },
1355
1341
* payment?: {
1356
- * method: string,
1357
- * created_at: string,
1358
- * message: string | null,
1359
- * banking_billet?: {
1342
+ * payment_method: string,
1343
+ * paid_at: string | null,
1344
+ * pix?: {
1345
+ * qrcode: string,
1346
+ * qrcode_image: string
1347
+ * }
1348
+ * banking_billet?: {
1360
1349
* barcode: string,
1361
- * pix?: {
1362
- * qrcode: string,
1363
- * qrcode_image: string
1364
- * },
1365
1350
* link: string,
1351
+ * expire_at: string
1366
1352
* pdf: {
1367
1353
* charge: string
1368
- * },
1369
- * expire_at: string
1370
- * },
1371
- * credit_card?: {
1372
- * mask: string,
1373
- * installments: number,
1374
- * installment_value: number,
1375
- * address: {
1376
- * street: string,
1377
- * number: string,
1378
- * complement: string | null,
1379
- * neighborhood: string,
1380
- * city: string,
1381
- * state: string,
1382
- * zipcode: string
1383
1354
* }
1384
1355
* },
1385
1356
* carnet?: {
1386
1357
* parcel: number,
1387
1358
* barcode: string,
1388
- * pix?: {
1389
- * qrcode: string,
1390
- * qrcode_image: string
1391
- * },
1392
- * url: string,
1393
- * parcel_link: string,
1394
- * pdf: {
1395
- * charge: string
1396
- * },
1397
1359
* expire_at: string,
1398
- * configurations?: {
1399
- * days_to_write_off?: number,
1360
+ * link: string,
1361
+ * configurations: {
1362
+ * days_to_write_off: number,
1400
1363
* interest_type?: 'monthly' | 'daily',
1401
- * interest? : number,
1402
- * fine? : number
1364
+ * interest: number,
1365
+ * fine: number
1403
1366
* }
1367
+ * pdf: {
1368
+ * charge: string
1369
+ * },
1404
1370
* }
1405
1371
* },
1406
1372
* link?: {
1407
1373
* billet_discount: number | null,
1408
1374
* card_discount: number | null,
1409
1375
* conditional_discount_value: number | null,
1410
- * conditional_discount_type: string | null,
1376
+ * conditional_discount_type: 'percentage' | 'currency' | null,
1411
1377
* conditional_discount_date: string | null,
1412
1378
* message: string | null,
1413
1379
* expire_at: string,
1414
1380
* request_delivery_address: boolean,
1415
- * payment_method: string ,
1381
+ * payment_method: 'banking_billet' | 'credit_card' | 'all' ,
1416
1382
* payment_url: string
1417
1383
* }
1418
1384
* }>
@@ -2091,7 +2057,7 @@ class CobrancasMethods {
2091
2057
* shippings?: Array<{
2092
2058
* name: string,
2093
2059
* value: number,
2094
- * payee_code: string
2060
+ * payee_code? : string
2095
2061
* }>,
2096
2062
* metadata?: {
2097
2063
* custom_id?: string,
@@ -2227,7 +2193,7 @@ class CobrancasMethods {
2227
2193
* shippings?: Array<{
2228
2194
* name: string,
2229
2195
* value: number,
2230
- * payee_code: string
2196
+ * payee_code? : string
2231
2197
* }>,
2232
2198
* metadata?: {
2233
2199
* custom_id?: string,
@@ -2436,7 +2402,7 @@ class CobrancasMethods {
2436
2402
* shippings?: Array<{
2437
2403
* name: string,
2438
2404
* value: number,
2439
- * payee_code: string
2405
+ * payee_code? : string
2440
2406
* }>,
2441
2407
* metadata?: {
2442
2408
* custom_id?: string,
@@ -4905,7 +4871,9 @@ class OpenFinanceMethods extends PixMethods {
4905
4871
*
4906
4872
* @param { {
4907
4873
* nome?: string,
4908
- * organizacao?: boolean
4874
+ * organizacao?: boolean,
4875
+ * modalidade?: 'imediato' | 'recorrente' | 'agendado',
4876
+ * tipoPessoa?: 'PJ' | 'PF'
4909
4877
* } } params
4910
4878
*
4911
4879
* @returns { Promise<{
@@ -5280,15 +5248,18 @@ class OpenFinanceMethods extends PixMethods {
5280
5248
* Para capturar uma falha utilize o `catch`, os campos disponíveis no objeto serão `nome` e `mensagem`.
5281
5249
*
5282
5250
* @param {{ identificadorPagamento: string } } params
5283
- * @param {{ valor: string } } body
5251
+ * @param {Array<{
5252
+ * endToEndId: string,
5253
+ * valor: string
5254
+ * }>} body
5284
5255
*
5285
- * @returns { Promise<{
5256
+ * @returns { Promise<Array< {
5286
5257
* identificadorPagamento: string,
5287
5258
* endToEndId: string,
5288
5259
* valor: string,
5289
5260
* dataCriacao: string,
5290
5261
* status: string,
5291
- * }>}
5262
+ * }>> }
5292
5263
*/
5293
5264
ofDevolutionRecurrencyPix ( params , body ) { }
5294
5265
}
@@ -5690,9 +5661,7 @@ class EfiPay extends AllMethods {
5690
5661
constructor ( options ) {
5691
5662
super ( ) ;
5692
5663
if ( options . pix_cert ) {
5693
- console . warn ( '' ) ;
5694
- console . warn ( 'O parâmetro "pix_cert" foi preterido, utilize "certificate" no lugar' ) ;
5695
- console . warn ( '' ) ;
5664
+ console . warn ( '⚠️ WARNING:\nO parâmetro "pix_cert" foi preterido, utilize "certificate" no lugar.' ) ;
5696
5665
options . certificate = options . pix_cert ;
5697
5666
}
5698
5667
let methods = { } ;
0 commit comments