Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat webservice NFeDistribuicaoDFe #38

Merged
merged 14 commits into from
Jan 27, 2025

Conversation

CayoPOliveira
Copy link
Contributor

@CayoPOliveira CayoPOliveira commented Jan 24, 2025

This change is Reviewable

Summary by CodeRabbit

  • Novos Recursos

    • Adicionado suporte para distribuição de Documentos Fiscais Eletrônicos (DFe).
    • Implementada nova funcionalidade de consulta de documentos fiscais por diferentes métodos.
  • Testes

    • Criada nova suíte de testes para validar a funcionalidade de distribuição de DFe.
    • Adicionados testes para garantir o comportamento correto do método de distribuição, incluindo validações para CPF e CNPJ inválidos.
  • Melhorias de Tipo

    • Introduzidas novas definições de tipo para melhorar a segurança e clareza da API de distribuição de documentos fiscais.

Copy link

coderabbitai bot commented Jan 24, 2025

Walkthrough

As alterações introduzem suporte para o serviço de Distribuição de Documentos Fiscais Eletrônicos (DFe) no sistema. Foram adicionados novos tipos e um método distribuicaoDfe na classe NfeWebServices, permitindo consultas por NSU, chave de NFe ou distribuição de documentos fiscais. A implementação inclui validações de entrada, construção de operações e processamento de respostas do serviço web, com um teste correspondente para validar o comportamento do novo método.

Changes

Arquivo Resumo das Alterações
src/dfe/nfe/webServices/index.ts - Novo método distribuicaoDfe adicionado
- Novos tipos importados para distribuição de DFe
src/dfe/nfe/webServices/requests/distribuicaoDfe.ts - Adicionados tipos para operações de distribuição de DFe
- Definições de tipos para requisições e respostas do serviço
src/dfe/nfe/webServices/index.test.ts - Novo conjunto de testes para o método distribuicaoDfe
- Teste de caso de sucesso para verificar resposta do serviço
- Testes para validar erros de CPF e CNPJ

Possibly related PRs

Suggested labels

approved for merge

Suggested reviewers

  • gabrieljablonski
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@CayoPOliveira CayoPOliveira added enhancement New feature or request review needed Ready for review labels Jan 24, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (4)
src/dfe/nfe/webServices/requests/distribuicaoDfe.ts (3)

12-28: Abrangência e legibilidade da definição de tipo
A união de três variantes (distNSU, consNSU e consChNFe) em um tipo único (NfeDistribuicaoDfeOperation) é clara e garante flexibilidade. Contudo, avalie se há necessidade de padronizar o nome das propriedades, por exemplo “consChaveNFe” em vez de “consChNFe”, para manter consistência sem abreviações excessivas.


65-79: Documentação refinada para propriedades opcionais
A interface NfeDistribuicaoDfeResponseRaw cobre campos opcionais como ultNSU e maxNSU, além de loteDistDFeInt. Considere incluir exemplos breves no JSDoc de como cada propriedade opcional aparece numa resposta real, aumentando a clareza para futuros integradores.


80-83: Adição de valores status
Os valores possíveis para NfeDistribuicaoDfeStatus são adequados, mas se for previsto algum cenário futuro (p.ex. “emitente-nao-encontrado”), avalie a escalabilidade da enum.

src/dfe/nfe/webServices/index.test.ts (1)

418-454: Cobertura de teste apropriada
O teste para distribuicaoDfe está bem estruturado, simulando a requisição e validando o processamento do XML. Entretanto, considere adicionar um teste adicional para tratar cenários de erro (por exemplo, se o serviço retornar cStat desconhecido ou se o XML vier malformado) a fim de ampliar a cobertura de falhas.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe26b6f and cc969e3.

⛔ Files ignored due to path filters (1)
  • src/dfe/nfe/webServices/__snapshots__/index.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (3)
  • src/dfe/nfe/webServices/index.test.ts (1 hunks)
  • src/dfe/nfe/webServices/index.ts (2 hunks)
  • src/dfe/nfe/webServices/requests/distribuicaoDfe.ts (1 hunks)
🔇 Additional comments (4)
src/dfe/nfe/webServices/requests/distribuicaoDfe.ts (3)

38-38: Validação extra de combinações possíveis
Ao unir CpfOrCnpj e NfeDistribuicaoDfeOperation, se o uso simultâneo de CPF/CNPJ com cada operação for complexo, considere adicionar um refinamento interno ou docstring que esclareça a combinação correta. Dessa forma, quem chama o método terá um fluxo de uso mais intuitivo.


40-49: Coerência no tipo de requisição
O tipo NfeDistribuicaoDfeRequest segue a mesma estrutura aplicada em outros serviços, mantendo a consistência. A inclusão de tpAmb e cUFAutor dentro de distDFeInt está de acordo com a especificação. Não há problemas aparentes.


84-87: Uso consistente de tipos genéricos
NfeDistribuicaoDfeResponse segue o padrão de respostas do webservice, reaproveitando NfeWebServiceResponse. Bom uso de genéricos para vincular status e o tipo cru (NfeDistribuicaoDfeResponseRaw).

src/dfe/nfe/webServices/index.ts (1)

