From 9b6b4560615c6b9b8b422e41c6ef7c59ad435b6e Mon Sep 17 00:00:00 2001 From: "Marcos Gerene F. Spirito" Date: Sun, 14 Jan 2024 08:50:30 -0300 Subject: [PATCH] =?UTF-8?q?[CTe][*]=20Considera=20a=20configura=C3=A7?= =?UTF-8?q?=C3=A3o=20IsValidaSchemas=20permitindo=20ignorar=20valida=C3=A7?= =?UTF-8?q?=C3=A3o=20de=20Schemas=20(#1470)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CTe.Servicos/Eventos/ServicoController.cs | 10 ++++++++-- CTe.Servicos/Recepcao/ServicoCTeRecepcao.cs | 9 +++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CTe.Servicos/Eventos/ServicoController.cs b/CTe.Servicos/Eventos/ServicoController.cs index 7e5b12eb8..089e8f63d 100644 --- a/CTe.Servicos/Eventos/ServicoController.cs +++ b/CTe.Servicos/Eventos/ServicoController.cs @@ -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; @@ -88,7 +91,10 @@ public async Task 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); diff --git a/CTe.Servicos/Recepcao/ServicoCTeRecepcao.cs b/CTe.Servicos/Recepcao/ServicoCTeRecepcao.cs index ae32e54e1..b24d962d3 100644 --- a/CTe.Servicos/Recepcao/ServicoCTeRecepcao.cs +++ b/CTe.Servicos/Recepcao/ServicoCTeRecepcao.cs @@ -145,11 +145,16 @@ private static enviCTe PreparaEnvioCTe(int lote, List 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; }