diff --git a/CTe.AppTeste/Properties/AssemblyInfo.cs b/CTe.AppTeste/Properties/AssemblyInfo.cs
index 2a85e87b1..eef631168 100644
--- a/CTe.AppTeste/Properties/AssemblyInfo.cs
+++ b/CTe.AppTeste/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/CTe.Classes/Properties/AssemblyInfo.cs b/CTe.Classes/Properties/AssemblyInfo.cs
index ab248a9ba..03ee9440d 100644
--- a/CTe.Classes/Properties/AssemblyInfo.cs
+++ b/CTe.Classes/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/CTe.Dacte.AppTeste/Properties/AssemblyInfo.cs b/CTe.Dacte.AppTeste/Properties/AssemblyInfo.cs
index 896ea7723..e15082b60 100644
--- a/CTe.Dacte.AppTeste/Properties/AssemblyInfo.cs
+++ b/CTe.Dacte.AppTeste/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/CTe.Dacte.Base/Properties/AssemblyInfo.cs b/CTe.Dacte.Base/Properties/AssemblyInfo.cs
index ff940cbff..8a86c6dbe 100644
--- a/CTe.Dacte.Base/Properties/AssemblyInfo.cs
+++ b/CTe.Dacte.Base/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/CTe.Dacte.Fast/Properties/AssemblyInfo.cs b/CTe.Dacte.Fast/Properties/AssemblyInfo.cs
index 56797b6ae..36dafabf2 100644
--- a/CTe.Dacte.Fast/Properties/AssemblyInfo.cs
+++ b/CTe.Dacte.Fast/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/CTe.Servicos/Properties/AssemblyInfo.cs b/CTe.Servicos/Properties/AssemblyInfo.cs
index 156ee1b54..f52d743d9 100644
--- a/CTe.Servicos/Properties/AssemblyInfo.cs
+++ b/CTe.Servicos/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/CTe.Utils/Properties/AssemblyInfo.cs b/CTe.Utils/Properties/AssemblyInfo.cs
index fa74e5bae..e4d5fabe5 100644
--- a/CTe.Utils/Properties/AssemblyInfo.cs
+++ b/CTe.Utils/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/CTe.Wsdl/Properties/AssemblyInfo.cs b/CTe.Wsdl/Properties/AssemblyInfo.cs
index 373d1d346..1e9deeeee 100644
--- a/CTe.Wsdl/Properties/AssemblyInfo.cs
+++ b/CTe.Wsdl/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/DFe.Classes/Properties/AssemblyInfo.cs b/DFe.Classes/Properties/AssemblyInfo.cs
index b72f5ba2f..a7379be48 100755
--- a/DFe.Classes/Properties/AssemblyInfo.cs
+++ b/DFe.Classes/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/DFe.Utils/Properties/AssemblyInfo.cs b/DFe.Utils/Properties/AssemblyInfo.cs
index 29ef1083d..37a3219ed 100755
--- a/DFe.Utils/Properties/AssemblyInfo.cs
+++ b/DFe.Utils/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/GraphicsPrinter/Properties/AssemblyInfo.cs b/GraphicsPrinter/Properties/AssemblyInfo.cs
index 6b95a4d3f..c0fdaa3a8 100644
--- a/GraphicsPrinter/Properties/AssemblyInfo.cs
+++ b/GraphicsPrinter/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/MDFe.AppTeste/Properties/AssemblyInfo.cs b/MDFe.AppTeste/Properties/AssemblyInfo.cs
index 14f236cab..0096df61b 100755
--- a/MDFe.AppTeste/Properties/AssemblyInfo.cs
+++ b/MDFe.AppTeste/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/MDFe.Classes/Properties/AssemblyInfo.cs b/MDFe.Classes/Properties/AssemblyInfo.cs
index 9cb01b386..42e0105ea 100755
--- a/MDFe.Classes/Properties/AssemblyInfo.cs
+++ b/MDFe.Classes/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/MDFe.Damdfe.AppTeste/Properties/AssemblyInfo.cs b/MDFe.Damdfe.AppTeste/Properties/AssemblyInfo.cs
index 1f198607d..539ad3a45 100755
--- a/MDFe.Damdfe.AppTeste/Properties/AssemblyInfo.cs
+++ b/MDFe.Damdfe.AppTeste/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/MDFe.Damdfe.Base/Properties/AssemblyInfo.cs b/MDFe.Damdfe.Base/Properties/AssemblyInfo.cs
index b7d65b0a2..95e1c6ec2 100755
--- a/MDFe.Damdfe.Base/Properties/AssemblyInfo.cs
+++ b/MDFe.Damdfe.Base/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/MDFe.Damdfe.Fast/Properties/AssemblyInfo.cs b/MDFe.Damdfe.Fast/Properties/AssemblyInfo.cs
index e0949f40d..4e16c739d 100755
--- a/MDFe.Damdfe.Fast/Properties/AssemblyInfo.cs
+++ b/MDFe.Damdfe.Fast/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/MDFe.Servicos/Properties/AssemblyInfo.cs b/MDFe.Servicos/Properties/AssemblyInfo.cs
index 5db0ca74f..3981121c2 100755
--- a/MDFe.Servicos/Properties/AssemblyInfo.cs
+++ b/MDFe.Servicos/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/MDFe.Utils/Properties/AssemblyInfo.cs b/MDFe.Utils/Properties/AssemblyInfo.cs
index ea269cd82..b9d6fab6b 100755
--- a/MDFe.Utils/Properties/AssemblyInfo.cs
+++ b/MDFe.Utils/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/MDFe.Wsdl/Properties/AssemblyInfo.cs b/MDFe.Wsdl/Properties/AssemblyInfo.cs
index 6f40d4554..877ff75ac 100755
--- a/MDFe.Wsdl/Properties/AssemblyInfo.cs
+++ b/MDFe.Wsdl/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/NFe.AppTeste/Properties/AssemblyInfo.cs b/NFe.AppTeste/Properties/AssemblyInfo.cs
index 0e651763c..3a8e98624 100644
--- a/NFe.AppTeste/Properties/AssemblyInfo.cs
+++ b/NFe.AppTeste/Properties/AssemblyInfo.cs
@@ -84,5 +84,5 @@
// utilizando o '*' como mostrado abaixo:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/NFe.Classes/Properties/AssemblyInfo.cs b/NFe.Classes/Properties/AssemblyInfo.cs
index 536ce1b4b..af36a05e7 100644
--- a/NFe.Classes/Properties/AssemblyInfo.cs
+++ b/NFe.Classes/Properties/AssemblyInfo.cs
@@ -67,5 +67,5 @@
// utilizando o '*' como mostrado abaixo:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/NFe.Danfe.AppTeste/Properties/AssemblyInfo.cs b/NFe.Danfe.AppTeste/Properties/AssemblyInfo.cs
index ec79e270d..cb99c5cf9 100644
--- a/NFe.Danfe.AppTeste/Properties/AssemblyInfo.cs
+++ b/NFe.Danfe.AppTeste/Properties/AssemblyInfo.cs
@@ -49,5 +49,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/NFe.Danfe.Base/Properties/AssemblyInfo.cs b/NFe.Danfe.Base/Properties/AssemblyInfo.cs
index cbbba6ff2..2e8768344 100644
--- a/NFe.Danfe.Base/Properties/AssemblyInfo.cs
+++ b/NFe.Danfe.Base/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/NFe.Danfe.Fast/Properties/AssemblyInfo.cs b/NFe.Danfe.Fast/Properties/AssemblyInfo.cs
index 1c776cb54..a2064f7f7 100644
--- a/NFe.Danfe.Fast/Properties/AssemblyInfo.cs
+++ b/NFe.Danfe.Fast/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// É possível especificar todos os valores ou usar como padrão os Números da Versão e da Revisão
// utilizando o "*" como mostrado abaixo:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/NFe.Danfe.Nativo/Properties/AssemblyInfo.cs b/NFe.Danfe.Nativo/Properties/AssemblyInfo.cs
index 77e1a5636..6be329eb7 100644
--- a/NFe.Danfe.Nativo/Properties/AssemblyInfo.cs
+++ b/NFe.Danfe.Nativo/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/NFe.Integracao/Properties/AssemblyInfo.cs b/NFe.Integracao/Properties/AssemblyInfo.cs
index 4a8d36397..ccde99d30 100644
--- a/NFe.Integracao/Properties/AssemblyInfo.cs
+++ b/NFe.Integracao/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/NFe.Servicos/NFe.Servicos.csproj b/NFe.Servicos/NFe.Servicos.csproj
index 980643acf..c8d598d12 100644
--- a/NFe.Servicos/NFe.Servicos.csproj
+++ b/NFe.Servicos/NFe.Servicos.csproj
@@ -61,6 +61,7 @@
+
diff --git a/NFe.Servicos/Properties/AssemblyInfo.cs b/NFe.Servicos/Properties/AssemblyInfo.cs
index b72debcc1..0f932674e 100644
--- a/NFe.Servicos/Properties/AssemblyInfo.cs
+++ b/NFe.Servicos/Properties/AssemblyInfo.cs
@@ -67,5 +67,5 @@
// utilizando o '*' como mostrado abaixo:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/NFe.Servicos/ServicoNfeFactory.cs b/NFe.Servicos/ServicoNfeFactory.cs
new file mode 100644
index 000000000..d28090732
--- /dev/null
+++ b/NFe.Servicos/ServicoNfeFactory.cs
@@ -0,0 +1,208 @@
+using System;
+using System.Reflection;
+using System.Security.Cryptography.X509Certificates;
+using DFe.Classes.Entidades;
+using DFe.Classes.Flags;
+using NFe.Classes.Servicos.Tipos;
+using NFe.Utils;
+using NFe.Wsdl;
+using NFe.Wsdl.AdmCsc;
+using NFe.Wsdl.Autorizacao;
+using NFe.Wsdl.Autorizacao.SVAN;
+using NFe.Wsdl.ConsultaProtocolo;
+using NFe.Wsdl.ConsultaProtocolo.SVAN;
+using NFe.Wsdl.DistribuicaoDFe;
+using NFe.Wsdl.Download;
+using NFe.Wsdl.Evento;
+using NFe.Wsdl.Evento.AN;
+using NFe.Wsdl.Evento.SVAN;
+using NFe.Wsdl.Inutilizacao;
+using NFe.Wsdl.Inutilizacao.SVAN;
+using NFe.Wsdl.Recepcao;
+using NFe.Wsdl.Status;
+using NFe.Wsdl.Status.SVAN;
+
+namespace NFe.Servicos
+{
+ public static class ServicoNfeFactory
+ {
+ public static INfeServicoAutorizacao CriaWsdlAutorizacao(ConfiguracaoServico cfg, X509Certificate2 certificado)
+ {
+ var url = Enderecador.ObterUrlServico(ServicoNFe.NFeAutorizacao, cfg);
+
+ if (cfg.IsSvanNFe4())
+ {
+ return new NFeAutorizacao4SVAN(url, certificado, cfg.TimeOut);
+ }
+
+ if (cfg.VersaoNFeAutorizacao == VersaoServico.ve400)
+ return new NFeAutorizacao4(url, certificado, cfg.TimeOut);
+
+
+
+ if (cfg.cUF == Estado.PR & cfg.VersaoNFeAutorizacao == VersaoServico.ve310)
+ return new NfeAutorizacao3(url, certificado, cfg.TimeOut);
+
+ return new NfeAutorizacao(url, certificado, cfg.TimeOut);
+ }
+
+ public static INfeServico CriaWsdlOutros(
+ ServicoNFe servico,
+ ConfiguracaoServico cfg,
+ X509Certificate2 certificado)
+ {
+ var url = Enderecador.ObterUrlServico(servico, cfg);
+ switch (servico)
+ {
+ case ServicoNFe.NfeStatusServico:
+ if (cfg.cUF == Estado.PR & cfg.VersaoNfeStatusServico == VersaoServico.ve310)
+ {
+ return new NfeStatusServico3(url, certificado, cfg.TimeOut);
+ }
+ if (cfg.cUF == Estado.BA & cfg.VersaoNfeStatusServico == VersaoServico.ve310 &
+ cfg.ModeloDocumento == ModeloDocumento.NFe)
+ {
+ return new NfeStatusServico(url, certificado, cfg.TimeOut);
+ }
+
+ if (cfg.IsSvanNFe4())
+ {
+ return new NfeStatusServico4NFeSVAN(url, certificado, cfg.TimeOut);
+ }
+
+ if (cfg.VersaoNfeStatusServico == VersaoServico.ve400)
+ {
+ return new NfeStatusServico4(url, certificado, cfg.TimeOut);
+ }
+
+ return new NfeStatusServico2(url, certificado, cfg.TimeOut);
+
+ case ServicoNFe.NfeConsultaProtocolo:
+
+ if (cfg.IsSvanNFe4())
+ {
+ return new NfeConsulta4SVAN(url, certificado, cfg.TimeOut);
+ }
+
+ if (cfg.VersaoNfeConsultaProtocolo == VersaoServico.ve400)
+ {
+ return new NfeConsulta4(url, certificado, cfg.TimeOut);
+ }
+
+ if (cfg.cUF == Estado.PR & cfg.VersaoNfeConsultaProtocolo == VersaoServico.ve310)
+ {
+ return new NfeConsulta3(url, certificado, cfg.TimeOut);
+ }
+ if (cfg.cUF == Estado.BA & cfg.VersaoNfeConsultaProtocolo == VersaoServico.ve310 &
+ cfg.ModeloDocumento == ModeloDocumento.NFe)
+ {
+ return new NfeConsulta(url, certificado, cfg.TimeOut);
+ }
+ return new NfeConsulta2(url, certificado, cfg.TimeOut);
+
+ case ServicoNFe.NfeRecepcao:
+ return new NfeRecepcao2(url, certificado, cfg.TimeOut);
+
+ case ServicoNFe.NfeRetRecepcao:
+ return new NfeRetRecepcao2(url, certificado, cfg.TimeOut);
+
+ case ServicoNFe.NFeAutorizacao:
+ throw new Exception(string.Format("O serviço {0} não pode ser criado no método {1}!", servico,
+ MethodBase.GetCurrentMethod().Name));
+
+ case ServicoNFe.NFeRetAutorizacao:
+ if (cfg.IsSvanNFe4())
+ {
+ return new NfeRetAutorizacao4SVAN(url, certificado, cfg.TimeOut);
+ }
+
+ if (cfg.VersaoNFeRetAutorizacao == VersaoServico.ve400)
+ return new NfeRetAutorizacao4(url, certificado, cfg.TimeOut);
+
+ if (cfg.cUF == Estado.PR & cfg.VersaoNFeAutorizacao == VersaoServico.ve310)
+ return new NfeRetAutorizacao3(url, certificado, cfg.TimeOut);
+ return new NfeRetAutorizacao(url, certificado, cfg.TimeOut);
+
+ case ServicoNFe.NfeInutilizacao:
+
+ if (cfg.IsSvanNFe4())
+ {
+ return new NFeInutilizacao4SVAN(url, certificado, cfg.TimeOut);
+ }
+
+ if (cfg.VersaoNfeStatusServico == VersaoServico.ve400)
+ {
+ return new NFeInutilizacao4(url, certificado, cfg.TimeOut);
+ }
+
+ if (cfg.cUF == Estado.PR & cfg.VersaoNfeStatusServico == VersaoServico.ve310)
+ {
+ return new NfeInutilizacao3(url, certificado, cfg.TimeOut);
+ }
+ if (cfg.cUF == Estado.BA & cfg.VersaoNfeStatusServico == VersaoServico.ve310 &
+ cfg.ModeloDocumento == ModeloDocumento.NFe)
+ {
+ return new NfeInutilizacao(url, certificado, cfg.TimeOut);
+ }
+
+ return new NfeInutilizacao2(url, certificado, cfg.TimeOut);
+
+ case ServicoNFe.RecepcaoEventoCancelmento:
+ case ServicoNFe.RecepcaoEventoCartaCorrecao:
+ if (cfg.IsSvanNFe4())
+ {
+ return new RecepcaoEvento4SVAN(url, certificado, cfg.TimeOut);
+ }
+
+ if (cfg.VersaoRecepcaoEventoCceCancelamento == VersaoServico.ve400)
+ {
+ return new RecepcaoEvento4(url, certificado, cfg.TimeOut);
+ }
+
+ return new RecepcaoEvento(url, certificado, cfg.TimeOut);
+
+ case ServicoNFe.RecepcaoEventoManifestacaoDestinatario:
+ {
+ if (cfg.VersaoRecepcaoEventoManifestacaoDestinatario == VersaoServico.ve400)
+ {
+ return new RecepcaoEvento4AN(url, certificado, cfg.TimeOut);
+ }
+
+ return new RecepcaoEvento(url, certificado, cfg.TimeOut);
+ }
+
+ case ServicoNFe.RecepcaoEventoEpec:
+ return new RecepcaoEPEC(url, certificado, cfg.TimeOut);
+
+ case ServicoNFe.NfeConsultaCadastro:
+ switch (cfg.cUF)
+ {
+ case Estado.CE:
+ return new Wsdl.ConsultaCadastro.CE.CadConsultaCadastro2(url, certificado,
+ cfg.TimeOut);
+ }
+
+
+ if (cfg.VersaoNfeConsultaCadastro == VersaoServico.ve400)
+ {
+ return new Wsdl.ConsultaCadastro.DEMAIS_UFs.CadConsultaCadastro4(url, certificado, cfg.TimeOut);
+ }
+
+ return new Wsdl.ConsultaCadastro.DEMAIS_UFs.CadConsultaCadastro2(url, certificado,
+ cfg.TimeOut);
+
+ case ServicoNFe.NfeDownloadNF:
+ return new NfeDownloadNF(url, certificado, cfg.TimeOut);
+
+ case ServicoNFe.NfceAdministracaoCSC:
+ return new NfceCsc(url, certificado, cfg.TimeOut);
+
+ case ServicoNFe.NFeDistribuicaoDFe:
+ return new NfeDistDFeInteresse(url, certificado, cfg.TimeOut);
+
+ }
+
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/NFe.Servicos/ServicosNFe.cs b/NFe.Servicos/ServicosNFe.cs
index a27cff4d1..deaf5a961 100644
--- a/NFe.Servicos/ServicosNFe.cs
+++ b/NFe.Servicos/ServicosNFe.cs
@@ -64,15 +64,6 @@
using NFe.Utils.Status;
using NFe.Utils.Validacao;
using NFe.Wsdl;
-using NFe.Wsdl.AdmCsc;
-using NFe.Wsdl.Autorizacao;
-using NFe.Wsdl.ConsultaProtocolo;
-using NFe.Wsdl.DistribuicaoDFe;
-using NFe.Wsdl.Download;
-using NFe.Wsdl.Evento;
-using NFe.Wsdl.Inutilizacao;
-using NFe.Wsdl.Recepcao;
-using NFe.Wsdl.Status;
using System;
using System.Collections.Generic;
using System.IO;
@@ -81,12 +72,6 @@
using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Xml;
-using NFe.Wsdl.Autorizacao.SVAN;
-using NFe.Wsdl.ConsultaProtocolo.SVAN;
-using NFe.Wsdl.Evento.AN;
-using NFe.Wsdl.Evento.SVAN;
-using NFe.Wsdl.Inutilizacao.SVAN;
-using NFe.Wsdl.Status.SVAN;
using FuncoesXml = DFe.Utils.FuncoesXml;
namespace NFe.Servicos
@@ -122,190 +107,17 @@ private void SalvarArquivoXml(string nomeArquivo, string xmlString)
private INfeServicoAutorizacao CriarServicoAutorizacao(ServicoNFe servico)
{
- var url = Enderecador.ObterUrlServico(servico, _cFgServico);
-
if (servico != ServicoNFe.NFeAutorizacao)
throw new Exception(
string.Format("O serviço {0} não pode ser criado no método {1}!", servico,
MethodBase.GetCurrentMethod().Name));
- if (IsSvanNFe4())
- {
- return new NFeAutorizacao4SVAN(url, _certificado, _cFgServico.TimeOut);
- }
-
- if (_cFgServico.VersaoNFeAutorizacao == VersaoServico.ve400)
- return new NFeAutorizacao4(url, _certificado, _cFgServico.TimeOut);
-
-
-
- if (_cFgServico.cUF == Estado.PR & _cFgServico.VersaoNFeAutorizacao == VersaoServico.ve310)
- return new NfeAutorizacao3(url, _certificado, _cFgServico.TimeOut);
-
- return new NfeAutorizacao(url, _certificado, _cFgServico.TimeOut);
+ return ServicoNfeFactory.CriaWsdlAutorizacao(_cFgServico, _certificado);
}
private INfeServico CriarServico(ServicoNFe servico)
{
- var url = Enderecador.ObterUrlServico(servico, _cFgServico);
- switch (servico)
- {
- case ServicoNFe.NfeStatusServico:
- if (_cFgServico.cUF == Estado.PR & _cFgServico.VersaoNfeStatusServico == VersaoServico.ve310)
- {
- return new NfeStatusServico3(url, _certificado, _cFgServico.TimeOut);
- }
- if (_cFgServico.cUF == Estado.BA & _cFgServico.VersaoNfeStatusServico == VersaoServico.ve310 &
- _cFgServico.ModeloDocumento == ModeloDocumento.NFe)
- {
- return new NfeStatusServico(url, _certificado, _cFgServico.TimeOut);
- }
-
- if (IsSvanNFe4())
- {
- return new NfeStatusServico4NFeSVAN(url, _certificado, _cFgServico.TimeOut);
- }
-
- if (_cFgServico.VersaoNfeStatusServico == VersaoServico.ve400)
- {
- return new NfeStatusServico4(url, _certificado, _cFgServico.TimeOut);
- }
-
- return new NfeStatusServico2(url, _certificado, _cFgServico.TimeOut);
-
- case ServicoNFe.NfeConsultaProtocolo:
-
- if (IsSvanNFe4())
- {
- return new NfeConsulta4SVAN(url, _certificado, _cFgServico.TimeOut);
- }
-
- if (_cFgServico.VersaoNfeConsultaProtocolo == VersaoServico.ve400)
- {
- return new NfeConsulta4(url, _certificado, _cFgServico.TimeOut);
- }
-
- if (_cFgServico.cUF == Estado.PR & _cFgServico.VersaoNfeConsultaProtocolo == VersaoServico.ve310)
- {
- return new NfeConsulta3(url, _certificado, _cFgServico.TimeOut);
- }
- if (_cFgServico.cUF == Estado.BA & _cFgServico.VersaoNfeConsultaProtocolo == VersaoServico.ve310 &
- _cFgServico.ModeloDocumento == ModeloDocumento.NFe)
- {
- return new NfeConsulta(url, _certificado, _cFgServico.TimeOut);
- }
- return new NfeConsulta2(url, _certificado, _cFgServico.TimeOut);
-
- case ServicoNFe.NfeRecepcao:
- return new NfeRecepcao2(url, _certificado, _cFgServico.TimeOut);
-
- case ServicoNFe.NfeRetRecepcao:
- return new NfeRetRecepcao2(url, _certificado, _cFgServico.TimeOut);
-
- case ServicoNFe.NFeAutorizacao:
- throw new Exception(string.Format("O serviço {0} não pode ser criado no método {1}!", servico,
- MethodBase.GetCurrentMethod().Name));
-
- case ServicoNFe.NFeRetAutorizacao:
- if (IsSvanNFe4())
- {
- return new NfeRetAutorizacao4SVAN(url, _certificado, _cFgServico.TimeOut);
- }
-
- if (_cFgServico.VersaoNFeRetAutorizacao == VersaoServico.ve400)
- return new NfeRetAutorizacao4(url, _certificado, _cFgServico.TimeOut);
-
- if (_cFgServico.cUF == Estado.PR & _cFgServico.VersaoNFeAutorizacao == VersaoServico.ve310)
- return new NfeRetAutorizacao3(url, _certificado, _cFgServico.TimeOut);
- return new NfeRetAutorizacao(url, _certificado, _cFgServico.TimeOut);
-
- case ServicoNFe.NfeInutilizacao:
-
- if (IsSvanNFe4())
- {
- return new NFeInutilizacao4SVAN(url, _certificado, _cFgServico.TimeOut);
- }
-
- if (_cFgServico.VersaoNfeStatusServico == VersaoServico.ve400)
- {
- return new NFeInutilizacao4(url, _certificado, _cFgServico.TimeOut);
- }
-
- if (_cFgServico.cUF == Estado.PR & _cFgServico.VersaoNfeStatusServico == VersaoServico.ve310)
- {
- return new NfeInutilizacao3(url, _certificado, _cFgServico.TimeOut);
- }
- if (_cFgServico.cUF == Estado.BA & _cFgServico.VersaoNfeStatusServico == VersaoServico.ve310 &
- _cFgServico.ModeloDocumento == ModeloDocumento.NFe)
- {
- return new NfeInutilizacao(url, _certificado, _cFgServico.TimeOut);
- }
-
- return new NfeInutilizacao2(url, _certificado, _cFgServico.TimeOut);
-
- case ServicoNFe.RecepcaoEventoCancelmento:
- case ServicoNFe.RecepcaoEventoCartaCorrecao:
- if (IsSvanNFe4())
- {
- return new RecepcaoEvento4SVAN(url, _certificado, _cFgServico.TimeOut);
- }
-
- if (_cFgServico.VersaoRecepcaoEventoCceCancelamento == VersaoServico.ve400)
- {
- return new RecepcaoEvento4(url, _certificado, _cFgServico.TimeOut);
- }
-
- return new RecepcaoEvento(url, _certificado, _cFgServico.TimeOut);
-
- case ServicoNFe.RecepcaoEventoManifestacaoDestinatario:
- {
- if (_cFgServico.VersaoRecepcaoEventoManifestacaoDestinatario == VersaoServico.ve400)
- {
- return new RecepcaoEvento4AN(url, _certificado, _cFgServico.TimeOut);
- }
-
- return new RecepcaoEvento(url, _certificado, _cFgServico.TimeOut);
- }
-
- case ServicoNFe.RecepcaoEventoEpec:
- return new RecepcaoEPEC(url, _certificado, _cFgServico.TimeOut);
-
- case ServicoNFe.NfeConsultaCadastro:
- switch (_cFgServico.cUF)
- {
- case Estado.CE:
- return new Wsdl.ConsultaCadastro.CE.CadConsultaCadastro2(url, _certificado,
- _cFgServico.TimeOut);
- }
-
-
- if (_cFgServico.VersaoNfeConsultaCadastro == VersaoServico.ve400)
- {
- return new Wsdl.ConsultaCadastro.DEMAIS_UFs.CadConsultaCadastro4(url, _certificado, _cFgServico.TimeOut);
- }
-
- return new Wsdl.ConsultaCadastro.DEMAIS_UFs.CadConsultaCadastro2(url, _certificado,
- _cFgServico.TimeOut);
-
- case ServicoNFe.NfeDownloadNF:
- return new NfeDownloadNF(url, _certificado, _cFgServico.TimeOut);
-
- case ServicoNFe.NfceAdministracaoCSC:
- return new NfceCsc(url, _certificado, _cFgServico.TimeOut);
-
- case ServicoNFe.NFeDistribuicaoDFe:
- return new NfeDistDFeInteresse(url, _certificado, _cFgServico.TimeOut);
-
- }
-
- return null;
- }
-
- private bool IsSvanNFe4()
- {
- return (_cFgServico.cUF == Estado.PA || _cFgServico.cUF == Estado.MA)
- && _cFgServico.VersaoNfeStatusServico == VersaoServico.ve400
- && _cFgServico.ModeloDocumento == ModeloDocumento.NFe;
+ return ServicoNfeFactory.CriaWsdlOutros(servico, _cFgServico, _certificado);
}
///
diff --git a/NFe.Testes/Properties/AssemblyInfo.cs b/NFe.Testes/Properties/AssemblyInfo.cs
index eccec68c2..15bdc2399 100644
--- a/NFe.Testes/Properties/AssemblyInfo.cs
+++ b/NFe.Testes/Properties/AssemblyInfo.cs
@@ -16,5 +16,5 @@
[assembly: Guid("3e44ea28-96ae-4fac-9e38-adc2e12930f1")]
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/NFe.Utils/ConfiguracaoServico.cs b/NFe.Utils/ConfiguracaoServico.cs
index 751d461ae..eaf2761f4 100644
--- a/NFe.Utils/ConfiguracaoServico.cs
+++ b/NFe.Utils/ConfiguracaoServico.cs
@@ -263,5 +263,12 @@ public static void LimparIntancia()
{
_instancia = null;
}
+
+ public bool IsSvanNFe4()
+ {
+ return (cUF == Estado.PA || cUF == Estado.MA)
+ && VersaoNfeStatusServico == VersaoServico.ve400
+ && ModeloDocumento == ModeloDocumento.NFe;
+ }
}
}
\ No newline at end of file
diff --git a/NFe.Utils/Properties/AssemblyInfo.cs b/NFe.Utils/Properties/AssemblyInfo.cs
index 118ef5ddc..7c8a83824 100644
--- a/NFe.Utils/Properties/AssemblyInfo.cs
+++ b/NFe.Utils/Properties/AssemblyInfo.cs
@@ -67,5 +67,5 @@
// utilizando o '*' como mostrado abaixo:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]
diff --git a/NFe.Wsdl/Properties/AssemblyInfo.cs b/NFe.Wsdl/Properties/AssemblyInfo.cs
index a1fbb9492..811b1957c 100644
--- a/NFe.Wsdl/Properties/AssemblyInfo.cs
+++ b/NFe.Wsdl/Properties/AssemblyInfo.cs
@@ -67,5 +67,5 @@
// utilizando o '*' como mostrado abaixo:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.683")]
-[assembly: AssemblyFileVersion("1.0.0.683")]
+[assembly: AssemblyVersion("1.0.0.684")]
+[assembly: AssemblyFileVersion("1.0.0.684")]