Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrar ajustes para MDFe no repositório original da biblioteca DFe.NET #1519

Merged
merged 32 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e431814
Corrigido typo "Extencoes" para "Extensoes"
andrebts May 16, 2024
7986fdb
Adicionado singleton para MDFeConfiguracao;
andrebts May 16, 2024
be93c2c
Adicionado parametro opcional MDFeConfiguracao a ExtMDFe
andrebts May 16, 2024
6f71fdc
Adicionado parâmetro MDFeConfiguracao a métodos das classes de extens…
andrebts May 17, 2024
9a54242
Adicionada descrição aos itens do enum MDFeModal;
andrebts May 17, 2024
fdbecd0
Implementado INotifyPropertyChanged em MDFeConfiguracao;
andrebts May 17, 2024
2def959
Renomeado Comp para MDFeComp;
andrebts May 17, 2024
1d6fe74
Adicionado tratamento para obtenção do valor do campo dhIniViagem em …
andrebts May 17, 2024
54bab3c
Renomeado infEntregaParcial para MDFeInfEntregaParcial;
andrebts May 17, 2024
2268d97
Renomeado prodPred para MDFeProdPred;
andrebts May 18, 2024
38f1709
Ajustado nome dos campos e adicionada documentação em MDFeInfRespTec.cs;
andrebts May 18, 2024
abcd2aa
Alterada versão do leiaute específico para o Modal (VersaoModal) no c…
andrebts May 18, 2024
c56f27a
Ajustado estilo das propriedades em MDFeValePed;
andrebts May 20, 2024
719bc05
Consolidado enum que representa "tpCarga";
andrebts May 20, 2024
66dd79f
Ajsutado nome da propriedade ProtMdFe para ProtMDFe da classe MDFeRet…
andrebts May 20, 2024
0407c18
Renomeado evPagtoOperMDFe para MDFeEvPagtoOperMDFe afim de manter com…
andrebts May 20, 2024
a1ad343
Adicionado parâmetro MDFeConfiguracao em ServicoMDFeConsultaProtocol…
andrebts May 21, 2024
d1e4cce
Adicionado parâmetro opcional MDFeConfiguracao em métodos das classes…
andrebts May 21, 2024
b7b03f5
Movida classe MDFeVersaoWebService para seu próprio arquivo
andrebts May 21, 2024
7295129
Adicionado tratamento para CPF ao método ObterChave de ChaveFiscal;
andrebts May 22, 2024
8acbb6f
Adicionado pacote de testes para MDFe;
andrebts May 23, 2024
6d3ea5f
Removido pacote MDFe.Tests
andrebts May 28, 2024
ab11965
Excluidos arquivos do pacote MDFe.Tests
andrebts May 28, 2024
e08f110
Ajustados nomes de propriedades para estarem conforme estilo utilizad…
andrebts Jun 4, 2024
48792e4
Adicionado tratamento para casos em que a data e hora de início da vi…
andrebts Jun 7, 2024
1a221f9
Ajsutado nome da propriedade InfANTT de MDFeRodo para estar em confor…
andrebts Jun 17, 2024
34d10ae
Adicionados métodos ExportarPdf e ObterHTML a DamdfeFrMDFe;
andrebts Jun 17, 2024
c761ede
Ajustado método SalvarXmlEmDisco para avaliar a configuração a ser ut…
andrebts Jun 17, 2024
4c66d28
Ajustado nome da propriedade IdCSRT da classe MDFeInfRespTec para ate…
andrebts Jun 21, 2024
5479f5c
Refatorado conteúdo do método Dispose e do destrutor de MDFeConfigura…
andrebts Jun 21, 2024
0dcaab4
Removido valor "Indefinido" do Enum MDFeTpCarga;
andrebts Jun 21, 2024
f5b3780
Ajuste no nome do elemento XML da propriedade longitude das classes M…
andrebts Jun 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CTe.Servicos/ConsultaProtocolo/ConsultaProtcoloServico.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
using CTe.Classes;
using CTe.Classes.Servicos.Consulta;
using CTe.Servicos.Factory;
using CTe.Utils.Extencoes;
using CTe.Utils.Extensoes;

