diff --git a/CTe.Classes/cteOSProc.cs b/CTe.Classes/cteOSProc.cs new file mode 100644 index 000000000..d75ceea22 --- /dev/null +++ b/CTe.Classes/cteOSProc.cs @@ -0,0 +1,32 @@ +using System; +using System.Xml.Serialization; +using CTe.Classes.Protocolo; +using CTe.Classes.Servicos.Tipos; +using DFe.Utils; + +namespace CTe.Classes +{ + [Serializable] + [XmlRoot(Namespace = "http://www.portalfiscal.inf.br/cte", + ElementName = "cteOSProc")] + public class cteOSProc + { + [XmlAttribute] + public versao versao { get; set; } + + public CTe CTeOS { get; set; } + + public protCTe protCTe { get; set; } + + + public static cteOSProc LoadXmlString(string xml) + { + return FuncoesXml.XmlStringParaClasse<cteOSProc>(xml); + } + + public static cteOSProc LoadXmlArquivo(string caminhoArquivoXml) + { + return FuncoesXml.ArquivoXmlParaClasse<cteOSProc>(caminhoArquivoXml); + } + } +} \ No newline at end of file diff --git a/CTe.Dacte.Base/CTe/CTeRetrato.frx b/CTe.Dacte.Base/CTe/CTeRetrato.frx index c34023d70..4b032e12f 100644 --- a/CTe.Dacte.Base/CTe/CTeRetrato.frx +++ b/CTe.Dacte.Base/CTe/CTeRetrato.frx @@ -1491,7 +1491,7 @@ namespace FastReport </DataBand> <DataBand Name="dataBandObservacao" Top="953.9" Width="737.1" Height="82.05" CanGrow="true" CanShrink="true" CanBreak="true"> <ShapeObject Name="Shape9" Width="737.1" Height="82.05" CanGrow="true" CanShrink="true" GrowToBottom="true"/> - <TextObject Name="Text168" Left="4" Top="15.45" Width="727.65" Height="65.15" CanGrow="true" CanShrink="true" GrowToBottom="true" Text="[cteProc.CTe.infCte.compl.xObs]" Font="Times New Roman, 8.25pt"/> + <TextObject Name="Text168" Left="4" Top="15.45" Width="727.65" Height="65.15" CanGrow="true" CanShrink="true" AllowExpressions="False" GrowToBottom="true" Text="[cteProc.CTe.infCte.compl.xObs]" Font="Times New Roman, 8.25pt"/> <TextObject Name="Text186" Left="-9.45" Top="26.9" Width="765.45" Height="18.9" CanGrow="true" CanShrink="true" GrowToBottom="true" Text="DOCUMENTO EMITIDO EM AMBIENTE DE HOMOLOGAÇÃO, SEM VALOR FISCAL" HorzAlign="Center" Font="Times New Roman, 12pt, style=Bold"/> <TextObject Name="Text163" Left="1" Top="1.55" Width="734.1" Height="11.45" CanGrow="true" CanShrink="true" GrowToBottom="true" Text="OBSERVAÇÕES" HorzAlign="Center" Font="Times New Roman, 6.75pt"/> <LineObject Name="Line45" Left="1" Top="13" Width="734.55" CanGrow="true" CanShrink="true" GrowToBottom="true"/> @@ -1584,8 +1584,8 @@ namespace FastReport <LineObject Name="Line46" Left="1" Top="14.45" Width="734.55"/> <TextObject Name="Text173" Left="1" Top="14.9" Width="94.5" Height="39.8" Font="Arial Narrow, 6.75pt"/> <TextObject Name="Text207" Left="94.5" Top="14.74" Width="348.65" Height="39.8" Font="Arial Narrow, 6.75pt"/> - <TextObject Name="Text208" Left="445.15" Top="14.9" Width="94.5" Height="39.8" Font="Arial Narrow, 6.75pt"/> - <TextObject Name="Text209" Left="538.1" Top="14.9" Width="198.45" Height="39.8" Text="123456789012345678901234567890123456789012345" Font="Arial Narrow, 6.75pt"/> + <TextObject Name="Text208" Left="445.15" Top="14.9" Width="94.5" Height="39.8" Font="Arial Narrow, 6.75pt" AllowExpressions="False"/> + <TextObject Name="Text209" Left="538.1" Top="14.9" Width="198.45" Height="39.8" Text="123456789012345678901234567890123456789012345" Font="Arial Narrow, 6.75pt" AllowExpressions="False"/> <TextObject Name="Text165" Left="1" Top="2" Width="442.15" Height="11.45" Text="USO EXCLUSIVO DO EMISSOR DO CTE" HorzAlign="Center" Font="Times New Roman, 6.75pt"/> <LineObject Name="Line47" Left="444.15" Top="1" Height="54.7"/> <TextObject Name="Text166" Left="444.15" Top="2" Width="290.95" Height="11.45" Text="RESERVADO AO FISCO" HorzAlign="Center" Font="Times New Roman, 6.75pt"/> diff --git a/CTe.Servicos/ConsultaProtocolo/ConsultaProtcoloServico.cs b/CTe.Servicos/ConsultaProtocolo/ConsultaProtcoloServico.cs index ca22fd62d..04cb5abf5 100644 --- a/CTe.Servicos/ConsultaProtocolo/ConsultaProtcoloServico.cs +++ b/CTe.Servicos/ConsultaProtocolo/ConsultaProtcoloServico.cs @@ -43,54 +43,60 @@ public class ConsultaProtcoloServico { public retConsSitCTe ConsultaProtocolo(string chave, ConfiguracaoServico configuracaoServico = null) { - var consSitCTe = ClassesFactory.CriarconsSitCTe(chave, configuracaoServico); + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; - if (configuracaoServico.IsValidaSchemas) - consSitCTe.ValidarSchema(configuracaoServico); + var consSitCTe = ClassesFactory.CriarconsSitCTe(chave, configServico); - consSitCTe.SalvarXmlEmDisco(configuracaoServico); + if (configServico.IsValidaSchemas) + consSitCTe.ValidarSchema(configServico); - var webService = WsdlFactory.CriaWsdlConsultaProtocolo(configuracaoServico); + consSitCTe.SalvarXmlEmDisco(configServico); + + var webService = WsdlFactory.CriaWsdlConsultaProtocolo(configServico); var retornoXml = webService.cteConsultaCT(consSitCTe.CriaRequestWs()); var retorno = retConsSitCTe.LoadXml(retornoXml.OuterXml, consSitCTe); - retorno.SalvarXmlEmDisco(chave, configuracaoServico); + retorno.SalvarXmlEmDisco(chave, configServico); return retorno; } public retConsSitCTe ConsultaProtocoloV4(string chave, ConfiguracaoServico configuracaoServico = null) { - var consSitCTe = ClassesFactory.CriarconsSitCTe(chave, configuracaoServico); + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + + var consSitCTe = ClassesFactory.CriarconsSitCTe(chave, configServico); - if (configuracaoServico.IsValidaSchemas) - consSitCTe.ValidarSchema(configuracaoServico); + if (configServico.IsValidaSchemas) + consSitCTe.ValidarSchema(configServico); - consSitCTe.SalvarXmlEmDisco(configuracaoServico); + consSitCTe.SalvarXmlEmDisco(configServico); - var webService = WsdlFactory.CriaWsdlConsultaProtocoloV4(configuracaoServico); + var webService = WsdlFactory.CriaWsdlConsultaProtocoloV4(configServico); var retornoXml = webService.cteConsultaCT(consSitCTe.CriaRequestWs()); var retorno = retConsSitCTe.LoadXml(retornoXml.OuterXml, consSitCTe); - retorno.SalvarXmlEmDisco(chave, configuracaoServico); + retorno.SalvarXmlEmDisco(chave, configServico); return retorno; } public async Task<retConsSitCTe> ConsultaProtocoloAsync(string chave, ConfiguracaoServico configuracaoServico = null) { - var consSitCTe = ClassesFactory.CriarconsSitCTe(chave, configuracaoServico); - - if (configuracaoServico.IsValidaSchemas) - consSitCTe.ValidarSchema(configuracaoServico); - - consSitCTe.SalvarXmlEmDisco(configuracaoServico); - - var webService = WsdlFactory.CriaWsdlConsultaProtocolo(configuracaoServico); + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + + var consSitCTe = ClassesFactory.CriarconsSitCTe(chave, configServico); + + if (configServico.IsValidaSchemas) + consSitCTe.ValidarSchema(configServico); + + consSitCTe.SalvarXmlEmDisco(configServico); + + var webService = WsdlFactory.CriaWsdlConsultaProtocolo(configServico); var retornoXml = await webService.cteConsultaCTAsync(consSitCTe.CriaRequestWs()); var retorno = retConsSitCTe.LoadXml(retornoXml.OuterXml, consSitCTe); - retorno.SalvarXmlEmDisco(chave, configuracaoServico); + retorno.SalvarXmlEmDisco(chave, configServico); return retorno; } diff --git a/CTe.Servicos/ConsultaRecibo/ConsultaReciboServico.cs b/CTe.Servicos/ConsultaRecibo/ConsultaReciboServico.cs index 6a2c8b595..67350d156 100644 --- a/CTe.Servicos/ConsultaRecibo/ConsultaReciboServico.cs +++ b/CTe.Servicos/ConsultaRecibo/ConsultaReciboServico.cs @@ -50,36 +50,40 @@ public ConsultaReciboServico(string recibo) public retConsReciCTe Consultar(ConfiguracaoServico configuracaoServico = null) { - var consReciCTe = ClassesFactory.CriaConsReciCTe(_recibo, configuracaoServico); - - if (configuracaoServico.IsValidaSchemas) - consReciCTe.ValidarSchema(configuracaoServico); - - consReciCTe.SalvarXmlEmDisco(configuracaoServico); - - var webService = WsdlFactory.CriaWsdlCteRetRecepcao(configuracaoServico); + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + + var consReciCTe = ClassesFactory.CriaConsReciCTe(_recibo, configServico); + + if (configServico.IsValidaSchemas) + consReciCTe.ValidarSchema(configServico); + + consReciCTe.SalvarXmlEmDisco(configServico); + + var webService = WsdlFactory.CriaWsdlCteRetRecepcao(configServico); var retornoXml = webService.cteRetRecepcao(consReciCTe.CriaRequestWs()); var retorno = retConsReciCTe.LoadXml(retornoXml.OuterXml, consReciCTe); - retorno.SalvarXmlEmDisco(configuracaoServico); + retorno.SalvarXmlEmDisco(configServico); return retorno; } public async Task<retConsReciCTe> ConsultarAsync(ConfiguracaoServico configuracaoServico = null) { - var consReciCTe = ClassesFactory.CriaConsReciCTe(_recibo, configuracaoServico); - - if (configuracaoServico.IsValidaSchemas) - consReciCTe.ValidarSchema(configuracaoServico); - - consReciCTe.SalvarXmlEmDisco(configuracaoServico); - - var webService = WsdlFactory.CriaWsdlCteRetRecepcao(configuracaoServico); + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + + var consReciCTe = ClassesFactory.CriaConsReciCTe(_recibo, configServico); + + if (configServico.IsValidaSchemas) + consReciCTe.ValidarSchema(configServico); + + consReciCTe.SalvarXmlEmDisco(configServico); + + var webService = WsdlFactory.CriaWsdlCteRetRecepcao(configServico); var retornoXml = await webService.cteRetRecepcaoAsync(consReciCTe.CriaRequestWs()); var retorno = retConsReciCTe.LoadXml(retornoXml.OuterXml, consReciCTe); - retorno.SalvarXmlEmDisco(configuracaoServico); + retorno.SalvarXmlEmDisco(configServico); return retorno; } diff --git a/CTe.Servicos/DistribuicaoDFe/ServicoCTeDistribuicaoDFe.cs b/CTe.Servicos/DistribuicaoDFe/ServicoCTeDistribuicaoDFe.cs index 55ce9f7a6..e068c9f3e 100644 --- a/CTe.Servicos/DistribuicaoDFe/ServicoCTeDistribuicaoDFe.cs +++ b/CTe.Servicos/DistribuicaoDFe/ServicoCTeDistribuicaoDFe.cs @@ -79,6 +79,7 @@ public ServicoCTeDistribuicaoDFe(ConfiguracaoServico configuracaoServico, X509Ce public RetornoCteDistDFeInt CTeDistDFeInteresse(string ufAutor, string documento, string ultNSU = "0", string nSU = "0", ConfiguracaoServico configuracaoServico = null) { var configServico = configuracaoServico ?? _configuracaoServico ?? ConfiguracaoServico.Instancia; + distDFeInt pedDistDFeInt; XmlDocument dadosConsulta; var ws = InicializaCTeDistDFeInteresse(documento, ultNSU, nSU, out pedDistDFeInt, out dadosConsulta, configServico); diff --git a/CTe.Servicos/EnviarCte/ServicoEnviarCte.cs b/CTe.Servicos/EnviarCte/ServicoEnviarCte.cs index b21d20cc0..583b08f54 100644 --- a/CTe.Servicos/EnviarCte/ServicoEnviarCte.cs +++ b/CTe.Servicos/EnviarCte/ServicoEnviarCte.cs @@ -14,10 +14,10 @@ public class ServicoEnviarCte public RetornoEnviarCte Enviar(int lote, Classes.CTe cte, ConfiguracaoServico configuracaoServico = null) { var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; - + ServicoCTeRecepcao servicoRecepcao = new ServicoCTeRecepcao(); - retEnviCte retEnviCte = servicoRecepcao.CTeRecepcao(lote, new List<Classes.CTe> {cte}, configServico); + retEnviCte retEnviCte = servicoRecepcao.CTeRecepcao(lote, new List<Classes.CTe> { cte }, configServico); if (retEnviCte.cStat != 103) { @@ -28,7 +28,6 @@ public RetornoEnviarCte Enviar(int lote, Classes.CTe cte, ConfiguracaoServico co retConsReciCTe retConsReciCTe = servicoConsultaRecibo.Consultar(configServico); - cteProc cteProc = null; if (retConsReciCTe.cStat == 104) { @@ -54,6 +53,7 @@ public RetornoEnviarCte Enviar(int lote, Classes.CTe cte, ConfiguracaoServico co public async Task<RetornoEnviarCte> EnviarAsync(int lote, Classes.CTe cte, ConfiguracaoServico configuracaoServico = null) { var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + ServicoCTeRecepcao servicoRecepcao = new ServicoCTeRecepcao(); retEnviCte retEnviCte = await servicoRecepcao.CTeRecepcaoAsync(lote, new List<Classes.CTe> { cte }, configServico); diff --git a/CTe.Servicos/Eventos/EventoCancelamento.cs b/CTe.Servicos/Eventos/EventoCancelamento.cs index 5584303e0..c644667fb 100644 --- a/CTe.Servicos/Eventos/EventoCancelamento.cs +++ b/CTe.Servicos/Eventos/EventoCancelamento.cs @@ -72,30 +72,33 @@ public EventoCancelamento(CteEletronicoOS cte, int sequenciaEvento, string numer public retEventoCTe Cancelar(ConfiguracaoServico configuracaoServico = null) { + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; var evento = ClassesFactory.CriaEvCancCTe(_justificativa, _numeroProtocolo); - EventoEnviado = FactoryEvento.CriaEvento(CTeTipoEvento.Cancelamento, _sequenciaEvento, _cte.Chave(), _cte.infCte.emit.CNPJ, evento, configuracaoServico); - RetornoSefaz = new ServicoController().Executar(_cte, _sequenciaEvento, evento, CTeTipoEvento.Cancelamento, configuracaoServico); + EventoEnviado = FactoryEvento.CriaEvento(CTeTipoEvento.Cancelamento, _sequenciaEvento, _cte.Chave(), _cte.infCte.emit.CNPJ, evento, configServico); + RetornoSefaz = new ServicoController().Executar(_cte, _sequenciaEvento, evento, CTeTipoEvento.Cancelamento, configServico); return RetornoSefaz; } public retEventoCTe CancelarOs(ConfiguracaoServico configuracaoServico = null) { + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; var evento = ClassesFactory.CriaEvCancCTe(_justificativa, _numeroProtocolo); - EventoEnviado = FactoryEvento.CriaEvento(CTeTipoEvento.Cancelamento, _sequenciaEvento, _cteOs.Chave(), _cteOs.InfCte.emit.CNPJ, evento, configuracaoServico); - RetornoSefaz = new ServicoController().Executar(_cteOs, _sequenciaEvento, evento, CTeTipoEvento.Cancelamento, configuracaoServico); + EventoEnviado = FactoryEvento.CriaEvento(CTeTipoEvento.Cancelamento, _sequenciaEvento, _cteOs.Chave(), _cteOs.InfCte.emit.CNPJ, evento, configServico); + RetornoSefaz = new ServicoController().Executar(_cteOs, _sequenciaEvento, evento, CTeTipoEvento.Cancelamento, configServico); return RetornoSefaz; } public async Task<retEventoCTe> CancelarAsync(ConfiguracaoServico configuracaoServico = null) { + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; var evento = ClassesFactory.CriaEvCancCTe(_justificativa, _numeroProtocolo); - EventoEnviado = FactoryEvento.CriaEvento(CTeTipoEvento.Cancelamento, _sequenciaEvento, _cte.Chave(), _cte.infCte.emit.CNPJ, evento, configuracaoServico); - RetornoSefaz = await new ServicoController().ExecutarAsync(_cte, _sequenciaEvento, evento, CTeTipoEvento.Cancelamento, configuracaoServico); + EventoEnviado = FactoryEvento.CriaEvento(CTeTipoEvento.Cancelamento, _sequenciaEvento, _cte.Chave(), _cte.infCte.emit.CNPJ, evento, configServico); + RetornoSefaz = await new ServicoController().ExecutarAsync(_cte, _sequenciaEvento, evento, CTeTipoEvento.Cancelamento, configServico); return RetornoSefaz; } diff --git a/CTe.Servicos/Eventos/FactoryEvento.cs b/CTe.Servicos/Eventos/FactoryEvento.cs index 04eaaca51..f862794e2 100644 --- a/CTe.Servicos/Eventos/FactoryEvento.cs +++ b/CTe.Servicos/Eventos/FactoryEvento.cs @@ -47,7 +47,8 @@ public class FactoryEvento //Vou manter para evitar quebra de código pois a classe e o metodo são publicos public static eventoCTe CriaEvento(CTeEletronico cte, CTeTipoEvento cTeTipoEvento, int sequenciaEvento, EventoContainer container, ConfiguracaoServico configuracaoServico = null) { - return CriaEvento(cTeTipoEvento, sequenciaEvento, cte.Chave(), cte.infCte.emit.CNPJ, container, configuracaoServico); + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + return CriaEvento(cTeTipoEvento, sequenciaEvento, cte.Chave(), cte.infCte.emit.CNPJ, container, configServico); } public static eventoCTe CriaEvento(CTeTipoEvento cTeTipoEvento, int sequenciaEvento, string chave, string cnpj, EventoContainer container, ConfiguracaoServico configuracaoServico = null) diff --git a/CTe.Servicos/Eventos/ServicoController.cs b/CTe.Servicos/Eventos/ServicoController.cs index 4754c5c2d..390af483c 100644 --- a/CTe.Servicos/Eventos/ServicoController.cs +++ b/CTe.Servicos/Eventos/ServicoController.cs @@ -50,64 +50,74 @@ public class ServicoController : IServicoController { public retEventoCTe Executar(CteEletronico cte, int sequenciaEvento, EventoContainer container, CTeTipoEvento cTeTipoEvento, ConfiguracaoServico configuracaoServico = null) { - return Executar(cTeTipoEvento, sequenciaEvento, cte.Chave(), cte.infCte.emit.CNPJ, container, configuracaoServico); + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + return Executar(cTeTipoEvento, sequenciaEvento, cte.Chave(), cte.infCte.emit.CNPJ, container, configServico); } public retEventoCTe Executar(CteEletronicoOS cte, int sequenciaEvento, EventoContainer container, CTeTipoEvento cTeTipoEvento, ConfiguracaoServico configuracaoServico = null) { - return Executar(cTeTipoEvento, sequenciaEvento, cte.Chave(), cte.InfCte.emit.CNPJ, container, configuracaoServico); + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + return Executar(cTeTipoEvento, sequenciaEvento, cte.Chave(), cte.InfCte.emit.CNPJ, container, configServico); } public async Task<retEventoCTe> ExecutarAsync(CteEletronico cte, int sequenciaEvento, EventoContainer container, CTeTipoEvento cTeTipoEvento, ConfiguracaoServico configuracaoServico = null) { - return await ExecutarAsync(cTeTipoEvento, sequenciaEvento, cte.Chave(), cte.infCte.emit.CNPJ, container, configuracaoServico); + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + return await ExecutarAsync(cTeTipoEvento, sequenciaEvento, cte.Chave(), cte.infCte.emit.CNPJ, container, configServico); } public retEventoCTe Executar(CTeTipoEvento cTeTipoEvento, int sequenciaEvento, string chave, string cnpj, EventoContainer container, ConfiguracaoServico configuracaoServico = null) { - var evento = FactoryEvento.CriaEvento(cTeTipoEvento, sequenciaEvento, chave, cnpj, container, configuracaoServico); - evento.Assina(configuracaoServico); - + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + var evento = FactoryEvento.CriaEvento(cTeTipoEvento, sequenciaEvento, chave, cnpj, container, configServico); + evento.Assina(configServico); + if (configuracaoServico.IsValidaSchemas) - evento.ValidarSchema(configuracaoServico); + evento.ValidarSchema(configServico); - evento.SalvarXmlEmDisco(configuracaoServico); + evento.SalvarXmlEmDisco(configServico); XmlNode retornoXml = null; if (evento.versao == versao.ve200 || evento.versao == versao.ve300) { - var webService = WsdlFactory.CriaWsdlCteEvento(configuracaoServico); + var webService = WsdlFactory.CriaWsdlCteEvento(configServico); retornoXml = webService.cteRecepcaoEvento(evento.CriaXmlRequestWs()); } if (evento.versao == versao.ve400) { - var webService = WsdlFactory.CriaWsdlCteEventoV4(configuracaoServico); + var webService = WsdlFactory.CriaWsdlCteEventoV4(configServico); retornoXml = webService.cteRecepcaoEvento(evento.CriaXmlRequestWs()); } var retorno = retEventoCTe.LoadXml(retornoXml.OuterXml, evento); - retorno.SalvarXmlEmDisco(configuracaoServico); + retorno.SalvarXmlEmDisco(configServico); return retorno; } - public async Task<retEventoCTe> ExecutarAsync(CTeTipoEvento cTeTipoEvento, int sequenciaEvento, string chave, string cnpj, EventoContainer container, ConfiguracaoServico configuracaoServico = null) + public async Task<retEventoCTe> ExecutarAsync(CTeTipoEvento cTeTipoEvento, + int sequenciaEvento, + string chave, string + cnpj, EventoContainer container, + ConfiguracaoServico configuracaoServico = null) { - var evento = FactoryEvento.CriaEvento(cTeTipoEvento, sequenciaEvento, chave, cnpj, container, configuracaoServico); - evento.Assina(configuracaoServico); - - if (configuracaoServico.IsValidaSchemas) - evento.ValidarSchema(configuracaoServico); - - evento.SalvarXmlEmDisco(configuracaoServico); + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + + var evento = FactoryEvento.CriaEvento(cTeTipoEvento, sequenciaEvento, chave, cnpj, container, configServico); + evento.Assina(configServico); + + if (configServico.IsValidaSchemas) + evento.ValidarSchema(configServico); + + evento.SalvarXmlEmDisco(configServico); - var webService = WsdlFactory.CriaWsdlCteEvento(configuracaoServico); + var webService = WsdlFactory.CriaWsdlCteEvento(configServico); var retornoXml = await webService.cteRecepcaoEventoAsync(evento.CriaXmlRequestWs()); var retorno = retEventoCTe.LoadXml(retornoXml.OuterXml, evento); - retorno.SalvarXmlEmDisco(configuracaoServico); + retorno.SalvarXmlEmDisco(configServico); return retorno; } diff --git a/CTe.Servicos/Factory/WsdlFactory.cs b/CTe.Servicos/Factory/WsdlFactory.cs index 1987fdf67..fb633d0e2 100644 --- a/CTe.Servicos/Factory/WsdlFactory.cs +++ b/CTe.Servicos/Factory/WsdlFactory.cs @@ -134,9 +134,11 @@ public static CteRecepcaoEvento CriaWsdlCteEvento(ConfiguracaoServico configurac public static CteRecepcaoEventoV4 CriaWsdlCteEventoV4(ConfiguracaoServico configuracaoServico = null, X509Certificate2 certificado = null) { - var url = UrlHelper.ObterUrlServico(configuracaoServico).CteRecepcaoEvento; + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; - var configuracaoWsdl = CriaConfiguracao(url, configuracaoServico, certificado); + var url = UrlHelper.ObterUrlServico(configServico).CteRecepcaoEvento; + + var configuracaoWsdl = CriaConfiguracao(url, configServico, certificado); return new CteRecepcaoEventoV4(configuracaoWsdl); } diff --git a/CTe.Servicos/Inutilizacao/InutilizacaoServico.cs b/CTe.Servicos/Inutilizacao/InutilizacaoServico.cs index da6f10e2e..361674039 100644 --- a/CTe.Servicos/Inutilizacao/InutilizacaoServico.cs +++ b/CTe.Servicos/Inutilizacao/InutilizacaoServico.cs @@ -78,32 +78,36 @@ public InutilizacaoServico(ConfigInutiliza configInutiliza) public retInutCTe Inutilizar(ConfiguracaoServico configuracaoServico = null) { - var inutCte = ClassesFactory.CriaInutCTe(_configInutiliza, configuracaoServico); - inutCte.Assinar(configuracaoServico); - inutCte.ValidarShcema(configuracaoServico); - inutCte.SalvarXmlEmDisco(configuracaoServico); + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; - var webService = WsdlFactory.CriaWsdlCteInutilizacao(configuracaoServico); + var inutCte = ClassesFactory.CriaInutCTe(_configInutiliza, configServico); + inutCte.Assinar(configServico); + inutCte.ValidarSchema(configServico); + inutCte.SalvarXmlEmDisco(configServico); + + var webService = WsdlFactory.CriaWsdlCteInutilizacao(configServico); var retornoXml = webService.cteInutilizacaoCT(inutCte.CriaRequestWs()); var retorno = retInutCTe.LoadXml(retornoXml.OuterXml, inutCte); - retorno.SalvarXmlEmDisco(inutCte.infInut.Id.Substring(2), configuracaoServico); + retorno.SalvarXmlEmDisco(inutCte.infInut.Id.Substring(2), configServico); return retorno; } public async Task<retInutCTe> InutilizarAsync(ConfiguracaoServico configuracaoServico = null) { - var inutCte = ClassesFactory.CriaInutCTe(_configInutiliza, configuracaoServico); - inutCte.Assinar(configuracaoServico); - inutCte.ValidarShcema(configuracaoServico); - inutCte.SalvarXmlEmDisco(configuracaoServico); + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + + var inutCte = ClassesFactory.CriaInutCTe(_configInutiliza, configServico); + inutCte.Assinar(configServico); + inutCte.ValidarSchema(configServico); + inutCte.SalvarXmlEmDisco(configServico); - var webService = WsdlFactory.CriaWsdlCteInutilizacao(configuracaoServico); + var webService = WsdlFactory.CriaWsdlCteInutilizacao(configServico); var retornoXml = await webService.cteInutilizacaoCTAsync(inutCte.CriaRequestWs()); var retorno = retInutCTe.LoadXml(retornoXml.OuterXml, inutCte); - retorno.SalvarXmlEmDisco(inutCte.infInut.Id.Substring(2), configuracaoServico); + retorno.SalvarXmlEmDisco(inutCte.infInut.Id.Substring(2), configServico); return retorno; } diff --git a/CTe.Servicos/Recepcao/ServicoCTeRecepcao.cs b/CTe.Servicos/Recepcao/ServicoCTeRecepcao.cs index b24d962d3..7ac0ee9f0 100644 --- a/CTe.Servicos/Recepcao/ServicoCTeRecepcao.cs +++ b/CTe.Servicos/Recepcao/ServicoCTeRecepcao.cs @@ -53,32 +53,36 @@ public class ServicoCTeRecepcao public retEnviCte CTeRecepcao(int lote, List<CTeEletronico> cteEletronicosList, ConfiguracaoServico configuracaoServico = null) { - var enviCte = PreparaEnvioCTe(lote, cteEletronicosList, configuracaoServico); + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; - var webService = WsdlFactory.CriaWsdlCteRecepcao(configuracaoServico); + var enviCte = PreparaEnvioCTe(lote, cteEletronicosList, configServico); + + var webService = WsdlFactory.CriaWsdlCteRecepcao(configServico); OnAntesDeEnviar(enviCte); - var retornoXml = webService.cteRecepcaoLote(enviCte.CriaRequestWs(configuracaoServico)); + var retornoXml = webService.cteRecepcaoLote(enviCte.CriaRequestWs(configServico)); var retorno = retEnviCte.LoadXml(retornoXml.OuterXml, enviCte); - retorno.SalvarXmlEmDisco(configuracaoServico); + retorno.SalvarXmlEmDisco(configServico); return retorno; } public async Task<retEnviCte> CTeRecepcaoAsync(int lote, List<CTeEletronico> cteEletronicosList, ConfiguracaoServico configuracaoServico = null) { - var enviCte = PreparaEnvioCTe(lote, cteEletronicosList, configuracaoServico); + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + + var enviCte = PreparaEnvioCTe(lote, cteEletronicosList, configServico); - var webService = WsdlFactory.CriaWsdlCteRecepcao(configuracaoServico); + var webService = WsdlFactory.CriaWsdlCteRecepcao(configServico); OnAntesDeEnviar(enviCte); - var retornoXml = await webService.cteRecepcaoLoteAsync(enviCte.CriaRequestWs(configuracaoServico)); + var retornoXml = await webService.cteRecepcaoLoteAsync(enviCte.CriaRequestWs(configServico)); var retorno = retEnviCte.LoadXml(retornoXml.OuterXml, enviCte); - retorno.SalvarXmlEmDisco(configuracaoServico); + retorno.SalvarXmlEmDisco(configServico); return retorno; } @@ -110,14 +114,14 @@ public retCTe CTeRecepcaoSincronoV4(CTeEletronico cte, ConfiguracaoServico confi cte.ValidaSchema(instanciaConfiguracao); cte.SalvarXmlEmDisco(instanciaConfiguracao); - var webService = WsdlFactory.CriaWsdlCteRecepcaoSincronoV4(configuracaoServico); + var webService = WsdlFactory.CriaWsdlCteRecepcaoSincronoV4(instanciaConfiguracao); //OnAntesDeEnviar(enviCte); - var retornoXml = webService.CTeRecepcaoSincV4(cte.CriaRequestWs(configuracaoServico)); + var retornoXml = webService.CTeRecepcaoSincV4(cte.CriaRequestWs(instanciaConfiguracao)); var retorno = retCTe.LoadXml(retornoXml.OuterXml, cte); - retorno.SalvarXmlEmDisco(cte.Chave(), configuracaoServico); + retorno.SalvarXmlEmDisco(cte.Chave(), instanciaConfiguracao); return retorno; } diff --git a/CTe.Utils/CTe/ExCteOSProc.cs b/CTe.Utils/CTe/ExCteOSProc.cs new file mode 100644 index 000000000..c990a2edf --- /dev/null +++ b/CTe.Utils/CTe/ExCteOSProc.cs @@ -0,0 +1,101 @@ +/********************************************************************************/ +/* Projeto: Biblioteca ZeusNFe */ +/* Biblioteca C# para emissão de Nota Fiscal Eletrônica - NFe e Nota Fiscal de */ +/* Consumidor Eletrônica - NFC-e (http://www.nfe.fazenda.gov.br) */ +/* */ +/* Direitos Autorais Reservados (c) 2014 Adenilton Batista da Silva */ +/* Zeusdev Tecnologia LTDA ME */ +/* */ +/* Você pode obter a última versão desse arquivo no GitHub */ +/* localizado em https://github.com/adeniltonbs/Zeus.Net.NFe.NFCe */ +/* */ +/* */ +/* Esta biblioteca é software livre; você pode redistribuí-la e/ou modificá-la */ +/* sob os termos da Licença Pública Geral Menor do GNU conforme publicada pela */ +/* Free Software Foundation; tanto a versão 2.1 da Licença, ou (a seu critério) */ +/* qualquer versão posterior. */ +/* */ +/* Esta biblioteca é distribuída na expectativa de que seja útil, porém, SEM */ +/* NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU */ +/* ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral Menor*/ +/* do GNU para mais detalhes. (Arquivo LICENÇA.TXT ou LICENSE.TXT) */ +/* */ +/* Você deve ter recebido uma cópia da Licença Pública Geral Menor do GNU junto*/ +/* com esta biblioteca; se não, escreva para a Free Software Foundation, Inc., */ +/* no endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. */ +/* Você também pode obter uma copia da licença em: */ +/* http://www.opensource.org/licenses/lgpl-license.php */ +/* */ +/* Zeusdev Tecnologia LTDA ME - adenilton@zeusautomacao.com.br */ +/* http://www.zeusautomacao.com.br/ */ +/* Rua Comendador Francisco josé da Cunha, 111 - Itabaiana - SE - 49500-000 */ +/********************************************************************************/ + +using System.IO; +using CTe.Classes; +using DFe.Utils; +using cteOSProc = CTe.Classes.cteOSProc; + +namespace CTe.Utils.CTe +{ + public static class ExtCteOSProc + { + /// <summary> + /// Carrega um arquivo XML para um objeto da classe cteOSProc + /// </summary> + /// <param name="cteOSProc"></param> + /// <param name="arquivoXml">arquivo XML</param> + /// <returns>Retorna um cteOSProc carregada com os dados do XML</returns> + public static cteOSProc CarregarDeArquivoXml(this cteOSProc cteOSProc, string arquivoXml) + { + return FuncoesXml.ArquivoXmlParaClasse<cteOSProc>(arquivoXml); + } + + /// <summary> + /// Converte o objeto cteOSProc para uma string no formato XML + /// </summary> + /// <param name="cteOSProc"></param> + /// <returns>Retorna uma string no formato XML com os dados do cteOSProc</returns> + public static string ObterXmlString(this cteOSProc cteOSProc) + { + return FuncoesXml.ClasseParaXmlString(cteOSProc); + } + + /// <summary> + /// Coverte uma string XML no formato cteOSProc para um objeto cteOSProc + /// </summary> + /// <param name="cteOSProc"></param> + /// <param name="xmlString"></param> + /// <returns>Retorna um objeto do tipo cteOSProc</returns> + public static cteOSProc CarregarDeXmlString(this cteOSProc cteOSProc, string xmlString) + { + var s = FuncoesXml.ObterNodeDeStringXml(typeof(cteOSProc).Name, xmlString); + return FuncoesXml.XmlStringParaClasse<cteOSProc>(s); + } + + /// <summary> + /// Grava os dados do objeto cteOSProc em um arquivo XML + /// </summary> + /// <param name="cteOSProc">Objeto cteOSProc</param> + /// <param name="arquivoXml">Diretório com nome do arquivo a ser gravado</param> + public static void SalvarArquivoXml(this cteOSProc cteOSProc, string arquivoXml) + { + FuncoesXml.ClasseParaArquivoXml(cteOSProc, arquivoXml); + } + + public static void SalvarXmlEmDisco(this cteOSProc cteOSProc, ConfiguracaoServico configuracaoServico = null) + { + if (cteOSProc == null) return; + + var instanciaServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + + if (instanciaServico.NaoSalvarXml()) return; + + var caminhoXml = instanciaServico.DiretorioSalvarXml; + + var arquivoSalvar = Path.Combine(caminhoXml, cteOSProc.CTeOS.Chave() + "-cteOSProc.xml"); + + FuncoesXml.ClasseParaArquivoXml(cteOSProc, arquivoSalvar); + } + } +} \ No newline at end of file diff --git a/CTe.Utils/CTe/ExtCTe.cs b/CTe.Utils/CTe/ExtCTe.cs index 7d216f594..e0f3d31f7 100644 --- a/CTe.Utils/CTe/ExtCTe.cs +++ b/CTe.Utils/CTe/ExtCTe.cs @@ -61,7 +61,7 @@ public static class ExtCTe /// <returns>Retorna uma NFe carregada com os dados do XML</returns> public static CteEletronica CarregarDeArquivoXml(this CteEletronica cte, string arquivoXml) { - var s = FuncoesXml.ObterNodeDeArquivoXml(typeof (CteEletronica).Name, arquivoXml); + var s = FuncoesXml.ObterNodeDeArquivoXml(typeof(CteEletronica).Name, arquivoXml); return FuncoesXml.XmlStringParaClasse<CteEletronica>(s); } @@ -83,7 +83,7 @@ public static string ObterXmlString(this CteEletronica cte) /// <returns>Retorna um objeto do tipo CTe</returns> public static CteEletronica CarregarDeXmlString(this CteEletronica cte, string xmlString) { - var s = FuncoesXml.ObterNodeDeStringXml(typeof (CteEletronica).Name, xmlString); + var s = FuncoesXml.ObterNodeDeStringXml(typeof(CteEletronica).Name, xmlString); return FuncoesXml.XmlStringParaClasse<CteEletronica>(s); } @@ -100,6 +100,7 @@ public static void ValidaSchema(this CteEletronica cte, ConfiguracaoServico conf var xmlValidacao = cte.ObterXmlString(); var servicoInstancia = configuracaoServico ?? ConfiguracaoServico.Instancia; + if (!servicoInstancia.IsValidaSchemas) return; @@ -120,7 +121,7 @@ public static void ValidaSchema(this CteEletronica cte, ConfiguracaoServico conf "versão 2.00 é 3.00"); } - if (cte.infCte.ide.tpCTe != tpCTe.Anulacao && cte.infCte.ide.tpCTe != tpCTe.Complemento) // Ct-e do Tipo Anulação/Complemento não tem Informações do Modal + if (cte.infCte.ide.tpCTe != tpCTe.Anulacao && cte.infCte.ide.tpCTe != tpCTe.Complemento) // Ct-e do Tipo Anulação/Complemento não tem Informações do Modal { var xmlModal = FuncoesXml.ClasseParaXmlString(cte.infCte.infCTeNorm.infModal); @@ -291,7 +292,7 @@ public static infCTeSupl QrCode(this CteEletronica cte, X509Certificate2 certifi qrCode.Append("&"); qrCode.Append("tpAmb=").Append((int)cte.infCte.ide.tpAmb); - if (cte.infCte.ide.tpEmis != tpEmis.teNormal + if (cte.infCte.ide.tpEmis != tpEmis.teNormal && cte.infCte.ide.tpEmis != tpEmis.teSVCRS && cte.infCte.ide.tpEmis != tpEmis.teSVCSP ) diff --git a/CTe.Utils/CTe/ExtEnvCte.cs b/CTe.Utils/CTe/ExtEnvCte.cs index e215f5154..8b698b751 100644 --- a/CTe.Utils/CTe/ExtEnvCte.cs +++ b/CTe.Utils/CTe/ExtEnvCte.cs @@ -47,16 +47,18 @@ public static class ExtEnvCte { public static void ValidaSchema(this enviCTe enviCTe, ConfiguracaoServico configuracaoServico = null) { + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + var xmlValidacao = enviCTe.ObterXmlString(); switch (enviCTe.versao) { case versao.ve200: - Validador.Valida(xmlValidacao, "enviCTe_v2.00.xsd", configuracaoServico); + Validador.Valida(xmlValidacao, "enviCTe_v2.00.xsd", configServico); break; case versao.ve400: case versao.ve300: - Validador.Valida(xmlValidacao, "enviCTe_v3.00.xsd", configuracaoServico); + Validador.Valida(xmlValidacao, "enviCTe_v3.00.xsd", configServico); break; default: throw new InvalidOperationException("Nos achamos um erro na hora de validar o schema, " + @@ -93,7 +95,7 @@ public static XmlDocument CriaRequestWs(this enviCTe enviCTe, ConfiguracaoServic var request = new XmlDocument(); var xml = enviCTe.ObterXmlString(); - + var instanciaServico = configuracaoServico ?? ConfiguracaoServico.Instancia; if (instanciaServico.cUF == Estado.PR diff --git a/CTe.Utils/DistribuicaoDFe/ExtdistDFeInt.cs b/CTe.Utils/DistribuicaoDFe/ExtdistDFeInt.cs index 1ad4ec66c..6b73322d1 100644 --- a/CTe.Utils/DistribuicaoDFe/ExtdistDFeInt.cs +++ b/CTe.Utils/DistribuicaoDFe/ExtdistDFeInt.cs @@ -54,16 +54,17 @@ public static string ObterXmlString(this distDFeInt pedDistDFeInt) public static void ValidaSchema(this distDFeInt pedDistDFeInt, ConfiguracaoServico configuracaoServico = null) { + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + var xmlValidacao = pedDistDFeInt.ObterXmlString(); - if (pedDistDFeInt.versao.Equals("1.00")) { - Validador.Valida(xmlValidacao, "distDFeInt_v1.00.xsd", configuracaoServico); + Validador.Valida(xmlValidacao, "distDFeInt_v1.00.xsd", configServico); } else if (pedDistDFeInt.versao.Equals("1.10")) { - Validador.Valida(xmlValidacao, "distDFeInt_v1.10.xsd", configuracaoServico); + Validador.Valida(xmlValidacao, "distDFeInt_v1.10.xsd", configServico); } else { diff --git a/CTe.Utils/Evento/Extevento.cs b/CTe.Utils/Evento/Extevento.cs index 7ecb83498..9f866503b 100644 --- a/CTe.Utils/Evento/Extevento.cs +++ b/CTe.Utils/Evento/Extevento.cs @@ -74,18 +74,20 @@ public static void Assina(this eventoCTe eventoCTe, ConfiguracaoServico configur public static void ValidarSchema(this eventoCTe eventoCTe, ConfiguracaoServico configuracaoServico = null) { + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + var xmlEvento = eventoCTe.ObterXmlString(); switch (eventoCTe.versao) { case versao.ve200: - Validador.Valida(xmlEvento, "eventoCTe_v2.00.xsd", configuracaoServico); + Validador.Valida(xmlEvento, "eventoCTe_v2.00.xsd", configServico); break; case versao.ve300: - Validador.Valida(xmlEvento, "eventoCTe_v3.00.xsd", configuracaoServico); + Validador.Valida(xmlEvento, "eventoCTe_v3.00.xsd", configServico); break; case versao.ve400: - Validador.Valida(xmlEvento, "eventoCTe_v4.00.xsd", configuracaoServico); + Validador.Valida(xmlEvento, "eventoCTe_v4.00.xsd", configServico); break; default: throw new InvalidOperationException("Nos achamos um erro na hora de validar o schema, " + @@ -98,22 +100,24 @@ public static void ValidarSchema(this eventoCTe eventoCTe, ConfiguracaoServico c private static void ValidarSchemaEventoContainer(EventoContainer container, versao versao, ConfiguracaoServico configuracaoServico = null) { + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + if (container.GetType() == typeof(evCancCTe)) { - var evCancCTe = (evCancCTe) container; + var evCancCTe = (evCancCTe)container; var xmlEventoCancelamento = evCancCTe.ObterXmlString(); switch (versao) { case versao.ve200: - Validador.Valida(xmlEventoCancelamento, "evCancCTe_v2.00.xsd", configuracaoServico); + Validador.Valida(xmlEventoCancelamento, "evCancCTe_v2.00.xsd", configServico); break; case versao.ve300: - Validador.Valida(xmlEventoCancelamento, "evCancCTe_v3.00.xsd", configuracaoServico); + Validador.Valida(xmlEventoCancelamento, "evCancCTe_v3.00.xsd", configServico); break; case versao.ve400: - Validador.Valida(xmlEventoCancelamento, "evCancCTe_v4.00.xsd", configuracaoServico); + Validador.Valida(xmlEventoCancelamento, "evCancCTe_v4.00.xsd", configServico); break; default: throw new InvalidOperationException("Nos achamos um erro na hora de validar o schema, " + @@ -133,13 +137,13 @@ private static void ValidarSchemaEventoContainer(EventoContainer container, vers switch (versao) { case versao.ve200: - Validador.Valida(xmlEventoCCe, "evCCeCTe_v2.00.xsd", configuracaoServico); + Validador.Valida(xmlEventoCCe, "evCCeCTe_v2.00.xsd", configServico); break; case versao.ve300: - Validador.Valida(xmlEventoCCe, "evCCeCTe_v3.00.xsd", configuracaoServico); + Validador.Valida(xmlEventoCCe, "evCCeCTe_v3.00.xsd", configServico); break; case versao.ve400: - Validador.Valida(xmlEventoCCe, "evCCeCTe_v4.00.xsd", configuracaoServico); + Validador.Valida(xmlEventoCCe, "evCCeCTe_v4.00.xsd", configServico); break; default: throw new InvalidOperationException("Nos achamos um erro na hora de validar o schema, " + @@ -157,13 +161,13 @@ private static void ValidarSchemaEventoContainer(EventoContainer container, vers switch (versao) { case versao.ve200: - Validador.Valida(xmlEventoCCe, "evPrestDesacordo_v2.00.xsd", configuracaoServico); + Validador.Valida(xmlEventoCCe, "evPrestDesacordo_v2.00.xsd", configServico); break; case versao.ve300: - Validador.Valida(xmlEventoCCe, "evPrestDesacordo_v3.00.xsd", configuracaoServico); + Validador.Valida(xmlEventoCCe, "evPrestDesacordo_v3.00.xsd", configServico); break; case versao.ve400: - Validador.Valida(xmlEventoCCe, "evPrestDesacordo_v4.00.xsd", configuracaoServico); + Validador.Valida(xmlEventoCCe, "evPrestDesacordo_v4.00.xsd", configServico); break; default: throw new InvalidOperationException("Nos achamos um erro na hora de validar o schema, " + diff --git a/CTe.Utils/Extensoes/ExtConsReciCTe.cs b/CTe.Utils/Extensoes/ExtConsReciCTe.cs index 57797d21c..8b8a55b1b 100644 --- a/CTe.Utils/Extensoes/ExtConsReciCTe.cs +++ b/CTe.Utils/Extensoes/ExtConsReciCTe.cs @@ -45,15 +45,16 @@ public static class ExtConsReciCTe { public static void ValidarSchema(this consReciCTe consReciCTe, ConfiguracaoServico configuracaoServico = null) { + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; var xmlValidacao = consReciCTe.ObterXmlString(); switch (consReciCTe.versao) { case versao.ve200: - Validador.Valida(xmlValidacao, "consReciCTe_v2.00.xsd", configuracaoServico); + Validador.Valida(xmlValidacao, "consReciCTe_v2.00.xsd", configServico); break; case versao.ve300: - Validador.Valida(xmlValidacao, "consReciCTe_v3.00.xsd", configuracaoServico); + Validador.Valida(xmlValidacao, "consReciCTe_v3.00.xsd", configServico); break; default: throw new InvalidOperationException("Nos achamos um erro na hora de validar o schema, " + diff --git a/CTe.Utils/Extensoes/ExtconsSitCTe.cs b/CTe.Utils/Extensoes/ExtconsSitCTe.cs index 5831e5941..8b39caf4f 100644 --- a/CTe.Utils/Extensoes/ExtconsSitCTe.cs +++ b/CTe.Utils/Extensoes/ExtconsSitCTe.cs @@ -46,20 +46,23 @@ public static class ExtconsSitCTe public static void ValidarSchema(this consSitCTe consSitCTe, ConfiguracaoServico configuracaoServico = null) { + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + var xmlValidacao = consSitCTe.ObterXmlString(); switch (consSitCTe.versao) { case versao.ve200: - Validador.Valida(xmlValidacao, "consSitCTe_v2.00.xsd", configuracaoServico); + Validador.Valida(xmlValidacao, "consSitCTe_v2.00.xsd", configServico); break; case versao.ve300: - Validador.Valida(xmlValidacao, "consSitCTe_v3.00.xsd", configuracaoServico); + Validador.Valida(xmlValidacao, "consSitCTe_v3.00.xsd", configServico); break; case versao.ve400: - Validador.Valida(xmlValidacao, "consSitCTe_v4.00.xsd", configuracaoServico); + Validador.Valida(xmlValidacao, "consSitCTe_v4.00.xsd", configServico); break; - default: throw new InvalidOperationException("Nos achamos um erro na hora de validar o schema, " + + default: + throw new InvalidOperationException("Nos achamos um erro na hora de validar o schema, " + "a versão está inválida, somente é permitido " + "versão 2.00 é 3.00"); } diff --git a/CTe.Utils/Extensoes/ExtconsStatServCte.cs b/CTe.Utils/Extensoes/ExtconsStatServCte.cs index 91e99210c..049a1fbff 100644 --- a/CTe.Utils/Extensoes/ExtconsStatServCte.cs +++ b/CTe.Utils/Extensoes/ExtconsStatServCte.cs @@ -45,18 +45,20 @@ public static class ExtconsStatServCte { public static void ValidarSchema(this consStatServCte consStatServCte, ConfiguracaoServico configuracaoServico = null) { + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + var xmlValidacao = consStatServCte.ObterXmlString(); switch (consStatServCte.versao) { case versao.ve200: - Validador.Valida(xmlValidacao, "consStatServCTe_v2.00.xsd", configuracaoServico); + Validador.Valida(xmlValidacao, "consStatServCTe_v2.00.xsd", configServico); break; case versao.ve300: - Validador.Valida(xmlValidacao, "consStatServCTe_v3.00.xsd", configuracaoServico); + Validador.Valida(xmlValidacao, "consStatServCTe_v3.00.xsd", configServico); break; case versao.ve400: - Validador.Valida(xmlValidacao, "consStatServCTe_v4.00.xsd", configuracaoServico); + Validador.Valida(xmlValidacao, "consStatServCTe_v4.00.xsd", configServico); break; default: throw new InvalidOperationException("Nos achamos um erro na hora de validar o schema, " + @@ -82,8 +84,8 @@ public static void SalvarXmlEmDisco(this consStatServCte statuServCte, Configura if (instanciaServico.NaoSalvarXml()) return; var caminhoXml = instanciaServico.DiretorioSalvarXml; - - var arquivoSalvar = Path.Combine(caminhoXml, DateTime.Now.ParaDataHoraString() + "-ped-sta.xml"); + + var arquivoSalvar = Path.Combine(caminhoXml, DateTime.Now.ParaDataHoraString() + "-ped-sta.xml"); FuncoesXml.ClasseParaArquivoXml(statuServCte, arquivoSalvar); } @@ -101,18 +103,20 @@ public static class ExtconsStatServCTe { public static void ValidarSchema(this consStatServCTe consStatServCte, ConfiguracaoServico configuracaoServico = null) { + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; + var xmlValidacao = consStatServCte.ObterXmlString(); switch (consStatServCte.versao) { case versao.ve200: - Validador.Valida(xmlValidacao, "consStatServCTe_v2.00.xsd", configuracaoServico); + Validador.Valida(xmlValidacao, "consStatServCTe_v2.00.xsd", configServico); break; case versao.ve300: - Validador.Valida(xmlValidacao, "consStatServCTe_v3.00.xsd", configuracaoServico); + Validador.Valida(xmlValidacao, "consStatServCTe_v3.00.xsd", configServico); break; case versao.ve400: - Validador.Valida(xmlValidacao, "consStatServCTe_v4.00.xsd", configuracaoServico); + Validador.Valida(xmlValidacao, "consStatServCTe_v4.00.xsd", configServico); break; default: throw new InvalidOperationException("Nos achamos um erro na hora de validar o schema, " + diff --git a/CTe.Utils/Extensoes/ExtinutCTe.cs b/CTe.Utils/Extensoes/ExtinutCTe.cs index c13368910..66e9d691b 100644 --- a/CTe.Utils/Extensoes/ExtinutCTe.cs +++ b/CTe.Utils/Extensoes/ExtinutCTe.cs @@ -63,18 +63,19 @@ public static string ObterXmlString(this inutCTe pedInutilizacao) return FuncoesXml.ClasseParaXmlString(pedInutilizacao); } - public static void ValidarShcema(this inutCTe inutCTe, ConfiguracaoServico configuracaoServico = null) + public static void ValidarSchema(this inutCTe inutCTe, ConfiguracaoServico configuracaoServico = null) { + var configServico = configuracaoServico ?? ConfiguracaoServico.Instancia; var xmlValidacao = inutCTe.ObterXmlString(); switch (inutCTe.versao) { case versao.ve200: - Validador.Valida(xmlValidacao, "inutCTe_v2.00.xsd", configuracaoServico); + Validador.Valida(xmlValidacao, "inutCTe_v2.00.xsd", configServico); break; case versao.ve300: - Validador.Valida(xmlValidacao, "inutCTe_v3.00.xsd", configuracaoServico); + Validador.Valida(xmlValidacao, "inutCTe_v3.00.xsd", configServico); break; default: throw new InvalidOperationException("Nos achamos um erro na hora de validar o schema, " + @@ -91,7 +92,7 @@ public static void SalvarXmlEmDisco(this inutCTe inutCTe, ConfiguracaoServico co var caminhoXml = instanciaServico.DiretorioSalvarXml; - var arquivoSalvar = Path.Combine(caminhoXml, inutCTe.infInut.Id+ "-ped-inu.xml"); + var arquivoSalvar = Path.Combine(caminhoXml, inutCTe.infInut.Id + "-ped-inu.xml"); FuncoesXml.ClasseParaArquivoXml(inutCTe, arquivoSalvar); } diff --git a/CTe.Utils/Inutilizacao/ExtretInutCTe.cs b/CTe.Utils/Inutilizacao/ExtretInutCTe.cs index c0b4c211d..6e378da2c 100644 --- a/CTe.Utils/Inutilizacao/ExtretInutCTe.cs +++ b/CTe.Utils/Inutilizacao/ExtretInutCTe.cs @@ -60,8 +60,6 @@ public static string ObterXmlString(this retInutCTe retInutCTe) { return FuncoesXml.ClasseParaXmlString(retInutCTe); } - - public static void SalvarXmlEmDisco(this retInutCTe retInutCTe, string chaveNome, ConfiguracaoServico configuracaoServico = null) { var instanciaServico = configuracaoServico ?? ConfiguracaoServico.Instancia; @@ -69,11 +67,10 @@ public static void SalvarXmlEmDisco(this retInutCTe retInutCTe, string chaveNome if (instanciaServico.NaoSalvarXml()) return; var caminhoXml = instanciaServico.DiretorioSalvarXml; - + var arquivoSalvar = Path.Combine(caminhoXml, chaveNome + "-inu.xml"); FuncoesXml.ClasseParaArquivoXml(retInutCTe, arquivoSalvar); } - } } \ No newline at end of file diff --git a/CTe.Utils/Validacao/Validador.cs b/CTe.Utils/Validacao/Validador.cs index 015fc5f7b..1d4773996 100644 --- a/CTe.Utils/Validacao/Validador.cs +++ b/CTe.Utils/Validacao/Validador.cs @@ -60,7 +60,7 @@ public static void Valida(string xml, string schema, ConfiguracaoServico configu schemas.XmlResolver = new XmlUrlResolver(); cfg.Schemas = schemas; - // Quando carregar o eschema, especificar o namespace que ele valida + // Quando carregar o schema, especificar o namespace que ele valida // e a localização do arquivo schemas.Add(null, arquivoSchema); // Especifica o tratamento de evento para os erros de validacao diff --git a/DFe.Classes/Entidades/Estado.cs b/DFe.Classes/Entidades/Estado.cs index 4461718d1..27c38adb2 100644 --- a/DFe.Classes/Entidades/Estado.cs +++ b/DFe.Classes/Entidades/Estado.cs @@ -204,6 +204,12 @@ public enum Estado [XmlEnum("91")] AN = 91, + /// <summary> + /// SVRS + /// </summary> + [XmlEnum("92")] + SVRS = 92, + /// <summary> /// Exterior /// </summary> diff --git a/MDFe.Servicos/RecepcaoMDFe/ServicoMDFeRecepcao.cs b/MDFe.Servicos/RecepcaoMDFe/ServicoMDFeRecepcao.cs index 73ab9e5c5..26de0ff81 100644 --- a/MDFe.Servicos/RecepcaoMDFe/ServicoMDFeRecepcao.cs +++ b/MDFe.Servicos/RecepcaoMDFe/ServicoMDFeRecepcao.cs @@ -107,6 +107,10 @@ public MDFeRetMDFe MDFeRecepcaoSinc(MDFeEletronico mdfe, MDFeConfiguracao cfgMdf mdfe.SalvarXmlEmDisco(null, config); var webService = WsdlFactory.CriaWsdlMDFeRecepcaoSinc(config); + + var enviMDFe = ClassesFactory.CriaEnviMDFe(lote: 1, mdfe, config); + OnAntesDeEnviar(enviMDFe); + var retornoXml = webService.mdfeRecepcao(mdfe.CriaXmlRequestWs()); var retorno = MDFeRetMDFe.LoadXml(retornoXml.OuterXml, mdfe); diff --git a/NFe.AppTeste.NetCore/Program.cs b/NFe.AppTeste.NetCore/Program.cs index f06cb64b2..31ee942e2 100644 --- a/NFe.AppTeste.NetCore/Program.cs +++ b/NFe.AppTeste.NetCore/Program.cs @@ -698,7 +698,7 @@ private static det GetDetalhe(int i, CRT crt, ModeloDocumento modelo) //Caso você resolva utilizar método ObterIcmsBasico(), comente esta proxima linha TipoICMS = - crt == CRT.SimplesNacional + crt == CRT.SimplesNacional || crt == CRT.SimplesNacionalMei ? InformarCSOSN(Csosnicms.Csosn102) : InformarICMS(Csticms.Cst00, VersaoServico.Versao310) }, diff --git a/NFe.AppTeste/MainWindow.xaml b/NFe.AppTeste/MainWindow.xaml index f84e452b9..4c8704abc 100644 --- a/NFe.AppTeste/MainWindow.xaml +++ b/NFe.AppTeste/MainWindow.xaml @@ -904,7 +904,7 @@ </TabControl> </StackPanel> </GroupBox> - <TabControl Name="TabSuperior" Height="266" Margin="510,10,-0,0" VerticalAlignment="Top"> + <TabControl Name="TabSuperior" Height="316" Margin="510,10,-0,0" VerticalAlignment="Top"> <TabItem Header="NF-e/NFC-e"> <Grid Background="White"> <Button x:Name="BtnStatusServico" Content="Status do Serviço" HorizontalAlignment="Left" @@ -966,11 +966,19 @@ Margin="192,210,0,0" VerticalAlignment="Top" Width="177" Click="BtnInsucessoEntrega_Click" /> <Button x:Name="BtnCancInsucessoEntrega" Content="Canc. Insucesso Entrega NFe" HorizontalAlignment="Left" Margin="375,210,0,0" VerticalAlignment="Top" Width="177" Click="BtnCancInsucessoEntrega_Click" /> + <Button x:Name="BtnComprovanteEntrega" Content="Comprovante Entrega NFe" HorizontalAlignment="Left" + Margin="10,235,0,0" VerticalAlignment="Top" Width="177" Click="BtnComprovanteEntrega_Click" /> + <Button x:Name="BtnCancComprovanteEntrega" Content="Canc. Comprovante Entrega NFe" HorizontalAlignment="Left" + Margin="192,235,0,0" VerticalAlignment="Top" Width="177" Click="BtnCancComprovanteEntrega_Click" /> + <Button x:Name="BtnConciliacaoFinanceira" Content="Conciliação Financeira NFe" HorizontalAlignment="Left" + Margin="10,260,0,0" VerticalAlignment="Top" Width="177" Click="BtnConciliacaoFinanceira_Click" /> + <Button x:Name="BtnCancConciliacaoFinanceira" Content="Canc. Conciliação Financeira NFe" HorizontalAlignment="Left" + Margin="192,260,0,0" VerticalAlignment="Top" Width="177" Click="BtnCancConciliacaoFinanceira_Click" /> </Grid> </TabItem> </TabControl> - <TabControl Name="TabInferior" Margin="509,281,0,0"> + <TabControl Name="TabInferior" Margin="509,331,0,0"> <TabItem Header="Envio"> <Grid Background="#FFE5E5E5"> <Grid.ColumnDefinitions> diff --git a/NFe.AppTeste/MainWindow.xaml.cs b/NFe.AppTeste/MainWindow.xaml.cs index 6d90c1731..0b006c1d2 100644 --- a/NFe.AppTeste/MainWindow.xaml.cs +++ b/NFe.AppTeste/MainWindow.xaml.cs @@ -382,7 +382,7 @@ private void BtnInsucessoEntrega_Click(object sender, RoutedEventArgs e) } } - private void BtnCancInsucessoEntrega_Click(object sender, RoutedEventArgs e) + private void BtnCancInsucessoEntrega_Click(object sender, RoutedEventArgs e) { const string titulo = "Cancelar Insucesso Entrega NFe"; @@ -435,6 +435,263 @@ private void BtnCancInsucessoEntrega_Click(object sender, RoutedEventArgs e) } } + private void BtnComprovanteEntrega_Click(object sender, RoutedEventArgs e) + { + const string titulo = "Comprovante Entrega NFe"; + + try + { + #region Comprovante Entrega NFe + + var idlote = Funcoes.InpuBox(this, titulo, "Identificador de controle do Lote de envio:", "1"); + if (string.IsNullOrEmpty(idlote)) throw new Exception("A Id do Lote deve ser informada!"); + + var sequenciaEvento = Funcoes.InpuBox(this, titulo, "Número sequencial do evento:", "1"); + if (string.IsNullOrEmpty(sequenciaEvento)) + throw new Exception("O número sequencial deve ser informado!"); + + var chave = Funcoes.InpuBox(this, titulo, "Chave da NFe:", "35240311656919000154550750000008281647961399"); + if (string.IsNullOrEmpty(chave)) throw new Exception("A Chave deve ser informada!"); + if (chave.Length != 44) throw new Exception("Chave deve conter 44 caracteres!"); + + var dhEntregaStr = Funcoes.InpuBox(this, titulo, "Data da entrega da NFe", DateTimeOffset.Now.ToString("dd/MM/yyyy")); + if (string.IsNullOrEmpty(dhEntregaStr)) throw new Exception("A Data deve ser informada!"); + + if (!DateTimeOffset.TryParse(dhEntregaStr, out DateTimeOffset dhEntrega)) + throw new Exception("Data inválida!"); + + var nDoc = Funcoes.InpuBox(this, titulo, "Documento da Pessoa:", "1234"); + if (string.IsNullOrEmpty(nDoc)) throw new Exception("Número do documento deve ser informado!"); + + var xNome = Funcoes.InpuBox(this, titulo, "Nome da Pessoa:", "José da Silva"); + if (string.IsNullOrEmpty(xNome)) throw new Exception("Nome da Pessoa deve ser informado!"); + + var imagemExemploBase64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAADUlEQVR42gECAP3/AP8BAQEATamDVwAAAABJRU5ErkJggg=="; + var concatenacao = chave + imagemExemploBase64; + + var hashComprovante = string.Empty; + using (SHA1 sha1 = SHA1.Create()) + { + byte[] inputBytes = Encoding.UTF8.GetBytes(concatenacao); + byte[] hashBytes = sha1.ComputeHash(inputBytes); + // O hash SHA-1 terá 20 bytes + hashComprovante = Convert.ToBase64String(hashBytes).Trim(); + } + + DateTimeOffset? dhHashComprovante = null; + var dhHashComprovanteStr = Funcoes.InpuBox(this, titulo, "Data geração do Hash Tentativa na Entrega:", DateTimeOffset.Now.ToString("dd/MM/yyyy")); + if (!string.IsNullOrEmpty(dhHashComprovanteStr)) dhHashComprovante = Convert.ToDateTime(dhHashComprovanteStr); + + decimal? latGps = null; + var latGpsStr = Funcoes.InpuBox(this, titulo, "Latitude GPS:"); + if (!string.IsNullOrEmpty(latGpsStr)) latGps = Convert.ToDecimal(latGpsStr); + + decimal? longGps = null; + var longGpsStr = Funcoes.InpuBox(this, titulo, "Latitude GPS:"); + if (!string.IsNullOrEmpty(longGpsStr)) longGps = Convert.ToDecimal(longGpsStr); + + + var servicoNFe = new ServicosNFe(_configuracoes.CfgServico); + var cpfcnpj = string.IsNullOrEmpty(_configuracoes.Emitente.CNPJ) + ? _configuracoes.Emitente.CPF + : _configuracoes.Emitente.CNPJ; + + var retornoComprovante = servicoNFe.RecepcaoEventoComprovanteEntrega(Convert.ToInt32(idlote), + Convert.ToInt16(sequenciaEvento), cpfcnpj, chave, dhEntrega, nDoc, xNome, hashComprovante, + dhHashComprovante, latGps, longGps, DFe.Classes.Entidades.Estado.SP); + + TrataRetorno(retornoComprovante); + + #endregion + } + catch (ComunicacaoException ex) + { + Funcoes.Mensagem(ex.Message, "Erro", MessageBoxButton.OK); + } + catch (ValidacaoSchemaException ex) + { + Funcoes.Mensagem(ex.Message, "Erro", MessageBoxButton.OK); + } + catch (Exception ex) + { + if (!string.IsNullOrEmpty(ex.Message)) + Funcoes.Mensagem(ex.Message, "Erro", MessageBoxButton.OK); + } + } + + private void BtnCancComprovanteEntrega_Click(object sender, RoutedEventArgs e) + { + const string titulo = "Cancelar Comprovante Entrega NFe"; + + try + { + #region Cancelar Comprovante Entrega NFe + + var idlote = Funcoes.InpuBox(this, titulo, "Identificador de controle do Lote de envio:", "1"); + if (string.IsNullOrEmpty(idlote)) throw new Exception("A Id do Lote deve ser informada!"); + + var sequenciaEvento = Funcoes.InpuBox(this, titulo, "Número sequencial do evento:", "1"); + if (string.IsNullOrEmpty(sequenciaEvento)) + throw new Exception("O número sequencial deve ser informado!"); + + var chave = Funcoes.InpuBox(this, titulo, "Chave da NFe:", "35240311656919000154550750000008281647961399"); + if (string.IsNullOrEmpty(chave)) throw new Exception("A Chave deve ser informada!"); + if (chave.Length != 44) throw new Exception("Chave deve conter 44 caracteres!"); + + var nProtEvento = Funcoes.InpuBox(this, titulo, "Nº Prot Evento:"); + + if (string.IsNullOrEmpty(nProtEvento)) + throw new Exception("O nº Prot Evento deve ser informado!"); + + + + var servicoNFe = new ServicosNFe(_configuracoes.CfgServico); + var cpfcnpj = string.IsNullOrEmpty(_configuracoes.Emitente.CNPJ) + ? _configuracoes.Emitente.CPF + : _configuracoes.Emitente.CNPJ; + + var retornoComprovante = servicoNFe.RecepcaoEventoCancComprovanteEntrega(Convert.ToInt32(idlote), + Convert.ToInt16(sequenciaEvento), cpfcnpj, chave, nProtEvento); + + TrataRetorno(retornoComprovante); + + #endregion + } + catch (ComunicacaoException ex) + { + Funcoes.Mensagem(ex.Message, "Erro", MessageBoxButton.OK); + } + catch (ValidacaoSchemaException ex) + { + Funcoes.Mensagem(ex.Message, "Erro", MessageBoxButton.OK); + } + catch (Exception ex) + { + if (!string.IsNullOrEmpty(ex.Message)) + Funcoes.Mensagem(ex.Message, "Erro", MessageBoxButton.OK); + } + } + + private void BtnConciliacaoFinanceira_Click(object sender, RoutedEventArgs e) + { + const string titulo = "Conciliação Financeira NFe"; + + try + { + #region Conciliação Financeira NFe + + var idlote = Funcoes.InpuBox(this, titulo, "Identificador de controle do Lote de envio:", "1"); + if (string.IsNullOrEmpty(idlote)) throw new Exception("A Id do Lote deve ser informada!"); + + var sequenciaEvento = Funcoes.InpuBox(this, titulo, "Número sequencial do evento:", "1"); + if (string.IsNullOrEmpty(sequenciaEvento)) + throw new Exception("O número sequencial deve ser informado!"); + + var chave = Funcoes.InpuBox(this, titulo, "Chave da NFe:", "35240311656919000154550750000008281647961399"); + if (string.IsNullOrEmpty(chave)) throw new Exception("A Chave deve ser informada!"); + if (chave.Length != 44) throw new Exception("Chave deve conter 44 caracteres!"); + + var meioPagamento = Funcoes.InpuBox(this, titulo, "Meio de Pagamento:", "17"); + if (string.IsNullOrEmpty(meioPagamento)) throw new Exception("Código do Meio de pagamento deve ser informado!"); + + var dhPagamentoStr = Funcoes.InpuBox(this, titulo, "Data de Pagamento:", DateTime.Now.ToString("dd/MM/yyyy")); + if (string.IsNullOrEmpty(dhPagamentoStr)) throw new Exception("A data de pagamento deve ser informada!"); + + if (!DateTime.TryParse(dhPagamentoStr, out DateTime dhPagamento)) + throw new Exception("Data inválida!"); + + decimal? valorPagamento = null; + var valorPagamentoStr = Funcoes.InpuBox(this, titulo, "Valor do Pagamento:", "1"); + if (string.IsNullOrEmpty(valorPagamentoStr)) throw new Exception("Valor do pagamento deve ser informado!"); + if (!string.IsNullOrEmpty(valorPagamentoStr)) valorPagamento = Convert.ToDecimal(valorPagamentoStr); + + + var servicoNFe = new ServicosNFe(_configuracoes.CfgServico); + var cpfcnpj = string.IsNullOrEmpty(_configuracoes.Emitente.CNPJ) + ? _configuracoes.Emitente.CPF + : _configuracoes.Emitente.CNPJ; + + var _pagamento = new Classes.Servicos.Evento.detPagEvento() + { + tPag = (FormaPagamento)Convert.ToInt32(meioPagamento), + dPag = dhPagamento, + vPag = valorPagamento.GetValueOrDefault() + }; + var retornoConciliacao = servicoNFe.RecepcaoEventoConciliacaoFinanceira(Convert.ToInt32(idlote), + Convert.ToInt16(sequenciaEvento), cpfcnpj, chave, new List<Classes.Servicos.Evento.detPagEvento>() { _pagamento }, DFe.Classes.Entidades.Estado.SP); + + TrataRetorno(retornoConciliacao); + + #endregion + } + catch (ComunicacaoException ex) + { + Funcoes.Mensagem(ex.Message, "Erro", MessageBoxButton.OK); + } + catch (ValidacaoSchemaException ex) + { + Funcoes.Mensagem(ex.Message, "Erro", MessageBoxButton.OK); + } + catch (Exception ex) + { + if (!string.IsNullOrEmpty(ex.Message)) + Funcoes.Mensagem(ex.Message, "Erro", MessageBoxButton.OK); + } + } + + private void BtnCancConciliacaoFinanceira_Click(object sender, RoutedEventArgs e) + { + const string titulo = "Cancelar Conciliação Financeira NFe"; + + try + { + #region Cancelar Conciliação Financeira NFe + + var idlote = Funcoes.InpuBox(this, titulo, "Identificador de controle do Lote de envio:", "1"); + if (string.IsNullOrEmpty(idlote)) throw new Exception("A Id do Lote deve ser informada!"); + + var sequenciaEvento = Funcoes.InpuBox(this, titulo, "Número sequencial do evento:", "1"); + if (string.IsNullOrEmpty(sequenciaEvento)) + throw new Exception("O número sequencial deve ser informado!"); + + var chave = Funcoes.InpuBox(this, titulo, "Chave da NFe:", "35240311656919000154550750000008281647961399"); + if (string.IsNullOrEmpty(chave)) throw new Exception("A Chave deve ser informada!"); + if (chave.Length != 44) throw new Exception("Chave deve conter 44 caracteres!"); + + var nProtEvento = Funcoes.InpuBox(this, titulo, "Nº Prot Evento:"); + + if (string.IsNullOrEmpty(nProtEvento)) + throw new Exception("O nº Prot Evento deve ser informado!"); + + + + var servicoNFe = new ServicosNFe(_configuracoes.CfgServico); + var cpfcnpj = string.IsNullOrEmpty(_configuracoes.Emitente.CNPJ) + ? _configuracoes.Emitente.CPF + : _configuracoes.Emitente.CNPJ; + + var retornoConciliacao = servicoNFe.RecepcaoEventoCancConciliacaoFinanceira(Convert.ToInt32(idlote), + Convert.ToInt16(sequenciaEvento), cpfcnpj, chave, nProtEvento); + + TrataRetorno(retornoConciliacao); + + #endregion + } + catch (ComunicacaoException ex) + { + Funcoes.Mensagem(ex.Message, "Erro", MessageBoxButton.OK); + } + catch (ValidacaoSchemaException ex) + { + Funcoes.Mensagem(ex.Message, "Erro", MessageBoxButton.OK); + } + catch (Exception ex) + { + if (!string.IsNullOrEmpty(ex.Message)) + Funcoes.Mensagem(ex.Message, "Erro", MessageBoxButton.OK); + } + } + private void BtnConsultaXml_Click(object sender, RoutedEventArgs e) { try @@ -1251,7 +1508,7 @@ protected virtual det GetDetalhe(int i, CRT crt, ModeloDocumento modelo) //Caso você resolva utilizar método ObterIcmsBasico(), comente esta proxima linha TipoICMS = - crt == CRT.SimplesNacional + crt == CRT.SimplesNacional || crt == CRT.SimplesNacionalMei ? InformarCSOSN(Csosnicms.Csosn102) : InformarICMS(Csticms.Cst00, VersaoServico.Versao310) }, diff --git a/NFe.AppTeste/NFe.AppTeste.csproj b/NFe.AppTeste/NFe.AppTeste.csproj index 8bbc12903..af1c6380c 100644 --- a/NFe.AppTeste/NFe.AppTeste.csproj +++ b/NFe.AppTeste/NFe.AppTeste.csproj @@ -14,10 +14,14 @@ <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <WarningLevel>4</WarningLevel> <NuGetPackageImportStamp>e0fff804</NuGetPackageImportStamp> - <SccProjectName>SAK</SccProjectName> - <SccLocalPath>SAK</SccLocalPath> - <SccAuxPath>SAK</SccAuxPath> - <SccProvider>SAK</SccProvider> + <SccProjectName> + </SccProjectName> + <SccLocalPath> + </SccLocalPath> + <SccAuxPath> + </SccAuxPath> + <SccProvider> + </SccProvider> <TargetFrameworkProfile /> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> @@ -259,6 +263,12 @@ <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> + <None Include="Schemas\e110750_v1.00.xsd"> + <SubType>Designer</SubType> + </None> + <None Include="Schemas\e110751_v1.00.xsd"> + <SubType>Designer</SubType> + </None> <None Include="Schemas\e111500_v1.00.xsd"> <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> @@ -359,6 +369,9 @@ <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> + <None Include="Schemas\envEventoCancEConf_v1.00.xsd"> + <SubType>Designer</SubType> + </None> <None Include="Schemas\envEventoCancEntregaNFe_v1.00.xsd"> <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> @@ -371,6 +384,9 @@ <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> + <None Include="Schemas\envEventoEConf_v1.00.xsd"> + <SubType>Designer</SubType> + </None> <None Include="Schemas\envEventoEntregaNFe_v1.00.xsd"> <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> @@ -419,6 +435,9 @@ <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> + <None Include="Schemas\EventoCancEConf_v1.00.xsd"> + <SubType>Designer</SubType> + </None> <None Include="Schemas\eventoCancEntregaNFe_v1.00.xsd"> <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> @@ -431,6 +450,9 @@ <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> + <None Include="Schemas\EventoEConf_v1.00.xsd"> + <SubType>Designer</SubType> + </None> <None Include="Schemas\eventoEntregaNFe_v1.00.xsd"> <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> @@ -543,6 +565,9 @@ <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> + <None Include="Schemas\leiauteEventoCancEConf_v1.00.xsd"> + <SubType>Designer</SubType> + </None> <None Include="Schemas\leiauteEventoCancEntregaNFe_v1.00.xsd"> <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> @@ -555,6 +580,9 @@ <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> + <None Include="Schemas\leiauteEventoEConf_v1.00.xsd"> + <SubType>Designer</SubType> + </None> <None Include="Schemas\leiauteEventoEntregaNFe_v1.00.xsd"> <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> @@ -675,6 +703,9 @@ <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> + <None Include="Schemas\procEventoCancEConf_v1.00.xsd"> + <SubType>Designer</SubType> + </None> <None Include="Schemas\procEventoCancEntregaNFe_v1.00.xsd"> <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> @@ -687,6 +718,9 @@ <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> + <None Include="Schemas\procEventoEConf_v1.00.xsd"> + <SubType>Designer</SubType> + </None> <None Include="Schemas\procEventoEntregaNFe_v1.00.xsd"> <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> @@ -891,10 +925,16 @@ <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> + <None Include="Schemas\retEventoCancEConf_v1.00.xsd"> + <SubType>Designer</SubType> + </None> <None Include="Schemas\retEventoCancEntregaNFe_v1.00.xsd"> <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> + <None Include="Schemas\retEventoEConf_v1.00.xsd"> + <SubType>Designer</SubType> + </None> <None Include="Schemas\retEventoEntregaNFe_v1.00.xsd"> <SubType>Designer</SubType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> diff --git a/NFe.AppTeste/Schemas/EventoCancEConf_v1.00.xsd b/NFe.AppTeste/Schemas/EventoCancEConf_v1.00.xsd new file mode 100644 index 000000000..662ea2356 --- /dev/null +++ b/NFe.AppTeste/Schemas/EventoCancEConf_v1.00.xsd @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified"> + <xs:include schemaLocation="leiauteEventoCancEConf_v1.00.xsd"/> + <xs:element name="evento" type="TEvento"> + <xs:annotation> + <xs:documentation>Schema XML de validação do evento de Cancelamento do Comprovante de Entrega da NFe</xs:documentation> + </xs:annotation> + </xs:element> +</xs:schema> diff --git a/NFe.AppTeste/Schemas/EventoEConf_v1.00.xsd b/NFe.AppTeste/Schemas/EventoEConf_v1.00.xsd new file mode 100644 index 000000000..713a60faa --- /dev/null +++ b/NFe.AppTeste/Schemas/EventoEConf_v1.00.xsd @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified"> + <xs:include schemaLocation="leiauteEventoEConf_v1.00.xsd"/> + <xs:element name="evento" type="TEvento"> + <xs:annotation> + <xs:documentation>Schema XML de validação do evento de Conciliação Financeira</xs:documentation> + </xs:annotation> + </xs:element> +</xs:schema> diff --git a/NFe.AppTeste/Schemas/e110750_v1.00.xsd b/NFe.AppTeste/Schemas/e110750_v1.00.xsd new file mode 100644 index 000000000..3633a8560 --- /dev/null +++ b/NFe.AppTeste/Schemas/e110750_v1.00.xsd @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- edited with XMLSpy v2008 (http://www.altova.com) by sas-softwares@procergs.rs.gov.br (PROCERGS) --> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified"> + <xs:include schemaLocation="tiposBasico_v1.03.xsd"/> + <xs:element name="detEvento"> + <xs:annotation> + <xs:documentation>Schema XML de validação do evento de Conciliação Financeira – ECONF</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="descEvento"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value="ECONF"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="verAplic" type="TVerAplic"> + <xs:annotation> + <xs:documentation>Versão do Aplicativo do Autor do Evento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="detPag" maxOccurs="100"> + <xs:annotation> + <xs:documentation>Grupo de detalhamento da forma de pagamento.</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="indPag" minOccurs="0"> + <xs:annotation> + <xs:documentation>Indicador da Forma de Pagamento:0-Pagamento à Vista;1-Pagamento à Prazo;</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:enumeration value="0"/> + <xs:enumeration value="1"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="tPag"> + <xs:annotation> + <xs:documentation>Forma de Pagamento:</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="[0-9]{2}"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="xPag" minOccurs="0"> + <xs:annotation> + <xs:documentation>Descrição do Meio de Pagamento</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="TString"> + <xs:minLength value="2"/> + <xs:maxLength value="60"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="vPag" type="TDec_1302"> + <xs:annotation> + <xs:documentation>Valor do Pagamento. Esta tag poderá ser omitida quando a tag tPag=90 (Sem Pagamento), caso contrário deverá ser preenchida.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="dPag" type="TData"> + <xs:annotation> + <xs:documentation>Data do Pagamento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:sequence minOccurs="0"> + <xs:element name="CNPJPag" type="TCnpj"> + <xs:annotation> + <xs:documentation>CNPJ transacional do pagamento - Preencher informando o CNPJ do estabelecimento onde o pagamento foi processado/transacionado/recebido quando a emissão do documento fiscal ocorrer em estabelecimento distinto</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="UFPag" type="TUfEmi"> + <xs:annotation> + <xs:documentation>UF do CNPJ do estabelecimento onde o pagamento foi processado/transacionado/recebido.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="CNPJIF" type="TCnpj" minOccurs="0"> + <xs:annotation> + <xs:documentation>CNPJ da instituição financeira, de pagamento, adquirente ou subadquirente.</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="tBand" minOccurs="0"> + <xs:annotation> + <xs:documentation>Bandeira da operadora de cartão</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="[0-9]{2}"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="cAut" minOccurs="0"> + <xs:annotation> + <xs:documentation>Número de autorização da operação com cartões, PIX, boletos e outros pagamentos eletrônicos</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="TString"> + <xs:minLength value="1"/> + <xs:maxLength value="128"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + </xs:sequence> + <xs:sequence minOccurs="0"> + <xs:element name="CNPJReceb" type="TCnpj"> + <xs:annotation> + <xs:documentation>Informar o CNPJ do estabelecimento beneficiário do pagamento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="UFReceb" type="TUfEmi"> + <xs:annotation> + <xs:documentation>UF do CNPJ do estabelecimento beneficiário do pagamento..</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:sequence> + <xs:attribute name="versao" use="required"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:enumeration value="1.00"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:complexType> + </xs:element> +</xs:schema> diff --git a/NFe.AppTeste/Schemas/e110751_v1.00.xsd b/NFe.AppTeste/Schemas/e110751_v1.00.xsd new file mode 100644 index 000000000..7543784ac --- /dev/null +++ b/NFe.AppTeste/Schemas/e110751_v1.00.xsd @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- edited with XMLSpy v2008 (http://www.altova.com) by sas-softwares@procergs.rs.gov.br (PROCERGS) --> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified"> + <xs:include schemaLocation="tiposBasico_v1.03.xsd"/> + <xs:element name="detEvento"> + <xs:annotation> + <xs:documentation>Schema XML de validação do evento de Cancelamento do Comprovante de Entrega da NF-e</xs:documentation> + </xs:annotation> + <xs:complexType> + <xs:sequence> + <xs:element name="descEvento"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value="Cancelamento Conciliação Financeira"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="verAplic" type="TVerAplic"> + <xs:annotation> + <xs:documentation>Versão do Aplicativo do Autor do Evento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="nProtEvento" type="TProt"> + <xs:annotation> + <xs:documentation>Número do Protocolo de Autorização do Evento da NF-e a que se refere este cancelamento.</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="versao" use="required"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:enumeration value="1.00"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:complexType> + </xs:element> +</xs:schema> diff --git a/NFe.AppTeste/Schemas/envEventoCancEConf_v1.00.xsd b/NFe.AppTeste/Schemas/envEventoCancEConf_v1.00.xsd new file mode 100644 index 000000000..bb0508691 --- /dev/null +++ b/NFe.AppTeste/Schemas/envEventoCancEConf_v1.00.xsd @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- edited with XMLSpy v2008 (http://www.altova.com) by sas-softwares@procergs.rs.gov.br (PROCERGS) --> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified"> + <xs:include schemaLocation="leiauteEventoCancEConf_v1.00.xsd"/> + <xs:element name="envEvento" type="TEnvEvento"> + <xs:annotation> + <xs:documentation>Schema XML de validação do lote de envio do evento de Cancelamento de Conciliação Financeira</xs:documentation> + </xs:annotation> + </xs:element> +</xs:schema> diff --git a/NFe.AppTeste/Schemas/envEventoEConf_v1.00.xsd b/NFe.AppTeste/Schemas/envEventoEConf_v1.00.xsd new file mode 100644 index 000000000..f4e5a28a2 --- /dev/null +++ b/NFe.AppTeste/Schemas/envEventoEConf_v1.00.xsd @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- edited with XMLSpy v2008 (http://www.altova.com) by sas-softwares@procergs.rs.gov.br (PROCERGS) --> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified"> + <xs:include schemaLocation="leiauteEventoEConf_v1.00.xsd"/> + <xs:element name="envEvento" type="TEnvEvento"> + <xs:annotation> + <xs:documentation>Schema XML de validação do lote de envio do evento de Conciliação Financeira</xs:documentation> + </xs:annotation> + </xs:element> +</xs:schema> diff --git a/NFe.AppTeste/Schemas/leiauteEventoCancEConf_v1.00.xsd b/NFe.AppTeste/Schemas/leiauteEventoCancEConf_v1.00.xsd new file mode 100644 index 000000000..710d25def --- /dev/null +++ b/NFe.AppTeste/Schemas/leiauteEventoCancEConf_v1.00.xsd @@ -0,0 +1,296 @@ +<!-- edited with XMLSpy v2008 (http://www.altova.com) by sas.softwares@procergs.rs.gov.br (PROCERGS) --> +<xs:schema xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified"> + <xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema_v1.01.xsd"/> + <xs:include schemaLocation="tiposBasico_v1.03.xsd"/> + <xs:include schemaLocation="e110751_v1.00.xsd"/> + <xs:complexType name="TEvento"> + <xs:annotation> + <xs:documentation>Tipo Evento</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="infEvento"> + <xs:complexType> + <xs:sequence> + <xs:element name="cOrgao" type="TCOrgaoIBGE"> + <xs:annotation> + <xs:documentation>Código do órgão de recepção do Evento. Utilizar a Tabela do IBGE extendida, utilizar 90 para identificar o Ambiente Nacional</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="tpAmb" type="TAmb"> + <xs:annotation> + <xs:documentation>Identificação do Ambiente: +1 - Produção +2 - Homologação</xs:documentation> + </xs:annotation> + </xs:element> + <xs:choice> + <xs:annotation> + <xs:documentation>Identificação do autor do evento</xs:documentation> + </xs:annotation> + <xs:element name="CNPJ" type="TCnpjOpc"> + <xs:annotation> + <xs:documentation>CNPJ</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="CPF" type="TCpf"> + <xs:annotation> + <xs:documentation>CPF</xs:documentation> + </xs:annotation> + </xs:element> + </xs:choice> + <xs:element name="chNFe" type="TChNFe"> + <xs:annotation> + <xs:documentation>Chave de Acesso da NF-e vinculada ao evento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="dhEvento" type="TDateTimeUTC"> + <xs:annotation> + <xs:documentation>Data de emissão no formato UTC. AAAA-MM-DDThh:mm:ssTZD</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="tpEvento"> + <xs:annotation> + <xs:documentation>Tipo do Evento</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="[0-9]{6}"/> + <xs:enumeration value="110751"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="nSeqEvento"> + <xs:annotation> + <xs:documentation>Seqüencial do evento para o mesmo tipo de evento. Para maioria dos eventos será 1, nos casos em que possa existir mais de um evento, como é o caso da carta de correção, o autor do evento deve numerar de forma seqüencial.</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="[1-9][0-9]{0,1}"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="verEvento"> + <xs:annotation> + <xs:documentation>Versão do Tipo do Evento</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:enumeration value="1.00"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element ref="detEvento"/> + </xs:sequence> + <xs:attribute name="Id" use="required"> + <xs:annotation> + <xs:documentation>Identificador da TAG a ser assinada, a regra de formação do Id é: +“ID” + tpEvento + chave da NF-e + nSeqEvento</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:ID"> + <xs:pattern value="ID[0-9]{52}"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:complexType> + </xs:element> + <xs:element ref="ds:Signature"/> + </xs:sequence> + <xs:attribute name="versao" type="TVerEvento" use="required"/> + </xs:complexType> + <xs:simpleType name="TVerEvento"> + <xs:annotation> + <xs:documentation>Tipo Versão do Evento</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="1\.00"/> + </xs:restriction> + </xs:simpleType> + <xs:complexType name="TretEvento"> + <xs:annotation> + <xs:documentation>Tipo retorno do Evento</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="infEvento"> + <xs:complexType> + <xs:sequence> + <xs:element name="tpAmb" type="TAmb"> + <xs:annotation> + <xs:documentation>Identificação do Ambiente: +1 - Produção +2 - Homologação</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="verAplic" type="TVerAplic"> + <xs:annotation> + <xs:documentation>Versão do Aplicativo que recebeu o Evento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="cOrgao" type="TCOrgaoIBGE"> + <xs:annotation> + <xs:documentation>Código do órgão de recepção do Evento. Utilizar a Tabela do IBGE extendida, utilizar 90 para identificar o Ambiente Nacional</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="cStat" type="TStat"> + <xs:annotation> + <xs:documentation>Código do status da registro do Evento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="xMotivo" type="TMotivo"> + <xs:annotation> + <xs:documentation>Descrição literal do status do registro do Evento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="chNFe" type="TChNFe" minOccurs="0"> + <xs:annotation> + <xs:documentation>Chave de Acesso NF-e vinculada</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="tpEvento" minOccurs="0"> + <xs:annotation> + <xs:documentation>Tipo do Evento vinculado</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="[0-9]{6}"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="xEvento" minOccurs="0"> + <xs:annotation> + <xs:documentation>Descrição do Evento</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="TString"> + <xs:minLength value="5"/> + <xs:maxLength value="60"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="nSeqEvento" minOccurs="0"> + <xs:annotation> + <xs:documentation>Seqüencial do evento</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="[1-9][0-9]{0,1}"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="dhRegEvento"> + <xs:annotation> + <xs:documentation>Data e Hora de do recebimento do evento ou do registro do evento formato UTC AAAA-MM-DDThh:mm:ssTZD.</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="(((20(([02468][048])|([13579][26]))-02-29))|(20[0-9][0-9])-((((0[1-9])|(1[0-2]))-((0[1-9])|(1\d)|(2[0-8])))|((((0[13578])|(1[02]))-31)|(((0[1,3-9])|(1[0-2]))-(29|30)))))T(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d-0[1-4]:00"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="nProt" type="TProt" minOccurs="0"> + <xs:annotation> + <xs:documentation>Número do protocolo de registro do evento</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="Id" use="optional"> + <xs:simpleType> + <xs:restriction base="xs:ID"> + <xs:pattern value="ID[0-9]{15}"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:complexType> + </xs:element> + <xs:element ref="ds:Signature" minOccurs="0"/> + </xs:sequence> + <xs:attribute name="versao" type="TVerEvento" use="required"/> + </xs:complexType> + <xs:complexType name="TEnvEvento"> + <xs:annotation> + <xs:documentation> Tipo Lote de Envio</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="idLote"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="[0-9]{1,15}"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="evento" type="TEvento" maxOccurs="20"/> + </xs:sequence> + <xs:attribute name="versao" type="TVerEnvEvento" use="required"/> + </xs:complexType> + <xs:simpleType name="TVerEnvEvento"> + <xs:annotation> + <xs:documentation>Tipo Versão do EnvEvento</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="1\.00"/> + </xs:restriction> + </xs:simpleType> + <xs:complexType name="TRetEnvEvento"> + <xs:annotation> + <xs:documentation> Tipo Retorno de Lote de Envio</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="idLote"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="[0-9]{1,15}"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="tpAmb" type="TAmb"> + <xs:annotation> + <xs:documentation>Identificação do Ambiente: +1 - Produção +2 - Homologação</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="verAplic" type="TVerAplic"> + <xs:annotation> + <xs:documentation>Versão do Aplicativo que recebeu o Evento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="cOrgao" type="TCOrgaoIBGE"> + <xs:annotation> + <xs:documentation>Código do òrgao que registrou o Evento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="cStat" type="TStat"> + <xs:annotation> + <xs:documentation>Código do status da registro do Evento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="xMotivo" type="TMotivo"> + <xs:annotation> + <xs:documentation>Descrição literal do status do registro do Evento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="retEvento" type="TretEvento" minOccurs="0" maxOccurs="20"/> + </xs:sequence> + <xs:attribute name="versao" type="TVerEnvEvento" use="required"/> + </xs:complexType> + <xs:complexType name="TProcEvento"> + <xs:annotation> + <xs:documentation>Tipo procEvento</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="evento" type="TEvento"/> + <xs:element name="retEvento" type="TretEvento"/> + </xs:sequence> + <xs:attribute name="versao" type="TVerEvento" use="required"/> + </xs:complexType> +</xs:schema> diff --git a/NFe.AppTeste/Schemas/leiauteEventoEConf_v1.00.xsd b/NFe.AppTeste/Schemas/leiauteEventoEConf_v1.00.xsd new file mode 100644 index 000000000..fe9d449d5 --- /dev/null +++ b/NFe.AppTeste/Schemas/leiauteEventoEConf_v1.00.xsd @@ -0,0 +1,296 @@ +<!-- edited with XMLSpy v2008 (http://www.altova.com) by sas-softwares@procergs.rs.gov.br (PROCERGS) --> +<xs:schema xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified"> + <xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema_v1.01.xsd"/> + <xs:include schemaLocation="tiposBasico_v1.03.xsd"/> + <xs:include schemaLocation="e110750_v1.00.xsd"/> + <xs:complexType name="TEvento"> + <xs:annotation> + <xs:documentation>Tipo Evento</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="infEvento"> + <xs:complexType> + <xs:sequence> + <xs:element name="cOrgao" type="TCOrgaoIBGE"> + <xs:annotation> + <xs:documentation>Código do órgão de recepção do Evento. Utilizar a Tabela do IBGE extendida, utilizar 91 para identificar o Ambiente Nacional</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="tpAmb" type="TAmb"> + <xs:annotation> + <xs:documentation>Identificação do Ambiente: +1 - Produção +2 - Homologação</xs:documentation> + </xs:annotation> + </xs:element> + <xs:choice> + <xs:annotation> + <xs:documentation>Identificação do autor do evento</xs:documentation> + </xs:annotation> + <xs:element name="CNPJ" type="TCnpjOpc"> + <xs:annotation> + <xs:documentation>CNPJ</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="CPF" type="TCpf"> + <xs:annotation> + <xs:documentation>CPF</xs:documentation> + </xs:annotation> + </xs:element> + </xs:choice> + <xs:element name="chNFe" type="TChNFe"> + <xs:annotation> + <xs:documentation>Chave de Acesso da NF-e vinculada ao evento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="dhEvento" type="TDateTimeUTC"> + <xs:annotation> + <xs:documentation>Data de emissão no formato UTC. AAAA-MM-DDThh:mm:ssTZD</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="tpEvento"> + <xs:annotation> + <xs:documentation>Tipo do Evento</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="[0-9]{6}"/> + <xs:enumeration value="110750"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="nSeqEvento"> + <xs:annotation> + <xs:documentation>Seqüencial do evento para o mesmo tipo de evento. Para maioria dos eventos será 1, nos casos em que possa existir mais de um evento, como é o caso da carta de correção, o autor do evento deve numerar de forma seqüencial.</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="[1-9][0-9]{0,1}"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="verEvento"> + <xs:annotation> + <xs:documentation>Versão do Tipo do Evento</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:enumeration value="1.00"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element ref="detEvento"/> + </xs:sequence> + <xs:attribute name="Id" use="required"> + <xs:annotation> + <xs:documentation>Identificador da TAG a ser assinada, a regra de formação do Id é: +“ID” + tpEvento + chave da NF-e + nSeqEvento</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:ID"> + <xs:pattern value="ID[0-9]{52}"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:complexType> + </xs:element> + <xs:element ref="ds:Signature"/> + </xs:sequence> + <xs:attribute name="versao" type="TVerEvento" use="required"/> + </xs:complexType> + <xs:simpleType name="TVerEvento"> + <xs:annotation> + <xs:documentation>Tipo Versão do Evento</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="1\.00"/> + </xs:restriction> + </xs:simpleType> + <xs:complexType name="TretEvento"> + <xs:annotation> + <xs:documentation>Tipo retorno do Evento</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="infEvento"> + <xs:complexType> + <xs:sequence> + <xs:element name="tpAmb" type="TAmb"> + <xs:annotation> + <xs:documentation>Identificação do Ambiente: +1 - Produção +2 - Homologação</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="verAplic" type="TVerAplic"> + <xs:annotation> + <xs:documentation>Versão do Aplicativo que recebeu o Evento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="cOrgao" type="TCOrgaoIBGE"> + <xs:annotation> + <xs:documentation>Código do órgão de recepção do Evento. Utilizar a Tabela do IBGE extendida, utilizar 91 para identificar o Ambiente Nacional</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="cStat" type="TStat"> + <xs:annotation> + <xs:documentation>Código do status da registro do Evento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="xMotivo" type="TMotivo"> + <xs:annotation> + <xs:documentation>Descrição literal do status do registro do Evento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="chNFe" type="TChNFe" minOccurs="0"> + <xs:annotation> + <xs:documentation>Chave de Acesso NF-e vinculada</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="tpEvento" minOccurs="0"> + <xs:annotation> + <xs:documentation>Tipo do Evento vinculado</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="[0-9]{6}"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="xEvento" minOccurs="0"> + <xs:annotation> + <xs:documentation>Descrição do Evento</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="TString"> + <xs:minLength value="5"/> + <xs:maxLength value="60"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="nSeqEvento" minOccurs="0"> + <xs:annotation> + <xs:documentation>Seqüencial do evento</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="[1-9][0-9]{0,1}"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="dhRegEvento"> + <xs:annotation> + <xs:documentation>Data e Hora de do recebimento do evento ou do registro do evento formato UTC AAAA-MM-DDThh:mm:ssTZD.</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="(((20(([02468][048])|([13579][26]))-02-29))|(20[0-9][0-9])-((((0[1-9])|(1[0-2]))-((0[1-9])|(1\d)|(2[0-8])))|((((0[13578])|(1[02]))-31)|(((0[1,3-9])|(1[0-2]))-(29|30)))))T(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d-0[1-4]:00"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="nProt" type="TProt" minOccurs="0"> + <xs:annotation> + <xs:documentation>Número do protocolo de registro do evento</xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute name="Id" use="optional"> + <xs:simpleType> + <xs:restriction base="xs:ID"> + <xs:pattern value="ID[0-9]{15}"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:complexType> + </xs:element> + <xs:element ref="ds:Signature" minOccurs="0"/> + </xs:sequence> + <xs:attribute name="versao" type="TVerEvento" use="required"/> + </xs:complexType> + <xs:complexType name="TEnvEvento"> + <xs:annotation> + <xs:documentation> Tipo Lote de Envio</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="idLote"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="[0-9]{1,15}"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="evento" type="TEvento" maxOccurs="20"/> + </xs:sequence> + <xs:attribute name="versao" type="TVerEnvEvento" use="required"/> + </xs:complexType> + <xs:simpleType name="TVerEnvEvento"> + <xs:annotation> + <xs:documentation>Tipo Versão do EnvEvento</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="1\.00"/> + </xs:restriction> + </xs:simpleType> + <xs:complexType name="TRetEnvEvento"> + <xs:annotation> + <xs:documentation> Tipo Retorno de Lote de Envio</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="idLote"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + <xs:pattern value="[0-9]{1,15}"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + <xs:element name="tpAmb" type="TAmb"> + <xs:annotation> + <xs:documentation>Identificação do Ambiente: +1 - Produção +2 - Homologação</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="verAplic" type="TVerAplic"> + <xs:annotation> + <xs:documentation>Versão do Aplicativo que recebeu o Evento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="cOrgao" type="TCOrgaoIBGE"> + <xs:annotation> + <xs:documentation>Código do òrgao que registrou o Evento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="cStat" type="TStat"> + <xs:annotation> + <xs:documentation>Código do status da registro do Evento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="xMotivo" type="TMotivo"> + <xs:annotation> + <xs:documentation>Descrição literal do status do registro do Evento</xs:documentation> + </xs:annotation> + </xs:element> + <xs:element name="retEvento" type="TretEvento" minOccurs="0" maxOccurs="20"/> + </xs:sequence> + <xs:attribute name="versao" type="TVerEnvEvento" use="required"/> + </xs:complexType> + <xs:complexType name="TProcEvento"> + <xs:annotation> + <xs:documentation>Tipo procEvento</xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element name="evento" type="TEvento"/> + <xs:element name="retEvento" type="TretEvento"/> + </xs:sequence> + <xs:attribute name="versao" type="TVerEvento" use="required"/> + </xs:complexType> +</xs:schema> diff --git a/NFe.AppTeste/Schemas/procEventoCancEConf_v1.00.xsd b/NFe.AppTeste/Schemas/procEventoCancEConf_v1.00.xsd new file mode 100644 index 000000000..df7830645 --- /dev/null +++ b/NFe.AppTeste/Schemas/procEventoCancEConf_v1.00.xsd @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified"> + <xs:include schemaLocation="leiauteEventoCancEConf_v1.00.xsd"/> + <xs:element name="procEventoNFe" type="TProcEvento"> + <xs:annotation> + <xs:documentation>Schema XML de validação do proc do evento de Cancelamento de Conciliação financeira</xs:documentation> + </xs:annotation> + </xs:element> +</xs:schema> diff --git a/NFe.AppTeste/Schemas/procEventoEConf_v1.00.xsd b/NFe.AppTeste/Schemas/procEventoEConf_v1.00.xsd new file mode 100644 index 000000000..d2607121d --- /dev/null +++ b/NFe.AppTeste/Schemas/procEventoEConf_v1.00.xsd @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified"> + <xs:include schemaLocation="leiauteEventoEConf_v1.00.xsd"/> + <xs:element name="procEventoNFe" type="TProcEvento"> + <xs:annotation> + <xs:documentation>Schema XML de validação do proc do Evento de Conciliação Financeira</xs:documentation> + </xs:annotation> + </xs:element> +</xs:schema> diff --git a/NFe.AppTeste/Schemas/retEventoCancEConf_v1.00.xsd b/NFe.AppTeste/Schemas/retEventoCancEConf_v1.00.xsd new file mode 100644 index 000000000..88791095a --- /dev/null +++ b/NFe.AppTeste/Schemas/retEventoCancEConf_v1.00.xsd @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified"> + <xs:include schemaLocation="leiauteEventoCancEConf_v1.00.xsd"/> + <xs:element name="retEnvEvento" type="TRetEnvEvento"> + <xs:annotation> + <xs:documentation>Schema XML de Retorno da envio do evento de Cancelamento de Conciliação Financeira</xs:documentation> + </xs:annotation> + </xs:element> +</xs:schema> diff --git a/NFe.AppTeste/Schemas/retEventoEConf_v1.00.xsd b/NFe.AppTeste/Schemas/retEventoEConf_v1.00.xsd new file mode 100644 index 000000000..83b7352f8 --- /dev/null +++ b/NFe.AppTeste/Schemas/retEventoEConf_v1.00.xsd @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" targetNamespace="http://www.portalfiscal.inf.br/nfe" elementFormDefault="qualified" attributeFormDefault="unqualified"> + <xs:include schemaLocation="leiauteEventoEConf_v1.00.xsd"/> + <xs:element name="retEnvEvento" type="TRetEnvEvento"> + <xs:annotation> + <xs:documentation>Schema XML de Retorno da envio do evento de Conciliação Financeira</xs:documentation> + </xs:annotation> + </xs:element> +</xs:schema> diff --git a/NFe.Classes/Informacoes/Cana/cana.cs b/NFe.Classes/Informacoes/Cana/cana.cs index a1b8c559e..0c88e4c63 100644 --- a/NFe.Classes/Informacoes/Cana/cana.cs +++ b/NFe.Classes/Informacoes/Cana/cana.cs @@ -37,6 +37,13 @@ namespace NFe.Classes.Informacoes.Cana { public class cana { + private decimal _qTotMes; + private decimal _qTotAnt; + private decimal _qTotGer; + private decimal _vFor; + private decimal _vTotDed; + private decimal _vLiqFor; + /// <summary> /// ZC02 - Identificação da safra /// </summary> @@ -53,10 +60,64 @@ public class cana [XmlElement("forDia")] public List<forDia> forDia { get; set; } + /// <summary> + /// ZC07 - Quantidade Total do Mês + /// </summary> + public decimal qTotMes + { + get { return _qTotMes; } + set { _qTotMes = value.Arredondar(10); } + } + + /// <summary> + /// ZC08 - Quantidade Total Anterior + /// </summary> + public decimal qTotAnt + { + get { return _qTotAnt; } + set { _qTotAnt = value.Arredondar(10); } + } + + /// <summary> + /// ZC09 - Quantidade Total Geral + /// </summary> + public decimal qTotGer + { + get { return _qTotGer; } + set { _qTotGer = value.Arredondar(10); } + } + /// <summary> /// ZC10 - Grupo Deduções – Taxas e Contribuições /// </summary> [XmlElement("deduc")] public List<deduc> deduc { get; set; } + + /// <summary> + /// ZC13 - Valor dos Fornecimentos + /// </summary> + public decimal vFor + { + get { return _vFor; } + set { _vFor = value.Arredondar(2); } + } + + /// <summary> + /// ZC14 - Valor Total da Dedução + /// </summary> + public decimal vTotDed + { + get { return _vTotDed; } + set { _vTotDed = value.Arredondar(2); } + } + + /// <summary> + /// ZC15 - Valor Líquido dos Fornecimentos + /// </summary> + public decimal vLiqFor + { + get { return _vLiqFor; } + set { _vLiqFor = value.Arredondar(2); } + } } } \ No newline at end of file diff --git a/NFe.Classes/Informacoes/Cana/deduc.cs b/NFe.Classes/Informacoes/Cana/deduc.cs index cba4bac83..90f60dd5b 100644 --- a/NFe.Classes/Informacoes/Cana/deduc.cs +++ b/NFe.Classes/Informacoes/Cana/deduc.cs @@ -35,9 +35,6 @@ namespace NFe.Classes.Informacoes.Cana public class deduc { private decimal _vDed; - private decimal _vFor; - private decimal _vTotDed; - private decimal _vLiqFor; /// <summary> /// ZC11 - Descrição da Dedução @@ -52,32 +49,5 @@ public decimal vDed get { return _vDed; } set { _vDed = value.Arredondar(2); } } - - /// <summary> - /// ZC13 - Valor dos Fornecimentos - /// </summary> - public decimal vFor - { - get { return _vFor; } - set { _vFor = value.Arredondar(2); } - } - - /// <summary> - /// ZC14 - Valor Total da Dedução - /// </summary> - public decimal vTotDed - { - get { return _vTotDed; } - set { _vTotDed = value.Arredondar(2); } - } - - /// <summary> - /// ZC15 - Valor Líquido dos Fornecimentos - /// </summary> - public decimal vLiqFor - { - get { return _vLiqFor; } - set { _vLiqFor = value.Arredondar(2); } - } } } \ No newline at end of file diff --git a/NFe.Classes/Informacoes/Cana/forDia.cs b/NFe.Classes/Informacoes/Cana/forDia.cs index c4b3369c3..cc6bce354 100644 --- a/NFe.Classes/Informacoes/Cana/forDia.cs +++ b/NFe.Classes/Informacoes/Cana/forDia.cs @@ -37,9 +37,6 @@ namespace NFe.Classes.Informacoes.Cana public class forDia { private decimal _qtde; - private decimal _qTotMes; - private decimal _qTotAnt; - private decimal _qTotGer; /// <summary> /// ZC05 - Dia @@ -55,32 +52,5 @@ public decimal qtde get { return _qtde; } set { _qtde = value.Arredondar(10); } } - - /// <summary> - /// ZC07 - Quantidade Total do Mês - /// </summary> - public decimal qTotMes - { - get { return _qTotMes; } - set { _qTotMes = value.Arredondar(10); } - } - - /// <summary> - /// ZC08 - Quantidade Total Anterior - /// </summary> - public decimal qTotAnt - { - get { return _qTotAnt; } - set { _qTotAnt = value.Arredondar(10); } - } - - /// <summary> - /// ZC09 - Quantidade Total Geral - /// </summary> - public decimal qTotGer - { - get { return _qTotGer; } - set { _qTotGer = value.Arredondar(10); } - } } } \ No newline at end of file diff --git a/NFe.Classes/Informacoes/Detalhe/gCred.cs b/NFe.Classes/Informacoes/Detalhe/gCred.cs new file mode 100644 index 000000000..425aef414 --- /dev/null +++ b/NFe.Classes/Informacoes/Detalhe/gCred.cs @@ -0,0 +1,41 @@ +namespace NFe.Classes.Informacoes.Detalhe +{ + public class gCred + { + private decimal? _pCredPresumido; + private decimal? _vCredPresumido; + + /// <summary> + /// I05h - Código de Benefício Fiscal de Crédito Presumido na UF aplicado ao item + /// </summary> + public string cCredPresumido { get; set; } + + /// <summary> + /// I05i - Percentual do Crédito Presumido + /// </summary> + public decimal? pCredPresumido + { + get { return _pCredPresumido; } + set { _pCredPresumido = value.Arredondar(4); } + } + + /// <summary> + /// I05j - Valor do Crédito Presumido + /// </summary> + public decimal? vCredPresumido + { + get { return _vCredPresumido; } + set { _vCredPresumido = value.Arredondar(2); } + } + + public bool ShouldSerializepCredPresumido() + { + return _pCredPresumido.HasValue && _pCredPresumido > 0; + } + + public bool ShouldSerializevCredPresumido() + { + return _vCredPresumido.HasValue && _vCredPresumido > 0; + } + } +} diff --git a/NFe.Classes/Informacoes/Detalhe/prod.cs b/NFe.Classes/Informacoes/Detalhe/prod.cs index cd4313d8e..e32da3749 100644 --- a/NFe.Classes/Informacoes/Detalhe/prod.cs +++ b/NFe.Classes/Informacoes/Detalhe/prod.cs @@ -59,8 +59,6 @@ public prod() private string _cEan; private string _cEanTrib; private decimal _vUnCom; - private decimal? _pCredPresumido; - private decimal? _vCredPresumido; /// <summary> /// I02 - Código do produto ou serviço @@ -129,29 +127,13 @@ public bool indEscalaSpecified /// declarações, nas UF que o exigem. /// </summary> public string cBenef { get; set; } - - /// <summary> - /// I05h - Código de Benefício Fiscal de Crédito Presumido na UF aplicado ao item - /// </summary> - public string cCredPresumido { get; set; } /// <summary> - /// I05i - Percentual do Crédito Presumido - /// </summary> - public decimal? pCredPresumido - { - get { return _pCredPresumido; } - set { _pCredPresumido = value.Arredondar(4); } - } - - /// <summary> - /// I05j - Valor do Crédito Presumido + /// I05G - Grupo de Informações sobre o Crédito Presumido + /// Versão 4.00 - NT 2019.001 /// </summary> - public decimal? vCredPresumido - { - get { return _vCredPresumido; } - set { _vCredPresumido = value.Arredondar(2); } - } + [XmlElement("gCred")] + public List<gCred> gCred { get; set; } /// <summary> /// I06 - Código EX TIPI (3 posições) @@ -365,16 +347,6 @@ public bool ShouldSerializevOutro() { return vOutro.HasValue && vOutro > 0; } - - public bool ShouldSerializepCredPresumido() - { - return _pCredPresumido.HasValue && _pCredPresumido > 0; - } - - public bool ShouldSerializevCredPresumido() - { - return _vCredPresumido.HasValue && _vCredPresumido > 0; - } } } diff --git a/NFe.Classes/Informacoes/Observacoes/procRefTipos.cs b/NFe.Classes/Informacoes/Observacoes/procRefTipos.cs index 5f39e77e8..18ace9443 100644 --- a/NFe.Classes/Informacoes/Observacoes/procRefTipos.cs +++ b/NFe.Classes/Informacoes/Observacoes/procRefTipos.cs @@ -128,7 +128,7 @@ public enum TipoAtoConcessorio tpAjusteSINIEF = 14, /// <summary> - /// 14 - Convênio ICMS (NT2023.004) + /// 15 - Convênio ICMS (NT2023.004) /// </summary> [Description("Convênio ICMS")] [XmlEnum("15")] diff --git a/NFe.Classes/Servicos/Evento/detEvento.cs b/NFe.Classes/Servicos/Evento/detEvento.cs index 938e74a55..befaedb01 100644 --- a/NFe.Classes/Servicos/Evento/detEvento.cs +++ b/NFe.Classes/Servicos/Evento/detEvento.cs @@ -169,7 +169,7 @@ public bool ShouldSerializeItensAverbados() } #endregion - #region Cancelamento Insucesso NFe + #region Cancelamento Insucesso/Comprovante de Entrega NFe /// <summary> /// P22 - Informar o número do Protocolo de Autorização do @@ -178,7 +178,7 @@ public bool ShouldSerializeItensAverbados() public string nProtEvento { get; set; } #endregion - + #region Insucesso NFe [XmlIgnore] public DateTimeOffset? dhTentativaEntrega { get; set; } @@ -262,5 +262,71 @@ public bool ShouldSerializelongGPS() #endregion + #region Comprovante Entrega NFe + + /// <summary> + /// P30 - Data e hora do final da entrega + /// </summary> + [XmlIgnore] + public DateTimeOffset? dhEntrega { get; set; } + + /// <summary> + /// Proxy para dhEntrega no formato AAAA-MM-DDThh:mm:ssTZD (UTC - Universal Coordinated Time) + /// </summary> + [XmlElement(ElementName = "dhEntrega")] + public string ProxyDhEntrega + { + get { return dhEntrega.ParaDataHoraStringUtc(); } + set { dhEntrega = DateTimeOffset.Parse(value); } + } + + /// <summary> + /// P31 - Número do documento de identificação da pessoa que assinou o Comprovante de Entrega da NF-e/> + /// </summary> + public string nDoc { get; set; } + + /// <summary> + /// P32 - Nome da pessoa que assinou o Comprovante de Entrega da NF-e/> + /// </summary> + public string xNome { get; set; } + + /// <summary> + /// P35 - Hash SHA-1, no formato Base64, resultante da concatenação de: Chave de Acesso da NF-e + Base64 + /// da imagem capturada do Comprovante de Entrega da NFe (ex: imagem capturada da assinatura eletrônica, digital do recebedor, foto, etc). + /// </summary> + public string hashComprovante { get; set; } + + /// <summary> + /// P36 - Data e hora da geração do hash da tentativa de entrega. Formato AAAA-MMDDThh:mm:ssTZD. + /// </summary> + [XmlIgnore] + public DateTimeOffset? dhHashComprovante { get; set; } + + /// <summary> + /// Proxy para dhHashComprovante no formato AAAA-MM-DDThh:mm:ssTZD (UTC - Universal Coordinated Time) + /// </summary> + [XmlElement(ElementName = "dhHashComprovante")] + public string ProxyDhHashComprovante + { + get { return dhHashComprovante.ParaDataHoraStringUtc(); } + set { dhHashComprovante = DateTimeOffset.Parse(value); } + } + + #endregion + + #region Conciliação Financeira + + /// <summary> + /// P21 - Grupo de detalhamento do pagamento + /// </summary> + [XmlElement("detPag")] + public List<detPagEvento> detPag { get; set; } + + public bool ShouldSerializedetPag() + { + return detPag != null; + } + + #endregion } } \ No newline at end of file diff --git a/NFe.Classes/Servicos/Evento/detPagEvento.cs b/NFe.Classes/Servicos/Evento/detPagEvento.cs new file mode 100644 index 000000000..d390f3cf5 --- /dev/null +++ b/NFe.Classes/Servicos/Evento/detPagEvento.cs @@ -0,0 +1,101 @@ +using System; +using DFe.Utils; +using System.Xml.Serialization; +using NFe.Classes.Informacoes.Pagamento; +using NFe.Classes.Informacoes.Identificacao.Tipos; + +namespace NFe.Classes.Servicos.Evento +{ + public sealed class detPagEvento + { + private decimal _vPag; + + /// <summary> + /// P22 - Indicador da Forma de Pagamento + /// </summary> + public IndicadorPagamentoDetalhePagamento? indPag { get; set; } + + public bool indPagSpecified { get { return indPag.HasValue; } } + + /// <summary> + /// P23 - Meio de pagamento + /// </summary> + public FormaPagamento tPag { get; set; } + + /// <summary> + /// P24 - Descrição do Meio de Pagamento + /// </summary> + public string xPag { get; set; } + + /// <summary> + /// P25 - Valor do Pagamento + /// </summary> + public decimal vPag + { + get { return _vPag.Arredondar(2); } + set { _vPag = value.Arredondar(2); } + } + + /// <summary> + /// P26 - Data do Pagamento + /// </summary> + [XmlIgnore] + public DateTime? dPag { get; set; } + + /// <summary> + /// Proxy para dPag no formato AAAA-MM-DD + /// </summary> + [XmlElement(ElementName = "dPag")] + public string ProxydPag + { + get { return dPag.ParaDataString(); } + set { dPag = DateTime.Parse(value); } + } + + /// <summary> + /// P28 - CNPJ do estabelecimento onde o pagamento foi processado/transacionado/recebido + /// quando a emissão do documento fiscal ocorrer em estabelecimento distinto + /// </summary> + public string CNPJPag { get; set; } + + /// <summary> + /// P29 - UF do CNPJ do estabelecimento onde o pagamento foi processado/transacionado/recebido + /// </summary> + public string UFPag { get; set; } + + /// <summary> + /// P30 - CNPJ da instituição financeira, de pagamento, adquirente ou subadquirente + /// </summary> + public string CNPJIF { get; set; } + + /// <summary> + /// P31 - Bandeira da operadora de cartão de crédito e/ou débito + /// </summary> + public BandeiraCartao? tBand { get; set; } + + public bool ShouldSerializetBand() + { + return tBand.HasValue; + } + + /// <summary> + /// P32 - Número de autorização da operação cartão de crédito e/ou débito + /// </summary> + public string cAut { get; set; } + + /// <summary> + /// P34 - CNPJ do estabelecimento beneficiário do pagamento + /// </summary> + public string CNPJReceb { get; set; } + + /// <summary> + /// P35 - UF do estabelecimento beneficiário do pagamento + /// </summary> + public string UFReceb { get; set; } + + public bool ShouldSerializedPag() + { + return dPag.HasValue; + } + } +} diff --git a/NFe.Classes/Servicos/Status/retConsStatServ.cs b/NFe.Classes/Servicos/Status/retConsStatServ.cs index 2c4edc57b..9221f914a 100644 --- a/NFe.Classes/Servicos/Status/retConsStatServ.cs +++ b/NFe.Classes/Servicos/Status/retConsStatServ.cs @@ -30,9 +30,11 @@ /* http://www.zeusautomacao.com.br/ */ /* Rua Comendador Francisco josé da Cunha, 111 - Itabaiana - SE - 49500-000 */ /********************************************************************************/ +using System; using System.Xml.Serialization; using DFe.Classes.Entidades; using DFe.Classes.Flags; +using DFe.Utils; namespace NFe.Classes.Servicos.Status { @@ -70,5 +72,45 @@ public class retConsStatServ : IRetornoServico /// FR07 - Código da UF que atendeu a solicitação /// </summary> public Estado cUF { get; set; } + + /// <summary> + /// FR08 - Data e hora de recebimento + /// </summary> + [XmlIgnore] + public DateTimeOffset dhRecbto { get; set; } + + [XmlElement(ElementName = "dhRecbto")] + public string ProxyDhRecbto + { + get { return dhRecbto.ParaDataHoraStringUtc(); } + set { dhRecbto = DateTimeOffset.Parse(value); } + } + + /// <summary> + /// FR09 - Tempo médio de resposta do serviço + /// </summary> + public int? tMed { get; set; } + + /// <summary> + /// FR10 - Data e hora de retorno do Web Service + /// </summary> + [XmlIgnore] + public DateTimeOffset? dhRetorno { get; set; } + + [XmlElement(ElementName = "dhRetorno")] + public string ProxydhRetorno + { + get { return dhRetorno.ParaDataHoraStringUtc(); } + set { dhRetorno = DateTimeOffset.Parse(value); } + } + + /// <summary> + /// FR11 - Informações adicionais para o Contribuinte + /// </summary> +#if NET5_0_OR_GREATER//o uso de tipos de referência anuláveis não é permitido até o C# 8.0. + public string? xObs { get; set; } +#else + public string xObs { get; set; } +#endif } } \ No newline at end of file diff --git a/NFe.Classes/Servicos/Tipos/NFeServicosTipos.cs b/NFe.Classes/Servicos/Tipos/NFeServicosTipos.cs index 8b3dadc3f..c0f8a1a6f 100644 --- a/NFe.Classes/Servicos/Tipos/NFeServicosTipos.cs +++ b/NFe.Classes/Servicos/Tipos/NFeServicosTipos.cs @@ -64,6 +64,26 @@ public enum ServicoNFe /// </summary> RecepcaoEventoCancInsucessoEntregaNFe, + /// <summary> + /// serviço destinado à recepção de mensagem do Evento Comprovante de Entrega da NFe + /// </summary> + RecepcaoEventoComprovanteEntregaNFe, + + /// <summary> + /// serviço destinado à recepção de mensagem do Evento Cancelamento do Comprovante de Entrega da NFe + /// </summary> + RecepcaoEventoCancComprovanteEntregaNFe, + + /// <summary> + /// serviço destinado à recepção de mensagem do Evento Conciliação Financeira da NFe + /// </summary> + RecepcaoEventoConciliacaoFinanceiraNFe, + + /// <summary> + /// serviço destinado à recepção de mensagem do Evento Cancelamento de Conciliação Financeira da NFe + /// </summary> + RecepcaoEventoCancConciliacaoFinanceiraNFe, + /// <summary> /// serviço destinado à recepção de mensagem do Evento de Manifestação do destinatário da NF-e /// </summary> @@ -162,6 +182,12 @@ public enum IndicadorSincronizacao /// 110140 - EPEC /// 110111 - Cancelamento /// 110112 - Cancelamento por substituição + /// 110130 - Comprovante de Entrega da NF-e + /// 110131 - Cancelamento Comprovante de Entrega da NF-e + /// 110192 - Insucesso na Entrega da NF-e + /// 110193 - Cancelamento Insucesso na Entrega da NF-e + /// 110750 - Conciliação Financeira da NF-e + /// 110751 - Cancelamento Conciliação Financeira da NF-e /// 210200 – Confirmação da Operação /// 210210 – Ciência da Emissão /// 210220 – Desconhecimento da Operação @@ -211,6 +237,34 @@ public enum NFeTipoEvento [XmlEnum("110193")] TeNfeCancInsucessoNaEntregadaNFe = 110193, + /// <summary> + /// 110130 - Comprovante de Entrega da NF-e + /// </summary> + [Description("Comprovante de Entrega da NF-e")] + [XmlEnum("110130")] + TeNfeComprovanteDeEntregadaNFe = 110130, + + /// <summary> + /// 110131 - Cancelamento Comprovante de Entrega da NF-e + /// </summary> + [Description("Cancelamento Comprovante de Entrega da NF-e")] + [XmlEnum("110131")] + TeNfeCancComprovanteDeEntregadaNFe = 110131, + + /// <summary> + /// 110750 - Conciliação Financeira da NF-e + /// </summary> + [Description("ECONF")] + [XmlEnum("110750")] + TeNfeConciliacaoFinanceiraNFe = 110750, + + /// <summary> + /// 110751 - Cancelamento Conciliação Financeira da NF-e + /// </summary> + [Description("Cancelamento Conciliação Financeira")] + [XmlEnum("110751")] + TeNfeCancConciliacaoFinanceiraNFe = 110751, + /// <summary> /// 210200 – Confirmação da Operação /// </summary> diff --git a/NFe.Danfe.Base/NFe/NFeRetrato.frx b/NFe.Danfe.Base/NFe/NFeRetrato.frx index 4b721937e..e12986475 100644 --- a/NFe.Danfe.Base/NFe/NFeRetrato.frx +++ b/NFe.Danfe.Base/NFe/NFeRetrato.frx @@ -198,7 +198,7 @@ namespace FastReport if (icmsBasico != null) { var orig = icmsBasico.GetIcmsOrig(); - if ((CRT)(Report.GetColumnValue("NFe.NFe.infNFe.emit.CRT")) == CRT.SimplesNacional) + if ((CRT)(Report.GetColumnValue("NFe.NFe.infNFe.emit.CRT")) == CRT.SimplesNacional || ((CRT)Report.GetColumnValue("NFe.NFe.infNFe.emit.CRT")) == CRT.SimplesNacionalMei) { if (icmsBasico.GetIcmsCst().CsticmsParaString() == "02" || icmsBasico.GetIcmsCst().CsticmsParaString() == "15" || icmsBasico.GetIcmsCst().CsticmsParaString() == "53" || icmsBasico.GetIcmsCst().CsticmsParaString() == "61") @@ -314,8 +314,6 @@ namespace FastReport valor = "(" +valor.Substring(0,2) + ") " + valor.Substring(2,4) + "-" + valor.Substring(6,4); else if (valor.Length == 11) valor = "(" +valor.Substring(0,2) + ") " + valor.Substring(2,5) + "-" + valor.Substring(7,4); - else - valor = valor; break; case 'd': //cpf / cnpj @@ -465,8 +463,8 @@ namespace FastReport private void DadosProdutosHeader_BeforePrint(object sender, EventArgs e) { - if (((CRT)Report.GetColumnValue("NFe.NFe.infNFe.emit.CRT")) == CRT.SimplesNacional) { - Memo119.Text = "O/CSOSN"; + if (((CRT)Report.GetColumnValue("NFe.NFe.infNFe.emit.CRT")) == CRT.SimplesNacional || ((CRT)Report.GetColumnValue("NFe.NFe.infNFe.emit.CRT")) == CRT.SimplesNacionalMei) { + Memo119.Text = "O/CSOSN"; } _Tamanho = 0; @@ -1459,4 +1457,4 @@ namespace FastReport <TextObject Name="memWatermark" Width="744.57" Height="1122.52" Text="[Mensagem]" Padding="0, 0, 0, 0" HorzAlign="Center" VertAlign="Center" Font="Times New Roman, 50pt, style=Bold" TextFill.Color="216, 216, 216"/> </OverlayBand> </ReportPage> -</Report> \ No newline at end of file +</Report> diff --git a/NFe.Danfe.Base/NFe/NFeSimplificado.frx b/NFe.Danfe.Base/NFe/NFeSimplificado.frx index 296d0ecce..b60de21d6 100644 --- a/NFe.Danfe.Base/NFe/NFeSimplificado.frx +++ b/NFe.Danfe.Base/NFe/NFeSimplificado.frx @@ -16,7 +16,6 @@ using FastReport.Dialog; using FastReport.Barcode; using FastReport.Table; using FastReport.Utils; -using NFe.Classes.Informacoes.Identificacao.Tipos; using NFe.Classes.Informacoes.Detalhe.Tributacao; using NFe.Classes.Informacoes.Detalhe.Tributacao.Estadual.Tipos; using NFe.Classes.Informacoes.Detalhe.Tributacao.Federal.Tipos; diff --git a/NFe.Danfe.Html/Dominio/DanfeNFe.cs b/NFe.Danfe.Html/Dominio/DanfeNFe.cs index 5b74ec46d..18bc0ceaa 100644 --- a/NFe.Danfe.Html/Dominio/DanfeNFe.cs +++ b/NFe.Danfe.Html/Dominio/DanfeNFe.cs @@ -176,7 +176,7 @@ public class DanfeNFe /// <param name="protocolo">Número do protocolo retornado pela SEFAZ</param> /// <param name="creditos">Créditos</param> /// <param name="issqn">ISSQN</param> - public DanfeNFe(Classes.NFe nfe, Status status,string protocolo, string creditos, Issqn issqn=null) + public DanfeNFe(Classes.NFe nfe, Status status,string protocolo, string creditos, Issqn issqn = null, string logo = "") { if (nfe == null) throw new ArgumentNullException(nameof(nfe)); if(nfe.infNFe.ide.mod!=ModeloDocumento.NFe) throw new InvalidOperationException("Modelo da nota imcompatível com o esperado 55"); @@ -187,7 +187,7 @@ public DanfeNFe(Classes.NFe nfe, Status status,string protocolo, string creditos var enderecoEmit = new Endereco(nfe.infNFe.emit.enderEmit.xLgr, nfe.infNFe.emit.enderEmit.xBairro, nfe.infNFe.emit.enderEmit.xMun, nfe.infNFe.emit.enderEmit.nro, nfe.infNFe.emit.enderEmit.CEP, nfe.infNFe.emit.enderEmit.UF.ToString(), nfe.infNFe.emit.enderEmit.fone.ToString(), nfe.infNFe.emit.enderEmit.UF.ToString()); - Emitente = new Emitente(nfe.infNFe.emit.xNome, nfe.infNFe.emit.IE, doc, "", enderecoEmit); + Emitente = new Emitente(nfe.infNFe.emit.xNome, nfe.infNFe.emit.IE, doc, logo, enderecoEmit); #endregion @@ -379,4 +379,4 @@ public DanfeNFe(Classes.NFe nfe, Status status,string protocolo, string creditos #endregion } -} \ No newline at end of file +} diff --git a/NFe.Integracao/NFeFacade.cs b/NFe.Integracao/NFeFacade.cs index a8728efb9..187508649 100644 --- a/NFe.Integracao/NFeFacade.cs +++ b/NFe.Integracao/NFeFacade.cs @@ -187,6 +187,8 @@ private void CarregarConfiguracoes() ConfiguracaoServico.Instancia.VersaoNfeStatusServico = versaoNFe; ConfiguracaoServico.Instancia.VersaoRecepcaoEventoCceCancelamento = versaoNFe; ConfiguracaoServico.Instancia.VersaoRecepcaoEventoInsucessoEntrega = versaoNFe; + ConfiguracaoServico.Instancia.VersaoRecepcaoEventoComprovanteEntrega = versaoNFe; + ConfiguracaoServico.Instancia.VersaoRecepcaoEventoConciliacaoFinanceira = versaoNFe; #endregion diff --git a/NFe.Servicos/ServicoNfeFactory.cs b/NFe.Servicos/ServicoNfeFactory.cs index b9e7eb1c6..50e418b22 100644 --- a/NFe.Servicos/ServicoNfeFactory.cs +++ b/NFe.Servicos/ServicoNfeFactory.cs @@ -231,8 +231,16 @@ public static INfeServico CriaWsdlOutros(ServicoNFe servico, ConfiguracaoServico case ServicoNFe.RecepcaoEventoInsucessoEntregaNFe: case ServicoNFe.RecepcaoEventoCancInsucessoEntregaNFe: + return new RecepcaoEvento4SVCAN(url, certificado, cfg.TimeOut); + + case ServicoNFe.RecepcaoEventoComprovanteEntregaNFe: + case ServicoNFe.RecepcaoEventoCancComprovanteEntregaNFe: return new RecepcaoEvento4AN(url, certificado, cfg.TimeOut); + case ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe: + case ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe: + return new RecepcaoEvento4SVCAN(url, certificado, cfg.TimeOut); + case ServicoNFe.RecepcaoEventoManifestacaoDestinatario: if (cfg.VersaoRecepcaoEventoManifestacaoDestinatario == VersaoServico.Versao400) { diff --git a/NFe.Servicos/ServicosNFe.cs b/NFe.Servicos/ServicosNFe.cs index 4aee927e9..8f3b49b09 100644 --- a/NFe.Servicos/ServicosNFe.cs +++ b/NFe.Servicos/ServicosNFe.cs @@ -405,7 +405,11 @@ private RetornoRecepcaoEvento RecepcaoEvento(int idlote, List<evento> eventos, S ServicoNFe.RecepcaoEventoEpec, ServicoNFe.RecepcaoEventoManifestacaoDestinatario, ServicoNFe.RecepcaoEventoInsucessoEntregaNFe, - ServicoNFe.RecepcaoEventoCancInsucessoEntregaNFe + ServicoNFe.RecepcaoEventoCancInsucessoEntregaNFe, + ServicoNFe.RecepcaoEventoComprovanteEntregaNFe, + ServicoNFe.RecepcaoEventoCancComprovanteEntregaNFe, + ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, + ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }; if ( !listaEventos.Contains(servicoEvento)) @@ -824,7 +828,7 @@ public RetornoRecepcaoEvento RecepcaoEventoInsucessoEntrega(int idlote, }; var infEvento = new infEventoEnv { - cOrgao = _cFgServico.cUF, + cOrgao = Estado.SVRS, tpAmb = _cFgServico.tpAmb, chNFe = chaveNFe, dhEvento = dhEvento ?? DateTime.Now, @@ -876,7 +880,7 @@ public RetornoRecepcaoEvento RecepcaoEventoCancInsucessoEntrega(int idlote, var infEvento = new infEventoEnv { - cOrgao = _cFgServico.cUF, + cOrgao = Estado.SVRS, tpAmb = _cFgServico.tpAmb, chNFe = chaveNFe, dhEvento = dhEvento ?? DateTime.Now, @@ -896,6 +900,230 @@ public RetornoRecepcaoEvento RecepcaoEventoCancInsucessoEntrega(int idlote, return retorno; } + /// <summary> + /// Recepção do Evento de Comprovante de Entrega + /// </summary> + /// <param name="idlote">Nº do lote</param> + /// <param name="sequenciaEvento">sequencia do evento</param> + /// <param name="cpfcnpj"></param> + /// <param name="chaveNFe"></param> + /// <param name="dhEntrega"></param> + /// <param name="nDoc">Número documento de identificação da pessoa</param> + /// <param name="xNome">Nome da pessoa</param> + /// <param name="hashComprovante">Hash SHA-1, no formato Base64, resultante da + /// concatenação de: Chave de Acesso da NF-e + Base64 + /// da imagem capturada do comprovante de entrega (ex: + /// imagem capturada da assinatura eletrônica, digital do + /// recebedor, foto, etc).</param> + /// <param name="dhHashComprovante"></param> + /// <param name="latGps">Latitude do ponto de entrega (não obrigatório) </param> + /// <param name="longGps">Longitude do ponto de entrega (não obrigatório)</param> + /// <param name="ufAutor"></param> + /// <param name="versaoAplicativo"></param> + /// <param name="dhEvento"></param> + /// <returns></returns> + public RetornoRecepcaoEvento RecepcaoEventoComprovanteEntrega(int idlote, + int sequenciaEvento, string cpfcnpj, string chaveNFe, DateTimeOffset dhEntrega, string nDoc, string xNome, string hashComprovante, + DateTimeOffset? dhHashComprovante = null, decimal? latGps = null, decimal? longGps = null, + Estado? ufAutor = null, string versaoAplicativo = null, DateTimeOffset? dhEvento = null) + { + + var versaoServico = + ServicoNFe.RecepcaoEventoCancelmento.VersaoServicoParaString( + _cFgServico.VersaoRecepcaoEventoComprovanteEntrega); + + var detEvento = new detEvento + { + versao = versaoServico, + descEvento = NFeTipoEvento.TeNfeComprovanteDeEntregadaNFe.Descricao(), + cOrgaoAutor = ufAutor ?? _cFgServico.cUF, + tpAutor = TipoAutor.taEmpresaEmitente, + verAplic = versaoAplicativo ?? "1.0", + dhEntrega = dhEntrega, + nDoc = nDoc, + xNome = xNome, + latGPS = latGps, + longGPS = longGps, + hashComprovante = hashComprovante, + dhHashComprovante = dhHashComprovante + }; + var infEvento = new infEventoEnv + { + cOrgao = Estado.AN, + tpAmb = _cFgServico.tpAmb, + chNFe = chaveNFe, + dhEvento = dhEvento ?? DateTime.Now, + tpEvento = NFeTipoEvento.TeNfeComprovanteDeEntregadaNFe, + nSeqEvento = sequenciaEvento, + verEvento = versaoServico, + detEvento = detEvento + }; + if (cpfcnpj.Length == 11) + infEvento.CPF = cpfcnpj; + else + infEvento.CNPJ = cpfcnpj; + + var evento = new evento { versao = versaoServico, infEvento = infEvento }; + + var retorno = RecepcaoEvento(idlote, new List<evento> { evento }, ServicoNFe.RecepcaoEventoComprovanteEntregaNFe, _cFgServico.VersaoRecepcaoEventoComprovanteEntrega, true); + return retorno; + } + + /// <summary> + /// Serviço para cancelamento comprovante de entrega + /// </summary> + /// <param name="idlote">Nº do lote</param> + /// <param name="sequenciaEvento">sequencia do evento</param> + /// <param name="cpfcnpj"></param> + /// <param name="chaveNFe"></param> + /// <param name="nProtEvento">Protocolo do evento de comprovante de entrega que deseja cancelar</param> + /// <param name="ufAutor"></param> + /// <param name="versaoAplicativo"></param> + /// <param name="dhEvento"></param> + /// <returns></returns> + public RetornoRecepcaoEvento RecepcaoEventoCancComprovanteEntrega(int idlote, + int sequenciaEvento, string cpfcnpj, string chaveNFe, string nProtEvento, + Estado? ufAutor = null, string versaoAplicativo = null, DateTimeOffset? dhEvento = null) + { + + var versaoServico = + ServicoNFe.RecepcaoEventoCancelmento.VersaoServicoParaString( + _cFgServico.VersaoRecepcaoEventoComprovanteEntrega); + + var detEvento = new detEvento + { + versao = versaoServico, + descEvento = NFeTipoEvento.TeNfeCancComprovanteDeEntregadaNFe.Descricao(), + cOrgaoAutor = ufAutor ?? _cFgServico.cUF, + tpAutor = TipoAutor.taEmpresaEmitente, + verAplic = versaoAplicativo ?? "1.0", + nProtEvento = nProtEvento + }; + + var infEvento = new infEventoEnv + { + cOrgao = Estado.AN, + tpAmb = _cFgServico.tpAmb, + chNFe = chaveNFe, + dhEvento = dhEvento ?? DateTime.Now, + tpEvento = NFeTipoEvento.TeNfeCancComprovanteDeEntregadaNFe, + nSeqEvento = sequenciaEvento, + verEvento = versaoServico, + detEvento = detEvento + }; + if (cpfcnpj.Length == 11) + infEvento.CPF = cpfcnpj; + else + infEvento.CNPJ = cpfcnpj; + + var evento = new evento { versao = versaoServico, infEvento = infEvento }; + + var retorno = RecepcaoEvento(idlote, new List<evento> { evento }, ServicoNFe.RecepcaoEventoCancComprovanteEntregaNFe, _cFgServico.VersaoRecepcaoEventoComprovanteEntrega, true); + return retorno; + } + + + /// <summary> + /// Recepção do Evento de Conciliação Financeira + /// </summary> + /// <param name="idlote">Nº do lote</param> + /// <param name="sequenciaEvento">sequencia do evento</param> + /// <param name="cpfcnpj"></param> + /// <param name="chaveNFe"></param> + /// <param name="pagamentos">Informações dos pagamentos</param> + /// <param name="ufAutor"></param> + /// <param name="versaoAplicativo"></param> + /// <param name="dhEvento"></param> + /// <returns></returns> + public RetornoRecepcaoEvento RecepcaoEventoConciliacaoFinanceira(int idlote, + int sequenciaEvento, string cpfcnpj, string chaveNFe, List<detPagEvento> pagamentos, + Estado? ufAutor = null, string versaoAplicativo = null, DateTimeOffset? dhEvento = null) + { + + var versaoServico = + ServicoNFe.RecepcaoEventoCancelmento.VersaoServicoParaString( + _cFgServico.VersaoRecepcaoEventoConciliacaoFinanceira); + + var detEvento = new detEvento + { + versao = versaoServico, + descEvento = NFeTipoEvento.TeNfeConciliacaoFinanceiraNFe.Descricao(), + verAplic = versaoAplicativo ?? "1.0", + detPag = pagamentos + }; + var infEvento = new infEventoEnv + { + cOrgao = (_cFgServico.ModeloDocumento == ModeloDocumento.NFCe ? _cFgServico.cUF : Estado.SVRS), + tpAmb = _cFgServico.tpAmb, + chNFe = chaveNFe, + dhEvento = dhEvento ?? DateTime.Now, + tpEvento = NFeTipoEvento.TeNfeConciliacaoFinanceiraNFe, + nSeqEvento = sequenciaEvento, + verEvento = versaoServico, + detEvento = detEvento + }; + if (cpfcnpj.Length == 11) + infEvento.CPF = cpfcnpj; + else + infEvento.CNPJ = cpfcnpj; + + var evento = new evento { versao = versaoServico, infEvento = infEvento }; + + var retorno = RecepcaoEvento(idlote, new List<evento> { evento }, ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, _cFgServico.VersaoRecepcaoEventoConciliacaoFinanceira, true); + return retorno; + } + + /// <summary> + /// Serviço para cancelamento Conciliação Financeira + /// </summary> + /// <param name="idlote">Nº do lote</param> + /// <param name="sequenciaEvento">sequencia do evento</param> + /// <param name="cpfcnpj"></param> + /// <param name="chaveNFe"></param> + /// <param name="nProtEvento">Protocolo do evento de conciliação financeira que deseja cancelar</param> + /// <param name="ufAutor"></param> + /// <param name="versaoAplicativo"></param> + /// <param name="dhEvento"></param> + /// <returns></returns> + public RetornoRecepcaoEvento RecepcaoEventoCancConciliacaoFinanceira(int idlote, + int sequenciaEvento, string cpfcnpj, string chaveNFe, string nProtEvento, + Estado? ufAutor = null, string versaoAplicativo = null, DateTimeOffset? dhEvento = null) + { + + var versaoServico = + ServicoNFe.RecepcaoEventoCancelmento.VersaoServicoParaString( + _cFgServico.VersaoRecepcaoEventoConciliacaoFinanceira); + + var detEvento = new detEvento + { + versao = versaoServico, + descEvento = NFeTipoEvento.TeNfeCancConciliacaoFinanceiraNFe.Descricao(), + verAplic = versaoAplicativo ?? "1.0", + nProtEvento = nProtEvento + }; + + var infEvento = new infEventoEnv + { + cOrgao = (_cFgServico.ModeloDocumento == ModeloDocumento.NFCe ? _cFgServico.cUF : Estado.SVRS), + tpAmb = _cFgServico.tpAmb, + chNFe = chaveNFe, + dhEvento = dhEvento ?? DateTime.Now, + tpEvento = NFeTipoEvento.TeNfeCancConciliacaoFinanceiraNFe, + nSeqEvento = sequenciaEvento, + verEvento = versaoServico, + detEvento = detEvento + }; + if (cpfcnpj.Length == 11) + infEvento.CPF = cpfcnpj; + else + infEvento.CNPJ = cpfcnpj; + + var evento = new evento { versao = versaoServico, infEvento = infEvento }; + + var retorno = RecepcaoEvento(idlote, new List<evento> { evento }, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe, _cFgServico.VersaoRecepcaoEventoConciliacaoFinanceira, true); + return retorno; + } + /// <summary> /// Consulta a situação cadastral, com base na UF/Documento /// <para>O documento pode ser: IE, CNPJ ou CPF</para> diff --git a/NFe.Utils.Testes/EnderecadorTestes.cs b/NFe.Utils.Testes/EnderecadorTestes.cs index b6377b46c..c3eb90acb 100644 --- a/NFe.Utils.Testes/EnderecadorTestes.cs +++ b/NFe.Utils.Testes/EnderecadorTestes.cs @@ -69,6 +69,9 @@ public EstadosData() todosOsEstados.Remove(Estado.EX); todosOsEstados.Remove(Estado.PA); + // UF autorizadora + todosOsEstados.Remove(Estado.SVRS); + var tiposAmbiente = Enum.GetValues(typeof(TipoAmbiente)).Cast<TipoAmbiente>().ToList(); var servicosAutorizacao = new[] {ServicoNFe.NFeAutorizacao, ServicoNFe.NFeRetAutorizacao}; diff --git a/NFe.Utils.Testes/ExtinfNFeSuplTestes.cs b/NFe.Utils.Testes/ExtinfNFeSuplTestes.cs index da5066c12..4427804f2 100644 --- a/NFe.Utils.Testes/ExtinfNFeSuplTestes.cs +++ b/NFe.Utils.Testes/ExtinfNFeSuplTestes.cs @@ -28,6 +28,9 @@ public EstadosAmbientesData() todosOsEstados.Remove(Estado.AN); todosOsEstados.Remove(Estado.EX); + // UF autorizadora + todosOsEstados.Remove(Estado.SVRS); + //Não divulgaram as urls para homologação e produção no ENCAT todosOsEstados.Remove(Estado.CE); todosOsEstados.Remove(Estado.ES); diff --git a/NFe.Utils/ConfiguracaoServico.cs b/NFe.Utils/ConfiguracaoServico.cs index 5cab4964d..112bfc5d9 100644 --- a/NFe.Utils/ConfiguracaoServico.cs +++ b/NFe.Utils/ConfiguracaoServico.cs @@ -61,6 +61,8 @@ public sealed class ConfiguracaoServico : INotifyPropertyChanged private bool _unZip = true; private VersaoServico _versaoRecepcaoEventoCceCancelamento; private VersaoServico _versaoRecepcaoEventoInsucessoEntrega; + private VersaoServico _versaoRecepcaoEventoComprovanteEntrega; + private VersaoServico _versaoRecepcaoEventoConciliacaoFinanceira; private VersaoServico _versaoRecepcaoEventoEpec; private VersaoServico _versaoRecepcaoEventoManifestacaoDestinatario; private VersaoServico _versaoNfeRecepcao; @@ -236,6 +238,8 @@ private void AtualizaVersoes() { VersaoRecepcaoEventoCceCancelamento = obterVersao(ServicoNFe.RecepcaoEventoCancelmento); VersaoRecepcaoEventoInsucessoEntrega = obterVersao(ServicoNFe.RecepcaoEventoInsucessoEntregaNFe); + VersaoRecepcaoEventoComprovanteEntrega = obterVersao(ServicoNFe.RecepcaoEventoComprovanteEntregaNFe); + VersaoRecepcaoEventoConciliacaoFinanceira = obterVersao(ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe); VersaoRecepcaoEventoEpec = obterVersao(ServicoNFe.RecepcaoEventoEpec); VersaoRecepcaoEventoManifestacaoDestinatario = obterVersao(ServicoNFe.RecepcaoEventoManifestacaoDestinatario); VersaoNfeRecepcao = obterVersao(ServicoNFe.NfeRecepcao); @@ -299,6 +303,34 @@ public VersaoServico VersaoRecepcaoEventoInsucessoEntrega } } + /// <summary> + /// Versão do serviço RecepcaoEvento para Comprovante de Entrega da NFe + /// </summary> + public VersaoServico VersaoRecepcaoEventoComprovanteEntrega + { + get { return _versaoRecepcaoEventoComprovanteEntrega; } + set + { + if (value == _versaoRecepcaoEventoComprovanteEntrega) return; + _versaoRecepcaoEventoComprovanteEntrega = value; + OnPropertyChanged(); + } + } + + /// <summary> + /// Versão do serviço RecepcaoEvento para Conciliação Financeira da NFe + /// </summary> + public VersaoServico VersaoRecepcaoEventoConciliacaoFinanceira + { + get { return _versaoRecepcaoEventoConciliacaoFinanceira; } + set + { + if (value == _versaoRecepcaoEventoConciliacaoFinanceira) return; + _versaoRecepcaoEventoConciliacaoFinanceira = value; + OnPropertyChanged(); + } + } + /// <summary> /// Versão do serviço RecepcaoEvento para Manifestação do destinatário /// </summary> diff --git a/NFe.Utils/Enderecos/Enderecador.cs b/NFe.Utils/Enderecos/Enderecador.cs index 36de39cd4..5dc607c27 100644 --- a/NFe.Utils/Enderecos/Enderecador.cs +++ b/NFe.Utils/Enderecos/Enderecador.cs @@ -218,7 +218,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NFeRetAutorizacao }, versao3, hom, emissao, Estado.AM, nfce, "https://homnfce.sefaz.am.gov.br/nfce-services-nac/services/NfeRetAutorizacao"); addServico(new[] { ServicoNFe.NfeConsultaProtocolo }, versao3, hom, emissao, Estado.AM, nfce, "https://homnfce.sefaz.am.gov.br/nfce-services-nac/services/NfeConsulta2"); addServico(new[] { ServicoNFe.NfeRecepcao }, versao3, hom, emissao, Estado.AM, nfce, "https://homnfce.sefaz.am.gov.br/nfce-services-nac/services/NfeRecepcao2"); - addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao1, hom, emissao, Estado.AM, nfce, "https://homnfce.sefaz.am.gov.br/nfce-services-nac/services/RecepcaoEvento"); + addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento, }, versao1, hom, emissao, Estado.AM, nfce, "https://homnfce.sefaz.am.gov.br/nfce-services-nac/services/RecepcaoEvento"); addServico(new[] { ServicoNFe.NfeStatusServico }, versao3, hom, emissao, Estado.AM, nfce, "https://homnfce.sefaz.am.gov.br/nfce-services-nac/services/NfeStatusServico2"); addServico(new[] { ServicoNFe.NfeRetRecepcao }, versao3, hom, emissao, Estado.AM, nfce, "https://homnfce.sefaz.am.gov.br/nfce-services-nac/services/NfeRetRecepcao2"); addServico(new[] { ServicoNFe.NfeInutilizacao }, versao3, hom, emissao, Estado.AM, nfce, "https://homnfce.sefaz.am.gov.br/nfce-services-nac/services/NfeInutilizacao2"); @@ -228,6 +228,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NfeConsultaProtocolo }, versao4, hom, emissao, Estado.AM, nfce, "https://homnfce.sefaz.am.gov.br/nfce-services/services/NfeConsulta4"); addServico(new[] { ServicoNFe.NfeStatusServico }, versao4, hom, emissao, Estado.AM, nfce, "https://homnfce.sefaz.am.gov.br/nfce-services/services/NfeStatusServico4"); addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao4, hom, emissao, Estado.AM, nfce, "https://homnfce.sefaz.am.gov.br/nfce-services/services/RecepcaoEvento4"); + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, hom, emissao, Estado.AM, nfce, "https://homnfce.sefaz.am.gov.br/nfce-services/services/RecepcaoEvento4"); #endregion } @@ -276,6 +277,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NfeConsultaProtocolo }, versao4, prod, emissao, Estado.AM, nfce, "https://nfce.sefaz.am.gov.br/nfce-services/services/NfeConsulta4"); addServico(new[] { ServicoNFe.NfeStatusServico }, versao4, prod, emissao, Estado.AM, nfce, "https://nfce.sefaz.am.gov.br/nfce-services/services/NfeStatusServico4"); addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao4, prod, emissao, Estado.AM, nfce, "https://nfce.sefaz.am.gov.br/nfce-services/services/RecepcaoEvento4"); + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, prod, emissao, Estado.AM, nfce, "https://nfce.sefaz.am.gov.br/nfce-services/services/RecepcaoEvento4"); #endregion } @@ -393,7 +395,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NfeStatusServico }, versao4, hom, emissao, Estado.CE, nfce, "https://nfceh.sefaz.ce.gov.br/nfce4/services/NFeStatusServico4?WSDL"); addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao4, hom, emissao, Estado.CE, nfce, "https://nfceh.sefaz.ce.gov.br/nfce4/services/NFeRecepcaoEvento4?WSDL"); addServico(new[] { ServicoNFe.NfeConsultaCadastro }, versao4, hom, emissao, Estado.CE, nfce, "https://nfceh.sefaz.ce.gov.br/nfce4/services/CadConsultaCadastro4?WSDL"); - + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, hom, emissao, Estado.CE, nfce, "https://nfceh.sefaz.ce.gov.br/nfce4/services/NFeRecepcaoEvento4?WSDL"); #endregion } @@ -438,6 +440,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NfeConsultaProtocolo }, versao4, prod, emissao, Estado.CE, nfce, "https://nfce.sefaz.ce.gov.br/nfce4/services/NFeConsultaProtocolo4?WSDL"); addServico(new[] { ServicoNFe.NfeStatusServico }, versao4, prod, emissao, Estado.CE, nfce, "https://nfce.sefaz.ce.gov.br/nfce4/services/NFeStatusServico4?WSDL"); addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao4, prod, emissao, Estado.CE, nfce, "https://nfce.sefaz.ce.gov.br/nfce4/services/NFeRecepcaoEvento4?WSDL"); + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, prod, emissao, Estado.CE, nfce, "https://nfce.sefaz.ce.gov.br/nfce4/services/NFeRecepcaoEvento4?WSDL"); #endregion } @@ -589,6 +592,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao4, hom, emissao, Estado.MG, nfce, "https://hnfce.fazenda.mg.gov.br/nfce/services/NFeRecepcaoEvento4"); addServico(new[] { ServicoNFe.NFeAutorizacao }, versao4, hom, emissao, Estado.MG, nfce, "https://hnfce.fazenda.mg.gov.br/nfce/services/NFeAutorizacao4"); addServico(new[] { ServicoNFe.NFeRetAutorizacao }, versao4, hom, emissao, Estado.MG, nfce, "https://hnfce.fazenda.mg.gov.br/nfce/services/NFeRetAutorizacao4"); + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, hom, emissao, Estado.MG, nfce, "https://hnfce.fazenda.mg.gov.br/nfce/services/NFeRecepcaoEvento4"); } #endregion @@ -624,6 +628,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao4, prod, emissao, Estado.MG, nfce, "https://nfce.fazenda.mg.gov.br/nfce/services/NFeRecepcaoEvento4"); addServico(new[] { ServicoNFe.NFeAutorizacao }, versao4, prod, emissao, Estado.MG, nfce, "https://nfce.fazenda.mg.gov.br/nfce/services/NFeAutorizacao4"); addServico(new[] { ServicoNFe.NFeRetAutorizacao }, versao4, prod, emissao, Estado.MG, nfce, "https://nfce.fazenda.mg.gov.br/nfce/services/NFeRetAutorizacao4"); + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, prod, emissao, Estado.MG, nfce, "https://nfce.fazenda.mg.gov.br/nfce/services/NFeRecepcaoEvento4"); } #endregion @@ -676,7 +681,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NfeStatusServico }, versao4, hom, emissao, Estado.MS, nfce, "https://hom.nfce.sefaz.ms.gov.br/ws/NFeStatusServico4"); addServico(new[] { ServicoNFe.NfeConsultaCadastro }, versao4, hom, emissao, Estado.MS, nfce, "https://hom.nfe.sefaz.ms.gov.br/ws/CadConsultaCadastro4"); addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao4, hom, emissao, Estado.MS, nfce, "https://hom.nfce.sefaz.ms.gov.br/ws/NFeRecepcaoEvento4"); - + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, hom, emissao, Estado.MS, nfce, "https://hom.nfce.sefaz.ms.gov.br/ws/NFeRecepcaoEvento4"); #endregion } @@ -725,6 +730,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NfeStatusServico }, versao4, prod, emissao, Estado.MS, nfce, "https://nfce.sefaz.ms.gov.br/ws/NFeStatusServico4"); addServico(new[] { ServicoNFe.NfeConsultaCadastro }, versao4, prod, emissao, Estado.MS, nfce, "https://nfe.sefaz.ms.gov.br/ws/CadConsultaCadastro4"); addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao4, prod, emissao, Estado.MS, nfce, "https://nfce.sefaz.ms.gov.br/ws/NFeRecepcaoEvento4"); + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, prod, emissao, Estado.MS, nfce, "https://nfce.sefaz.ms.gov.br/ws/NFeRecepcaoEvento4"); #endregion } @@ -779,6 +785,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NfeConsultaProtocolo }, versao4, hom, emissao, Estado.MT, nfce, "https://homologacao.sefaz.mt.gov.br/nfcews/services/NfeConsulta4"); addServico(new[] { ServicoNFe.NfeStatusServico }, versao4, hom, emissao, Estado.MT, nfce, "https://homologacao.sefaz.mt.gov.br/nfcews/services/NfeStatusServico4"); addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao4, hom, emissao, Estado.MT, nfce, "https://homologacao.sefaz.mt.gov.br/nfcews/services/RecepcaoEvento4"); + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, hom, emissao, Estado.MT, nfce, "https://homologacao.sefaz.mt.gov.br/nfcews/services/RecepcaoEvento4"); #endregion } @@ -827,6 +834,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NfeConsultaProtocolo }, versao4, prod, emissao, Estado.MT, nfce, "https://nfce.sefaz.mt.gov.br/nfcews/services/NfeConsulta4"); addServico(new[] { ServicoNFe.NfeStatusServico }, versao4, prod, emissao, Estado.MT, nfce, "https://nfce.sefaz.mt.gov.br/nfcews/services/NfeStatusServico4"); addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao4, prod, emissao, Estado.MT, nfce, "https://nfce.sefaz.mt.gov.br/nfcews/services/RecepcaoEvento4"); + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, prod, emissao, Estado.MT, nfce, "https://nfce.sefaz.mt.gov.br/nfcews/services/RecepcaoEvento4"); #endregion } @@ -967,6 +975,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NfeStatusServico }, versao4, hom, emissao, Estado.PR, nfce, "https://homologacao.nfce.sefa.pr.gov.br/nfce/NFeStatusServico4"); addServico(new[] { ServicoNFe.NfeConsultaCadastro }, versao4, hom, emissao, Estado.PR, nfce, "https://homologacao.nfce.sefa.pr.gov.br/nfce/CadConsultaCadastro4"); addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao4, hom, emissao, Estado.PR, nfce, "https://homologacao.nfce.sefa.pr.gov.br/nfce/NFeRecepcaoEvento4"); + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, hom, emissao, Estado.PR, nfce, "https://homologacao.nfce.sefa.pr.gov.br/nfce/NFeRecepcaoEvento4"); #endregion } @@ -1021,6 +1030,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NfeStatusServico }, versao4, prod, emissao, Estado.PR, nfce, "https://nfce.sefa.pr.gov.br/nfce/NFeStatusServico4"); addServico(new[] { ServicoNFe.NfeConsultaCadastro }, versao4, prod, emissao, Estado.PR, nfce, "https://nfce.sefa.pr.gov.br/nfce/CadConsultaCadastro4"); addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao4, prod, emissao, Estado.PR, nfce, "https://nfce.sefa.pr.gov.br/nfce/NFeRecepcaoEvento4"); + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, prod, emissao, Estado.PR, nfce, "https://nfce.sefa.pr.gov.br/nfce/NFeRecepcaoEvento4"); #endregion } @@ -1089,6 +1099,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NfeConsultaProtocolo }, versao4, hom, emissao, Estado.RS, nfce, "https://nfce-homologacao.sefazrs.rs.gov.br/ws/NfeConsulta/NfeConsulta4.asmx"); addServico(new[] { ServicoNFe.NfeStatusServico }, versao4, hom, emissao, Estado.RS, nfce, "https://nfce-homologacao.sefazrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx"); addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao4, hom, emissao, Estado.RS, nfce, "https://nfce-homologacao.sefazrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx"); + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, hom, emissao, Estado.RS, nfce, "https://nfce-homologacao.sefazrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx"); #endregion } @@ -1134,6 +1145,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NfeConsultaProtocolo }, versao4, prod, emissao, Estado.RS, nfce, "https://nfce.sefazrs.rs.gov.br/ws/NfeConsulta/NfeConsulta4.asmx"); addServico(new[] { ServicoNFe.NfeStatusServico }, versao4, prod, emissao, Estado.RS, nfce, "https://nfce.sefazrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx"); addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao4, prod, emissao, Estado.RS, nfce, "https://nfce.sefazrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx"); + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, prod, emissao, Estado.RS, nfce, "https://nfce.sefazrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx"); #endregion } @@ -1207,6 +1219,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NfeConsultaProtocolo }, versao4, hom, emissao, Estado.SP, nfce, "https://homologacao.nfce.fazenda.sp.gov.br/ws/NFeConsultaProtocolo4.asmx"); addServico(new[] { ServicoNFe.NfeStatusServico }, versao4, hom, emissao, Estado.SP, nfce, "https://homologacao.nfce.fazenda.sp.gov.br/ws/NFeStatusServico4.asmx"); addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao4, hom, emissao, Estado.SP, nfce, "https://homologacao.nfce.fazenda.sp.gov.br/ws/NFeRecepcaoEvento4.asmx"); + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, hom, emissao, Estado.SP, nfce, "https://homologacao.nfce.fazenda.sp.gov.br/ws/NFeRecepcaoEvento4.asmx"); #endregion } @@ -1256,6 +1269,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NfeConsultaProtocolo }, versao4, prod, emissao, Estado.SP, nfce, "https://nfce.fazenda.sp.gov.br/ws/NFeConsultaProtocolo4.asmx"); addServico(new[] { ServicoNFe.NfeStatusServico }, versao4, prod, emissao, Estado.SP, nfce, "https://nfce.fazenda.sp.gov.br/ws/NFeStatusServico4.asmx"); addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao4, prod, emissao, Estado.SP, nfce, "https://nfce.fazenda.sp.gov.br/ws/NFeRecepcaoEvento4.asmx"); + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, prod, emissao, Estado.SP, nfce, "https://nfce.fazenda.sp.gov.br/ws/NFeRecepcaoEvento4.asmx"); #endregion } @@ -1374,6 +1388,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NfeConsultaProtocolo }, versao4, hom, emissao, estado, nfce, "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta4.asmx"); addServico(new[] { ServicoNFe.NfeStatusServico }, versao4, hom, emissao, estado, nfce, "https://nfce-homologacao.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx"); addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao4, hom, emissao, estado, nfce, "https://nfce-homologacao.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx"); + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, hom, emissao, estado, nfce, "https://nfce-homologacao.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx"); #endregion } @@ -1436,6 +1451,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NfeConsultaProtocolo }, versao4, prod, emissao, estado, nfce, "https://nfce.svrs.rs.gov.br/ws/NfeConsulta/NfeConsulta4.asmx"); addServico(new[] { ServicoNFe.NfeStatusServico }, versao4, prod, emissao, estado, nfce, "https://nfce.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx"); addServico(new[] { ServicoNFe.RecepcaoEventoCancelmento }, versao4, prod, emissao, estado, nfce, "https://nfce.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx"); + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, prod, emissao, estado, nfce, "https://nfce.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx"); #endregion } @@ -1594,6 +1610,9 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NfeDownloadNF }, versao2E3, hom, TipoEmissao.teNormal, estado, modelo, "https://hom.nfe.fazenda.gov.br/NfeDownloadNF/NfeDownloadNF.asmx"); if (modelo != ModeloDocumento.NFCe) addServico(new[] { ServicoNFe.NFeDistribuicaoDFe }, versao1, hom, TipoEmissao.teNormal, estado, modelo, "https://hom1.nfe.fazenda.gov.br/NFeDistribuicaoDFe/NFeDistribuicaoDFe.asmx"); + + // Comprovante de Entrega + addServico(new[] { ServicoNFe.RecepcaoEventoComprovanteEntregaNFe, ServicoNFe.RecepcaoEventoCancComprovanteEntregaNFe }, versao1, hom, TipoEmissao.teNormal, estado, modelo, "https://hom1.nfe.fazenda.gov.br/NFeRecepcaoEvento4/NFeRecepcaoEvento4.asmx"); } } @@ -1623,6 +1642,9 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.NfeDownloadNF }, versao2E3, prod, TipoEmissao.teNormal, estado, modelo, "https://www.nfe.fazenda.gov.br/NfeDownloadNF/NfeDownloadNF.asmx"); if (modelo != ModeloDocumento.NFCe) addServico(new[] { ServicoNFe.NFeDistribuicaoDFe }, versao1, prod, TipoEmissao.teNormal, estado, modelo, "https://www1.nfe.fazenda.gov.br/NFeDistribuicaoDFe/NFeDistribuicaoDFe.asmx"); + + // Comprovante de Entrega + addServico(new[] { ServicoNFe.RecepcaoEventoComprovanteEntregaNFe, ServicoNFe.RecepcaoEventoCancComprovanteEntregaNFe }, versao1, prod, TipoEmissao.teNormal, estado, modelo, "https://www.nfe.fazenda.gov.br/NFeRecepcaoEvento4/NFeRecepcaoEvento4.asmx"); } } @@ -1630,7 +1652,7 @@ private static List<EnderecoServico> CarregarEnderecosServicos() #endregion - #region ConsultaGtin e Insucesso na entrega + #region ConsultaGtin / Insucesso na entrega / Conciliação Financeira foreach (var estado in Enum.GetValues(typeof(Estado)) .Cast<Estado>() .ToList()) @@ -1644,8 +1666,16 @@ private static List<EnderecoServico> CarregarEnderecosServicos() addServico(new[] { ServicoNFe.ConsultaGtin }, versao1, TipoAmbiente.Homologacao, emissao, estado, modelo, "https://dfe-servico.svrs.rs.gov.br/ws/ccgConsGTIN/ccgConsGTIN.asmx"); //Insucesso Entrega NFe - addServico(new[] { ServicoNFe.RecepcaoEventoInsucessoEntregaNFe, ServicoNFe.RecepcaoEventoCancInsucessoEntregaNFe }, versao1, TipoAmbiente.Producao, emissao, estado, modelo, "https://www.nfe.fazenda.gov.br/NFeRecepcaoEvento4/NFeRecepcaoEvento4.asmx"); - addServico(new[] { ServicoNFe.RecepcaoEventoInsucessoEntregaNFe, ServicoNFe.RecepcaoEventoCancInsucessoEntregaNFe }, versao1, TipoAmbiente.Homologacao, emissao, estado, modelo, "https://hom1.nfe.fazenda.gov.br/NFeRecepcaoEvento4/NFeRecepcaoEvento4.asmx"); + addServico(new[] { ServicoNFe.RecepcaoEventoInsucessoEntregaNFe, ServicoNFe.RecepcaoEventoCancInsucessoEntregaNFe }, versao1, TipoAmbiente.Producao, emissao, estado, modelo, "https://nfe.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx"); + addServico(new[] { ServicoNFe.RecepcaoEventoInsucessoEntregaNFe, ServicoNFe.RecepcaoEventoCancInsucessoEntregaNFe }, versao1, TipoAmbiente.Homologacao, emissao, estado, modelo, "https://nfe-homologacao.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx"); + + + if (modelo == ModeloDocumento.NFe) + { + //Conciliação Financeira NFe + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, TipoAmbiente.Producao, emissao, estado, modelo, "https://nfe.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx"); + addServico(new[] { ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe, ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe }, versao1, TipoAmbiente.Homologacao, emissao, estado, modelo, "https://nfe-homologacao.svrs.rs.gov.br/ws/recepcaoevento/recepcaoevento4.asmx"); + } } } } @@ -1680,6 +1710,12 @@ public static void CarregarEnderecos() case ServicoNFe.RecepcaoEventoInsucessoEntregaNFe: case ServicoNFe.RecepcaoEventoCancInsucessoEntregaNFe: return cfgServico.VersaoRecepcaoEventoInsucessoEntrega; + case ServicoNFe.RecepcaoEventoComprovanteEntregaNFe: + case ServicoNFe.RecepcaoEventoCancComprovanteEntregaNFe: + return cfgServico.VersaoRecepcaoEventoComprovanteEntrega; + case ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe: + case ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe: + return cfgServico.VersaoRecepcaoEventoConciliacaoFinanceira; case ServicoNFe.RecepcaoEventoEpec: return cfgServico.VersaoRecepcaoEventoEpec; case ServicoNFe.RecepcaoEventoManifestacaoDestinatario: diff --git a/NFe.Utils/Tributacao/Estadual/ICMSGeral.cs b/NFe.Utils/Tributacao/Estadual/ICMSGeral.cs index bcaf63a13..35fbadffc 100644 --- a/NFe.Utils/Tributacao/Estadual/ICMSGeral.cs +++ b/NFe.Utils/Tributacao/Estadual/ICMSGeral.cs @@ -55,7 +55,7 @@ public ICMSGeral(ICMSBasico icmsBasico) public ICMSGeral() { - + } /// <summary> @@ -247,12 +247,30 @@ public ICMSBasico ObterICMSBasico(CRT crt) /// </summary> public decimal? vICMSDeson { get; set; } + /// <summary> + /// N28b - Indica se o valor do ICMS desonerado (vICMSDeson) deduz + /// do valor do item (vProd). (NT 2023.004) + /// </summary> + public DeduzDesoneracaoNoProduto? indDeduzDeson { get; set; } + + // <summary> + /// N33a - Valor do ICMS- ST desonerado + /// Versão 4.00 + /// </summary> + public decimal? vICMSSTDeson { get; set; } + + /// <summary> + /// N33b - Motivo da desoneração do ICMS- ST + /// Versão 4.00 + /// </summary> + public MotivoDesoneracaoIcmsSt? motDesICMSST { get; set; } + /// <summary> /// Motivo da desoneração do ICMS /// </summary> public MotivoDesoneracaoIcms? motDesICMS { get; set; } - /// <summary> + /// <summary> /// Valor do ICMS da Operação /// </summary> public decimal? vICMSOp { get; set; } @@ -271,7 +289,7 @@ public ICMSBasico ObterICMSBasico(CRT crt) /// Valor da BC do ICMS ST retido /// </summary> public decimal? vBCSTRet { get; set; } - + /// <summary> /// Valor do ICMS ST retido /// </summary> @@ -370,8 +388,8 @@ public ICMSBasico ObterICMSBasico(CRT crt) /// Valor do FCP retido por Substituição Tributária /// </summary> public decimal? vFCPSTRet { get; set; } - - /// <summary> + + /// <summary> /// Valor do ICMS próprio do Substituto (tag: vICMSSubstituto) /// </summary> public decimal? vICMSSubstituto { get; set; } @@ -412,5 +430,6 @@ public ICMSBasico ObterICMSBasico(CRT crt) /// Valor do ICMS retido anteriormente /// </summary> public decimal? vICMSMonoRet { get; set; } + } } \ No newline at end of file diff --git a/NFe.Utils/Validacao/Validador.cs b/NFe.Utils/Validacao/Validador.cs index f32170d2e..82e9d20dc 100644 --- a/NFe.Utils/Validacao/Validador.cs +++ b/NFe.Utils/Validacao/Validador.cs @@ -66,6 +66,14 @@ internal static string ObterArquivoSchema(ServicoNFe servicoNFe, VersaoServico v return "envEventoInsucessoNFe_v1.00.xsd"; case ServicoNFe.RecepcaoEventoCancInsucessoEntregaNFe: return "envEventoCancInsucessoNFe_v1.00.xsd"; + case ServicoNFe.RecepcaoEventoComprovanteEntregaNFe: + return "envEventoEntregaNFe_v1.00.xsd"; + case ServicoNFe.RecepcaoEventoCancComprovanteEntregaNFe: + return "envEventoCancEntregaNFe_v1.00.xsd"; + case ServicoNFe.RecepcaoEventoConciliacaoFinanceiraNFe: + return "envEventoEConf_v1.00.xsd"; + case ServicoNFe.RecepcaoEventoCancConciliacaoFinanceiraNFe: + return "envEventoCancEConf_v1.00.xsd"; case ServicoNFe.RecepcaoEventoEpec: return "envEPEC_v1.00.xsd"; case ServicoNFe.RecepcaoEventoManifestacaoDestinatario: