Skip to content

Commit 2e7b896

Browse files
authored
Merge pull request #322 from lucasmoraes804/feature/giss-jaboticabal
Giss jaboticabal
2 parents d4fd963 + c64959c commit 2e7b896

31 files changed

Lines changed: 4873 additions & 105 deletions

src/OpenAC.Net.NFSe.Demo/FormMain.cs

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ private void GerarRps()
527527
var municipio = cmbCidades.GetSelectedValue<OpenMunicipioNFSe>();
528528
if (municipio == null) return;
529529

530-
var numeroRps = "1";
530+
var numeroRps = "162";
531531
if (InputBox.Show("Nº RPS", "Informe o número do RPS.", ref numeroRps).Equals(DialogResult.Cancel)) return;
532532

533533
openNFSe.NotasServico.Clear();
@@ -546,6 +546,10 @@ private void GerarRps()
546546
nfSe.IdentificacaoRps.Serie = "NF";
547547
nfSe.IdentificacaoRps.SeriePrestacao = "99";
548548
break;
549+
550+
case NFSeProvider.GISS:
551+
nfSe.IdentificacaoRps.Serie = "NFT";
552+
break;
549553

550554
default:
551555
nfSe.IdentificacaoRps.Serie = "1";
@@ -574,7 +578,7 @@ private void GerarRps()
574578
nfSe.RegimeEspecialTributacao = RegimeEspecialTributacao.SimplesNacional;
575579
nfSe.IncentivadorCultural = NFSeSimNao.Nao;
576580

577-
var itemListaServico = municipio.Provedor.IsIn(NFSeProvider.Betha, NFSeProvider.ISSe, NFSeProvider.ISSCuritiba) ? "0107" : "01.07";
581+
var itemListaServico = municipio.Provedor.IsIn(NFSeProvider.Betha, NFSeProvider.ISSe, NFSeProvider.ISSCuritiba) ? "1705" : "07.10";
578582
if (InputBox.Show("Item na lista de serviço", "Informe o item na lista de serviço.", ref itemListaServico).Equals(DialogResult.Cancel)) return;
579583

580584
// Setar o cnae de acordo com o schema aceito pelo provedor.
@@ -583,6 +587,7 @@ private void GerarRps()
583587
nfSe.Servico.CodigoCnae = cnae;
584588

585589
var CodigoTributacaoMunicipio = municipio.Provedor.IsIn(NFSeProvider.SiapNet, NFSeProvider.ABase) ? "5211701" :
590+
municipio.Provedor.IsIn(NFSeProvider.GISS) ? "8121400" :
586591
municipio.Provedor.IsIn(NFSeProvider.Sigep) ? "1" : "01.07.00 / 00010700";
587592

588593
nfSe.Servico.ItemListaServico = itemListaServico;
@@ -597,19 +602,22 @@ private void GerarRps()
597602
nfSe.Servico.MunicipioIncidencia = nfSe.Servico.CodigoMunicipio;
598603
}
599604

