@pairus/product-data 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +408 -141
- package/dist/index.d.mts +307 -2
- package/dist/index.d.ts +307 -2
- package/dist/index.js +364 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +362 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -25,6 +25,107 @@ declare class BaseResource {
|
|
|
25
25
|
protected maxRetries: number;
|
|
26
26
|
constructor(apiKey: string, baseUrl: string, timeoutMs: number, maxRetries: number);
|
|
27
27
|
protected request<T>(options: RequestOptions): Promise<T>;
|
|
28
|
+
protected requestText(options: RequestOptions): Promise<string>;
|
|
29
|
+
protected requestBinary(options: RequestOptions): Promise<ArrayBuffer>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Tipos e interfaces para o módulo DF-e Inbound (Captura SEFAZ e Manifestação do Destinatário).
|
|
34
|
+
*/
|
|
35
|
+
type TipoManifestacaoDFe = '210210' | '210200' | '210220' | '210240';
|
|
36
|
+
interface DocumentoDFe {
|
|
37
|
+
chave_acesso: string;
|
|
38
|
+
nsu?: string;
|
|
39
|
+
numero?: number;
|
|
40
|
+
serie?: number;
|
|
41
|
+
cnpj_emitente?: string;
|
|
42
|
+
nome_emitente?: string;
|
|
43
|
+
valor_total?: number;
|
|
44
|
+
data_emissao?: string;
|
|
45
|
+
situacao?: string;
|
|
46
|
+
tipo_documento?: string;
|
|
47
|
+
manifestacao_status?: string;
|
|
48
|
+
tem_xml_completo?: boolean;
|
|
49
|
+
}
|
|
50
|
+
interface SincronizarDFeInput {
|
|
51
|
+
cnpj: string;
|
|
52
|
+
ambiente?: 'producao' | 'homologacao';
|
|
53
|
+
}
|
|
54
|
+
interface SincronizarDFeResponse {
|
|
55
|
+
sucesso: boolean;
|
|
56
|
+
cstat: number;
|
|
57
|
+
xmotivo: string;
|
|
58
|
+
ult_nsu: string;
|
|
59
|
+
max_nsu: string;
|
|
60
|
+
novos_documentos: number;
|
|
61
|
+
mensagem: string;
|
|
62
|
+
documentos: DocumentoDFe[];
|
|
63
|
+
}
|
|
64
|
+
interface ListarDocumentosDFeParams {
|
|
65
|
+
cnpj: string;
|
|
66
|
+
ambiente?: 'producao' | 'homologacao';
|
|
67
|
+
limite?: number;
|
|
68
|
+
}
|
|
69
|
+
interface ListarDocumentosDFeResponse {
|
|
70
|
+
cnpj: string;
|
|
71
|
+
ambiente: string;
|
|
72
|
+
total: number;
|
|
73
|
+
ult_nsu: string;
|
|
74
|
+
max_nsu: string;
|
|
75
|
+
documentos: DocumentoDFe[];
|
|
76
|
+
}
|
|
77
|
+
interface ManifestarDFeInput {
|
|
78
|
+
cnpj: string;
|
|
79
|
+
chave_acesso: string;
|
|
80
|
+
tipo_evento: TipoManifestacaoDFe | string;
|
|
81
|
+
justificativa?: string;
|
|
82
|
+
ambiente?: 'producao' | 'homologacao';
|
|
83
|
+
}
|
|
84
|
+
interface ManifestarDFeResponse {
|
|
85
|
+
sucesso: boolean;
|
|
86
|
+
cstat: number;
|
|
87
|
+
xmotivo: string;
|
|
88
|
+
protocolo?: string;
|
|
89
|
+
tipo_evento?: string;
|
|
90
|
+
detalhes?: Record<string, any>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
declare class DFeResource extends BaseResource {
|
|
94
|
+
/**
|
|
95
|
+
* Dispara busca ativa de notas fiscais emitidas contra o CNPJ na SEFAZ Nacional.
|
|
96
|
+
*
|
|
97
|
+
* @param input Parâmetros de sincronização (CNPJ e ambiente opcional)
|
|
98
|
+
* @returns Resultado da consulta SEFAZ com novos documentos e controle de NSU
|
|
99
|
+
*/
|
|
100
|
+
sincronizar(input: SincronizarDFeInput): Promise<SincronizarDFeResponse>;
|
|
101
|
+
/**
|
|
102
|
+
* Lista notas fiscais de compras emitidas por fornecedores contra a sua empresa.
|
|
103
|
+
*
|
|
104
|
+
* @param params Filtros de busca (CNPJ, ambiente e limite de registros)
|
|
105
|
+
* @returns Lista de documentos fiscais capturados e status de manifestação
|
|
106
|
+
*/
|
|
107
|
+
listarDocumentos(params: ListarDocumentosDFeParams): Promise<ListarDocumentosDFeResponse>;
|
|
108
|
+
/**
|
|
109
|
+
* Registra evento oficial de Manifestação do Destinatário perante o Ambiente Nacional da SEFAZ.
|
|
110
|
+
*
|
|
111
|
+
* @param input Dados do evento ('210210' Ciência, '210200' Confirmação, '210220' Desconhecimento, '210240' Não Realizada)
|
|
112
|
+
* @returns Protocolo de homologação do evento na SEFAZ
|
|
113
|
+
*/
|
|
114
|
+
manifestar(input: ManifestarDFeInput): Promise<ManifestarDFeResponse>;
|
|
115
|
+
/**
|
|
116
|
+
* Baixa o arquivo XML autorizado (procNFe) da nota fiscal capturada.
|
|
117
|
+
*
|
|
118
|
+
* @param chaveAcesso Chave de acesso de 44 dígitos da NF-e
|
|
119
|
+
* @returns Conteúdo do XML em formato string
|
|
120
|
+
*/
|
|
121
|
+
baixarXml(chaveAcesso: string): Promise<string>;
|
|
122
|
+
/**
|
|
123
|
+
* Baixa o DANFE em PDF da nota fiscal de fornecedor.
|
|
124
|
+
*
|
|
125
|
+
* @param chaveAcesso Chave de acesso de 44 dígitos da NF-e
|
|
126
|
+
* @returns ArrayBuffer contendo o PDF binário
|
|
127
|
+
*/
|
|
128
|
+
baixarDanfe(chaveAcesso: string): Promise<ArrayBuffer>;
|
|
28
129
|
}
|
|
29
130
|
|
|
30
131
|
interface EmissaoItemInput {
|
|
@@ -258,12 +359,167 @@ interface TaxPredictionResponse {
|
|
|
258
359
|
dados_tributarios?: TaxPredictionData;
|
|
259
360
|
resultados?: TaxPredictionItemResult[];
|
|
260
361
|
}
|
|
362
|
+
interface FiscalSanitizeItemInput {
|
|
363
|
+
ncm: string;
|
|
364
|
+
cest?: string;
|
|
365
|
+
descricao?: string;
|
|
366
|
+
gtin?: string;
|
|
367
|
+
}
|
|
368
|
+
interface FiscalSanitizeItemResult {
|
|
369
|
+
ncm: string;
|
|
370
|
+
ncm_valido: boolean;
|
|
371
|
+
descricao_ncm?: string;
|
|
372
|
+
cest_informado?: string;
|
|
373
|
+
cest_sugerido?: string;
|
|
374
|
+
sujeito_st: boolean;
|
|
375
|
+
aliquotas_sugeridas?: Record<string, any>;
|
|
376
|
+
avisos?: string[];
|
|
377
|
+
}
|
|
378
|
+
interface FiscalSanitizeResponse {
|
|
379
|
+
status: string;
|
|
380
|
+
provider: string;
|
|
381
|
+
timestamp?: string;
|
|
382
|
+
total_itens: number;
|
|
383
|
+
itens: Array<Record<string, any>>;
|
|
384
|
+
}
|
|
261
385
|
|
|
262
386
|
declare class FiscalResource extends BaseResource {
|
|
263
387
|
/**
|
|
264
388
|
* Executa a predição fiscal completa da Reforma Tributária (IBS/CBS/IS) e NF-e.
|
|
265
389
|
*/
|
|
266
390
|
predict(params: TaxPredictionParams): Promise<TaxPredictionResponse>;
|
|
391
|
+
/**
|
|
392
|
+
* Audita e higieniza uma lista de produtos em lote perante as tabelas fiscais vigentes.
|
|
393
|
+
*/
|
|
394
|
+
sanitize(itens: Array<Record<string, any>>): Promise<any>;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
interface EnderecoNFSeInput {
|
|
398
|
+
logradouro: string;
|
|
399
|
+
numero: string;
|
|
400
|
+
complemento?: string;
|
|
401
|
+
bairro: string;
|
|
402
|
+
codigo_municipio_ibge: string;
|
|
403
|
+
uf: string;
|
|
404
|
+
cep: string;
|
|
405
|
+
}
|
|
406
|
+
interface PrestadorNFSeInput {
|
|
407
|
+
cnpj: string;
|
|
408
|
+
inscricao_municipal: string;
|
|
409
|
+
razao_social: string;
|
|
410
|
+
nome_fantasia?: string;
|
|
411
|
+
optante_simples_nacional?: boolean;
|
|
412
|
+
regime_especial_tributacao?: string;
|
|
413
|
+
endereco?: EnderecoNFSeInput;
|
|
414
|
+
}
|
|
415
|
+
interface TomadorNFSeInput {
|
|
416
|
+
cpf_cnpj: string;
|
|
417
|
+
razao_social: string;
|
|
418
|
+
inscricao_municipal?: string;
|
|
419
|
+
email?: string;
|
|
420
|
+
telefone?: string;
|
|
421
|
+
endereco?: EnderecoNFSeInput;
|
|
422
|
+
}
|
|
423
|
+
interface RetencoesFederaisInput {
|
|
424
|
+
pis_retido?: boolean;
|
|
425
|
+
aliquota_pis?: number;
|
|
426
|
+
valor_pis?: number;
|
|
427
|
+
cofins_retido?: boolean;
|
|
428
|
+
aliquota_cofins?: number;
|
|
429
|
+
valor_cofins?: number;
|
|
430
|
+
csll_retida?: boolean;
|
|
431
|
+
aliquota_csll?: number;
|
|
432
|
+
valor_csll?: number;
|
|
433
|
+
irrf_retido?: boolean;
|
|
434
|
+
aliquota_irrf?: number;
|
|
435
|
+
valor_irrf?: number;
|
|
436
|
+
inss_retido?: boolean;
|
|
437
|
+
aliquota_inss?: number;
|
|
438
|
+
valor_inss?: number;
|
|
439
|
+
}
|
|
440
|
+
interface ServicoNFSeInput {
|
|
441
|
+
item_lista_servico: string;
|
|
442
|
+
discriminacao: string;
|
|
443
|
+
municipio_prestacao_ibge: string;
|
|
444
|
+
valor_servicos: number;
|
|
445
|
+
codigo_cnae?: string;
|
|
446
|
+
codigo_tributacao_municipio?: string;
|
|
447
|
+
valor_deducoes?: number;
|
|
448
|
+
valor_desconto_incondicionado?: number;
|
|
449
|
+
valor_desconto_condicionado?: number;
|
|
450
|
+
iss_retido?: boolean;
|
|
451
|
+
aliquota_iss?: number;
|
|
452
|
+
exigibilidade_iss?: string;
|
|
453
|
+
retencoes_federais?: RetencoesFederaisInput;
|
|
454
|
+
}
|
|
455
|
+
interface NFSeEmissaoInput {
|
|
456
|
+
prestador: PrestadorNFSeInput | Record<string, any>;
|
|
457
|
+
tomador: TomadorNFSeInput | Record<string, any>;
|
|
458
|
+
servico: ServicoNFSeInput | Record<string, any>;
|
|
459
|
+
serie_dps?: string;
|
|
460
|
+
numero_dps?: number;
|
|
461
|
+
modo?: 'direto' | 'assistido' | 'simulacao';
|
|
462
|
+
politica_rejeicao?: 'autocura_silenciosa' | 'autocura_assistida' | 'nenhuma';
|
|
463
|
+
ambiente?: 'producao' | 'homologacao';
|
|
464
|
+
informacoes_complementares?: string;
|
|
465
|
+
webhook_url?: string;
|
|
466
|
+
}
|
|
467
|
+
interface NFSeEmissaoResponse {
|
|
468
|
+
sucesso: boolean;
|
|
469
|
+
status: 'autorizada' | 'rejeitada' | 'cancelada' | 'simulada';
|
|
470
|
+
numero_nfse?: string;
|
|
471
|
+
codigo_verificacao?: string;
|
|
472
|
+
chave_acesso_nacional?: string;
|
|
473
|
+
data_emissao?: string;
|
|
474
|
+
link_visualizacao?: string;
|
|
475
|
+
danfse_pdf_base64?: string;
|
|
476
|
+
xml_nfse?: string;
|
|
477
|
+
valor_servicos: number;
|
|
478
|
+
valor_iss: number;
|
|
479
|
+
valor_iss_retido: number;
|
|
480
|
+
total_retencoes_federais: number;
|
|
481
|
+
valor_liquido: number;
|
|
482
|
+
erros?: string[];
|
|
483
|
+
alertas?: string[];
|
|
484
|
+
trilha_auditoria?: Record<string, any>[];
|
|
485
|
+
creditos_cobrados: number;
|
|
486
|
+
tempo_processamento_ms: number;
|
|
487
|
+
}
|
|
488
|
+
interface CancelamentoNFSeInput {
|
|
489
|
+
numero_nfse: string;
|
|
490
|
+
cnpj_prestador: string;
|
|
491
|
+
inscricao_municipal: string;
|
|
492
|
+
codigo_municipio_ibge: string;
|
|
493
|
+
justificativa: string;
|
|
494
|
+
motivo_codigo?: string;
|
|
495
|
+
codigo_verificacao?: string;
|
|
496
|
+
chave_acesso_nacional?: string;
|
|
497
|
+
}
|
|
498
|
+
interface CancelamentoNFSeResponse {
|
|
499
|
+
sucesso: boolean;
|
|
500
|
+
numero_nfse: string;
|
|
501
|
+
data_cancelamento?: string;
|
|
502
|
+
mensagem: string;
|
|
503
|
+
erros?: string[];
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
declare class NFSeResource extends BaseResource {
|
|
507
|
+
/**
|
|
508
|
+
* Emite uma Nota Fiscal de Serviços Eletrônica (NFS-e) perante o SND ou prefeitura.
|
|
509
|
+
*/
|
|
510
|
+
emitir(payload: NFSeEmissaoInput | Record<string, any>): Promise<NFSeEmissaoResponse>;
|
|
511
|
+
/**
|
|
512
|
+
* Simula o cálculo de NFS-e com retenções e apuração tributária (custo ZERO de créditos).
|
|
513
|
+
*/
|
|
514
|
+
simular(payload: NFSeEmissaoInput | Record<string, any>): Promise<NFSeEmissaoResponse>;
|
|
515
|
+
/**
|
|
516
|
+
* Homologa o cancelamento oficial de uma NFS-e perante o SND ou prefeitura.
|
|
517
|
+
*/
|
|
518
|
+
cancelar(payload: CancelamentoNFSeInput): Promise<CancelamentoNFSeResponse>;
|
|
519
|
+
/**
|
|
520
|
+
* Consulta os dados, status e DANFSE de uma NFS-e pelo número ou chave de 50 dígitos.
|
|
521
|
+
*/
|
|
522
|
+
consultar(chaveOuNumero: string): Promise<Record<string, any>>;
|
|
267
523
|
}
|
|
268
524
|
|
|
269
525
|
interface ProductDetails {
|
|
@@ -287,13 +543,60 @@ interface ProductResponse {
|
|
|
287
543
|
produto?: ProductDetails;
|
|
288
544
|
raw_data?: Record<string, any>;
|
|
289
545
|
}
|
|
546
|
+
interface ProductSearchResultItem {
|
|
547
|
+
gtin: string;
|
|
548
|
+
xProd: string;
|
|
549
|
+
marca?: string;
|
|
550
|
+
categoria?: string;
|
|
551
|
+
score?: number;
|
|
552
|
+
ncm?: string;
|
|
553
|
+
cest?: string;
|
|
554
|
+
imagem_url?: string;
|
|
555
|
+
}
|
|
556
|
+
interface ProductSearchResponse {
|
|
557
|
+
status: string;
|
|
558
|
+
provider: string;
|
|
559
|
+
total_encontrados: number;
|
|
560
|
+
termo_buscado: string;
|
|
561
|
+
produtos: ProductSearchResultItem[];
|
|
562
|
+
}
|
|
563
|
+
interface ProductEnrichedDetails {
|
|
564
|
+
gtin: string;
|
|
565
|
+
xProd: string;
|
|
566
|
+
descricao_completa?: string;
|
|
567
|
+
ficha_tecnica?: Record<string, any>;
|
|
568
|
+
palavras_chave?: string[];
|
|
569
|
+
ncm?: string;
|
|
570
|
+
cest?: string;
|
|
571
|
+
marca?: string;
|
|
572
|
+
categoria?: string;
|
|
573
|
+
imagem_url?: string;
|
|
574
|
+
peso_bruto?: number;
|
|
575
|
+
peso_liquido?: number;
|
|
576
|
+
dados_tributarios_sugeridos?: Record<string, any>;
|
|
577
|
+
}
|
|
290
578
|
|
|
291
579
|
declare class ProductsResource extends BaseResource {
|
|
292
580
|
/**
|
|
293
|
-
* Consulta um produto por código de barras GTIN/EAN.
|
|
581
|
+
* Consulta dados oficiais de um produto por código de barras GTIN/EAN (V1).
|
|
294
582
|
* @param gtin Código numérico de 8 a 14 dígitos.
|
|
295
583
|
*/
|
|
296
584
|
get(gtin: string): Promise<ProductDetails>;
|
|
585
|
+
/**
|
|
586
|
+
* Consulta dados enriquecidos por IA, com SEO e ficha técnica estruturada (V2).
|
|
587
|
+
* @param gtin Código numérico do produto.
|
|
588
|
+
*/
|
|
589
|
+
getEnriched(gtin: string): Promise<ProductEnrichedDetails>;
|
|
590
|
+
/**
|
|
591
|
+
* Executa busca semântica por intenção/linguagem natural (V2).
|
|
592
|
+
* @param query Termo livre de busca (ex: 'refrigerante zero lata').
|
|
593
|
+
*/
|
|
594
|
+
search(query: string): Promise<ProductSearchResponse>;
|
|
595
|
+
/**
|
|
596
|
+
* Reconhece código de barras por visão computacional a partir de foto JPEG (OCR V2).
|
|
597
|
+
* @param file Blob, Buffer ou FormData com a imagem JPEG.
|
|
598
|
+
*/
|
|
599
|
+
scan(file: Blob | Buffer | FormData): Promise<ProductEnrichedDetails>;
|
|
297
600
|
}
|
|
298
601
|
|
|
299
602
|
interface WebhookEvent<T = Record<string, any>> {
|
|
@@ -324,6 +627,8 @@ declare class PairusProductData {
|
|
|
324
627
|
readonly products: ProductsResource;
|
|
325
628
|
readonly fiscal: FiscalResource;
|
|
326
629
|
readonly emissao: EmissaoResource;
|
|
630
|
+
readonly nfse: NFSeResource;
|
|
631
|
+
readonly dfe: DFeResource;
|
|
327
632
|
constructor(options?: PairusClientOptions);
|
|
328
633
|
}
|
|
329
634
|
|
|
@@ -354,4 +659,4 @@ declare class NetworkError extends PairusError {
|
|
|
354
659
|
constructor(message: string);
|
|
355
660
|
}
|
|
356
661
|
|
|
357
|
-
export { AuthenticationError, type CancelamentoInput, type CartaCorrecaoInput, DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT_MS, type DetalheAutocura, type EmissaoDestinatarioInput, type EmissaoItemInput, type EmissaoNFeInput, type EmissaoNFeResponse, EmissaoResource, type EventoNFeResponse, FiscalResource, type FuelData, type IBSCBSData, type InutilizacaoInput, InvalidSignatureError, NetworkError, PairusAPIError, type PairusClientOptions, PairusError, PairusProductData, type ProductDetails, type ProductResponse, ProductsResource, RateLimitError, type SelectiveTaxData, type TaxPredictionData, type TaxPredictionItemInput, type TaxPredictionItemResult, type TaxPredictionParams, type TaxPredictionResponse, type WebhookEvent, Webhooks };
|
|
662
|
+
export { AuthenticationError, type CancelamentoInput, type CancelamentoNFSeInput, type CancelamentoNFSeResponse, type CartaCorrecaoInput, DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT_MS, DFeResource, type DetalheAutocura, type DocumentoDFe, type EmissaoDestinatarioInput, type EmissaoItemInput, type EmissaoNFeInput, type EmissaoNFeResponse, EmissaoResource, type EnderecoNFSeInput, type EventoNFeResponse, FiscalResource, type FiscalSanitizeItemInput, type FiscalSanitizeItemResult, type FiscalSanitizeResponse, type FuelData, type IBSCBSData, type InutilizacaoInput, InvalidSignatureError, type ListarDocumentosDFeParams, type ListarDocumentosDFeResponse, type ManifestarDFeInput, type ManifestarDFeResponse, type NFSeEmissaoInput, type NFSeEmissaoResponse, NFSeResource, NetworkError, PairusAPIError, type PairusClientOptions, PairusError, PairusProductData, type PrestadorNFSeInput, type ProductDetails, type ProductEnrichedDetails, type ProductResponse, type ProductSearchResponse, type ProductSearchResultItem, ProductsResource, RateLimitError, type RetencoesFederaisInput, type SelectiveTaxData, type ServicoNFSeInput, type SincronizarDFeInput, type SincronizarDFeResponse, type TaxPredictionData, type TaxPredictionItemInput, type TaxPredictionItemResult, type TaxPredictionParams, type TaxPredictionResponse, type TipoManifestacaoDFe, type TomadorNFSeInput, type WebhookEvent, Webhooks };
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,107 @@ declare class BaseResource {
|
|
|
25
25
|
protected maxRetries: number;
|
|
26
26
|
constructor(apiKey: string, baseUrl: string, timeoutMs: number, maxRetries: number);
|
|
27
27
|
protected request<T>(options: RequestOptions): Promise<T>;
|
|
28
|
+
protected requestText(options: RequestOptions): Promise<string>;
|
|
29
|
+
protected requestBinary(options: RequestOptions): Promise<ArrayBuffer>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Tipos e interfaces para o módulo DF-e Inbound (Captura SEFAZ e Manifestação do Destinatário).
|
|
34
|
+
*/
|
|
35
|
+
type TipoManifestacaoDFe = '210210' | '210200' | '210220' | '210240';
|
|
36
|
+
interface DocumentoDFe {
|
|
37
|
+
chave_acesso: string;
|
|
38
|
+
nsu?: string;
|
|
39
|
+
numero?: number;
|
|
40
|
+
serie?: number;
|
|
41
|
+
cnpj_emitente?: string;
|
|
42
|
+
nome_emitente?: string;
|
|
43
|
+
valor_total?: number;
|
|
44
|
+
data_emissao?: string;
|
|
45
|
+
situacao?: string;
|
|
46
|
+
tipo_documento?: string;
|
|
47
|
+
manifestacao_status?: string;
|
|
48
|
+
tem_xml_completo?: boolean;
|
|
49
|
+
}
|
|
50
|
+
interface SincronizarDFeInput {
|
|
51
|
+
cnpj: string;
|
|
52
|
+
ambiente?: 'producao' | 'homologacao';
|
|
53
|
+
}
|
|
54
|
+
interface SincronizarDFeResponse {
|
|
55
|
+
sucesso: boolean;
|
|
56
|
+
cstat: number;
|
|
57
|
+
xmotivo: string;
|
|
58
|
+
ult_nsu: string;
|
|
59
|
+
max_nsu: string;
|
|
60
|
+
novos_documentos: number;
|
|
61
|
+
mensagem: string;
|
|
62
|
+
documentos: DocumentoDFe[];
|
|
63
|
+
}
|
|
64
|
+
interface ListarDocumentosDFeParams {
|
|
65
|
+
cnpj: string;
|
|
66
|
+
ambiente?: 'producao' | 'homologacao';
|
|
67
|
+
limite?: number;
|
|
68
|
+
}
|
|
69
|
+
interface ListarDocumentosDFeResponse {
|
|
70
|
+
cnpj: string;
|
|
71
|
+
ambiente: string;
|
|
72
|
+
total: number;
|
|
73
|
+
ult_nsu: string;
|
|
74
|
+
max_nsu: string;
|
|
75
|
+
documentos: DocumentoDFe[];
|
|
76
|
+
}
|
|
77
|
+
interface ManifestarDFeInput {
|
|
78
|
+
cnpj: string;
|
|
79
|
+
chave_acesso: string;
|
|
80
|
+
tipo_evento: TipoManifestacaoDFe | string;
|
|
81
|
+
justificativa?: string;
|
|
82
|
+
ambiente?: 'producao' | 'homologacao';
|
|
83
|
+
}
|
|
84
|
+
interface ManifestarDFeResponse {
|
|
85
|
+
sucesso: boolean;
|
|
86
|
+
cstat: number;
|
|
87
|
+
xmotivo: string;
|
|
88
|
+
protocolo?: string;
|
|
89
|
+
tipo_evento?: string;
|
|
90
|
+
detalhes?: Record<string, any>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
declare class DFeResource extends BaseResource {
|
|
94
|
+
/**
|
|
95
|
+
* Dispara busca ativa de notas fiscais emitidas contra o CNPJ na SEFAZ Nacional.
|
|
96
|
+
*
|
|
97
|
+
* @param input Parâmetros de sincronização (CNPJ e ambiente opcional)
|
|
98
|
+
* @returns Resultado da consulta SEFAZ com novos documentos e controle de NSU
|
|
99
|
+
*/
|
|
100
|
+
sincronizar(input: SincronizarDFeInput): Promise<SincronizarDFeResponse>;
|
|
101
|
+
/**
|
|
102
|
+
* Lista notas fiscais de compras emitidas por fornecedores contra a sua empresa.
|
|
103
|
+
*
|
|
104
|
+
* @param params Filtros de busca (CNPJ, ambiente e limite de registros)
|
|
105
|
+
* @returns Lista de documentos fiscais capturados e status de manifestação
|
|
106
|
+
*/
|
|
107
|
+
listarDocumentos(params: ListarDocumentosDFeParams): Promise<ListarDocumentosDFeResponse>;
|
|
108
|
+
/**
|
|
109
|
+
* Registra evento oficial de Manifestação do Destinatário perante o Ambiente Nacional da SEFAZ.
|
|
110
|
+
*
|
|
111
|
+
* @param input Dados do evento ('210210' Ciência, '210200' Confirmação, '210220' Desconhecimento, '210240' Não Realizada)
|
|
112
|
+
* @returns Protocolo de homologação do evento na SEFAZ
|
|
113
|
+
*/
|
|
114
|
+
manifestar(input: ManifestarDFeInput): Promise<ManifestarDFeResponse>;
|
|
115
|
+
/**
|
|
116
|
+
* Baixa o arquivo XML autorizado (procNFe) da nota fiscal capturada.
|
|
117
|
+
*
|
|
118
|
+
* @param chaveAcesso Chave de acesso de 44 dígitos da NF-e
|
|
119
|
+
* @returns Conteúdo do XML em formato string
|
|
120
|
+
*/
|
|
121
|
+
baixarXml(chaveAcesso: string): Promise<string>;
|
|
122
|
+
/**
|
|
123
|
+
* Baixa o DANFE em PDF da nota fiscal de fornecedor.
|
|
124
|
+
*
|
|
125
|
+
* @param chaveAcesso Chave de acesso de 44 dígitos da NF-e
|
|
126
|
+
* @returns ArrayBuffer contendo o PDF binário
|
|
127
|
+
*/
|
|
128
|
+
baixarDanfe(chaveAcesso: string): Promise<ArrayBuffer>;
|
|
28
129
|
}
|
|
29
130
|
|
|
30
131
|
interface EmissaoItemInput {
|
|
@@ -258,12 +359,167 @@ interface TaxPredictionResponse {
|
|
|
258
359
|
dados_tributarios?: TaxPredictionData;
|
|
259
360
|
resultados?: TaxPredictionItemResult[];
|
|
260
361
|
}
|
|
362
|
+
interface FiscalSanitizeItemInput {
|
|
363
|
+
ncm: string;
|
|
364
|
+
cest?: string;
|
|
365
|
+
descricao?: string;
|
|
366
|
+
gtin?: string;
|
|
367
|
+
}
|
|
368
|
+
interface FiscalSanitizeItemResult {
|
|
369
|
+
ncm: string;
|
|
370
|
+
ncm_valido: boolean;
|
|
371
|
+
descricao_ncm?: string;
|
|
372
|
+
cest_informado?: string;
|
|
373
|
+
cest_sugerido?: string;
|
|
374
|
+
sujeito_st: boolean;
|
|
375
|
+
aliquotas_sugeridas?: Record<string, any>;
|
|
376
|
+
avisos?: string[];
|
|
377
|
+
}
|
|
378
|
+
interface FiscalSanitizeResponse {
|
|
379
|
+
status: string;
|
|
380
|
+
provider: string;
|
|
381
|
+
timestamp?: string;
|
|
382
|
+
total_itens: number;
|
|
383
|
+
itens: Array<Record<string, any>>;
|
|
384
|
+
}
|
|
261
385
|
|
|
262
386
|
declare class FiscalResource extends BaseResource {
|
|
263
387
|
/**
|
|
264
388
|
* Executa a predição fiscal completa da Reforma Tributária (IBS/CBS/IS) e NF-e.
|
|
265
389
|
*/
|
|
266
390
|
predict(params: TaxPredictionParams): Promise<TaxPredictionResponse>;
|
|
391
|
+
/**
|
|
392
|
+
* Audita e higieniza uma lista de produtos em lote perante as tabelas fiscais vigentes.
|
|
393
|
+
*/
|
|
394
|
+
sanitize(itens: Array<Record<string, any>>): Promise<any>;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
interface EnderecoNFSeInput {
|
|
398
|
+
logradouro: string;
|
|
399
|
+
numero: string;
|
|
400
|
+
complemento?: string;
|
|
401
|
+
bairro: string;
|
|
402
|
+
codigo_municipio_ibge: string;
|
|
403
|
+
uf: string;
|
|
404
|
+
cep: string;
|
|
405
|
+
}
|
|
406
|
+
interface PrestadorNFSeInput {
|
|
407
|
+
cnpj: string;
|
|
408
|
+
inscricao_municipal: string;
|
|
409
|
+
razao_social: string;
|
|
410
|
+
nome_fantasia?: string;
|
|
411
|
+
optante_simples_nacional?: boolean;
|
|
412
|
+
regime_especial_tributacao?: string;
|
|
413
|
+
endereco?: EnderecoNFSeInput;
|
|
414
|
+
}
|
|
415
|
+
interface TomadorNFSeInput {
|
|
416
|
+
cpf_cnpj: string;
|
|
417
|
+
razao_social: string;
|
|
418
|
+
inscricao_municipal?: string;
|
|
419
|
+
email?: string;
|
|
420
|
+
telefone?: string;
|
|
421
|
+
endereco?: EnderecoNFSeInput;
|
|
422
|
+
}
|
|
423
|
+
interface RetencoesFederaisInput {
|
|
424
|
+
pis_retido?: boolean;
|
|
425
|
+
aliquota_pis?: number;
|
|
426
|
+
valor_pis?: number;
|
|
427
|
+
cofins_retido?: boolean;
|
|
428
|
+
aliquota_cofins?: number;
|
|
429
|
+
valor_cofins?: number;
|
|
430
|
+
csll_retida?: boolean;
|
|
431
|
+
aliquota_csll?: number;
|
|
432
|
+
valor_csll?: number;
|
|
433
|
+
irrf_retido?: boolean;
|
|
434
|
+
aliquota_irrf?: number;
|
|
435
|
+
valor_irrf?: number;
|
|
436
|
+
inss_retido?: boolean;
|
|
437
|
+
aliquota_inss?: number;
|
|
438
|
+
valor_inss?: number;
|
|
439
|
+
}
|
|
440
|
+
interface ServicoNFSeInput {
|
|
441
|
+
item_lista_servico: string;
|
|
442
|
+
discriminacao: string;
|
|
443
|
+
municipio_prestacao_ibge: string;
|
|
444
|
+
valor_servicos: number;
|
|
445
|
+
codigo_cnae?: string;
|
|
446
|
+
codigo_tributacao_municipio?: string;
|
|
447
|
+
valor_deducoes?: number;
|
|
448
|
+
valor_desconto_incondicionado?: number;
|
|
449
|
+
valor_desconto_condicionado?: number;
|
|
450
|
+
iss_retido?: boolean;
|
|
451
|
+
aliquota_iss?: number;
|
|
452
|
+
exigibilidade_iss?: string;
|
|
453
|
+
retencoes_federais?: RetencoesFederaisInput;
|
|
454
|
+
}
|
|
455
|
+
interface NFSeEmissaoInput {
|
|
456
|
+
prestador: PrestadorNFSeInput | Record<string, any>;
|
|
457
|
+
tomador: TomadorNFSeInput | Record<string, any>;
|
|
458
|
+
servico: ServicoNFSeInput | Record<string, any>;
|
|
459
|
+
serie_dps?: string;
|
|
460
|
+
numero_dps?: number;
|
|
461
|
+
modo?: 'direto' | 'assistido' | 'simulacao';
|
|
462
|
+
politica_rejeicao?: 'autocura_silenciosa' | 'autocura_assistida' | 'nenhuma';
|
|
463
|
+
ambiente?: 'producao' | 'homologacao';
|
|
464
|
+
informacoes_complementares?: string;
|
|
465
|
+
webhook_url?: string;
|
|
466
|
+
}
|
|
467
|
+
interface NFSeEmissaoResponse {
|
|
468
|
+
sucesso: boolean;
|
|
469
|
+
status: 'autorizada' | 'rejeitada' | 'cancelada' | 'simulada';
|
|
470
|
+
numero_nfse?: string;
|
|
471
|
+
codigo_verificacao?: string;
|
|
472
|
+
chave_acesso_nacional?: string;
|
|
473
|
+
data_emissao?: string;
|
|
474
|
+
link_visualizacao?: string;
|
|
475
|
+
danfse_pdf_base64?: string;
|
|
476
|
+
xml_nfse?: string;
|
|
477
|
+
valor_servicos: number;
|
|
478
|
+
valor_iss: number;
|
|
479
|
+
valor_iss_retido: number;
|
|
480
|
+
total_retencoes_federais: number;
|
|
481
|
+
valor_liquido: number;
|
|
482
|
+
erros?: string[];
|
|
483
|
+
alertas?: string[];
|
|
484
|
+
trilha_auditoria?: Record<string, any>[];
|
|
485
|
+
creditos_cobrados: number;
|
|
486
|
+
tempo_processamento_ms: number;
|
|
487
|
+
}
|
|
488
|
+
interface CancelamentoNFSeInput {
|
|
489
|
+
numero_nfse: string;
|
|
490
|
+
cnpj_prestador: string;
|
|
491
|
+
inscricao_municipal: string;
|
|
492
|
+
codigo_municipio_ibge: string;
|
|
493
|
+
justificativa: string;
|
|
494
|
+
motivo_codigo?: string;
|
|
495
|
+
codigo_verificacao?: string;
|
|
496
|
+
chave_acesso_nacional?: string;
|
|
497
|
+
}
|
|
498
|
+
interface CancelamentoNFSeResponse {
|
|
499
|
+
sucesso: boolean;
|
|
500
|
+
numero_nfse: string;
|
|
501
|
+
data_cancelamento?: string;
|
|
502
|
+
mensagem: string;
|
|
503
|
+
erros?: string[];
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
declare class NFSeResource extends BaseResource {
|
|
507
|
+
/**
|
|
508
|
+
* Emite uma Nota Fiscal de Serviços Eletrônica (NFS-e) perante o SND ou prefeitura.
|
|
509
|
+
*/
|
|
510
|
+
emitir(payload: NFSeEmissaoInput | Record<string, any>): Promise<NFSeEmissaoResponse>;
|
|
511
|
+
/**
|
|
512
|
+
* Simula o cálculo de NFS-e com retenções e apuração tributária (custo ZERO de créditos).
|
|
513
|
+
*/
|
|
514
|
+
simular(payload: NFSeEmissaoInput | Record<string, any>): Promise<NFSeEmissaoResponse>;
|
|
515
|
+
/**
|
|
516
|
+
* Homologa o cancelamento oficial de uma NFS-e perante o SND ou prefeitura.
|
|
517
|
+
*/
|
|
518
|
+
cancelar(payload: CancelamentoNFSeInput): Promise<CancelamentoNFSeResponse>;
|
|
519
|
+
/**
|
|
520
|
+
* Consulta os dados, status e DANFSE de uma NFS-e pelo número ou chave de 50 dígitos.
|
|
521
|
+
*/
|
|
522
|
+
consultar(chaveOuNumero: string): Promise<Record<string, any>>;
|
|
267
523
|
}
|
|
268
524
|
|
|
269
525
|
interface ProductDetails {
|
|
@@ -287,13 +543,60 @@ interface ProductResponse {
|
|
|
287
543
|
produto?: ProductDetails;
|
|
288
544
|
raw_data?: Record<string, any>;
|
|
289
545
|
}
|
|
546
|
+
interface ProductSearchResultItem {
|
|
547
|
+
gtin: string;
|
|
548
|
+
xProd: string;
|
|
549
|
+
marca?: string;
|
|
550
|
+
categoria?: string;
|
|
551
|
+
score?: number;
|
|
552
|
+
ncm?: string;
|
|
553
|
+
cest?: string;
|
|
554
|
+
imagem_url?: string;
|
|
555
|
+
}
|
|
556
|
+
interface ProductSearchResponse {
|
|
557
|
+
status: string;
|
|
558
|
+
provider: string;
|
|
559
|
+
total_encontrados: number;
|
|
560
|
+
termo_buscado: string;
|
|
561
|
+
produtos: ProductSearchResultItem[];
|
|
562
|
+
}
|
|
563
|
+
interface ProductEnrichedDetails {
|
|
564
|
+
gtin: string;
|
|
565
|
+
xProd: string;
|
|
566
|
+
descricao_completa?: string;
|
|
567
|
+
ficha_tecnica?: Record<string, any>;
|
|
568
|
+
palavras_chave?: string[];
|
|
569
|
+
ncm?: string;
|
|
570
|
+
cest?: string;
|
|
571
|
+
marca?: string;
|
|
572
|
+
categoria?: string;
|
|
573
|
+
imagem_url?: string;
|
|
574
|
+
peso_bruto?: number;
|
|
575
|
+
peso_liquido?: number;
|
|
576
|
+
dados_tributarios_sugeridos?: Record<string, any>;
|
|
577
|
+
}
|
|
290
578
|
|
|
291
579
|
declare class ProductsResource extends BaseResource {
|
|
292
580
|
/**
|
|
293
|
-
* Consulta um produto por código de barras GTIN/EAN.
|
|
581
|
+
* Consulta dados oficiais de um produto por código de barras GTIN/EAN (V1).
|
|
294
582
|
* @param gtin Código numérico de 8 a 14 dígitos.
|
|
295
583
|
*/
|
|
296
584
|
get(gtin: string): Promise<ProductDetails>;
|
|
585
|
+
/**
|
|
586
|
+
* Consulta dados enriquecidos por IA, com SEO e ficha técnica estruturada (V2).
|
|
587
|
+
* @param gtin Código numérico do produto.
|
|
588
|
+
*/
|
|
589
|
+
getEnriched(gtin: string): Promise<ProductEnrichedDetails>;
|
|
590
|
+
/**
|
|
591
|
+
* Executa busca semântica por intenção/linguagem natural (V2).
|
|
592
|
+
* @param query Termo livre de busca (ex: 'refrigerante zero lata').
|
|
593
|
+
*/
|
|
594
|
+
search(query: string): Promise<ProductSearchResponse>;
|
|
595
|
+
/**
|
|
596
|
+
* Reconhece código de barras por visão computacional a partir de foto JPEG (OCR V2).
|
|
597
|
+
* @param file Blob, Buffer ou FormData com a imagem JPEG.
|
|
598
|
+
*/
|
|
599
|
+
scan(file: Blob | Buffer | FormData): Promise<ProductEnrichedDetails>;
|
|
297
600
|
}
|
|
298
601
|
|
|
299
602
|
interface WebhookEvent<T = Record<string, any>> {
|
|
@@ -324,6 +627,8 @@ declare class PairusProductData {
|
|
|
324
627
|
readonly products: ProductsResource;
|
|
325
628
|
readonly fiscal: FiscalResource;
|
|
326
629
|
readonly emissao: EmissaoResource;
|
|
630
|
+
readonly nfse: NFSeResource;
|
|
631
|
+
readonly dfe: DFeResource;
|
|
327
632
|
constructor(options?: PairusClientOptions);
|
|
328
633
|
}
|
|
329
634
|
|
|
@@ -354,4 +659,4 @@ declare class NetworkError extends PairusError {
|
|
|
354
659
|
constructor(message: string);
|
|
355
660
|
}
|
|
356
661
|
|
|
357
|
-
export { AuthenticationError, type CancelamentoInput, type CartaCorrecaoInput, DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT_MS, type DetalheAutocura, type EmissaoDestinatarioInput, type EmissaoItemInput, type EmissaoNFeInput, type EmissaoNFeResponse, EmissaoResource, type EventoNFeResponse, FiscalResource, type FuelData, type IBSCBSData, type InutilizacaoInput, InvalidSignatureError, NetworkError, PairusAPIError, type PairusClientOptions, PairusError, PairusProductData, type ProductDetails, type ProductResponse, ProductsResource, RateLimitError, type SelectiveTaxData, type TaxPredictionData, type TaxPredictionItemInput, type TaxPredictionItemResult, type TaxPredictionParams, type TaxPredictionResponse, type WebhookEvent, Webhooks };
|
|
662
|
+
export { AuthenticationError, type CancelamentoInput, type CancelamentoNFSeInput, type CancelamentoNFSeResponse, type CartaCorrecaoInput, DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT_MS, DFeResource, type DetalheAutocura, type DocumentoDFe, type EmissaoDestinatarioInput, type EmissaoItemInput, type EmissaoNFeInput, type EmissaoNFeResponse, EmissaoResource, type EnderecoNFSeInput, type EventoNFeResponse, FiscalResource, type FiscalSanitizeItemInput, type FiscalSanitizeItemResult, type FiscalSanitizeResponse, type FuelData, type IBSCBSData, type InutilizacaoInput, InvalidSignatureError, type ListarDocumentosDFeParams, type ListarDocumentosDFeResponse, type ManifestarDFeInput, type ManifestarDFeResponse, type NFSeEmissaoInput, type NFSeEmissaoResponse, NFSeResource, NetworkError, PairusAPIError, type PairusClientOptions, PairusError, PairusProductData, type PrestadorNFSeInput, type ProductDetails, type ProductEnrichedDetails, type ProductResponse, type ProductSearchResponse, type ProductSearchResultItem, ProductsResource, RateLimitError, type RetencoesFederaisInput, type SelectiveTaxData, type ServicoNFSeInput, type SincronizarDFeInput, type SincronizarDFeResponse, type TaxPredictionData, type TaxPredictionItemInput, type TaxPredictionItemResult, type TaxPredictionParams, type TaxPredictionResponse, type TipoManifestacaoDFe, type TomadorNFSeInput, type WebhookEvent, Webhooks };
|