Skip to content

Commit 036db92

Browse files
author
Letícia Lopes
committed
finalizado GISS Online de Jaboticabal
1 parent c7efac4 commit 036db92

2 files changed

Lines changed: 66 additions & 3 deletions

File tree

src/OpenAC.Net.NFSe/OpenAC.Net.NFSe.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
<PackageLicenseFile>LICENSE</PackageLicenseFile>
2020
<PackageReadmeFile>README.md</PackageReadmeFile>
2121
<NeutralLanguage>pt-BR</NeutralLanguage>
22-
<AssemblyVersion>1.5.0.2</AssemblyVersion>
23-
<FileVersion>1.5.0.2</FileVersion>
24-
<Version>1.5.0.2</Version>
22+
<AssemblyVersion>1.5.12.21</AssemblyVersion>
23+
<FileVersion>1.5.12.21</FileVersion>
24+
<Version>1.5.12.21</Version>
2525
<PublishRepositoryUrl>true</PublishRepositoryUrl>
2626
<EmbedUntrackedSources>true</EmbedUntrackedSources>
2727
<DebugType>embedded</DebugType>

src/OpenAC.Net.NFSe/Providers/GISS/ProviderGISS.cs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,69 @@ protected override void AssinarConsultarLoteRps(RetornoConsultarLoteRps retornoW
181181
retornoWebservice.XmlEnvio = XmlSigning.AssinarXml(retornoWebservice.XmlEnvio, "con:ConsultarLoteRpsEnvio", "", Certificado);
182182
}
183183

184+
protected override void TratarRetornoConsultarLoteRps(RetornoConsultarLoteRps retornoWebservice, NotaServicoCollection notas)
185+
{
186+
// Analisa mensagem de retorno
187+
var xmlRet = XDocument.Parse(retornoWebservice.XmlRetorno);
188+
189+
retornoWebservice.Lote = xmlRet.Root?.ElementAnyNs("NumeroLote")?.GetValue<int>() ?? 0;
190+
191+
var retornoLote = xmlRet.ElementAnyNs("ConsultarLoteRpsResposta");
192+
var situacao = retornoLote?.ElementAnyNs("Situacao");
193+
if (situacao != null)
194+
retornoWebservice.Situacao = situacao.GetValue<string>();
195+
196+
MensagemErro(retornoWebservice, xmlRet, "ConsultarLoteRpsResposta");
197+
if (retornoWebservice.Erros.Any()) return;
198+
199+
retornoWebservice.Sucesso = true;
200+
201+
if (notas == null) return;
202+
203+
var listaNfse = retornoLote?.ElementAnyNs("ListaNfse");
204+
205+
if (listaNfse == null)
206+
{
207+
retornoWebservice.Erros.Add(new Evento { Codigo = "0", Descricao = "Lista de NFSe não encontrada! (ListaNfse)" });
208+
return;
209+
}
210+
211+
var notasFiscais = new List<NotaServico>();
212+
213+
foreach (var compNfse in listaNfse.ElementsAnyNs("CompNfse"))
214+
{
215+
var nfse = compNfse.ElementAnyNs("Nfse").ElementAnyNs("InfNfse");
216+
var numeroNFSe = nfse.ElementAnyNs("Numero")?.GetValue<string>() ?? string.Empty;
217+
var chaveNFSe = nfse.ElementAnyNs("CodigoVerificacao")?.GetValue<string>() ?? string.Empty;
218+
var dataNFSe = nfse.ElementAnyNs("DataEmissao")?.GetValue<DateTime>() ?? DateTime.Now;
219+
var numeroRps = nfse.ElementAnyNs("DeclaracaoPrestacaoServico")?
220+
.ElementAnyNs("InfDeclaracaoPrestacaoServico")?
221+
.ElementAnyNs("Rps")?
222+
.ElementAnyNs("IdentificacaoRps")?
223+
.ElementAnyNs("Numero").GetValue<string>() ?? string.Empty;
224+
225+
GravarNFSeEmDisco(compNfse.AsString(true), $"NFSe-{numeroNFSe}-{chaveNFSe}-.xml", dataNFSe);
226+
227+
var nota = notas.FirstOrDefault(x => x.IdentificacaoRps.Numero == numeroRps);
228+
if (nota == null)
229+
{
230+
nota = notas.Load(compNfse.ToString());
231+
}
232+
else
233+
{
234+
nota.IdentificacaoNFSe.Numero = numeroNFSe;
235+
nota.IdentificacaoNFSe.Chave = chaveNFSe;
236+
nota.IdentificacaoNFSe.DataEmissao = dataNFSe;
237+
nota.XmlOriginal = compNfse.ToString();
238+
}
239+
240+
nota.Protocolo = retornoWebservice.Protocolo;
241+
notasFiscais.Add(nota);
242+
}
243+
244+
retornoWebservice.Notas = notasFiscais.ToArray();
245+
}
246+
184247
protected override void PrepararCancelarNFSe(RetornoCancelar retornoWebservice)
185248
{
186249
if (retornoWebservice.NumeroNFSe.IsEmpty() || retornoWebservice.CodigoCancelamento.IsEmpty())

0 commit comments

Comments
 (0)