namespace CTe.Servicos.ConsultaProtocolo
{
Expand Down
2 changes: 1 addition & 1 deletion CTe.Servicos/ConsultaRecibo/ConsultaReciboServico.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
using CTe.Classes;
using CTe.Classes.Servicos.Recepcao.Retorno;
using CTe.Servicos.Factory;
using CTe.Utils.Extencoes;
using CTe.Utils.Extensoes;

namespace CTe.Servicos.ConsultaRecibo
{
Expand Down
2 changes: 1 addition & 1 deletion CTe.Servicos/ConsultaStatus/StatusServico.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
using CTe.Classes;
using CTe.Classes.Servicos.Status;
using CTe.Servicos.Factory;
using CTe.Utils.Extencoes;
using CTe.Utils.Extensoes;

namespace CTe.Servicos.ConsultaStatus
{
Expand Down
2 changes: 1 addition & 1 deletion CTe.Servicos/Inutilizacao/InutilizacaoServico.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
using CTe.Classes;
using CTe.Classes.Servicos.Inutilizacao;
using CTe.Servicos.Factory;
using CTe.Utils.Extencoes;
using CTe.Utils.Extensoes;
using CTe.Utils.Inutilizacao;
using DFe.Classes.Flags;

Expand Down
2 changes: 1 addition & 1 deletion CTe.Utils/Evento/Extevento.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
using CTe.Classes;
using CTe.Classes.Servicos.Evento;
using CTe.Classes.Servicos.Tipos;
using CTe.Utils.Extencoes;
using CTe.Utils.Extensoes;
using CTe.Utils.Validacao;
using DFe.Utils;
using DFe.Utils.Assinatura;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
using CTe.Utils.Validacao;
using DFe.Utils;

namespace CTe.Utils.Extencoes
namespace CTe.Utils.Extensoes
{
public static class ExtConsReciCTe
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
using CTe.Utils.Validacao;
using DFe.Utils;

namespace CTe.Utils.Extencoes
namespace CTe.Utils.Extensoes
{
public static class ExtconsSitCTe
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
using CTe.Utils.Validacao;
using DFe.Utils;

namespace CTe.Utils.Extencoes
namespace CTe.Utils.Extensoes
{
public static class ExtconsStatServCte
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
using CTe.Classes.Servicos.Evento;
using DFe.Utils;

namespace CTe.Utils.Extencoes
namespace CTe.Utils.Extensoes
{
public static class ExtevCCeCTe
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
using CTe.Classes.Servicos.Evento;
using DFe.Utils;

namespace CTe.Utils.Extencoes
namespace CTe.Utils.Extensoes
{
public static class ExtevCancCTe
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
using CTe.Classes.Servicos.Evento;
using DFe.Utils;

namespace CTe.Utils.Extencoes
namespace CTe.Utils.Extensoes
{
public static class ExtevPrestDesacordo
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
using DFe.Utils;
using DFe.Utils.Assinatura;

namespace CTe.Utils.Extencoes
namespace CTe.Utils.Extensoes
{
public static class ExtinutCTe
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
using CTe.Classes.Servicos.Consulta;
using DFe.Utils;

namespace CTe.Utils.Extencoes
namespace CTe.Utils.Extensoes
{
public static class ExtretConsSitCTe
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
using CTe.Classes.Servicos.Status;
using DFe.Utils;

namespace CTe.Utils.Extencoes
namespace CTe.Utils.Extensoes
{
public static class ExtretConsStatServ
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
using CTe.Classes.Servicos.Status;
using DFe.Utils;

namespace CTe.Utils.Extencoes
namespace CTe.Utils.Extensoes
{
public static class ExtretConsStatServCte
{
Expand Down
19 changes: 12 additions & 7 deletions DFe.Utils/ChaveFiscal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,19 @@ public static DadosChaveFiscal ObterChave(Estado ufEmitente, DateTimeOffset data
{
var chave = new StringBuilder();

if (cnpjEmitente.Length < 14)
{
cnpjEmitente = cnpjEmitente.PadLeft(14, '0');
}

chave.Append(((int)ufEmitente).ToString("D2"))
andrebts marked this conversation as resolved.
Show resolved Hide resolved
.Append(dataEmissao.ToString("yyMM"))
.Append(cnpjEmitente)
.Append(((int)modelo).ToString("D2"))
.Append(serie.ToString("D3"))
.Append(numero.ToString("D9"))
.Append(tipoEmissao.ToString())
.Append(cNf.ToString("D8"));
.Append(dataEmissao.ToString("yyMM"))
.Append(cnpjEmitente)
.Append(((int)modelo).ToString("D2"))
.Append(serie.ToString("D3"))
.Append(numero.ToString("D9"))
.Append(tipoEmissao.ToString())
.Append(cNf.ToString("D8"));

var digitoVerificador = ObterDigitoVerificador(chave.ToString());

Expand Down
2 changes: 1 addition & 1 deletion DFe.Utils/StringExtencoes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Shared.DFe.Utils
{
public static class StringExtencoes
public static class StringExtensoes
{
public static string RemoverAcentos(this string valor)
{
Expand Down
75 changes: 38 additions & 37 deletions MDFe.AppTeste/MDFeTesteModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@
/* http://www.zeusautomacao.com.br/ */
/* Rua Comendador Francisco josé da Cunha, 111 - Itabaiana - SE - 49500-000 */
/********************************************************************************/

using DFe.Classes.Entidades;
using DFe.Classes.Flags;
using DFe.Utils;
using MDFe.AppTeste.Dao;
using MDFe.AppTeste.Entidades;
using MDFe.AppTeste.ModelBase;
using MDFe.Classes.Extencoes;
using MDFe.Classes.Extensoes;
using MDFe.Classes.Flags;
using MDFe.Classes.Informacoes;
using MDFe.Classes.Informacoes.Evento.CorpoEvento;
Expand Down Expand Up @@ -612,7 +613,7 @@ public void CriarEnviar()
#endregion dados emitente (emit)

#region modal
if (MDFeConfiguracao.VersaoWebService.VersaoLayout == VersaoServico.Versao100)
if (MDFeConfiguracao.Instancia.VersaoWebService.VersaoLayout == VersaoServico.Versao100)
{
mdfe.InfMDFe.InfModal.Modal = new MDFeRodo
{
Expand Down Expand Up @@ -640,16 +641,16 @@ public void CriarEnviar()
}


if (MDFeConfiguracao.VersaoWebService.VersaoLayout == VersaoServico.Versao300)
if (MDFeConfiguracao.Instancia.VersaoWebService.VersaoLayout == VersaoServico.Versao300)
{
mdfe.InfMDFe.InfModal.Modal = new MDFeRodo
{
infANTT = new MDFeInfANTT
InfANTT = new MDFeInfANTT
{
RNTRC = config.Empresa.RNTRC,

// não é obrigatorio
infCIOT = new List<infCIOT>
InfCIOT = new List<infCIOT>
{
new infCIOT
{
Expand Down Expand Up @@ -692,7 +693,7 @@ public void CriarEnviar()
TpCar = MDFeTpCar.NaoAplicavel
},

lacRodo = new List<MDFeLacre>
LacRodo = new List<MDFeLacre>
{
new MDFeLacre
{
Expand Down Expand Up @@ -722,7 +723,7 @@ public void CriarEnviar()
};


if (MDFeConfiguracao.VersaoWebService.VersaoLayout == VersaoServico.Versao300)
if (MDFeConfiguracao.Instancia.VersaoWebService.VersaoLayout == VersaoServico.Versao300)
{
mdfe.InfMDFe.InfDoc.InfMunDescarga[0].InfCTe[0].Peri = new List<MDFePeri>
{
Expand All @@ -738,7 +739,7 @@ public void CriarEnviar()

#region seg

if (MDFeConfiguracao.VersaoWebService.VersaoLayout == VersaoServico.Versao300)
if (MDFeConfiguracao.Instancia.VersaoWebService.VersaoLayout == VersaoServico.Versao300)
{
mdfe.InfMDFe.Seg = new List<MDFeSeg>();

Expand Down Expand Up @@ -766,19 +767,19 @@ public void CriarEnviar()

#region Produto Predominante

if (MDFeConfiguracao.VersaoWebService.VersaoLayout == VersaoServico.Versao300)
if (MDFeConfiguracao.Instancia.VersaoWebService.VersaoLayout == VersaoServico.Versao300)
{
mdfe.InfMDFe.prodPred = new prodPred
mdfe.InfMDFe.ProdPred = new MDFeProdPred
{
tpCarga = tpCarga.CargaGeral,
xProd = "aaaaaaaaaaaaaaaaaaaaa",
infLotacao = new infLotacao
TpCarga = MDFeTpCarga.CargaGeral,
XProd = "aaaaaaaaaaaaaaaaaaaaa",
InfLotacao = new MDFeInfLotacao
{
infLocalCarrega = new infLocalCarrega
InfLocalCarrega = new MDFeInfLocalCarrega
{
CEP = "75950000"
},
infLocalDescarrega = new infLocalDescarrega
InfLocalDescarrega = new MDFeInfLocalDescarrega
{
CEP = "75950000"
}
Expand All @@ -804,12 +805,12 @@ public void CriarEnviar()

#region dados responsavel tecnico

mdfe.InfMDFe.infRespTec = new infRespTec
mdfe.InfMDFe.InfRespTec = new MDFeInfRespTec
{
CNPJ = "21025760000123",
email = "[email protected]",
fone = "64981081602",
xContato = "roberto alves"
Email = "[email protected]",
Fone = "64981081602",
XContato = "roberto alves"
};
#endregion

Expand Down Expand Up @@ -898,7 +899,7 @@ public void GerarESalvar()
#endregion dados emitente (emit)

#region modal
if (MDFeConfiguracao.VersaoWebService.VersaoLayout == VersaoServico.Versao100)
if (MDFeConfiguracao.Instancia.VersaoWebService.VersaoLayout == VersaoServico.Versao100)
{
mdfe.InfMDFe.InfModal.VersaoModal = MDFeVersaoModal.Versao100;
mdfe.InfMDFe.InfModal.Modal = new MDFeRodo
Expand Down Expand Up @@ -927,25 +928,25 @@ public void GerarESalvar()
}


if (MDFeConfiguracao.VersaoWebService.VersaoLayout == VersaoServico.Versao300)
if (MDFeConfiguracao.Instancia.VersaoWebService.VersaoLayout == VersaoServico.Versao300)
{
mdfe.InfMDFe.InfModal.VersaoModal = MDFeVersaoModal.Versao300;
mdfe.InfMDFe.InfModal.Modal = new MDFeRodo
{
infANTT = new MDFeInfANTT
InfANTT = new MDFeInfANTT
{
RNTRC = config.Empresa.RNTRC,

// não é obrigatorio
infCIOT = new List<infCIOT>
InfCIOT = new List<infCIOT>
{
new infCIOT
{
CIOT = "123456789123",
CNPJ = "21025760000123"
}
},
valePed = new MDFeValePed
ValePed = new MDFeValePed
{
Disp = new List<MDFeDisp>
{
Expand All @@ -954,7 +955,7 @@ public void GerarESalvar()
CNPJForn = "21025760000123",
CNPJPg = "21025760000123",
NCompra = "838388383",
vValePed = 100.33m
VValePed = 100.33m
}
}
}
Expand All @@ -980,7 +981,7 @@ public void GerarESalvar()
TpCar = MDFeTpCar.NaoAplicavel
},

lacRodo = new List<MDFeLacre>
LacRodo = new List<MDFeLacre>
{
new MDFeLacre
{
Expand Down Expand Up @@ -1011,7 +1012,7 @@ public void GerarESalvar()
};


if (MDFeConfiguracao.VersaoWebService.VersaoLayout == VersaoServico.Versao300)
if (MDFeConfiguracao.Instancia.VersaoWebService.VersaoLayout == VersaoServico.Versao300)
{
mdfe.InfMDFe.InfDoc.InfMunDescarga[0].InfCTe[0].Peri = new List<MDFePeri>
{
Expand All @@ -1027,7 +1028,7 @@ public void GerarESalvar()

#region seg

if (MDFeConfiguracao.VersaoWebService.VersaoLayout == VersaoServico.Versao300)
if (MDFeConfiguracao.Instancia.VersaoWebService.VersaoLayout == VersaoServico.Versao300)
{
mdfe.InfMDFe.Seg = new List<MDFeSeg>();

Expand Down Expand Up @@ -1379,17 +1380,17 @@ private static void CarregarConfiguracoesMDFe(Configuracao config)
ManterDadosEmCache = config.CertificadoDigital.ManterEmCache,
};

MDFeConfiguracao.ConfiguracaoCertificado = configuracaoCertificado;
MDFeConfiguracao.CaminhoSchemas = config.ConfigWebService.CaminhoSchemas;
MDFeConfiguracao.CaminhoSalvarXml = config.DiretorioSalvarXml;
MDFeConfiguracao.IsSalvarXml = config.IsSalvarXml;
MDFeConfiguracao.Instancia.ConfiguracaoCertificado = configuracaoCertificado;
MDFeConfiguracao.Instancia.CaminhoSchemas = config.ConfigWebService.CaminhoSchemas;
MDFeConfiguracao.Instancia.CaminhoSalvarXml = config.DiretorioSalvarXml;
MDFeConfiguracao.Instancia.IsSalvarXml = config.IsSalvarXml;

MDFeConfiguracao.VersaoWebService.VersaoLayout = config.ConfigWebService.VersaoLayout;
MDFeConfiguracao.Instancia.VersaoWebService.VersaoLayout = config.ConfigWebService.VersaoLayout;

MDFeConfiguracao.VersaoWebService.TipoAmbiente = config.ConfigWebService.Ambiente;
MDFeConfiguracao.VersaoWebService.UfEmitente = config.ConfigWebService.UfEmitente;
MDFeConfiguracao.VersaoWebService.TimeOut = config.ConfigWebService.TimeOut;
MDFeConfiguracao.IsAdicionaQrCode = true;
MDFeConfiguracao.Instancia.VersaoWebService.TipoAmbiente = config.ConfigWebService.Ambiente;
MDFeConfiguracao.Instancia.VersaoWebService.UfEmitente = config.ConfigWebService.UfEmitente;
MDFeConfiguracao.Instancia.VersaoWebService.TimeOut = config.ConfigWebService.TimeOut;
MDFeConfiguracao.Instancia.IsAdicionaQrCode = true;
}

protected virtual void OnSucessoSync(RetornoEEnvio e)
Expand Down
Loading