Skip to content

Commit

Permalink
[CTe][*] Considera a configuração IsValidaSchemas permitindo ignorar …
Browse files Browse the repository at this point in the history
…validação de Schemas (#1470)
  • Loading branch information
marcosgerene authored Jan 14, 2024
1 parent 6f8a3e2 commit 9b6b456
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
10 changes: 8 additions & 2 deletions CTe.Servicos/Eventos/ServicoController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ public retEventoCTe Executar(CTeTipoEvento cTeTipoEvento, int sequenciaEvento, s
{
var evento = FactoryEvento.CriaEvento(cTeTipoEvento, sequenciaEvento, chave, cnpj, container, configuracaoServico);
evento.Assina(configuracaoServico);
evento.ValidarSchema(configuracaoServico);

if (configuracaoServico.IsValidaSchemas)
evento.ValidarSchema(configuracaoServico);

evento.SalvarXmlEmDisco(configuracaoServico);

XmlNode retornoXml = null;
Expand All @@ -88,7 +91,10 @@ public async Task<retEventoCTe> ExecutarAsync(CTeTipoEvento cTeTipoEvento, int s
{
var evento = FactoryEvento.CriaEvento(cTeTipoEvento, sequenciaEvento, chave, cnpj, container, configuracaoServico);
evento.Assina(configuracaoServico);
evento.ValidarSchema(configuracaoServico);

if (configuracaoServico.IsValidaSchemas)
evento.ValidarSchema(configuracaoServico);

evento.SalvarXmlEmDisco(configuracaoServico);

var webService = WsdlFactory.CriaWsdlCteEvento(configuracaoServico);
Expand Down
9 changes: 7 additions & 2 deletions CTe.Servicos/Recepcao/ServicoCTeRecepcao.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,16 @@ private static enviCTe PreparaEnvioCTe(int lote, List<CTeEletronico> cteEletroni
cte.infCte.ide.tpEmis = instanciaConfiguracao.TipoEmissao;
cte.Assina(instanciaConfiguracao);
cte.infCTeSupl = cte.QrCode(instanciaConfiguracao.X509Certificate2, Encoding.UTF8, instanciaConfiguracao.IsAdicionaQrCode, UrlHelper.ObterUrlQrCode(instanciaConfiguracao));
cte.ValidaSchema(instanciaConfiguracao);

if (configuracaoServico.IsValidaSchemas)
cte.ValidaSchema(instanciaConfiguracao);

cte.SalvarXmlEmDisco(instanciaConfiguracao);
}

enviCte.ValidaSchema(instanciaConfiguracao);
if (configuracaoServico.IsValidaSchemas)
enviCte.ValidaSchema(instanciaConfiguracao);

enviCte.SalvarXmlEmDisco(instanciaConfiguracao);
return enviCte;
}
Expand Down

0 comments on commit 9b6b456

Please sign in to comment.