600-
nfSe.Servico.Valores.ValorServicos = 100;
605+
if (municipio.Provedor.IsIn(NFSeProvider.GISS))
606+
nfSe.Servico.CodigoPais = 0076;
607+
608+
nfSe.Servico.Valores.ValorServicos = 1;
601609
nfSe.Servico.Valores.ValorDeducoes = 0;
602610
nfSe.Servico.Valores.ValorPis = 0;
603611
nfSe.Servico.Valores.ValorCofins = 0;
604612
nfSe.Servico.Valores.ValorInss = 0;
605613
nfSe.Servico.Valores.ValorIr = 0;
606614
nfSe.Servico.Valores.ValorCsll = 0;
607615
nfSe.Servico.Valores.IssRetido = SituacaoTributaria.Normal;
608-
nfSe.Servico.Valores.ValorIss = municipio.Provedor == NFSeProvider.SiapNet ? 2 : 0;
616+
nfSe.Servico.Valores.ValorIss = municipio.Provedor == NFSeProvider.SiapNet ? 2 : 0.20m;
609617
nfSe.Servico.Valores.ValorOutrasRetencoes = 0;
610-
nfSe.Servico.Valores.BaseCalculo = 100;
611-
nfSe.Servico.Valores.Aliquota = 2;
612-
nfSe.Servico.Valores.ValorLiquidoNfse = 100;
618+
nfSe.Servico.Valores.BaseCalculo = 1;
619+
nfSe.Servico.Valores.Aliquota = municipio.Provedor == NFSeProvider.GISS ? 0.0200m : 2;
620+
nfSe.Servico.Valores.ValorLiquidoNfse = 1;
613621
nfSe.Servico.Valores.ValorIssRetido = 0;
614622
nfSe.Servico.Valores.DescontoCondicionado = 0;
615623
nfSe.Servico.Valores.DescontoIncondicionado = 0;
@@ -620,11 +628,16 @@ private void GerarRps()
620628
var servico = nfSe.Servico.ItemsServico.AddNew();
621629
servico.Descricao = "Teste";
622630
servico.Quantidade = 1M;
623-
servico.ValorTotal = 100;
631+
servico.ValorTotal = 1;
624632
servico.Tributavel = NFSeSimNao.Sim;
625633
}
626634

627-
nfSe.Tomador.CpfCnpj = "44854962283";
635+
if (municipio.Provedor == NFSeProvider.GISS)
636+
{
637+
nfSe.Servico.MunicipioIncidencia = nfSe.Servico.CodigoMunicipio;
638+
}
639+
640+
nfSe.Tomador.CpfCnpj = "49413978867";
628641
nfSe.Tomador.InscricaoMunicipal = "";
629642
nfSe.Tomador.RazaoSocial = "Nome";
630643

@@ -636,12 +649,12 @@ private void GerarRps()
636649
nfSe.Tomador.Endereco.CodigoMunicipio = municipio.Codigo;
637650
nfSe.Tomador.Endereco.Municipio = municipio.Nome;
638651
nfSe.Tomador.Endereco.Uf = municipio.UF.ToString();
639-
nfSe.Tomador.Endereco.Cep = "14020010";
652+
nfSe.Tomador.Endereco.Cep = "14876155";
640653
nfSe.Tomador.Endereco.CodigoPais = 1058;
641654
nfSe.Tomador.Endereco.Pais = "BRASIL";
642655

643656
nfSe.Tomador.DadosContato.DDD = "16";
644-
nfSe.Tomador.DadosContato.Telefone = "30111234";
657+
nfSe.Tomador.DadosContato.Telefone = "1630111234";
645658
nfSe.Tomador.DadosContato.Email = "NOME@EMPRESA.COM.BR";
646659
}
647660