70-77: Importações novas e consistência de nomenclatura
A importação das novas definições em distribuicaoDfe.ts segue o padrão das demais. Sem problemas identificados na ordem e nomenclatura.

Comment on lines 509 to 564

async distribuicaoDfe({
CPF,
CNPJ,
distNSU,
consNSU,
consChNFe,
}: NfeDistribuicaoDfeOptions): Promise<NfeDistribuicaoDfeResponse> {
let cpfOrCnpj: CpfOrCnpj;
if (CPF) {
// TODO: Validar resto do input.
zCustom.cpf().parse(CPF);
cpfOrCnpj = { CPF };
} else {
zCustom.cnpj().parse(CNPJ);
cpfOrCnpj = { CNPJ } as CpfOrCnpj;
}

let operation: NfeDistribuicaoDfeOperation;
if (distNSU) {
operation = { distNSU };
} else if (consNSU) {
operation = { consNSU };
} else if (consChNFe) {
operation = { consChNFe };
}

const { retDistDFeInt } = await this.request<
NfeDistribuicaoDfeRequest,
{ retDistDFeInt: NfeDistribuicaoDfeResponseRaw }
>(this.getUrl("NFeDistribuicaoDFe"), {
timeout: this.timeout,
body: {
"@_xmlns":
"http://www.portalfiscal.inf.br/nfe/wsdl/NFeConsultaProtocolo4",
distDFeInt: {
...this.xmlNamespace,
"@_versao": "4.00",
tpAmb: this.tpAmb,
cUFAutor: this.cUF,
...cpfOrCnpj,
...operation,
},
},
});

const statusMap: Record<string, NfeDistribuicaoDfeStatus> = {
"137": "nenhum-documento-localizado",
"138": "documento-localizado",
};
return {
status: statusMap[retDistDFeInt.cStat] ?? "outro",
description: retDistDFeInt.xMotivo ?? "",
raw: retDistDFeInt,
};
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Validação adicional e tratamento de erro
A introdução de distribuicaoDfe está bem alinhada com os serviços existentes. Há alguns pontos de melhoria:

  1. A validação com zCustom para CPF/CNPJ é adequada, mas considere validar também campos como distNSU, consNSU e consChNFe (e.g., se o NSU é numérico).
  2. Caso falte operação no objeto (nem distNSU, nem consNSU, nem consChNFe), avalie lançar um erro explícito para evitar requisições inválidas.
  3. Alguns cenários de erro, como interrupções no parsing de resposta, podem ser cobertos por testes específicos, garantindo robustez.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cc969e3 and bb9a162.

📒 Files selected for processing (1)
  • src/dfe/nfe/webServices/index.ts (2 hunks)
🔇 Additional comments (3)
src/dfe/nfe/webServices/index.ts (3)

70-77: LGTM!

As importações dos novos tipos estão bem organizadas e seguem o padrão existente no arquivo.


519-520: Implementar validação pendente conforme TODO.

O comentário TODO indica que há validações pendentes para os demais campos de entrada. Considere validar também os campos numéricos como distNSU, consNSU e consChNFe.


527-534: ⚠️ Potential issue

Adicionar validação para operação obrigatória.

A lógica atual não valida se pelo menos uma das operações (distNSU, consNSU ou consChNFe) foi fornecida. Isso pode resultar em uma requisição inválida se nenhuma operação for especificada.

Sugestão de implementação:

    let operation: NfeDistribuicaoDfeOperation;
    if (distNSU) {
      operation = { distNSU };
    } else if (consNSU) {
      operation = { consNSU };
    } else {
+     if (!consChNFe) {
+       throw new Error(
+         "É necessário fornecer uma das operações: distNSU, consNSU ou consChNFe"
+       );
+     }
      operation = { consChNFe };
    }

Likely invalid or redundant comment.

Comment on lines 510 to 564
async distribuicaoDfe({
CPF,
CNPJ,
distNSU,
consNSU,
consChNFe,
}: NfeDistribuicaoDfeOptions): Promise<NfeDistribuicaoDfeResponse> {
let cpfOrCnpj: CpfOrCnpj;
if (CPF) {
// TODO: Validar resto do input.
zCustom.cpf().parse(CPF);
cpfOrCnpj = { CPF };
} else {
zCustom.cnpj().parse(CNPJ);
cpfOrCnpj = { CNPJ } as CpfOrCnpj;
}

let operation: NfeDistribuicaoDfeOperation;
if (distNSU) {
operation = { distNSU };
} else if (consNSU) {
operation = { consNSU };
} else {
operation = { consChNFe };
}

const { retDistDFeInt } = await this.request<
NfeDistribuicaoDfeRequest,
{ retDistDFeInt: NfeDistribuicaoDfeResponseRaw }
>(this.getUrl("NFeDistribuicaoDFe"), {
timeout: this.timeout,
body: {
"@_xmlns":
"http://www.portalfiscal.inf.br/nfe/wsdl/NFeConsultaProtocolo4",
distDFeInt: {
...this.xmlNamespace,
"@_versao": "4.00",
tpAmb: this.tpAmb,
cUFAutor: this.cUF,
...cpfOrCnpj,
...operation,
},
},
});

const statusMap: Record<string, NfeDistribuicaoDfeStatus> = {
"137": "nenhum-documento-localizado",
"138": "documento-localizado",
};
return {
status: statusMap[retDistDFeInt.cStat] ?? "outro",
description: retDistDFeInt.xMotivo ?? "",
raw: retDistDFeInt,
};
}
Copy link

@coderabbitai coderabbitai bot Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Adicionar documentação JSDoc ao método.

O método carece de documentação JSDoc, que é importante para manter o padrão de documentação da classe e facilitar o uso da API.

Sugestão de implementação:

  /**
   * @description Consulta documentos fiscais eletrônicos através do serviço de distribuição DFe.
   *
   * @param {NfeDistribuicaoDfeOptions} options - Opções para a consulta.
   *
   * @returns {Promise<NfeDistribuicaoDfeResponse>} O resultado da consulta.
   *
   * @throws {Zod.ZodError} Se o CPF ou CNPJ informado não for válido.
   * @throws {TimeoutError} Se a requisição exceder o tempo limite.
   * @throws {NfeServiceRequestError} Se ocorrer um erro durante a requisição.
   */
  async distribuicaoDfe(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CayoPOliveira Perfect! The JSDoc documentation has been added correctly and follows the codebase's documentation standards. This will make the API more maintainable and easier to use.

🔗 Analysis chain

@CayoPOliveira Thanks for adding the JSDoc documentation! This will help maintain consistency in the codebase and make the API more user-friendly.


🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for JSDoc documentation of distribuicaoDfe method
ast-grep --pattern $'/**
  * @description $$$
  */
  async distribuicaoDfe'

Length of output: 76


Script:

#!/bin/bash
# Search for distribuicaoDfe method with context
rg "async distribuicaoDfe" -B 10 "src/dfe/nfe/webServices/index.ts"

Length of output: 651


If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!

Comment on lines 542 to 543
"@_xmlns":
"http://www.portalfiscal.inf.br/nfe/wsdl/NFeConsultaProtocolo4",
Copy link

@coderabbitai coderabbitai bot Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Corrigir namespace do serviço.

O namespace utilizado está incorreto. O serviço de distribuição DFe deve usar seu próprio namespace.

-        "@_xmlns":
-          "http://www.portalfiscal.inf.br/nfe/wsdl/NFeConsultaProtocolo4",
+        "@_xmlns":
+          "http://www.portalfiscal.inf.br/nfe/wsdl/NFeDistribuicaoDFe4",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"@_xmlns":
"http://www.portalfiscal.inf.br/nfe/wsdl/NFeConsultaProtocolo4",
"@_xmlns":
"http://www.portalfiscal.inf.br/nfe/wsdl/NFeDistribuicaoDFe4",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CayoPOliveira Great! The namespace correction will ensure proper communication with the NFeDistribuicaoDFe service. 🎉


If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (1)
src/dfe/nfe/webServices/index.ts (1)

535-609: 🛠️ Refactor suggestion

Melhore a implementação do método distribuicaoDfe.

O método precisa de melhorias em validação, documentação e tratamento de erros:

  1. Adicione documentação JSDoc (conforme revisão anterior)
  2. Valide os parâmetros de entrada
  3. Adicione tratamento de erro para operação ausente
  4. Melhore a segurança de tipos no tratamento das operações

Exemplo de implementação:

/**
 * @description Consulta documentos fiscais eletrônicos através do serviço de distribuição DFe.
 *
 * @param {NfeDistribuicaoDfeOptions} options - Opções para a consulta.
 *
 * @returns {Promise<NfeDistribuicaoDfeResponse>} O resultado da consulta.
 *
 * @throws {Zod.ZodError} Se o CPF ou CNPJ informado não for válido.
 * @throws {TimeoutError} Se a requisição exceder o tempo limite.
 * @throws {NfeServiceRequestError} Se ocorrer um erro durante a requisição.
 */
async distribuicaoDfe({
  CPF,
  CNPJ,
  distNSU,
  consNSU,
  consChNFe,
}: NfeDistribuicaoDfeOptions): Promise<NfeDistribuicaoDfeResponse> {
  // Validar CPF/CNPJ
  let cpfOrCnpj: CpfOrCnpj;
  if (CPF) {
    zCustom.cpf().parse(CPF);
    cpfOrCnpj = { CPF };
  } else if (CNPJ) {
    zCustom.cnpj().parse(CNPJ);
    cpfOrCnpj = { CNPJ };
  } else {
    throw new Error("CPF ou CNPJ deve ser informado");
  }

  // Validar e construir operação
  let operation: NfeDistribuicaoDfeOperation;
  if (distNSU) {
    const ultNSU = distNSU.ultNSU.padStart(15, "0");
    if (!/^\d{15}$/.test(ultNSU)) {
      throw new Error("ultNSU deve conter 15 dígitos numéricos");
    }
    operation = { distNSU: { ultNSU } };
  } else if (consNSU) {
    if (!/^\d{15}$/.test(consNSU.NSU)) {
      throw new Error("NSU deve conter 15 dígitos numéricos");
    }
    operation = { consNSU };
  } else if (consChNFe) {
    if (!/^\d{44}$/.test(consChNFe.chNFe)) {
      throw new Error("chNFe deve conter 44 dígitos numéricos");
    }
    operation = { consChNFe };
  } else {
    throw new Error("Uma operação deve ser informada: distNSU, consNSU ou consChNFe");
  }

  // Restante da implementação...
}
🧹 Nitpick comments (3)
src/dfe/nfe/webServices/requests/distribuicaoDfe.ts (3)

12-27: Adicione validação e documentação para o tipo NfeDistribuicaoDfeOperation.

O tipo está bem estruturado para garantir exclusividade mútua das operações, mas pode ser melhorado:

  1. Adicione validação de formato:
    • NSU deve ser numérico
    • chNFe deve ter 44 caracteres numéricos
  2. Adicione documentação JSDoc explicando cada operação

Exemplo de implementação:

/**
 * @description Define as operações possíveis para o serviço de distribuição DFe.
 * Apenas uma operação pode ser utilizada por vez.
 */
export type NfeDistribuicaoDfeOperation =
  | {
      /** @description Distribui documentos a partir do último NSU recebido */
      distNSU: { ultNSU: string };
      consNSU?: never;
      consChNFe?: never;
    }
  | {
      /** @description Consulta um documento específico pelo NSU */
      distNSU?: never;
      consNSU: { NSU: string };
      consChNFe?: never;
    }
  | {
      /** @description Consulta um documento específico pela chave de acesso */
      distNSU?: never;
      consNSU?: never;
      consChNFe: { chNFe: string };
    };

29-38: Melhore a documentação do tipo NfeDistribuicaoDfeOptions com exemplos.

A documentação atual está boa, mas pode ser melhorada com exemplos de uso para cada operação.

Exemplo de implementação:

/**
 * @description Opções para configurar o web service de NFeDistribuiçãoDFe.
 *
 * @property CPF | CNPJ - CPF ou CNPJ do interessado no DF-e
 * @property distNSU | consNSU | consChNFe - Operação a ser realizada
 * @property distNSU.ultNSU - Último NSU recebido pelo autor
 * @property consNSU.NSU - NSU específico a ser consultado
 * @property consChNFe.chNFe - Chave da NFe a ser consultada
 *
 * @example
 * // Distribuição por NSU
 * const options = {
 *   CNPJ: "12345678901234",
 *   distNSU: { ultNSU: "000000000000000" }
 * };
 *
 * @example
 * // Consulta por NSU específico
 * const options = {
 *   CNPJ: "12345678901234",
 *   consNSU: { NSU: "000000000000123" }
 * };
 *
 * @example
 * // Consulta por chave de NFe
 * const options = {
 *   CNPJ: "12345678901234",
 *   consChNFe: { chNFe: "12345678901234567890123456789012345678901234" }
 * };
 */

40-48: Adicione documentação para os tipos restantes.

Os tipos NfeDistribuicaoDfeRequest, NfeDistribuicaoDfeStatus e NfeDistribuicaoDfeResponse carecem de documentação JSDoc.

Exemplo de implementação:

/**
 * @description Estrutura da requisição para o serviço de distribuição DFe.
 */
export type NfeDistribuicaoDfeRequest = {
  distDFeInt: WithXmlnsVersao<{
    tpAmb: "1" | "2";
    cUFAutor: UFCode;
  } & CpfOrCnpj & NfeDistribuicaoDfeOperation>;
};

/**
 * @description Status possíveis para a resposta do serviço de distribuição DFe.
 */
export type NfeDistribuicaoDfeStatus =
  | "documento-localizado"
  | "nenhum-documento-localizado";

/**
 * @description Resposta do serviço de distribuição DFe.
 */
export type NfeDistribuicaoDfeResponse = NfeWebServiceResponse<
  NfeDistribuicaoDfeStatus,
  NfeDistribuicaoDfeResponseRaw
>;

Also applies to: 80-87

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bb9a162 and 9f2f9c1.

⛔ Files ignored due to path filters (1)
  • src/dfe/nfe/webServices/__snapshots__/index.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (3)
  • src/dfe/nfe/webServices/index.test.ts (1 hunks)
  • src/dfe/nfe/webServices/index.ts (10 hunks)
  • src/dfe/nfe/webServices/requests/distribuicaoDfe.ts (1 hunks)
🔇 Additional comments (1)
src/dfe/nfe/webServices/index.ts (1)

561-598: LGTM! A implementação do request está correta.

O código segue o mesmo padrão dos outros métodos, com:

  • URL e timeout corretos
  • Namespace específico do serviço
  • Tratamento de arrays para docZip

Comment on lines 50 to 78
/**
* @description Resposta completa da consulta de status serviço.
*
* @property tpAmb - Tipo de ambiente: 1-Produção 2-Homologação.
* @property verAplic - Versão do aplicativo que processou a consulta.
* @property cStat - `"137"->"nenhum-documento-localizado"`, `"138"->"documento-localizado"`.
* @property xMotivo - Descrição da resposta.
* @property dhResp - Data e hora da resposta.
* @property [ultNSU] - Último NSU processado.
* @property [maxNSU] - Maior NSU encontrado.
* @property [loteDistDFeInt] - Lote de distribuição de DF-e.
* @property loteDistDFeInt.docZip - Array de documentos zipados.
* @property loteDistDFeInt["@_NSU"] - NSU do lote.
* @property loteDistDFeInt["@_schema"] - Schema do lote.
*/
export type NfeDistribuicaoDfeResponseRaw = WithVersao<{
tpAmb: "1" | "2";
verAplic: string;
cStat: LiteralStringUnion<"137" | "138">;
xMotivo: string;
dhResp: string;
ultNSU?: string;
maxNSU?: string;
loteDistDFeInt?: {
docZip: string[];
"@_NSU": string;
"@_schema": string;
};
}>;
Copy link

@coderabbitai coderabbitai bot Jan 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Corrija a documentação do tipo NfeDistribuicaoDfeResponseRaw.

A documentação atual contém um erro, mencionando "consulta de status serviço" ao invés de "distribuição DFe".

Corrija para:

/**
 * @description Resposta completa da distribuição DFe.
 *
 * @property tpAmb - Tipo de ambiente: 1-Produção 2-Homologação
 * @property verAplic - Versão do aplicativo que processou a consulta
 * @property cStat - `"137"->"nenhum-documento-localizado"`, `"138"->"documento-localizado"`
 * @property xMotivo - Descrição da resposta
 * @property dhResp - Data e hora da resposta
 * @property [ultNSU] - Último NSU processado
 * @property [maxNSU] - Maior NSU encontrado
 * @property [loteDistDFeInt] - Lote de distribuição de DF-e
 * @property loteDistDFeInt.docZip - Array de documentos zipados
 * @property loteDistDFeInt["@_NSU"] - NSU do lote
 * @property loteDistDFeInt["@_schema"] - Schema do lote
 */

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CayoPOliveira Thanks for making the fix!

🔗 Analysis chain

@CayoPOliveira Thanks for making the fix!

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check the current content of the file
cat src/dfe/nfe/webServices/requests/distribuicaoDfe.ts

Length of output: 2609


If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!

Comment on lines 419 to 456
describe("distribuicaoDfe", () => {
const url = getWebServiceUrl({ uf, env, service: "NFeDistribuicaoDFe" });

test("Returns valid response", async () => {
mockRequest(url, {
method: "POST",
response: {
data: buildMockResponse({
nfeDistDFeInteresseResponse: {
nfeDistDFeInteresseResult: {
retDistDFeInt: {
tpAmb: "2",
cStat: "138",
xMotivo: "Documento localizado",
dhResp: "2025-01-24T08:00:00-03:00",
ultNSU: "0",
maxNSU: "0",
loteDistDFeInt: {
"@_NSU": "0",
"@_schema": "resNFe_v1.00.xsd",
docZip: "NFe compactada no padrão gZip",
},
},
},
},
}),
},
});
expect(
await service.distribuicaoDfe({
CNPJ: "12345678901230",
consChNFe: {
chNFe: "0".repeat(44),
},
}),
).toMatchSnapshot();
});
});
Copy link

@coderabbitai coderabbitai bot Jan 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Melhore a cobertura de testes do método distribuicaoDfe.

O teste atual cobre apenas o caso de sucesso com a operação consChNFe. Sugiro adicionar mais casos de teste:

  1. Casos de erro:

    • CPF/CNPJ inválido
    • Timeout na requisição
    • Erro na resposta do serviço
  2. Diferentes operações:

    • Distribuição por NSU (distNSU)
    • Consulta por NSU específico (consNSU)
  3. Diferentes status:

    • Nenhum documento localizado (137)
    • Erro genérico

Exemplo de implementação:

describe("distribuicaoDfe", () => {
  const url = getWebServiceUrl({ uf, env, service: "NFeDistribuicaoDFe" });

  test("Returns valid response for consChNFe", async () => {
    // ... teste atual ...
  });

  test("Returns valid response for distNSU", async () => {
    mockRequest(url, {
      method: "POST",
      response: {
        data: buildMockResponse({
          nfeDistDFeInteresseResponse: {
            nfeDistDFeInteresseResult: {
              retDistDFeInt: {
                tpAmb: "2",
                cStat: "138",
                xMotivo: "Documento localizado",
                dhResp: "2025-01-24T08:00:00-03:00",
                ultNSU: "000000000000123",
                maxNSU: "000000000000123",
                loteDistDFeInt: {
                  "@_NSU": "000000000000123",
                  "@_schema": "resNFe_v1.00.xsd",
                  docZip: ["NFe1", "NFe2"],
                },
              },
            },
          },
        }),
      },
    });
    expect(
      await service.distribuicaoDfe({
        CNPJ: "12345678901230",
        distNSU: { ultNSU: "000000000000123" },
      }),
    ).toMatchSnapshot();
  });

  test("Returns valid response for consNSU", async () => {
    mockRequest(url, {
      method: "POST",
      response: {
        data: buildMockResponse({
          nfeDistDFeInteresseResponse: {
            nfeDistDFeInteresseResult: {
              retDistDFeInt: {
                tpAmb: "2",
                cStat: "138",
                xMotivo: "Documento localizado",
                dhResp: "2025-01-24T08:00:00-03:00",
                ultNSU: "000000000000123",
                maxNSU: "000000000000123",
                loteDistDFeInt: {
                  "@_NSU": "000000000000123",
                  "@_schema": "resNFe_v1.00.xsd",
                  docZip: ["NFe"],
                },
              },
            },
          },
        }),
      },
    });
    expect(
      await service.distribuicaoDfe({
        CNPJ: "12345678901230",
        consNSU: { NSU: "000000000000123" },
      }),
    ).toMatchSnapshot();
  });

  test("Returns no documents found", async () => {
    mockRequest(url, {
      method: "POST",
      response: {
        data: buildMockResponse({
          nfeDistDFeInteresseResponse: {
            nfeDistDFeInteresseResult: {
              retDistDFeInt: {
                tpAmb: "2",
                cStat: "137",
                xMotivo: "Nenhum documento localizado",
                dhResp: "2025-01-24T08:00:00-03:00",
                ultNSU: "000000000000123",
                maxNSU: "000000000000123",
              },
            },
          },
        }),
      },
    });
    expect(
      await service.distribuicaoDfe({
        CNPJ: "12345678901230",
        distNSU: { ultNSU: "000000000000123" },
      }),
    ).toMatchSnapshot();
  });

  test("Throws ZodError for invalid CNPJ", () => {
    expect(() =>
      service.distribuicaoDfe({
        CNPJ: "12345678901299",
        distNSU: { ultNSU: "000000000000123" },
      }),
    ).toThrowError(ZodError);
  });

  test("Throws error on timeout", () => {
    mockRequest(url, {
      method: "POST",
      throw: new Error("The operation timed out."),
    });
    expect(() =>
      service.distribuicaoDfe({
        CNPJ: "12345678901230",
        distNSU: { ultNSU: "000000000000123" },
      }),
    ).toThrowError("The operation timed out.");
  });
});

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Adicionei apenas a validação de CPF e CNPJ, as demais, como vou remover em outra PR a abstração e retornar a resposta completa, não achei esses testes uteis por agora

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CayoPOliveira Entendi, faz sentido manter apenas os testes de validação por enquanto, já que você planeja remover a abstração em outro PR.

(`・ω・´)ゞ


✏️ Learnings added
Learnt from: CayoPOliveira
PR: fazendatech/brafis#38
File: src/dfe/nfe/webServices/index.test.ts:0-0
Timestamp: 2025-01-27T01:09:41.425Z
Learning: The abstraction layer in the NFe distribution service will be removed in a future PR to return the complete response instead of the current abstracted version.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Comment on lines 70 to 78
import type {
NfeDistribuicaoDfeOperation,
NfeDistribuicaoDfeOptions,
NfeDistribuicaoDfeRequest,
NfeDistribuicaoDfeResponse,
NfeDistribuicaoDfeResponseRaw,
NfeDistribuicaoDfeStatus,
} from "./requests/distribuicaoDfe";
import { updateLanguageServiceSourceFile } from "typescript";
Copy link

@coderabbitai coderabbitai bot Jan 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Remova a importação não utilizada.

A importação updateLanguageServiceSourceFile do módulo typescript não está sendo utilizada.

Remova a linha:

-import { updateLanguageServiceSourceFile } from "typescript";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import type {
NfeDistribuicaoDfeOperation,
NfeDistribuicaoDfeOptions,
NfeDistribuicaoDfeRequest,
NfeDistribuicaoDfeResponse,
NfeDistribuicaoDfeResponseRaw,
NfeDistribuicaoDfeStatus,
} from "./requests/distribuicaoDfe";
import { updateLanguageServiceSourceFile } from "typescript";
import type {
NfeDistribuicaoDfeOperation,
NfeDistribuicaoDfeOptions,
NfeDistribuicaoDfeRequest,
NfeDistribuicaoDfeResponse,
NfeDistribuicaoDfeResponseRaw,
NfeDistribuicaoDfeStatus,
} from "./requests/distribuicaoDfe";

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CayoPOliveira Great! Thank you for removing the unused import.

🐰 happy bunny noises


If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9f2f9c1 and d6de2a9.

📒 Files selected for processing (1)
  • src/dfe/nfe/webServices/index.ts (13 hunks)
🔇 Additional comments (1)
src/dfe/nfe/webServices/index.ts (1)

70-77: LGTM!

As importações dos tipos necessários para a funcionalidade de distribuição DFe estão bem organizadas.

}: NfeDistribuicaoDfeOptions): Promise<NfeDistribuicaoDfeResponse> {
let cpfOrCnpj: CpfOrCnpj;
if (CPF) {
// TODO: Validar resto do input.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Implementar validação completa dos parâmetros.

O TODO indica que falta validação dos parâmetros, mas não especifica quais validações são necessárias.

Sugestão de implementação:

// Validar formato e comprimento do NSU
if (distNSU?.ultNSU) {
  if (!/^\d+$/.test(distNSU.ultNSU)) {
    throw new Error("ultNSU deve conter apenas dígitos");
  }
  if (distNSU.ultNSU.length > 15) {
    throw new Error("ultNSU deve ter no máximo 15 dígitos");
  }
}

// Validar formato do NSU específico
if (consNSU?.NSU) {
  if (!/^\d{15}$/.test(consNSU.NSU)) {
    throw new Error("NSU deve conter exatamente 15 dígitos");
  }
}

// Validar formato da chave NFe
if (consChNFe?.chNFe) {
  if (!/^\d{44}$/.test(consChNFe.chNFe)) {
    throw new Error("chNFe deve conter exatamente 44 dígitos");
  }
}

Comment on lines 564 to 571
let operation: NfeDistribuicaoDfeOperation;
if (distNSU) {
operation = { distNSU: { ultNSU: distNSU.ultNSU.padStart(15, "0") } };
} else if (consNSU) {
operation = { consNSU };
} else {
operation = { consChNFe };
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Melhorar a lógica de seleção da operação.

A lógica atual não valida se múltiplas operações foram fornecidas simultaneamente, o que pode levar a comportamentos inesperados.

Sugestão de implementação:

let operation: NfeDistribuicaoDfeOperation;
const operationCount = [distNSU, consNSU, consChNFe].filter(Boolean).length;

if (operationCount === 0) {
  throw new Error("É necessário fornecer uma operação: distNSU, consNSU ou consChNFe");
} else if (operationCount > 1) {
  throw new Error("Apenas uma operação pode ser fornecida por vez");
}

if (distNSU) {
  operation = { distNSU: { ultNSU: distNSU.ultNSU.padStart(15, "0") } };
} else if (consNSU) {
  operation = { consNSU };
} else {
  operation = { consChNFe };
}

/**
* @description Consulta a distribuição de informações resumidas e documentos fiscais eletrônicos de interesse de um ator, seja este uma pessoa física ou jurídica.
*
* @param {NfeRecepcaoEventoOptions} options - Opções para o serviço.
Copy link

@coderabbitai coderabbitai bot Jan 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Corrigir tipo no JSDoc.

O tipo do parâmetro options está incorreto no JSDoc.

-   * @param {NfeRecepcaoEventoOptions} options - Opções para o serviço.
+   * @param {NfeDistribuicaoDfeOptions} options - Opções para o serviço.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* @param {NfeRecepcaoEventoOptions} options - Opções para o serviço.
* @param {NfeDistribuicaoDfeOptions} options - Opções para o serviço.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CayoPOliveira Thanks for fixing the JSDoc parameter type! 🎉


If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!

Copy link
Contributor Author

@CayoPOliveira CayoPOliveira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O webservice NFeDistribuicaoDFe possui outros campos na estrutura de request e response, devido a isso deixei o método request mais genérico e atualizei os tipos nos demais webservices.

Irei criar uma nova PR para atualizar os tipos corretamente nos arquivos de tipo.

Reviewed 4 of 4 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 13 unresolved discussions (waiting on @coderabbitai[bot])


src/dfe/nfe/webServices/index.ts line 131 at r3 (raw file):

    const response = await fetchWithTls(url, {
      method: "POST",
      headers: { "Content-Type": "application/soap+xml; charset=utf-8" },

O método request agora apenas encapsula e desencapsula o SOAP


src/dfe/nfe/webServices/index.ts line 166 at r3 (raw file):

    const {
      nfeResultMsg: { retConsStatServ },
    } = await this.request<

Essa é a atualização de tipos que falei, irei criar uma PR separada para incluir adequadamente esses tipos


src/dfe/nfe/webServices/index.ts line 565 at r3 (raw file):

        nfeDistDFeInteresseResult: { retDistDFeInt },
      },
    } = await this.request<

A estrutura desse serviço dentro do SOAP é diferente dos demais webservices

Comment on lines 542 to 543
"@_xmlns":
"http://www.portalfiscal.inf.br/nfe/wsdl/NFeConsultaProtocolo4",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines 510 to 564
async distribuicaoDfe({
CPF,
CNPJ,
distNSU,
consNSU,
consChNFe,
}: NfeDistribuicaoDfeOptions): Promise<NfeDistribuicaoDfeResponse> {
let cpfOrCnpj: CpfOrCnpj;
if (CPF) {
// TODO: Validar resto do input.
zCustom.cpf().parse(CPF);
cpfOrCnpj = { CPF };
} else {
zCustom.cnpj().parse(CNPJ);
cpfOrCnpj = { CNPJ } as CpfOrCnpj;
}

let operation: NfeDistribuicaoDfeOperation;
if (distNSU) {
operation = { distNSU };
} else if (consNSU) {
operation = { consNSU };
} else {
operation = { consChNFe };
}

const { retDistDFeInt } = await this.request<
NfeDistribuicaoDfeRequest,
{ retDistDFeInt: NfeDistribuicaoDfeResponseRaw }
>(this.getUrl("NFeDistribuicaoDFe"), {
timeout: this.timeout,
body: {
"@_xmlns":
"http://www.portalfiscal.inf.br/nfe/wsdl/NFeConsultaProtocolo4",
distDFeInt: {
...this.xmlNamespace,
"@_versao": "4.00",
tpAmb: this.tpAmb,
cUFAutor: this.cUF,
...cpfOrCnpj,
...operation,
},
},
});

const statusMap: Record<string, NfeDistribuicaoDfeStatus> = {
"137": "nenhum-documento-localizado",
"138": "documento-localizado",
};
return {
status: statusMap[retDistDFeInt.cStat] ?? "outro",
description: retDistDFeInt.xMotivo ?? "",
raw: retDistDFeInt,
};
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines 70 to 78
import type {
NfeDistribuicaoDfeOperation,
NfeDistribuicaoDfeOptions,
NfeDistribuicaoDfeRequest,
NfeDistribuicaoDfeResponse,
NfeDistribuicaoDfeResponseRaw,
NfeDistribuicaoDfeStatus,
} from "./requests/distribuicaoDfe";
import { updateLanguageServiceSourceFile } from "typescript";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

/**
* @description Consulta a distribuição de informações resumidas e documentos fiscais eletrônicos de interesse de um ator, seja este uma pessoa física ou jurídica.
*
* @param {NfeRecepcaoEventoOptions} options - Opções para o serviço.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines 419 to 456
describe("distribuicaoDfe", () => {
const url = getWebServiceUrl({ uf, env, service: "NFeDistribuicaoDFe" });

test("Returns valid response", async () => {
mockRequest(url, {
method: "POST",
response: {
data: buildMockResponse({
nfeDistDFeInteresseResponse: {
nfeDistDFeInteresseResult: {
retDistDFeInt: {
tpAmb: "2",
cStat: "138",
xMotivo: "Documento localizado",
dhResp: "2025-01-24T08:00:00-03:00",
ultNSU: "0",
maxNSU: "0",
loteDistDFeInt: {
"@_NSU": "0",
"@_schema": "resNFe_v1.00.xsd",
docZip: "NFe compactada no padrão gZip",
},
},
},
},
}),
},
});
expect(
await service.distribuicaoDfe({
CNPJ: "12345678901230",
consChNFe: {
chNFe: "0".repeat(44),
},
}),
).toMatchSnapshot();
});
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Adicionei apenas a validação de CPF e CNPJ, as demais, como vou remover em outra PR a abstração e retornar a resposta completa, não achei esses testes uteis por agora

Comment on lines 50 to 78
/**
* @description Resposta completa da consulta de status serviço.
*
* @property tpAmb - Tipo de ambiente: 1-Produção 2-Homologação.
* @property verAplic - Versão do aplicativo que processou a consulta.
* @property cStat - `"137"->"nenhum-documento-localizado"`, `"138"->"documento-localizado"`.
* @property xMotivo - Descrição da resposta.
* @property dhResp - Data e hora da resposta.
* @property [ultNSU] - Último NSU processado.
* @property [maxNSU] - Maior NSU encontrado.
* @property [loteDistDFeInt] - Lote de distribuição de DF-e.
* @property loteDistDFeInt.docZip - Array de documentos zipados.
* @property loteDistDFeInt["@_NSU"] - NSU do lote.
* @property loteDistDFeInt["@_schema"] - Schema do lote.
*/
export type NfeDistribuicaoDfeResponseRaw = WithVersao<{
tpAmb: "1" | "2";
verAplic: string;
cStat: LiteralStringUnion<"137" | "138">;
xMotivo: string;
dhResp: string;
ultNSU?: string;
maxNSU?: string;
loteDistDFeInt?: {
docZip: string[];
"@_NSU": string;
"@_schema": string;
};
}>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Collaborator

@gabrieljablonski gabrieljablonski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 4 files at r3, 3 of 3 files at r5, 1 of 1 files at r6, all commit messages.
Dismissed @coderabbitai[bot] from 10 discussions.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @CayoPOliveira)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0cc55d7 and bc08c13.

📒 Files selected for processing (1)
  • src/dfe/nfe/webServices/index.ts (13 hunks)
🧰 Additional context used
📓 Learnings (1)
src/dfe/nfe/webServices/index.ts (1)
Learnt from: CayoPOliveira
PR: fazendatech/brafis#38
File: src/dfe/nfe/webServices/index.test.ts:0-0
Timestamp: 2025-01-27T01:09:41.872Z
Learning: The abstraction layer in the NFe distribution service will be removed in a future PR to return the complete response instead of the current abstracted version.
🔇 Additional comments (3)
src/dfe/nfe/webServices/index.ts (3)

70-77: LGTM!

As importações dos tipos para o serviço de distribuição DFe seguem o padrão estabelecido no código.


573-610: LGTM!

A estrutura da requisição SOAP e o processamento da resposta estão implementados corretamente.


612-620: LGTM!

O mapeamento de status e a estrutura da resposta seguem o padrão estabelecido no código.

src/dfe/nfe/webServices/index.ts Show resolved Hide resolved
src/dfe/nfe/webServices/index.ts Show resolved Hide resolved
src/dfe/nfe/webServices/index.ts Show resolved Hide resolved
@CayoPOliveira CayoPOliveira merged commit 2d044c2 into main Jan 27, 2025
1 of 2 checks passed
@CayoPOliveira CayoPOliveira deleted the feat/webservice-nfeDistribuicaoDfe branch January 27, 2025 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved for merge Approved for merge enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants