Pessoal,
estava tentando manifestar ciência da operação no ambiente nacional:
Nfe.EventoNFe.Evento.Clear;
with Nfe.EventoNFe.Evento.Add do
begin
infEvento.cOrgao := 91;//NotaUtil.UFtoCUF(Uf);
infEvento.chNFe := Chave;
infEvento.CNPJ := Cnpj;
infEvento.dhEvento := Now;
infEvento.tpEvento := teManifDestCiencia;
end;
Nfe.EnviarEventoNFe(1);
Porém, sempre recebia Rejeicao: O autor do evento diverge do destinatario da NF-e
Percebi que não estava direcionando para a url do ambiente nacional.
A TNFeEnvEvento.DefinirURL coloca o FLayout := LayNFeEventoAN
E na NotaUtil.GetURL é inicialmente retornado a url do ambiente nacional, mas em seguida no mesmo método é depois retornado a url do ambiente estadual, então fiz a seguinte alteração no NotaUtil.GetURL:
class function NotaUtil.GetURL(const AUF, AAmbiente, FormaEmissao : Integer;
ALayOut: TLayOut; AModeloDF: TpcnModeloDF = moNFe; AVersaoDF: TpcnVersaoDF = ve200): WideString;
begin
case FormaEmissao of
1,2,4,5,9 : begin
case ALayOut of
LayNfeEnvDPEC : Result := DFeUtil.SeSenao(AAmbiente=1, 'https://www.nfe.fazenda.gov.br/SCERecepcaoRFB/SCERecepcaoRFB.asmx', 'https://hom.nfe.fazenda.gov.br/SCERecepcaoRFB/SCERecepcaoRFB.asmx');
LayNfeConsultaDPEC : Result := DFeUtil.SeSenao(AAmbiente=1, 'https://www.nfe.fazenda.gov.br/SCEConsultaRFB/SCEConsultaRFB.asmx', 'https://hom.nfe.fazenda.gov.br/SCEConsultaRFB/SCEConsultaRFB.asmx');
LayNFeEventoAN : Result := DFeUtil.SeSenao(AAmbiente=1, 'https://www.nfe.fazenda.gov.br/RecepcaoEvento/RecepcaoEvento.asmx', 'https://hom.nfe.fazenda.gov.br/RecepcaoEvento/RecepcaoEvento.asmx ');
LayNfeConsNFeDest : Result := DFeUtil.SeSenao(AAmbiente=1, 'https://www.nfe.fazenda.gov.br/NFeConsultaDest/NFeConsultaDest.asmx', 'https://hom.nfe.fazenda.gov.br/NFeConsultaDest/NFeConsultaDest.asmx');
LayNfeDownloadNFe : Result := DFeUtil.SeSenao(AAmbiente=1, 'https://www.nfe.fazenda.gov.br/NfeDownloadNF/NfeDownloadNF.asmx', 'https://hom.nfe.fazenda.gov.br/NfeDownloadNF/NfeDownloadNF.asmx');
LayDistDFeInt : Result := DFeUtil.SeSenao(AAmbiente=1, 'https://www1.nfe.fazenda.gov.br/NFeDistribuicaoDFe/NFeDistribuicaoDFe.asmx', 'https://hom.nfe.fazenda.gov.br/NFeDistribuicaoDFe/NFeDistribuicaoDFe.asmx'); https://www1.nfe.fazenda.gov.br/NFeDistribuicaoDFe/NFeDistribuicaoDFe.asmx
end;
if (ALayOut <> LayNFeEventoAN) then //Adicionei esta verificação
begin
case AUF of
...
end;
end;
end;
end;
Bom, resolveu, me retornou a url do ambiente nacional, mas não tenho certeza se seria a melhor solução, e se for, para que seja adicionado aos fontes.