src/OpenAC.Net.NFSe/Commom/Client/NFSeSoapServiceClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ protected virtual string Execute(string soapAction, string message, string soapH
128128
{
129129
case SoapVersion.Soap11:
130130
content = new StringContent(EnvelopeEnvio, CharSet, "text/xml");
131-
if (Provider.Name != NFSeProvider.Sigep.ToString())
131+
if (Provider.Name != NFSeProvider.Sigep.ToString() && Provider.Name != NFSeProvider.GISS.ToString())
132132
content.Headers.Add("SOAPAction", $"\"{soapAction}\"");
133133
break;
134134

src/OpenAC.Net.NFSe/Commom/Types/NFSeProvider.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,8 @@ public enum NFSeProvider : sbyte
139139
ISSIntegra = 47,
140140

141141
ISSRecife = 48,
142+
142143
FintelISS = 51,
144+
145+
GISS = 49
143146
}
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
using OpenAC.Net.DFe.Core;
2+
using System;
3+
using System.Linq;
4+
using System.Security.Cryptography.X509Certificates;
5+
using System.Text;
6+
using OpenAC.Net.Core.Extensions;
7+
using System.Xml.Linq;
8+
using System.Net;
9+
using System.Text.RegularExpressions;
10+
using System.Xml;
11+
using System.ServiceModel.Channels;
12+
13+
namespace OpenAC.Net.NFSe.Providers.GISS
14+
{
15+
internal class GISSServiceClient : NFSeSoapServiceClient, IServiceClient
16+
{
17+
#region Constructors
18+
19+
public GISSServiceClient(ProviderGISS provider, TipoUrl tipoUrl, X509Certificate2 certificado) : base(provider, tipoUrl, certificado, SoapVersion.Soap11)
20+
{
21+
}
22+
23+
public GISSServiceClient(ProviderGISS provider, TipoUrl tipoUrl) : base(provider, tipoUrl, SoapVersion.Soap11)
24+
{
25+
}
26+
27+
#endregion Constructors
28+
29+
#region Methods
30+
31+
public string Enviar(string cabec, string msg)
32+
{
33+
var message = new StringBuilder();
34+
message.Append("<nfse:RecepcionarLoteRpsRequest>");
35+
message.Append("<nfseCabecMsg>");
36+
message.AppendCData("<ns4:cabecalho versao=\"2.00\" xmlns:ns2=\"http://www.giss.com.br/tipos-v2_04.xsd\" xmlns:ns4=\"http://www.giss.com.br/cabecalho-v2_04.xsd\" xmlns:nss03=\"http://www.w3.org/2000/09/xmldsig#\"><ns4:versaoDados>2.00</ns4:versaoDados></ns4:cabecalho>");
37+
message.Append("</nfseCabecMsg>");
38+
message.Append("<nfseDadosMsg>");
39+
message.AppendCData(msg);
40+
message.Append("</nfseDadosMsg>");
41+
42+
message.Append("</nfse:RecepcionarLoteRpsRequest>");
43+
44+
return Execute("http://nfse.abrasf.org.br/RecepcionarLoteRps", message.ToString(), "EnviarLoteRpsResposta");
45+
}
46+
47+
public string EnviarSincrono(string cabec, string msg) => throw new NotImplementedException("Função não implementada/suportada neste Provedor !");
48+
49+
public string ConsultarSituacao(string cabec, string msg) => throw new NotImplementedException("Função não implementada/suportada neste Provedor !");
50+
51+
public string ConsultarLoteRps(string cabec, string msg)
52+
{
53+
var message = new StringBuilder();
54+
message.Append("<nfse:ConsultarLoteRpsRequest>");
55+
message.Append("<nfseCabecMsg>");
56+
message.AppendCData("<ns4:cabecalho versao=\"2.00\" xmlns:ns2=\"http://www.giss.com.br/tipos-v2_04.xsd\" xmlns:ns4=\"http://www.giss.com.br/cabecalho-v2_04.xsd\" xmlns:nss03=\"http://www.w3.org/2000/09/xmldsig#\"><ns4:versaoDados>2.00</ns4:versaoDados></ns4:cabecalho>");
57+
message.Append("</nfseCabecMsg>");
58+
message.Append("<nfseDadosMsg>");
59+
message.AppendCData(msg);
60+
message.Append("</nfseDadosMsg>");
61+
62+
message.Append("</nfse:ConsultarLoteRpsRequest>");
63+
64+
return Execute("http://nfse.abrasf.org.br/ConsultarLoteRps", message.ToString(), "ConsultarLoteRpsResposta");
65+
}
66+
67+
public string ConsultarSequencialRps(string cabec, string msg) => throw new NotImplementedException("Função não implementada/suportada neste Provedor !");
68+
69+
public string ConsultarNFSeRps(string cabec, string msg)
70+
{
71+
var message = new StringBuilder();
72+
message.Append("<nfse:ConsultarNfsePorRpsRequest>");
73+
message.Append("<nfseCabecMsg>");
74+
message.AppendCData("<ns4:cabecalho versao=\"2.00\" xmlns:ns2=\"http://www.giss.com.br/tipos-v2_04.xsd\" xmlns:ns4=\"http://www.giss.com.br/cabecalho-v2_04.xsd\" xmlns:nss03=\"http://www.w3.org/2000/09/xmldsig#\"><ns4:versaoDados>2.00</ns4:versaoDados></ns4:cabecalho>");
75+
message.Append("</nfseCabecMsg>");
76+
message.Append("<nfseDadosMsg>");
77+
message.AppendCData(msg);
78+
message.Append("</nfseDadosMsg>");
79+
message.Append("</nfse:ConsultarNfsePorRpsRequest>");
80+
81+
return Execute("http://nfse.abrasf.org.br/ConsultarNfsePorRps", message.ToString(), "ConsultarNfseRpsResposta");
82+
}
83+
84+
public string ConsultarNFSe(string cabec, string msg) => throw new NotImplementedException("Função não implementada/suportada neste Provedor !");
85+
86+
public string CancelarNFSe(string cabec, string msg)
87+
{
88+
var message = new StringBuilder();
89+
message.Append("<nfse:CancelarNfseRequest>");
90+
message.Append("<nfseCabecMsg>");
91+
message.AppendCData("<ns4:cabecalho versao=\"2.00\" xmlns:ns2=\"http://www.giss.com.br/tipos-v2_04.xsd\" xmlns:ns4=\"http://www.giss.com.br/cabecalho-v2_04.xsd\" xmlns:nss03=\"http://www.w3.org/2000/09/xmldsig#\"><ns4:versaoDados>2.00</ns4:versaoDados></ns4:cabecalho>");
92+
message.Append("</nfseCabecMsg>");
93+
message.Append("<nfseDadosMsg>");
94+
message.AppendCData(msg);
95+
message.Append("</nfseDadosMsg>");
96+
97+
message.Append("</nfse:CancelarNfseRequest>");
98+
99+
return Execute("http://nfse.abrasf.org.br/CancelarNfse", message.ToString(), "CancelarNfseResposta");
100+
}
101+
102+
public string CancelarNFSeLote(string cabec, string msg) => throw new NotImplementedException("Função não implementada/suportada neste Provedor !");
103+
104+
public string SubstituirNFSe(string cabec, string msg) => throw new NotImplementedException("Função não implementada/suportada neste Provedor !");
105+
106+
private string Execute(string soapAction, string message, string responseTag)
107+
{
108+
return Execute(soapAction, message, "", responseTag, "xmlns:nfse=\"http://nfse.abrasf.org.br\"");
109+
}
110+
111+
protected override string TratarRetorno(XElement xElement, string[] responseTag)
112+
{
113+
var xmlValue = XDocument.Parse(xElement.Value);
114+
var reader = xmlValue.ElementAnyNs(responseTag[0]).CreateReader();
115+
reader.MoveToContent();
116+
var xml = reader.ReadOuterXml().Replace("ns2:", string.Empty).Replace("ns3:", string.Empty);
117+
118+
return xml;
119+
/*XmlDocument xmlDoc = new XmlDocument();
120+
xmlDoc.LoadXml(xml);
121+
122+
var mensagem = xmlDoc.GetElementsByTagName("Mensagem");
123+
if (mensagem.Count == 0)
124+
return xml;
125+
else
126+
{
127+
var correcao = xmlDoc.GetElementsByTagName("Correcao");
128+
var correcaoText = "";
129+
if (correcao.Count > 0)
130+
correcaoText = " - Correção: " + correcao[0].InnerText;
131+
return mensagem[0].InnerText + correcaoText;
132+
}*/
133+
}
134+
135+
#endregion Methods
136+
}
137+
}

0 commit comments

Comments
 (0)