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

Incompatibilidade de tipos no envio de evento. #13

Closed
skerme opened this issue Oct 15, 2023 · 1 comment
Closed

Incompatibilidade de tipos no envio de evento. #13

skerme opened this issue Oct 15, 2023 · 1 comment
Labels
question Further information is requested

Comments

@skerme
Copy link

skerme commented Oct 15, 2023

Descrição

Boaaaaa noite.

Estou enviando a manifestação da nota, usei o exemplo dado aqui, mas está relantando essa incompatibilidade.

image

@lucashpmelo
Copy link
Owner

Bom dia, acredito que você possa resolver esse problema definindo um type para o objeto lote:

import { RecepcaoEvento } from "node-mde";
import fs from "fs";

type EventoLote = {
  chNFe: string;
  tipoEvento: 210210 | 210240 | 210200 | 210220;
  justificativa?: string | undefined;
};

const run = async () => {
  const recepcao = new RecepcaoEvento({
    pfx: fs.readFileSync("./certificado.pfx"),
    passphrase: "senha",
    cnpj: "12345678901234",
    tpAmb: "2",
  });

  const lote: EventoLote[] = [
    {
      chNFe: "41000000000000000000000000000000000000000040",
      tipoEvento: 210210,
    },
    {
      chNFe: "41000000000000000000000000000000000000000041",
      tipoEvento: 210240,
      justificativa: "Não foi realizado a entrega correta dos itens da nota.",
    },
  ];

  const manifestacao = await recepcao.enviarEvento({
    idLote: "1337",
    lote: lote,
  });

  if (manifestacao.error) {
    throw new Error(manifestacao.error);
  }
};

run();

@skerme skerme closed this as completed Oct 16, 2023
@lucashpmelo lucashpmelo added the question Further information is requested label Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants