diff --git a/.gitignore b/.gitignore index 88ba55d3..c21e08a1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ target/ .idea/ *.iml /target/ +/.github/*.md +show, \ No newline at end of file diff --git a/README.md b/README.md index 83425b03..941c836d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Java-NFe [![MIT License](https://img.shields.io/github/license/Samuel-Oliveira/Java_NFe.svg) ](https://github.com/Samuel-Oliveira/Java_NFe/blob/master/LICENSE) [![Maven Central](https://img.shields.io/maven-central/v/br.com.swconsultoria/java-nfe.svg?label=Maven%20Central)](https://search.maven.org/artifact/br.com.swconsultoria/java-nfe/4.00.49/jar) +# Java-NFe [![MIT License](https://img.shields.io/github/license/Samuel-Oliveira/Java_NFe.svg) ](https://github.com/Samuel-Oliveira/Java_NFe/blob/master/LICENSE) [![Maven Central](https://img.shields.io/maven-central/v/br.com.swconsultoria/java-nfe.svg?label=Maven%20Central)](https://search.maven.org/artifact/br.com.swconsultoria/java-nfe/4.00.51/jar) [![Coverage Status](https://coveralls.io/repos/github/Samuel-Oliveira/Java_NFe/badge.svg?branch=master)](https://coveralls.io/github/Samuel-Oliveira/Java_NFe?branch=master) Biblioteca Java para consumo do WebService de NFe/NFCe ### Powered by @@ -22,7 +22,7 @@ Para Iniciar : br.com.swconsultoria java-nfe - 4.00.49 + 4.00.51 ``` @@ -34,7 +34,7 @@ repositories { } } dependencies { - implementation "br.com.swconsultoria:java-nfe:4.00.49" + implementation "br.com.swconsultoria:java-nfe:4.00.51" } ``` @@ -44,6 +44,13 @@ ________________________________________________________________________________ # Historico de Versões +## v4.00.51 - 19/03/2026 - Schemas PL.010b (v1.30) +- Adicionado Teste Unitarios +- Atualizado Cacert + +## v4.00.50 - 16/02/2026 - Schemas PL.010b (v1.30) +- Ajustes Impressao Danfe + ## v4.00.49 - 18/01/2026 - Schemas PL.010b (v1.30) - Corrigido monofasia retida Anteriormente. - Adicionado calculos IBSCBS para Diferimento diff --git a/pom-base.xml b/pom-base.xml index 19f41efb..dafc6fae 100644 --- a/pom-base.xml +++ b/pom-base.xml @@ -3,7 +3,7 @@ br.com.swconsultoria java-nfe - 4.00.49-${versao}-SNAPSHOT + 4.00.51-${versao}-SNAPSHOT Java_NFe Api java para consumo do webService de nota fiscal eletronica https://github.com/Samuel-Oliveira/Java_NFe @@ -31,7 +31,7 @@ 1.8 - 3.13 + 3.14 4.4.6 2.3.1 2.3.1 diff --git a/pom.xml b/pom.xml index e19b31f5..5d6db058 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ br.com.swconsultoria java-nfe - 4.00.49 + 4.00.51 Java_NFe Api java para consumo do webService de nota fiscal eletronica https://github.com/Samuel-Oliveira/Java_NFe @@ -31,7 +31,7 @@ 1.8 - 3.13 + 3.14 4.4.6 2.3.1 2.3.1 @@ -279,6 +279,15 @@ true + + + org.eluder.coveralls + coveralls-maven-plugin + 4.3.0 + + paGe4qkZvPNJtvxqY8NaJN5ImZO56RqB6 + + diff --git a/schemas/leiauteNFe_v4.00.xsd b/schemas/leiauteNFe_v4.00.xsd index 7393b031..28079674 100644 --- a/schemas/leiauteNFe_v4.00.xsd +++ b/schemas/leiauteNFe_v4.00.xsd @@ -18,9 +18,7 @@ - + @@ -211,7 +209,13 @@ Campo preenchido somente quando “indPres = 5 (Operação presencial, fora do e - Tipo de Nota de Débito + Tipo de Nota de Débito: +01=Transferência de créditos para Cooperativas; +02=Anulação de Crédito por Saídas Imunes/Isentas; +03=Débitos de notas fiscais não processadas na apuração; +04=Multa e juros; +05=Transferência de crédito de sucessão. + @@ -503,7 +507,7 @@ Preencher com "2B", quando se tratar de Cupom Fiscal emitido por máqu - + Chave de acesso da NF-e de antecipação de pagamento @@ -2557,13 +2561,15 @@ ambiente. - Motivo da desoneração do ICMS:3-Uso na agropecuária;9-Outros;12-Fomento agropecuário + Motivo da desoneração do ICMS:3-Uso na agropecuária;9-Outros; 10=Deficiente Condutor (Convênio ICMS 38/12); 11=Deficiente Não Condutor (Convênio ICMS 38/12); 12-Fomento agropecuário + + @@ -3397,11 +3403,39 @@ Informar o motivo da desoneração: Percentual de redução da BC + + + Código de Benefício Fiscal na UF aplicado ao item quando houver RBC. + + + + + + + + Alíquota do ICMS + + + + Valor do ICMS da Operação + + + + + Percentual do diferemento + + + + + Valor do ICMS da diferido + + + Valor do ICMS @@ -3424,6 +3458,23 @@ Informar o motivo da desoneração: + + + + Percentual do diferimento do ICMS relativo ao Fundo de Combate à Pobreza (FCP). + + + + + Valor do ICMS relativo ao Fundo de Combate à Pobreza (FCP) diferido. + + + + + Valor efetivo do ICMS relativo ao Fundo de Combate à Pobreza (FCP). + + + @@ -3571,12 +3622,14 @@ Operação interestadual para consumidor final com partilha do ICMS devido na o Tributação pelo ICMS 10 - Tributada e com cobrança do ICMS por substituição tributária; +20 – Redução de base de cálculo 90 – Outros. + @@ -3695,6 +3748,43 @@ Operação interestadual para consumidor final com partilha do ICMS devido na o Sigla da UF para qual é devido o ICMS ST da operação. + + + Grupo desoneração + + + + Valor do ICMS de desoneração + + + + + Motivo da desoneração do ICMS:9-Outros;10=Deficiente Condutor (Convênio ICMS 38/12) 11=Deficiente Não Condutor (Convênio ICMS 38/12) + + + + + + + + + + + + + Indica se o valor do ICMS desonerado (vICMSDeson) deduz do valor do item (vProd): +0=Valor do ICMS desonerado (vICMSDeson) não deduz do valor do item (vProd) / total da NF-e; +1=Valor do ICMS desonerado (vICMSDeson) deduz do valor do item (vProd) / total da NF-e. + + + + + + + + + + @@ -6520,16 +6610,16 @@ tipo de ato concessório: - - - - - + + + + + @@ -7578,4 +7668,4 @@ alterado para tamanho variavel 1-4. (NT2011/004) - \ No newline at end of file + diff --git a/schemas/nfe_v4.00.xsd b/schemas/nfe_v4.00.xsd index c934ca2b..b8e3dd25 100644 --- a/schemas/nfe_v4.00.xsd +++ b/schemas/nfe_v4.00.xsd @@ -1,12 +1,10 @@ - - - - - - - Nota Fiscal Eletrônica - - - + + + + + + + Nota Fiscal Eletrônica + + + diff --git a/schemas/xmldsig-core-schema_v1.01.xsd b/schemas/xmldsig-core-schema_v1.01.xsd index 65daee9a..f7dc8dc6 100644 --- a/schemas/xmldsig-core-schema_v1.01.xsd +++ b/schemas/xmldsig-core-schema_v1.01.xsd @@ -1,98 +1,98 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/br/com/swconsultoria/nfe/dom/ConfiguracoesNfe.java b/src/main/java/br/com/swconsultoria/nfe/dom/ConfiguracoesNfe.java index fec10b43..131bd422 100644 --- a/src/main/java/br/com/swconsultoria/nfe/dom/ConfiguracoesNfe.java +++ b/src/main/java/br/com/swconsultoria/nfe/dom/ConfiguracoesNfe.java @@ -109,8 +109,8 @@ public static ConfiguracoesNfe criarConfiguracoes(EstadosEnum estado, AmbienteEn log.info(String.format("JAVA-NFE | Samuel Oliveira | samuel@swconsultoria.com.br " + "| VERSAO=%s | DATA_VERSAO=%s | PASTA_SCHEMAS=%s | AMBIENTE=%s | ESTADO=%s", - "4.00.49", - "18/01/2026", + "4.00.51", + "19/03/2026", pastaSchemas, ambiente, estado.getNome().toUpperCase())); diff --git a/src/main/resources/jasper/nfe/danfe.jasper b/src/main/resources/jasper/nfe/danfe.jasper index 31337840..fd78d135 100644 Binary files a/src/main/resources/jasper/nfe/danfe.jasper and b/src/main/resources/jasper/nfe/danfe.jasper differ diff --git a/src/main/resources/jasper/nfe/danfe.jrxml b/src/main/resources/jasper/nfe/danfe.jrxml index c50fe6e9..f472373d 100644 --- a/src/main/resources/jasper/nfe/danfe.jrxml +++ b/src/main/resources/jasper/nfe/danfe.jrxml @@ -1001,8 +1001,8 @@ $F{Trans_CPF}.substring(9,11) : ""]]> - + diff --git a/src/test/java/br/com/swconsultoria/nfe/CancelarTest.java b/src/test/java/br/com/swconsultoria/nfe/CancelarTest.java new file mode 100644 index 00000000..0a92613f --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/CancelarTest.java @@ -0,0 +1,120 @@ +package br.com.swconsultoria.nfe; + +import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe; +import br.com.swconsultoria.nfe.dom.Evento; +import br.com.swconsultoria.nfe.dom.enuns.AmbienteEnum; +import br.com.swconsultoria.nfe.dom.enuns.AssinaturaEnum; +import br.com.swconsultoria.nfe.dom.enuns.DocumentoEnum; +import br.com.swconsultoria.nfe.dom.enuns.EstadosEnum; +import br.com.swconsultoria.nfe.exception.NfeException; +import br.com.swconsultoria.nfe.schema.envEventoCancNFe.TEnvEvento; +import br.com.swconsultoria.nfe.schema.envEventoCancNFe.TRetEnvEvento; +import br.com.swconsultoria.nfe.util.CancelamentoUtil; +import br.com.swconsultoria.nfe.util.StubUtil; +import br.com.swconsultoria.nfe.wsdl.NFeRecepcaoEvento.NFeRecepcaoEvento4Stub; +import mockit.Mock; +import mockit.MockUp; +import org.apache.axiom.om.util.AXIOMUtil; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class CancelarTest { + + private static final String RET_EVENTO_XML = + "" + + "12TESTE" + + "91128" + + "Lote de Evento Processado" + + ""; + + private ConfiguracoesNfe config; + private TEnvEvento enviEvento; + + @BeforeEach + void setUp() throws NfeException { + config = new ConfiguracoesNfe(); + config.setEstado(EstadosEnum.SP); + config.setAmbiente(AmbienteEnum.HOMOLOGACAO); + config.setEncode("UTF-8"); + + config.setZoneId(java.time.ZoneId.of("America/Sao_Paulo")); + + Evento evento = new Evento(); + evento.setChave("52230309158456000159550010000731791567812345"); + evento.setCnpj("09158456000159"); + evento.setProtocolo("352230000123456"); + evento.setMotivo("Cancelamento por erro na emissao do documento fiscal"); + evento.setDataEvento(java.time.LocalDateTime.of(2024, 1, 15, 10, 0, 0)); + enviEvento = CancelamentoUtil.montaCancelamento(evento, config); + } + + private void mockStubUtil() { + new MockUp() { + @Mock + public void configuraHttpClient(org.apache.axis2.client.Stub stub, + ConfiguracoesNfe cfg, String url) { } + }; + } + + private void mockAssinar() { + new MockUp() { + @Mock + public String assinaNfe(ConfiguracoesNfe cfg, String xml, + AssinaturaEnum tipo) throws NfeException { + return xml; + } + }; + } + + private void mockEventosStub() { + new MockUp() { + @Mock + public void $init(String endpoint) { } + + @Mock + public NFeRecepcaoEvento4Stub.NfeResultMsg nfeRecepcaoEvento( + NFeRecepcaoEvento4Stub.NfeDadosMsg data) throws Exception { + NFeRecepcaoEvento4Stub.NfeResultMsg result = new NFeRecepcaoEvento4Stub.NfeResultMsg(); + result.setExtraElement(AXIOMUtil.stringToOM(RET_EVENTO_XML)); + return result; + } + }; + } + + @Test + void eventoCancelamento_semValidacao_retornaEvento() throws NfeException { + mockStubUtil(); + mockAssinar(); + mockEventosStub(); + + TRetEnvEvento ret = Cancelar.eventoCancelamento(config, enviEvento, false, DocumentoEnum.NFE); + + assertNotNull(ret); + assertEquals("128", ret.getCStat()); + } + + @Test + void eventoCancelamento_retornaLoteProcessado() throws NfeException { + mockStubUtil(); + mockAssinar(); + mockEventosStub(); + + TRetEnvEvento ret = Cancelar.eventoCancelamento(config, enviEvento, false, DocumentoEnum.NFE); + + assertEquals("Lote de Evento Processado", ret.getXMotivo()); + } + + @Test + void eventoCancelamento_retornaAmbienteHomologacao() throws NfeException { + mockStubUtil(); + mockAssinar(); + mockEventosStub(); + + TRetEnvEvento ret = Cancelar.eventoCancelamento(config, enviEvento, false, DocumentoEnum.NFE); + + assertEquals("2", ret.getTpAmb()); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/CartaCorrecaoTest.java b/src/test/java/br/com/swconsultoria/nfe/CartaCorrecaoTest.java new file mode 100644 index 00000000..add663a9 --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/CartaCorrecaoTest.java @@ -0,0 +1,119 @@ +package br.com.swconsultoria.nfe; + +import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe; +import br.com.swconsultoria.nfe.dom.Evento; +import br.com.swconsultoria.nfe.dom.enuns.AmbienteEnum; +import br.com.swconsultoria.nfe.dom.enuns.AssinaturaEnum; +import br.com.swconsultoria.nfe.dom.enuns.EstadosEnum; +import br.com.swconsultoria.nfe.exception.NfeException; +import br.com.swconsultoria.nfe.schema.envcce.TEnvEvento; +import br.com.swconsultoria.nfe.schema.envcce.TRetEnvEvento; +import br.com.swconsultoria.nfe.util.CartaCorrecaoUtil; +import br.com.swconsultoria.nfe.util.StubUtil; +import br.com.swconsultoria.nfe.wsdl.NFeRecepcaoEvento.NFeRecepcaoEvento4Stub; +import mockit.Mock; +import mockit.MockUp; +import org.apache.axiom.om.util.AXIOMUtil; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class CartaCorrecaoTest { + + private static final String RET_EVENTO_XML = + "" + + "12TESTE" + + "91128" + + "Lote de Evento Processado" + + ""; + + private ConfiguracoesNfe config; + private TEnvEvento enviEvento; + + @BeforeEach + void setUp() throws NfeException { + config = new ConfiguracoesNfe(); + config.setEstado(EstadosEnum.SP); + config.setAmbiente(AmbienteEnum.HOMOLOGACAO); + config.setEncode("UTF-8"); + + config.setZoneId(java.time.ZoneId.of("America/Sao_Paulo")); + + Evento evento = new Evento(); + evento.setChave("52230309158456000159550010000731791567812345"); + evento.setCnpj("09158456000159"); + evento.setMotivo("Correcao no campo de endereco do destinatario da nota fiscal"); + evento.setSequencia(1); + evento.setDataEvento(java.time.LocalDateTime.of(2024, 3, 10, 9, 0, 0)); + enviEvento = CartaCorrecaoUtil.montaCCe(evento, config); + } + + private void mockStubUtil() { + new MockUp() { + @Mock + public void configuraHttpClient(org.apache.axis2.client.Stub stub, + ConfiguracoesNfe cfg, String url) { } + }; + } + + private void mockAssinar() { + new MockUp() { + @Mock + public String assinaNfe(ConfiguracoesNfe cfg, String xml, + AssinaturaEnum tipo) throws NfeException { + return xml; + } + }; + } + + private void mockEventosStub() { + new MockUp() { + @Mock + public void $init(String endpoint) { } + + @Mock + public NFeRecepcaoEvento4Stub.NfeResultMsg nfeRecepcaoEvento( + NFeRecepcaoEvento4Stub.NfeDadosMsg data) throws Exception { + NFeRecepcaoEvento4Stub.NfeResultMsg result = new NFeRecepcaoEvento4Stub.NfeResultMsg(); + result.setExtraElement(AXIOMUtil.stringToOM(RET_EVENTO_XML)); + return result; + } + }; + } + + @Test + void eventoCCe_semValidacao_retornaEvento() throws NfeException { + mockStubUtil(); + mockAssinar(); + mockEventosStub(); + + TRetEnvEvento ret = CartaCorrecao.eventoCCe(config, enviEvento, false); + + assertNotNull(ret); + assertEquals("128", ret.getCStat()); + } + + @Test + void eventoCCe_retornaLoteProcessado() throws NfeException { + mockStubUtil(); + mockAssinar(); + mockEventosStub(); + + TRetEnvEvento ret = CartaCorrecao.eventoCCe(config, enviEvento, false); + + assertEquals("Lote de Evento Processado", ret.getXMotivo()); + } + + @Test + void eventoCCe_retornaAmbienteHomologacao() throws NfeException { + mockStubUtil(); + mockAssinar(); + mockEventosStub(); + + TRetEnvEvento ret = CartaCorrecao.eventoCCe(config, enviEvento, false); + + assertEquals("2", ret.getTpAmb()); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/ConsultaReciboTest.java b/src/test/java/br/com/swconsultoria/nfe/ConsultaReciboTest.java new file mode 100644 index 00000000..edbedb5e --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/ConsultaReciboTest.java @@ -0,0 +1,92 @@ +package br.com.swconsultoria.nfe; + +import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe; +import br.com.swconsultoria.nfe.dom.enuns.AmbienteEnum; +import br.com.swconsultoria.nfe.dom.enuns.DocumentoEnum; +import br.com.swconsultoria.nfe.dom.enuns.EstadosEnum; +import br.com.swconsultoria.nfe.exception.NfeException; +import br.com.swconsultoria.nfe.schema_4.consReciNFe.TRetConsReciNFe; +import br.com.swconsultoria.nfe.util.StubUtil; +import br.com.swconsultoria.nfe.wsdl.NFeRetAutorizacao.NFeRetAutorizacao4Stub; +import mockit.Mock; +import mockit.MockUp; +import org.apache.axiom.om.util.AXIOMUtil; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class ConsultaReciboTest { + + private static final String RET_RECIBO_XML = + "" + + "2104Lote processado" + + "35" + + ""; + + private ConfiguracoesNfe config; + + @BeforeEach + void setUp() { + config = new ConfiguracoesNfe(); + config.setEstado(EstadosEnum.SP); + config.setAmbiente(AmbienteEnum.HOMOLOGACAO); + config.setEncode("UTF-8"); + } + + private void mockStubUtil() { + new MockUp() { + @Mock + public void configuraHttpClient(org.apache.axis2.client.Stub stub, + ConfiguracoesNfe cfg, String url) { } + }; + } + + private void mockReciboStub() { + new MockUp() { + @Mock + public void $init(String endpoint) { } + + @Mock + public NFeRetAutorizacao4Stub.NfeResultMsg nfeRetAutorizacaoLote( + NFeRetAutorizacao4Stub.NfeDadosMsg data) throws Exception { + NFeRetAutorizacao4Stub.NfeResultMsg result = new NFeRetAutorizacao4Stub.NfeResultMsg(); + result.setExtraElement(AXIOMUtil.stringToOM(RET_RECIBO_XML)); + return result; + } + }; + } + + @Test + void reciboNfe_reciboValido_retornaLoteProcessado() throws NfeException { + mockStubUtil(); + mockReciboStub(); + + TRetConsReciNFe ret = ConsultaRecibo.reciboNfe(config, "135240000000001", DocumentoEnum.NFE); + + assertNotNull(ret); + assertEquals("104", ret.getCStat()); + } + + @Test + void reciboNfe_retornaMotivo() throws NfeException { + mockStubUtil(); + mockReciboStub(); + + TRetConsReciNFe ret = ConsultaRecibo.reciboNfe(config, "135240000000001", DocumentoEnum.NFE); + + assertEquals("Lote processado", ret.getXMotivo()); + } + + @Test + void reciboNfe_nfce_retornaResultado() throws NfeException { + mockStubUtil(); + mockReciboStub(); + + TRetConsReciNFe ret = ConsultaRecibo.reciboNfe(config, "135240000000001", DocumentoEnum.NFCE); + + assertNotNull(ret); + assertEquals("104", ret.getCStat()); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/ConsultaXmlTest.java b/src/test/java/br/com/swconsultoria/nfe/ConsultaXmlTest.java new file mode 100644 index 00000000..03a28e21 --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/ConsultaXmlTest.java @@ -0,0 +1,93 @@ +package br.com.swconsultoria.nfe; + +import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe; +import br.com.swconsultoria.nfe.dom.enuns.AmbienteEnum; +import br.com.swconsultoria.nfe.dom.enuns.DocumentoEnum; +import br.com.swconsultoria.nfe.dom.enuns.EstadosEnum; +import br.com.swconsultoria.nfe.exception.NfeException; +import br.com.swconsultoria.nfe.schema_4.consSitNFe.TRetConsSitNFe; +import br.com.swconsultoria.nfe.util.StubUtil; +import br.com.swconsultoria.nfe.wsdl.NFeConsultaProtocolo.NFeConsultaProtocolo4Stub; +import mockit.Mock; +import mockit.MockUp; +import org.apache.axiom.om.util.AXIOMUtil; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class ConsultaXmlTest { + + private static final String CHAVE = "35240101234567890001550010000000011000000012"; + + private static final String RET_CONSULTA_XML = + "" + + "2100Autorizado o uso da NF-e" + + "352024-01-01T10:00:00-03:00" + + ""; + + private ConfiguracoesNfe config; + + @BeforeEach + void setUp() { + config = new ConfiguracoesNfe(); + config.setEstado(EstadosEnum.SP); + config.setAmbiente(AmbienteEnum.HOMOLOGACAO); + config.setEncode("UTF-8"); + } + + private void mockStubUtil() { + new MockUp() { + @Mock + public void configuraHttpClient(org.apache.axis2.client.Stub stub, + ConfiguracoesNfe cfg, String url) { } + }; + } + + private void mockConsultaStub() { + new MockUp() { + @Mock + public void $init(String endpoint) { } + + @Mock + public NFeConsultaProtocolo4Stub.NfeResultMsg nfeConsultaNF( + NFeConsultaProtocolo4Stub.NfeDadosMsg data) throws Exception { + NFeConsultaProtocolo4Stub.NfeResultMsg result = new NFeConsultaProtocolo4Stub.NfeResultMsg(); + result.setExtraElement(AXIOMUtil.stringToOM(RET_CONSULTA_XML)); + return result; + } + }; + } + + @Test + void consultaXml_chaveValida_retornaResultado() throws NfeException { + mockStubUtil(); + mockConsultaStub(); + + TRetConsSitNFe ret = ConsultaXml.consultaXml(config, CHAVE, DocumentoEnum.NFE); + + assertNotNull(ret); + assertEquals("100", ret.getCStat()); + } + + @Test + void consultaXml_retornaMotivo() throws NfeException { + mockStubUtil(); + mockConsultaStub(); + + TRetConsSitNFe ret = ConsultaXml.consultaXml(config, CHAVE, DocumentoEnum.NFE); + + assertEquals("Autorizado o uso da NF-e", ret.getXMotivo()); + } + + @Test + void consultaXml_retornaAmbienteHomologacao() throws NfeException { + mockStubUtil(); + mockConsultaStub(); + + TRetConsSitNFe ret = ConsultaXml.consultaXml(config, CHAVE, DocumentoEnum.NFE); + + assertEquals("2", ret.getTpAmb()); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/DistribuicaoDFeTest.java b/src/test/java/br/com/swconsultoria/nfe/DistribuicaoDFeTest.java new file mode 100644 index 00000000..17290e95 --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/DistribuicaoDFeTest.java @@ -0,0 +1,106 @@ +package br.com.swconsultoria.nfe; + +import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe; +import br.com.swconsultoria.nfe.dom.enuns.AmbienteEnum; +import br.com.swconsultoria.nfe.dom.enuns.ConsultaDFeEnum; +import br.com.swconsultoria.nfe.dom.enuns.EstadosEnum; +import br.com.swconsultoria.nfe.dom.enuns.PessoaEnum; +import br.com.swconsultoria.nfe.exception.NfeException; +import br.com.swconsultoria.nfe.schema.retdistdfeint.RetDistDFeInt; +import br.com.swconsultoria.nfe.util.StubUtil; +import br.com.swconsultoria.nfe.wsdl.NFeDistribuicaoDFe.NFeDistribuicaoDFeStub; +import mockit.Mock; +import mockit.MockUp; +import org.apache.axiom.om.util.AXIOMUtil; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class DistribuicaoDFeTest { + + private static final String RET_DIST_XML = + "" + + "2SVRS" + + "137Nenhum documento localizado" + + "2024-01-01T10:00:00-03:00" + + "000000000000000000000000000000" + + ""; + + private static final String CNPJ = "09158456000159"; + + private ConfiguracoesNfe config; + + @BeforeEach + void setUp() { + config = new ConfiguracoesNfe(); + config.setEstado(EstadosEnum.SP); + config.setAmbiente(AmbienteEnum.HOMOLOGACAO); + config.setEncode("UTF-8"); + } + + private void mockStubUtil() { + new MockUp() { + @Mock + public void configuraHttpClient(org.apache.axis2.client.Stub stub, + ConfiguracoesNfe cfg, String url) { } + }; + } + + private void mockDistStub() { + new MockUp() { + @Mock + public void $init(String endpoint) { } + + @Mock + public NFeDistribuicaoDFeStub.NfeDistDFeInteresseResponse nfeDistDFeInteresse( + NFeDistribuicaoDFeStub.NfeDistDFeInteresse data) throws Exception { + NFeDistribuicaoDFeStub.NfeDistDFeInteresseResult_type0 resultType0 = + new NFeDistribuicaoDFeStub.NfeDistDFeInteresseResult_type0(); + resultType0.setExtraElement(AXIOMUtil.stringToOM(RET_DIST_XML)); + + NFeDistribuicaoDFeStub.NfeDistDFeInteresseResponse response = + new NFeDistribuicaoDFeStub.NfeDistDFeInteresseResponse(); + response.setNfeDistDFeInteresseResult(resultType0); + return response; + } + }; + } + + @Test + void consultaNfe_comNsu_retornaDistribuicao() throws NfeException { + mockStubUtil(); + mockDistStub(); + + RetDistDFeInt ret = DistribuicaoDFe.consultaNfe(config, PessoaEnum.JURIDICA, CNPJ, + ConsultaDFeEnum.NSU, "000000000000000"); + + assertNotNull(ret); + assertEquals("137", ret.getCStat()); + } + + @Test + void consultaNfe_comChave_retornaDistribuicao() throws NfeException { + mockStubUtil(); + mockDistStub(); + + RetDistDFeInt ret = DistribuicaoDFe.consultaNfe(config, PessoaEnum.JURIDICA, CNPJ, + ConsultaDFeEnum.CHAVE, "35240101234567890001550010000000011000000012"); + + assertNotNull(ret); + assertEquals("Nenhum documento localizado", ret.getXMotivo()); + } + + @Test + void consultaNfe_comCpf_retornaDistribuicao() throws NfeException { + mockStubUtil(); + mockDistStub(); + + RetDistDFeInt ret = DistribuicaoDFe.consultaNfe(config, PessoaEnum.FISICA, "12345678901", + ConsultaDFeEnum.NSU, "000000000000000"); + + assertNotNull(ret); + assertEquals("2", ret.getTpAmb()); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/InutilizarTest.java b/src/test/java/br/com/swconsultoria/nfe/InutilizarTest.java new file mode 100644 index 00000000..2650d3f9 --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/InutilizarTest.java @@ -0,0 +1,121 @@ +package br.com.swconsultoria.nfe; + +import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe; +import br.com.swconsultoria.nfe.dom.enuns.AmbienteEnum; +import br.com.swconsultoria.nfe.dom.enuns.AssinaturaEnum; +import br.com.swconsultoria.nfe.dom.enuns.DocumentoEnum; +import br.com.swconsultoria.nfe.dom.enuns.EstadosEnum; +import br.com.swconsultoria.nfe.exception.NfeException; +import br.com.swconsultoria.nfe.schema_4.inutNFe.TInutNFe; +import br.com.swconsultoria.nfe.schema_4.inutNFe.TRetInutNFe; +import br.com.swconsultoria.nfe.util.StubUtil; +import br.com.swconsultoria.nfe.wsdl.NFeInutilizacao.NFeInutilizacao4Stub; +import mockit.Mock; +import mockit.MockUp; +import org.apache.axiom.om.util.AXIOMUtil; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class InutilizarTest { + + private static final String RET_INUT_XML = + "" + + "" + + "2102" + + "Inutilizacao de numero homologado" + + "352024-01-01T10:00:00-03:00" + + ""; + + private ConfiguracoesNfe config; + private TInutNFe inutNFe; + + @BeforeEach + void setUp() { + config = new ConfiguracoesNfe(); + config.setEstado(EstadosEnum.SP); + config.setAmbiente(AmbienteEnum.HOMOLOGACAO); + config.setEncode("UTF-8"); + + inutNFe = new TInutNFe(); + TInutNFe.InfInut infInut = new TInutNFe.InfInut(); + infInut.setCNPJ("09158456000159"); + infInut.setAno("24"); + infInut.setMod("55"); + infInut.setSerie("001"); + infInut.setNNFIni("1"); + infInut.setNNFFin("1"); + infInut.setXJust("Inutilizacao de teste com justificativa longa"); + inutNFe.setInfInut(infInut); + } + + private void mockStubUtil() { + new MockUp() { + @Mock + public void configuraHttpClient(org.apache.axis2.client.Stub stub, + ConfiguracoesNfe cfg, String url) { } + }; + } + + private void mockAssinar() { + new MockUp() { + @Mock + public String assinaNfe(ConfiguracoesNfe cfg, String xml, + AssinaturaEnum tipo) throws NfeException { + return xml; + } + }; + } + + private void mockInutilizacaoStub() { + new MockUp() { + @Mock + public void $init(String endpoint) { } + + @Mock + public NFeInutilizacao4Stub.NfeResultMsg nfeInutilizacaoNF( + NFeInutilizacao4Stub.NfeDadosMsg data) throws Exception { + NFeInutilizacao4Stub.NfeResultMsg result = new NFeInutilizacao4Stub.NfeResultMsg(); + result.setExtraElement(AXIOMUtil.stringToOM(RET_INUT_XML)); + return result; + } + }; + } + + @Test + void inutiliza_semValidacao_retornaInutilizacao() throws NfeException { + mockStubUtil(); + mockAssinar(); + mockInutilizacaoStub(); + + TRetInutNFe ret = Inutilizar.inutiliza(config, inutNFe, DocumentoEnum.NFE, false); + + assertNotNull(ret); + assertNotNull(ret.getInfInut()); + } + + @Test + void inutiliza_retornaNumeroHomologado() throws NfeException { + mockStubUtil(); + mockAssinar(); + mockInutilizacaoStub(); + + TRetInutNFe ret = Inutilizar.inutiliza(config, inutNFe, DocumentoEnum.NFE, false); + + assertEquals("102", ret.getInfInut().getCStat()); + assertEquals("Inutilizacao de numero homologado", ret.getInfInut().getXMotivo()); + } + + @Test + void inutiliza_retornaAmbienteHomologacao() throws NfeException { + mockStubUtil(); + mockAssinar(); + mockInutilizacaoStub(); + + TRetInutNFe ret = Inutilizar.inutiliza(config, inutNFe, DocumentoEnum.NFE, false); + + assertEquals("2", ret.getInfInut().getTpAmb()); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/ManifestacaoDestinatarioTest.java b/src/test/java/br/com/swconsultoria/nfe/ManifestacaoDestinatarioTest.java new file mode 100644 index 00000000..2a146fb0 --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/ManifestacaoDestinatarioTest.java @@ -0,0 +1,120 @@ +package br.com.swconsultoria.nfe; + +import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe; +import br.com.swconsultoria.nfe.dom.Evento; +import br.com.swconsultoria.nfe.dom.enuns.AmbienteEnum; +import br.com.swconsultoria.nfe.dom.enuns.AssinaturaEnum; +import br.com.swconsultoria.nfe.dom.enuns.EstadosEnum; +import br.com.swconsultoria.nfe.dom.enuns.ManifestacaoEnum; +import br.com.swconsultoria.nfe.exception.NfeException; +import br.com.swconsultoria.nfe.schema.envConfRecebto.TEnvEvento; +import br.com.swconsultoria.nfe.schema.envConfRecebto.TRetEnvEvento; +import br.com.swconsultoria.nfe.util.ManifestacaoUtil; +import br.com.swconsultoria.nfe.util.StubUtil; +import br.com.swconsultoria.nfe.wsdl.NFeRecepcaoEvento.NFeRecepcaoEvento4Stub; +import mockit.Mock; +import mockit.MockUp; +import org.apache.axiom.om.util.AXIOMUtil; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class ManifestacaoDestinatarioTest { + + private static final String RET_EVENTO_XML = + "" + + "12TESTE" + + "91128" + + "Lote de Evento Processado" + + ""; + + private ConfiguracoesNfe config; + private TEnvEvento enviEvento; + + @BeforeEach + void setUp() throws NfeException { + config = new ConfiguracoesNfe(); + config.setEstado(EstadosEnum.SP); + config.setAmbiente(AmbienteEnum.HOMOLOGACAO); + config.setEncode("UTF-8"); + + config.setZoneId(java.time.ZoneId.of("America/Sao_Paulo")); + + Evento evento = new Evento(); + evento.setChave("52230309158456000159550010000731791567812345"); + evento.setCnpj("09158456000159"); + evento.setProtocolo("352230000123456"); + evento.setTipoManifestacao(ManifestacaoEnum.CONFIRMACAO_DA_OPERACAO); + evento.setDataEvento(java.time.LocalDateTime.of(2024, 1, 15, 10, 0, 0)); + enviEvento = ManifestacaoUtil.montaManifestacao(evento, config); + } + + private void mockStubUtil() { + new MockUp() { + @Mock + public void configuraHttpClient(org.apache.axis2.client.Stub stub, + ConfiguracoesNfe cfg, String url) { } + }; + } + + private void mockAssinar() { + new MockUp() { + @Mock + public String assinaNfe(ConfiguracoesNfe cfg, String xml, + AssinaturaEnum tipo) throws NfeException { + return xml; + } + }; + } + + private void mockEventosStub() { + new MockUp() { + @Mock + public void $init(String endpoint) { } + + @Mock + public NFeRecepcaoEvento4Stub.NfeResultMsg nfeRecepcaoEvento( + NFeRecepcaoEvento4Stub.NfeDadosMsg data) throws Exception { + NFeRecepcaoEvento4Stub.NfeResultMsg result = new NFeRecepcaoEvento4Stub.NfeResultMsg(); + result.setExtraElement(AXIOMUtil.stringToOM(RET_EVENTO_XML)); + return result; + } + }; + } + + @Test + void eventoManifestacao_semValidacao_retornaEvento() throws NfeException { + mockStubUtil(); + mockAssinar(); + mockEventosStub(); + + TRetEnvEvento ret = ManifestacaoDestinatario.eventoManifestacao(config, enviEvento, false); + + assertNotNull(ret); + assertEquals("128", ret.getCStat()); + } + + @Test + void eventoManifestacao_retornaLoteProcessado() throws NfeException { + mockStubUtil(); + mockAssinar(); + mockEventosStub(); + + TRetEnvEvento ret = ManifestacaoDestinatario.eventoManifestacao(config, enviEvento, false); + + assertEquals("Lote de Evento Processado", ret.getXMotivo()); + } + + @Test + void eventoManifestacao_retornaAmbienteHomologacao() throws NfeException { + mockStubUtil(); + mockAssinar(); + mockEventosStub(); + + TRetEnvEvento ret = ManifestacaoDestinatario.eventoManifestacao(config, enviEvento, false); + + assertEquals("2", ret.getTpAmb()); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/NfeTest.java b/src/test/java/br/com/swconsultoria/nfe/NfeTest.java new file mode 100644 index 00000000..4169a0eb --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/NfeTest.java @@ -0,0 +1,98 @@ +package br.com.swconsultoria.nfe; + +import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe; +import br.com.swconsultoria.nfe.dom.enuns.DocumentoEnum; +import br.com.swconsultoria.nfe.dom.enuns.PessoaEnum; +import br.com.swconsultoria.nfe.exception.NfeException; +import org.junit.jupiter.api.Test; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Modifier; + +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Testes de Nfe — fachada principal da biblioteca. + * Verifica o contrato da API (construtor privado, rejeição de config nula). + * As chamadas de rede não são testadas aqui (requerem certificado + SEFAZ). + */ +class NfeTest { + + // ------------------------------------------------------------------------- + // Construtor privado + // ------------------------------------------------------------------------- + + @Test + void nfe_construtorEPrivado() throws Exception { + Constructor constructor = Nfe.class.getDeclaredConstructor(); + assertTrue(Modifier.isPrivate(constructor.getModifiers()), + "Nfe deve ter construtor privado para impedir instanciação"); + } + + // ------------------------------------------------------------------------- + // Rejeição de ConfiguracoesNfe nula (lança NfeException antes da chamada WS) + // ------------------------------------------------------------------------- + + @Test + void statusServico_configNula_lancaNfeException() { + assertThrows(NfeException.class, + () -> Nfe.statusServico(null, DocumentoEnum.NFE)); + } + + @Test + void consultaXml_configNula_lancaNfeException() { + assertThrows(NfeException.class, + () -> Nfe.consultaXml(null, "52230309158456000159550010000731791567812345", DocumentoEnum.NFE)); + } + + @Test + void consultaRecibo_configNula_lancaNfeException() { + assertThrows(NfeException.class, + () -> Nfe.consultaRecibo(null, "123456789012345", DocumentoEnum.NFE)); + } + + @Test + void distribuicaoDfe_configNula_lancaNfeException() { + assertThrows(NfeException.class, + () -> Nfe.distribuicaoDfe(null, PessoaEnum.JURIDICA, "09158456000159", + br.com.swconsultoria.nfe.dom.enuns.ConsultaDFeEnum.NSU, "000000000000001")); + } + + @Test + void inutilizacao_configNula_lancaNfeException() { + br.com.swconsultoria.nfe.schema_4.inutNFe.TInutNFe inutNFe = + new br.com.swconsultoria.nfe.schema_4.inutNFe.TInutNFe(); + br.com.swconsultoria.nfe.schema_4.inutNFe.TInutNFe.InfInut infInut = + new br.com.swconsultoria.nfe.schema_4.inutNFe.TInutNFe.InfInut(); + infInut.setCNPJ("09158456000159"); + inutNFe.setInfInut(infInut); + + assertThrows(NfeException.class, + () -> Nfe.inutilizacao(null, inutNFe, DocumentoEnum.NFE, false)); + } + + // ------------------------------------------------------------------------- + // Config sem certificado lança NfeException (getCertificado() retorna null) + // ------------------------------------------------------------------------- + + @Test + void statusServico_configSemCertificado_lancaNfeException() { + ConfiguracoesNfe config = new ConfiguracoesNfe(); + config.setEstado(br.com.swconsultoria.nfe.dom.enuns.EstadosEnum.GO); + config.setAmbiente(br.com.swconsultoria.nfe.dom.enuns.AmbienteEnum.HOMOLOGACAO); + + assertThrows(Exception.class, + () -> Nfe.statusServico(config, DocumentoEnum.NFE)); + } + + @Test + void consultaXml_configSemCertificado_lancaNfeException() { + ConfiguracoesNfe config = new ConfiguracoesNfe(); + config.setEstado(br.com.swconsultoria.nfe.dom.enuns.EstadosEnum.GO); + config.setAmbiente(br.com.swconsultoria.nfe.dom.enuns.AmbienteEnum.HOMOLOGACAO); + + assertThrows(Exception.class, + () -> Nfe.consultaXml(config, "52230309158456000159550010000731791567812345", DocumentoEnum.NFE)); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/StatusTest.java b/src/test/java/br/com/swconsultoria/nfe/StatusTest.java new file mode 100644 index 00000000..ed8071fe --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/StatusTest.java @@ -0,0 +1,93 @@ +package br.com.swconsultoria.nfe; + +import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe; +import br.com.swconsultoria.nfe.dom.enuns.AmbienteEnum; +import br.com.swconsultoria.nfe.dom.enuns.DocumentoEnum; +import br.com.swconsultoria.nfe.dom.enuns.EstadosEnum; +import br.com.swconsultoria.nfe.exception.NfeException; +import br.com.swconsultoria.nfe.schema_4.consStatServ.TRetConsStatServ; +import br.com.swconsultoria.nfe.util.StubUtil; +import br.com.swconsultoria.nfe.wsdl.NFeStatusServico4.NFeStatusServico4Stub; +import mockit.Mock; +import mockit.MockUp; +import org.apache.axiom.om.util.AXIOMUtil; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class StatusTest { + + private static final String RET_STATUS_XML = + "" + + "2107Servico em Operacao" + + "352024-01-01T10:00:00-03:001" + + ""; + + private ConfiguracoesNfe config; + + @BeforeEach + void setUp() { + config = new ConfiguracoesNfe(); + config.setEstado(EstadosEnum.SP); + config.setAmbiente(AmbienteEnum.HOMOLOGACAO); + config.setEncode("UTF-8"); + } + + private void mockStubUtil() { + new MockUp() { + @Mock + public void configuraHttpClient(org.apache.axis2.client.Stub stub, + ConfiguracoesNfe cfg, String url) { /* skip cert */ } + }; + } + + private void mockStatusStub() { + new MockUp() { + @Mock + public void $init(String endpoint) { /* skip Axis2 init */ } + + @Mock + public NFeStatusServico4Stub.NfeResultMsg nfeStatusServicoNF( + NFeStatusServico4Stub.NfeDadosMsg data) throws Exception { + NFeStatusServico4Stub.NfeResultMsg result = new NFeStatusServico4Stub.NfeResultMsg(); + result.setExtraElement(AXIOMUtil.stringToOM(RET_STATUS_XML)); + return result; + } + }; + } + + @Test + void statusServico_nfe_retornaEstadoOperacional() throws NfeException { + mockStubUtil(); + mockStatusStub(); + + TRetConsStatServ ret = Status.statusServico(config, DocumentoEnum.NFE); + + assertNotNull(ret); + assertEquals("107", ret.getCStat()); + assertEquals("Servico em Operacao", ret.getXMotivo()); + } + + @Test + void statusServico_nfce_retornaEstadoOperacional() throws NfeException { + mockStubUtil(); + mockStatusStub(); + + TRetConsStatServ ret = Status.statusServico(config, DocumentoEnum.NFCE); + + assertNotNull(ret); + assertEquals("107", ret.getCStat()); + } + + @Test + void statusServico_retornaAmbienteHomologacao() throws NfeException { + mockStubUtil(); + mockStatusStub(); + + TRetConsStatServ ret = Status.statusServico(config, DocumentoEnum.NFE); + + assertEquals("2", ret.getTpAmb()); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/ValidarTest.java b/src/test/java/br/com/swconsultoria/nfe/ValidarTest.java new file mode 100644 index 00000000..f1a05da8 --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/ValidarTest.java @@ -0,0 +1,175 @@ +package br.com.swconsultoria.nfe; + +import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe; +import br.com.swconsultoria.nfe.dom.enuns.ServicosEnum; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.xml.sax.SAXParseException; + +import java.io.File; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Testes unitários de Validar — validação de XML contra esquemas XSD locais. + * Nenhuma chamada de rede é realizada. + */ +class ValidarTest { + + /* ----------------------------------------------------------------------- + * Constantes + * --------------------------------------------------------------------- */ + private static final String SCHEMAS_PATH = "schemas"; + private static final String STATUS_XSD = + SCHEMAS_PATH + File.separator + "consStatServ_v4.00.xsd"; + + /** XML mínimo e válido para consStatServ (homologação, Goiás). */ + private static final String XML_STATUS_VALIDO = + "" + + "252STATUS"; + + /** XML inválido: campo obrigatório cUF ausente. */ + private static final String XML_STATUS_SEM_CUF = + "" + + "2STATUS"; + + /** XML malformado (tag não fechada). */ + private static final String XML_MALFORMADO = "2"; + + /** XML completamente vazio. */ + private static final String XML_VAZIO = ""; + + private Validar validar; + + @BeforeEach + void setUp() { + validar = new Validar(); + } + + // ------------------------------------------------------------------------- + // isValidXml(String xsd, String xml) + // ------------------------------------------------------------------------- + + @Test + void isValidXml_xsdInexistente_retornaFalso() { + assertFalse(validar.isValidXml("/caminho/nao/existe.xsd", XML_STATUS_VALIDO)); + } + + @Test + void isValidXml_xmlValidoComXsdReal_retornaVerdadeiro() { + assertTrue(validar.isValidXml(STATUS_XSD, XML_STATUS_VALIDO)); + } + + @Test + void isValidXml_xmlInvalidoSemCampoObrigatorio_retornaFalso() { + assertFalse(validar.isValidXml(STATUS_XSD, XML_STATUS_SEM_CUF)); + } + + @Test + void isValidXml_xmlMalformado_retornaFalso() { + assertFalse(validar.isValidXml(STATUS_XSD, XML_MALFORMADO)); + } + + @Test + void isValidXml_xmlVazio_retornaFalso() { + assertFalse(validar.isValidXml(STATUS_XSD, XML_VAZIO)); + } + + // ------------------------------------------------------------------------- + // isValidXml(String pastaSchemas, String xml, ServicosEnum servico) + // ------------------------------------------------------------------------- + + @Test + void isValidXml_comPastaEServico_xmlValido_retornaVerdadeiro() { + assertTrue(validar.isValidXml(SCHEMAS_PATH, XML_STATUS_VALIDO, ServicosEnum.STATUS_SERVICO)); + } + + @Test + void isValidXml_comPastaEServico_xmlInvalido_retornaFalso() { + assertFalse(validar.isValidXml(SCHEMAS_PATH, XML_STATUS_SEM_CUF, ServicosEnum.STATUS_SERVICO)); + } + + @Test + void isValidXml_comPastaInexistente_retornaFalso() { + assertFalse(validar.isValidXml("/pasta/invalida", XML_STATUS_VALIDO, ServicosEnum.STATUS_SERVICO)); + } + + // ------------------------------------------------------------------------- + // isValidXml(ConfiguracoesNfe config, String xml, ServicosEnum servico) + // ------------------------------------------------------------------------- + + @Test + void isValidXml_comConfigSemPastaSchemas_retornaFalso() { + ConfiguracoesNfe config = new ConfiguracoesNfe(); // pastaSchemas == null + assertFalse(validar.isValidXml(config, XML_STATUS_VALIDO, ServicosEnum.STATUS_SERVICO)); + } + + @Test + void isValidXml_comConfigComPastaValida_xmlValido_retornaVerdadeiro() throws Exception { + ConfiguracoesNfe config = new ConfiguracoesNfe(); + // Injetar pastaSchemas via reflexão (setter é privado) + java.lang.reflect.Field campo = ConfiguracoesNfe.class.getDeclaredField("pastaSchemas"); + campo.setAccessible(true); + campo.set(config, SCHEMAS_PATH); + + assertTrue(validar.isValidXml(config, XML_STATUS_VALIDO, ServicosEnum.STATUS_SERVICO)); + } + + @Test + void isValidXml_comConfigComPastaValida_xmlInvalido_retornaFalso() throws Exception { + ConfiguracoesNfe config = new ConfiguracoesNfe(); + java.lang.reflect.Field campo = ConfiguracoesNfe.class.getDeclaredField("pastaSchemas"); + campo.setAccessible(true); + campo.set(config, SCHEMAS_PATH); + + assertFalse(validar.isValidXml(config, XML_STATUS_SEM_CUF, ServicosEnum.STATUS_SERVICO)); + } + + // ------------------------------------------------------------------------- + // ErrorHandler — error(), fatalError(), warning() + // ------------------------------------------------------------------------- + + @Test + void error_comMensagemContada_naoLancaExcecao() { + // "cvc-type.3.1.3:" é contado como erro (não está nos filtros de isError) + assertDoesNotThrow(() -> + validar.error(new SAXParseException("cvc-type.3.1.3: campo inválido", null))); + } + + @Test + void error_comMensagemIgnorada_enumeracao_naoLancaExcecao() { + // "cvc-enumeration-valid:" é filtrado pelo isError() e não conta como erro + assertDoesNotThrow(() -> + validar.error(new SAXParseException("cvc-enumeration-valid: valor invalido", null))); + } + + @Test + void error_comMensagemIgnorada_pattern_naoLancaExcecao() { + assertDoesNotThrow(() -> + validar.error(new SAXParseException("cvc-pattern-valid: padrao invalido", null))); + } + + @Test + void error_comMensagemIgnorada_maxLength_naoLancaExcecao() { + assertDoesNotThrow(() -> + validar.error(new SAXParseException("cvc-maxLength-valid: tamanho excedido", null))); + } + + @Test + void error_comMensagemIgnorada_datatype_naoLancaExcecao() { + assertDoesNotThrow(() -> + validar.error(new SAXParseException("cvc-datatype-valid: tipo invalido", null))); + } + + @Test + void fatalError_naoLancaExcecao() { + assertDoesNotThrow(() -> + validar.fatalError(new SAXParseException("erro fatal de parse", null))); + } + + @Test + void warning_naoLancaExcecao() { + assertDoesNotThrow(() -> + validar.warning(new SAXParseException("aviso de validacao", null))); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/exemplos/EventoGenericoTeste.java b/src/test/java/br/com/swconsultoria/nfe/exemplos/EventoGenericoTeste.java index b269bb34..eb2877eb 100644 --- a/src/test/java/br/com/swconsultoria/nfe/exemplos/EventoGenericoTeste.java +++ b/src/test/java/br/com/swconsultoria/nfe/exemplos/EventoGenericoTeste.java @@ -44,7 +44,7 @@ public static void main(String[] args) { detEvento.setDescEvento("Informação de efetivo pagamento integral para liberar crédito presumido do adquirente"); detEvento.setCOrgaoAutor(config.getEstado().getCodigoUF()); detEvento.setTpAutor("1"); - detEvento.setVerAplic("v4.00.49"); + detEvento.setVerAplic("v4.00.51"); detEvento.setIndQuitacao("1"); generico.setDetEvento(detEvento); diff --git a/src/test/java/br/com/swconsultoria/nfe/exemplos/IbsCbsTeste.java b/src/test/java/br/com/swconsultoria/nfe/exemplos/IbsCbsTest.java similarity index 89% rename from src/test/java/br/com/swconsultoria/nfe/exemplos/IbsCbsTeste.java rename to src/test/java/br/com/swconsultoria/nfe/exemplos/IbsCbsTest.java index aa8c021d..41db4832 100644 --- a/src/test/java/br/com/swconsultoria/nfe/exemplos/IbsCbsTeste.java +++ b/src/test/java/br/com/swconsultoria/nfe/exemplos/IbsCbsTest.java @@ -1,5 +1,7 @@ package br.com.swconsultoria.nfe.exemplos; +import br.com.swconsultoria.certificado.Certificado; +import br.com.swconsultoria.certificado.CertificadoService; import br.com.swconsultoria.nfe.Nfe; import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe; import br.com.swconsultoria.nfe.dom.enuns.AmbienteEnum; @@ -19,13 +21,16 @@ import javax.xml.namespace.QName; import java.io.IOException; import java.math.BigDecimal; +import java.net.URI; +import java.nio.file.Paths; +import java.util.Objects; import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author Samuel Oliveira */ -class IbsCbsTeste { +class IbsCbsTest { @Test void testeIbsCbs() throws Exception { @@ -125,7 +130,7 @@ private static TEnviNFe addTotaisIbsCbs(IbsCbsUtil ibsCbsUtil, TEnviNFe enviNFe, TIBSCBSMonoTot totaisIbsCsb = ibsCbsUtil.preencheTotaisIbsCsb(); enviNFe.getNFe().get(0).getInfNFe().getTotal().setIBSCBSTot(totaisIbsCsb); - return Nfe.montaNfe(config, enviNFe, true); + return Nfe.montaNfe(config, enviNFe, false); } private static String getIbsCbsJson() throws IOException { @@ -138,7 +143,11 @@ private static TEnviNFe getEnviNFe() throws IOException { } private static ConfiguracoesNfe getConfiguracoesNfe() throws Exception { - return ConfiguracaoTeste.iniciaConfiguracoes(EstadosEnum.GO, AmbienteEnum.HOMOLOGACAO); + URI uri = Objects.requireNonNull(IbsCbsTest.class.getClassLoader() + .getResource("NAO_UTILIZE.pfx")) + .toURI(); + Certificado certificado = CertificadoService.certificadoPfx(Paths.get(uri).toString(), "123456"); + return ConfiguracoesNfe.criarConfiguracoes(EstadosEnum.GO, AmbienteEnum.HOMOLOGACAO, certificado, null); } } diff --git a/src/test/java/br/com/swconsultoria/nfe/util/CancelamentoSubstituicaoUtilTest.java b/src/test/java/br/com/swconsultoria/nfe/util/CancelamentoSubstituicaoUtilTest.java new file mode 100644 index 00000000..4d79699b --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/util/CancelamentoSubstituicaoUtilTest.java @@ -0,0 +1,118 @@ +package br.com.swconsultoria.nfe.util; + +import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe; +import br.com.swconsultoria.nfe.dom.Evento; +import br.com.swconsultoria.nfe.dom.enuns.AmbienteEnum; +import br.com.swconsultoria.nfe.dom.enuns.EstadosEnum; +import br.com.swconsultoria.nfe.dom.enuns.EventosEnum; +import br.com.swconsultoria.nfe.exception.NfeException; +import br.com.swconsultoria.nfe.schema.envEventoCancSubst.TEnvEvento; +import br.com.swconsultoria.nfe.schema.envEventoCancSubst.TEvento; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; + +class CancelamentoSubstituicaoUtilTest { + + private static final String CHAVE = "52230309158456000159550010000731791567812345"; + private static final String CHAVE_SUBST = "52230309158456000159550010000731801234567890"; + private static final String CNPJ = "09158456000159"; + private static final String PROTOCOLO = "352230000123456"; + private static final String MOTIVO = "Cancelamento por substituicao de NF-e"; + + private ConfiguracoesNfe config; + + @BeforeEach + void setUp() { + config = new ConfiguracoesNfe(); + config.setEstado(EstadosEnum.GO); + config.setAmbiente(AmbienteEnum.HOMOLOGACAO); + config.setZoneId(ZoneId.of("America/Sao_Paulo")); + } + + private Evento novoEvento() { + Evento e = new Evento(); + e.setChave(CHAVE); + e.setCnpj(CNPJ); + e.setProtocolo(PROTOCOLO); + e.setMotivo(MOTIVO); + e.setChaveSusbstituta(CHAVE_SUBST); + e.setDataEvento(LocalDateTime.of(2024, 1, 20, 11, 0, 0)); + return e; + } + + @Test + void montaCancelamento_retornaTEnvEvento() throws NfeException { + TEnvEvento resultado = CancelamentoSubstituicaoUtil.montaCancelamento(novoEvento(), config); + assertNotNull(resultado); + assertEquals(1, resultado.getEvento().size()); + } + + @Test + void montaCancelamento_tpEvento_ehCancelamentoSubstituicao() throws NfeException { + TEnvEvento resultado = CancelamentoSubstituicaoUtil.montaCancelamento(novoEvento(), config); + TEvento.InfEvento info = resultado.getEvento().get(0).getInfEvento(); + assertEquals(EventosEnum.CANCELAMENTO_SUBSTITUICAO.getCodigo(), info.getTpEvento()); + } + + @Test + void montaCancelamento_idComecaComID() throws NfeException { + TEnvEvento resultado = CancelamentoSubstituicaoUtil.montaCancelamento(novoEvento(), config); + assertTrue(resultado.getEvento().get(0).getInfEvento().getId().startsWith("ID")); + } + + @Test + void montaCancelamento_chaveNFe_preenchida() throws NfeException { + TEnvEvento resultado = CancelamentoSubstituicaoUtil.montaCancelamento(novoEvento(), config); + assertEquals(CHAVE, resultado.getEvento().get(0).getInfEvento().getChNFe()); + } + + @Test + void montaCancelamento_chaveSubstituta_preenchida() throws NfeException { + TEnvEvento resultado = CancelamentoSubstituicaoUtil.montaCancelamento(novoEvento(), config); + assertEquals(CHAVE_SUBST, resultado.getEvento().get(0).getInfEvento().getDetEvento().getChNFeRef()); + } + + @Test + void montaCancelamento_protocolo_preenchido() throws NfeException { + TEnvEvento resultado = CancelamentoSubstituicaoUtil.montaCancelamento(novoEvento(), config); + assertEquals(PROTOCOLO, resultado.getEvento().get(0).getInfEvento().getDetEvento().getNProt()); + } + + @Test + void montaCancelamento_justificativa_preenchida() throws NfeException { + TEnvEvento resultado = CancelamentoSubstituicaoUtil.montaCancelamento(novoEvento(), config); + assertEquals(MOTIVO, resultado.getEvento().get(0).getInfEvento().getDetEvento().getXJust()); + } + + @Test + void montaCancelamento_descEvento_cancelamentoPorSubstituicao() throws NfeException { + TEnvEvento resultado = CancelamentoSubstituicaoUtil.montaCancelamento(novoEvento(), config); + assertEquals("Cancelamento por substituicao", + resultado.getEvento().get(0).getInfEvento().getDetEvento().getDescEvento()); + } + + @Test + void montaCancelamento_lote_retornaMultiplosEventos() throws NfeException { + List lista = new ArrayList<>(); + lista.add(novoEvento()); + lista.add(novoEvento()); + + TEnvEvento resultado = CancelamentoSubstituicaoUtil.montaCancelamento(lista, config); + assertEquals(2, resultado.getEvento().size()); + } + + @Test + void montaCancelamento_loteAcimaDe20_lancaExcecao() { + List lista = new ArrayList<>(); + for (int i = 0; i < 21; i++) lista.add(novoEvento()); + + assertThrows(NfeException.class, () -> CancelamentoSubstituicaoUtil.montaCancelamento(lista, config)); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/util/CancelamentoUtilTest.java b/src/test/java/br/com/swconsultoria/nfe/util/CancelamentoUtilTest.java new file mode 100644 index 00000000..fc19c635 --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/util/CancelamentoUtilTest.java @@ -0,0 +1,111 @@ +package br.com.swconsultoria.nfe.util; + +import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe; +import br.com.swconsultoria.nfe.dom.Evento; +import br.com.swconsultoria.nfe.dom.enuns.AmbienteEnum; +import br.com.swconsultoria.nfe.dom.enuns.EstadosEnum; +import br.com.swconsultoria.nfe.dom.enuns.EventosEnum; +import br.com.swconsultoria.nfe.exception.NfeException; +import br.com.swconsultoria.nfe.schema.envEventoCancNFe.TEnvEvento; +import br.com.swconsultoria.nfe.schema.envEventoCancNFe.TEvento; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; + +class CancelamentoUtilTest { + + private static final String CHAVE = "52230309158456000159550010000731791567812345"; + private static final String CNPJ = "09158456000159"; + private static final String PROTOCOLO = "352230000123456"; + private static final String MOTIVO = "Cancelamento por erro na emissao"; + + private ConfiguracoesNfe config; + + @BeforeEach + void setUp() { + config = new ConfiguracoesNfe(); + config.setEstado(EstadosEnum.GO); + config.setAmbiente(AmbienteEnum.HOMOLOGACAO); + config.setZoneId(ZoneId.of("America/Sao_Paulo")); + } + + private Evento novoEvento() { + Evento e = new Evento(); + e.setChave(CHAVE); + e.setCnpj(CNPJ); + e.setProtocolo(PROTOCOLO); + e.setMotivo(MOTIVO); + e.setDataEvento(LocalDateTime.of(2024, 1, 15, 10, 0, 0)); + return e; + } + + @Test + void montaCancelamento_unico_retornaTEnvEvento() throws NfeException { + TEnvEvento resultado = CancelamentoUtil.montaCancelamento(novoEvento(), config); + assertNotNull(resultado); + assertEquals(1, resultado.getEvento().size()); + } + + @Test + void montaCancelamento_tpEvento_ehCancelamento() throws NfeException { + TEnvEvento resultado = CancelamentoUtil.montaCancelamento(novoEvento(), config); + TEvento.InfEvento info = resultado.getEvento().get(0).getInfEvento(); + assertEquals(EventosEnum.CANCELAMENTO.getCodigo(), info.getTpEvento()); + } + + @Test + void montaCancelamento_chaveNFe_preenchida() throws NfeException { + TEnvEvento resultado = CancelamentoUtil.montaCancelamento(novoEvento(), config); + assertEquals(CHAVE, resultado.getEvento().get(0).getInfEvento().getChNFe()); + } + + @Test + void montaCancelamento_idComecaComID() throws NfeException { + TEnvEvento resultado = CancelamentoUtil.montaCancelamento(novoEvento(), config); + String id = resultado.getEvento().get(0).getInfEvento().getId(); + assertTrue(id.startsWith("ID")); + } + + @Test + void montaCancelamento_protocolo_preenchido() throws NfeException { + TEnvEvento resultado = CancelamentoUtil.montaCancelamento(novoEvento(), config); + assertEquals(PROTOCOLO, resultado.getEvento().get(0).getInfEvento().getDetEvento().getNProt()); + } + + @Test + void montaCancelamento_justificativa_preenchida() throws NfeException { + TEnvEvento resultado = CancelamentoUtil.montaCancelamento(novoEvento(), config); + assertEquals(MOTIVO, resultado.getEvento().get(0).getInfEvento().getDetEvento().getXJust()); + } + + @Test + void montaCancelamento_lote_retornaMultiplosEventos() throws NfeException { + List lista = new ArrayList<>(); + lista.add(novoEvento()); + lista.add(novoEvento()); + + TEnvEvento resultado = CancelamentoUtil.montaCancelamento(lista, config); + assertEquals(2, resultado.getEvento().size()); + } + + @Test + void montaCancelamento_loteAcimaDe20_lancaExcecao() { + List lista = new ArrayList<>(); + for (int i = 0; i < 21; i++) lista.add(novoEvento()); + + assertThrows(NfeException.class, () -> CancelamentoUtil.montaCancelamento(lista, config)); + } + + @Test + void montaCancelamento_ambienteHomologacao_preenchido() throws NfeException { + TEnvEvento resultado = CancelamentoUtil.montaCancelamento(novoEvento(), config); + assertEquals(AmbienteEnum.HOMOLOGACAO.getCodigo(), + resultado.getEvento().get(0).getInfEvento().getTpAmb()); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/util/CartaCorrecaoUtilTest.java b/src/test/java/br/com/swconsultoria/nfe/util/CartaCorrecaoUtilTest.java new file mode 100644 index 00000000..6bdc32f9 --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/util/CartaCorrecaoUtilTest.java @@ -0,0 +1,103 @@ +package br.com.swconsultoria.nfe.util; + +import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe; +import br.com.swconsultoria.nfe.dom.Evento; +import br.com.swconsultoria.nfe.dom.enuns.AmbienteEnum; +import br.com.swconsultoria.nfe.dom.enuns.EstadosEnum; +import br.com.swconsultoria.nfe.dom.enuns.EventosEnum; +import br.com.swconsultoria.nfe.exception.NfeException; +import br.com.swconsultoria.nfe.schema.envcce.TEnvEvento; +import br.com.swconsultoria.nfe.schema.envcce.TEvento; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; + +class CartaCorrecaoUtilTest { + + private static final String CHAVE = "52230309158456000159550010000731791567812345"; + private static final String CNPJ = "09158456000159"; + private static final String CORRECAO = "Correcao no campo de endereco do destinatario"; + + private ConfiguracoesNfe config; + + @BeforeEach + void setUp() { + config = new ConfiguracoesNfe(); + config.setEstado(EstadosEnum.GO); + config.setAmbiente(AmbienteEnum.HOMOLOGACAO); + config.setZoneId(ZoneId.of("America/Sao_Paulo")); + } + + private Evento novoCCe() { + Evento e = new Evento(); + e.setChave(CHAVE); + e.setCnpj(CNPJ); + e.setMotivo(CORRECAO); + e.setSequencia(1); + e.setDataEvento(LocalDateTime.of(2024, 3, 10, 9, 0, 0)); + return e; + } + + @Test + void montaCCe_unico_retornaTEnvEvento() throws NfeException { + TEnvEvento resultado = CartaCorrecaoUtil.montaCCe(novoCCe(), config); + assertNotNull(resultado); + assertEquals(1, resultado.getEvento().size()); + } + + @Test + void montaCCe_tpEvento_ehCCe() throws NfeException { + TEnvEvento resultado = CartaCorrecaoUtil.montaCCe(novoCCe(), config); + TEvento.InfEvento info = resultado.getEvento().get(0).getInfEvento(); + assertEquals(EventosEnum.CCE.getCodigo(), info.getTpEvento()); + } + + @Test + void montaCCe_chaveNFe_preenchida() throws NfeException { + TEnvEvento resultado = CartaCorrecaoUtil.montaCCe(novoCCe(), config); + assertEquals(CHAVE, resultado.getEvento().get(0).getInfEvento().getChNFe()); + } + + @Test + void montaCCe_correcao_preenchida() throws NfeException { + TEnvEvento resultado = CartaCorrecaoUtil.montaCCe(novoCCe(), config); + assertEquals(CORRECAO, resultado.getEvento().get(0).getInfEvento().getDetEvento().getXCorrecao()); + } + + @Test + void montaCCe_descEvento_cartaDeCorrecao() throws NfeException { + TEnvEvento resultado = CartaCorrecaoUtil.montaCCe(novoCCe(), config); + assertEquals("Carta de Correcao", + resultado.getEvento().get(0).getInfEvento().getDetEvento().getDescEvento()); + } + + @Test + void montaCCe_lote_retornaMultiplosEventos() throws NfeException { + List lista = new ArrayList<>(); + lista.add(novoCCe()); + lista.add(novoCCe()); + + TEnvEvento resultado = CartaCorrecaoUtil.montaCCe(lista, config); + assertEquals(2, resultado.getEvento().size()); + } + + @Test + void montaCCe_loteAcimaDe20_lancaExcecao() { + List lista = new ArrayList<>(); + for (int i = 0; i < 21; i++) lista.add(novoCCe()); + + assertThrows(NfeException.class, () -> CartaCorrecaoUtil.montaCCe(lista, config)); + } + + @Test + void montaCCe_idComecaComID() throws NfeException { + TEnvEvento resultado = CartaCorrecaoUtil.montaCCe(novoCCe(), config); + assertTrue(resultado.getEvento().get(0).getInfEvento().getId().startsWith("ID")); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/util/ChaveUtilTest.java b/src/test/java/br/com/swconsultoria/nfe/util/ChaveUtilTest.java new file mode 100644 index 00000000..b4149170 --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/util/ChaveUtilTest.java @@ -0,0 +1,100 @@ +package br.com.swconsultoria.nfe.util; + +import br.com.swconsultoria.nfe.dom.enuns.EstadosEnum; +import org.junit.jupiter.api.Test; + +import java.time.LocalDateTime; + +import static org.junit.jupiter.api.Assertions.*; + +class ChaveUtilTest { + + private static final String CNPJ = "10732644000128"; + private static final String MODELO_NFE = "55"; + private static final String TIPO_EMISSAO = "1"; + private static final LocalDateTime DATA_EMISSAO = LocalDateTime.of(2024, 3, 15, 10, 30, 0); + + // ------------------------------------------------------------------------- + // completarComZerosAEsquerda + // ------------------------------------------------------------------------- + + @Test + void completarComZerosAEsquerda_stringMenorQueAlvo_adicionaZeros() { + assertEquals("00042", ChaveUtil.completarComZerosAEsquerda("42", 5)); + } + + @Test + void completarComZerosAEsquerda_stringExataAoTamanho_naoAltera() { + assertEquals("12345", ChaveUtil.completarComZerosAEsquerda("12345", 5)); + } + + @Test + void completarComZerosAEsquerda_stringMaiorQueAlvo_naoAltera() { + assertEquals("123456", ChaveUtil.completarComZerosAEsquerda("123456", 3)); + } + + @Test + void completarComZerosAEsquerda_stringVazia_retornaSoZeros() { + assertEquals("000", ChaveUtil.completarComZerosAEsquerda("", 3)); + } + + @Test + void completarComZerosAEsquerda_tamanhoUm_retornaUmDigito() { + assertEquals("5", ChaveUtil.completarComZerosAEsquerda("5", 1)); + } + + // ------------------------------------------------------------------------- + // getChaveNF + // ------------------------------------------------------------------------- + + @Test + void getChaveNF_retornaChaveComPrefixoNFe() { + ChaveUtil chave = new ChaveUtil(EstadosEnum.GO, CNPJ, MODELO_NFE, 1, 1, TIPO_EMISSAO, "12345678", DATA_EMISSAO); + assertTrue(chave.getChaveNF().startsWith("NFe")); + } + + @Test + void getChaveNF_retornaTamanhoCorreto() { + // "NFe" (3) + 43 dígitos da chave + 1 dígito verificador = 47 chars + ChaveUtil chave = new ChaveUtil(EstadosEnum.SP, CNPJ, MODELO_NFE, 1, 92756, TIPO_EMISSAO, "12345678", DATA_EMISSAO); + assertEquals(47, chave.getChaveNF().length()); + } + + @Test + void getChaveNF_conteudoNaoNulo() { + ChaveUtil chave = new ChaveUtil(EstadosEnum.MG, CNPJ, MODELO_NFE, 1, 1, TIPO_EMISSAO, "00000001", DATA_EMISSAO); + assertNotNull(chave.getChaveNF()); + } + + // ------------------------------------------------------------------------- + // getDigitoVerificador + // ------------------------------------------------------------------------- + + @Test + void getDigitoVerificador_retornaUmDigito() { + ChaveUtil chave = new ChaveUtil(EstadosEnum.GO, CNPJ, MODELO_NFE, 1, 1, TIPO_EMISSAO, "12345678", DATA_EMISSAO); + assertEquals(1, chave.getDigitoVerificador().length()); + } + + @Test + void getDigitoVerificador_consistenteComChave() { + ChaveUtil chave = new ChaveUtil(EstadosEnum.GO, CNPJ, MODELO_NFE, 1, 1, TIPO_EMISSAO, "12345678", DATA_EMISSAO); + String chaveCompleta = chave.getChaveNF(); // "NFe" + 43 dígitos + dv + String dvDaChave = chaveCompleta.substring(chaveCompleta.length() - 1); + assertEquals(dvDaChave, chave.getDigitoVerificador()); + } + + @Test + void getDigitoVerificador_diferentes_numerosNfe_geramChavesDiferentes() { + ChaveUtil chave1 = new ChaveUtil(EstadosEnum.GO, CNPJ, MODELO_NFE, 1, 100, TIPO_EMISSAO, "12345678", DATA_EMISSAO); + ChaveUtil chave2 = new ChaveUtil(EstadosEnum.GO, CNPJ, MODELO_NFE, 1, 200, TIPO_EMISSAO, "12345678", DATA_EMISSAO); + assertNotEquals(chave1.getChaveNF(), chave2.getChaveNF()); + } + + @Test + void getDigitoVerificador_diferentesEstados_geramChavesDiferentes() { + ChaveUtil chaveGO = new ChaveUtil(EstadosEnum.GO, CNPJ, MODELO_NFE, 1, 1, TIPO_EMISSAO, "12345678", DATA_EMISSAO); + ChaveUtil chaveSP = new ChaveUtil(EstadosEnum.SP, CNPJ, MODELO_NFE, 1, 1, TIPO_EMISSAO, "12345678", DATA_EMISSAO); + assertNotEquals(chaveGO.getChaveNF(), chaveSP.getChaveNF()); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/util/EpecUtilTest.java b/src/test/java/br/com/swconsultoria/nfe/util/EpecUtilTest.java new file mode 100644 index 00000000..5fe7fe21 --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/util/EpecUtilTest.java @@ -0,0 +1,111 @@ +package br.com.swconsultoria.nfe.util; + +import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe; +import br.com.swconsultoria.nfe.dom.Evento; +import br.com.swconsultoria.nfe.dom.EventoEpec; +import br.com.swconsultoria.nfe.dom.enuns.AmbienteEnum; +import br.com.swconsultoria.nfe.dom.enuns.EstadosEnum; +import br.com.swconsultoria.nfe.dom.enuns.EventosEnum; +import br.com.swconsultoria.nfe.exception.NfeException; +import br.com.swconsultoria.nfe.schema.envEpec.TEnvEvento; +import br.com.swconsultoria.nfe.schema.envEpec.TEvento; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; + +class EpecUtilTest { + + private static final String CHAVE = "52230309158456000159550010000731791567812345"; + private static final String CNPJ = "09158456000159"; + + private ConfiguracoesNfe config; + + @BeforeEach + void setUp() { + config = new ConfiguracoesNfe(); + config.setEstado(EstadosEnum.GO); + config.setAmbiente(AmbienteEnum.HOMOLOGACAO); + config.setZoneId(ZoneId.of("America/Sao_Paulo")); + } + + private Evento novoEpec() { + EventoEpec epecDetalhe = new EventoEpec(); + epecDetalhe.setTipoNF("1"); + epecDetalhe.setIeEmitente("104282215"); + epecDetalhe.setEstadoDestinatario(EstadosEnum.SP); + epecDetalhe.setCnpjDestinatario("08944957000360"); + epecDetalhe.setvNF("1000.00"); + epecDetalhe.setvICMS("0.00"); + epecDetalhe.setvST("0.00"); + + Evento e = new Evento(); + e.setChave(CHAVE); + e.setCnpj(CNPJ); + e.setDataEvento(LocalDateTime.of(2024, 2, 28, 15, 30, 0)); + e.setEventoEpec(epecDetalhe); + return e; + } + + @Test + void montaEpec_unico_retornaTEnvEvento() throws NfeException { + TEnvEvento resultado = EpecUtil.montaEpec(novoEpec(), config); + assertNotNull(resultado); + assertEquals(1, resultado.getEvento().size()); + } + + @Test + void montaEpec_tpEvento_ehEpec() throws NfeException { + TEnvEvento resultado = EpecUtil.montaEpec(novoEpec(), config); + TEvento.InfEvento info = resultado.getEvento().get(0).getInfEvento(); + assertEquals(EventosEnum.EPEC.getCodigo(), info.getTpEvento()); + } + + @Test + void montaEpec_chaveNFe_preenchida() throws NfeException { + TEnvEvento resultado = EpecUtil.montaEpec(novoEpec(), config); + assertEquals(CHAVE, resultado.getEvento().get(0).getInfEvento().getChNFe()); + } + + @Test + void montaEpec_idComecaComID() throws NfeException { + TEnvEvento resultado = EpecUtil.montaEpec(novoEpec(), config); + assertTrue(resultado.getEvento().get(0).getInfEvento().getId().startsWith("ID")); + } + + @Test + void montaEpec_descEvento_epec() throws NfeException { + TEnvEvento resultado = EpecUtil.montaEpec(novoEpec(), config); + assertEquals("EPEC", resultado.getEvento().get(0).getInfEvento().getDetEvento().getDescEvento()); + } + + @Test + void montaEpec_lote_retornaMultiplosEventos() throws NfeException { + List lista = new ArrayList<>(); + lista.add(novoEpec()); + lista.add(novoEpec()); + + TEnvEvento resultado = EpecUtil.montaEpec(lista, config); + assertEquals(2, resultado.getEvento().size()); + } + + @Test + void montaEpec_loteAcimaDe20_lancaExcecao() { + List lista = new ArrayList<>(); + for (int i = 0; i < 21; i++) lista.add(novoEpec()); + + assertThrows(NfeException.class, () -> EpecUtil.montaEpec(lista, config)); + } + + @Test + void montaEpec_ambiente_preenchido() throws NfeException { + TEnvEvento resultado = EpecUtil.montaEpec(novoEpec(), config); + assertEquals(AmbienteEnum.HOMOLOGACAO.getCodigo(), + resultado.getEvento().get(0).getInfEvento().getTpAmb()); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/util/InutilizacaoUtilTest.java b/src/test/java/br/com/swconsultoria/nfe/util/InutilizacaoUtilTest.java new file mode 100644 index 00000000..7a1ac238 --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/util/InutilizacaoUtilTest.java @@ -0,0 +1,100 @@ +package br.com.swconsultoria.nfe.util; + +import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe; +import br.com.swconsultoria.nfe.dom.enuns.AmbienteEnum; +import br.com.swconsultoria.nfe.dom.enuns.DocumentoEnum; +import br.com.swconsultoria.nfe.dom.enuns.EstadosEnum; +import br.com.swconsultoria.nfe.schema_4.inutNFe.TInutNFe; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.time.LocalDateTime; +import java.time.ZoneId; + +import static org.junit.jupiter.api.Assertions.*; + +class InutilizacaoUtilTest { + + private static final String CNPJ = "09158456000159"; + private static final String JUSTIFICATIVA = "Numero de NF-e inutilizado por falha de sistema"; + + private ConfiguracoesNfe config; + private final LocalDateTime dataInut = LocalDateTime.of(2024, 5, 20, 8, 0, 0); + + @BeforeEach + void setUp() { + config = new ConfiguracoesNfe(); + config.setEstado(EstadosEnum.GO); + config.setAmbiente(AmbienteEnum.HOMOLOGACAO); + config.setZoneId(ZoneId.of("America/Sao_Paulo")); + } + + @Test + void montaInutilizacao_retornaTInutNFe() { + TInutNFe resultado = InutilizacaoUtil.montaInutilizacao( + DocumentoEnum.NFE, CNPJ, 1, 100, 110, JUSTIFICATIVA, dataInut, config); + + assertNotNull(resultado); + assertNotNull(resultado.getInfInut()); + } + + @Test + void montaInutilizacao_id_comecaComID() { + TInutNFe resultado = InutilizacaoUtil.montaInutilizacao( + DocumentoEnum.NFE, CNPJ, 1, 100, 110, JUSTIFICATIVA, dataInut, config); + + assertTrue(resultado.getInfInut().getId().startsWith("ID")); + } + + @Test + void montaInutilizacao_serieFormatada3digitos() { + TInutNFe resultado = InutilizacaoUtil.montaInutilizacao( + DocumentoEnum.NFE, CNPJ, 5, 1, 1, JUSTIFICATIVA, dataInut, config); + + // ID contains zero-padded serie + String id = resultado.getInfInut().getId(); + assertTrue(id.contains("005"), "ID deve conter serie com 3 digitos: " + id); + } + + @Test + void montaInutilizacao_numeroFormatado9digitos() { + TInutNFe resultado = InutilizacaoUtil.montaInutilizacao( + DocumentoEnum.NFE, CNPJ, 1, 42, 50, JUSTIFICATIVA, dataInut, config); + + String id = resultado.getInfInut().getId(); + assertTrue(id.contains("000000042"), "ID deve conter nNFIni com 9 digitos: " + id); + assertTrue(id.contains("000000050"), "ID deve conter nNFFin com 9 digitos: " + id); + } + + @Test + void montaInutilizacao_justificativa_preenchida() { + TInutNFe resultado = InutilizacaoUtil.montaInutilizacao( + DocumentoEnum.NFE, CNPJ, 1, 1, 1, JUSTIFICATIVA, dataInut, config); + + assertEquals(JUSTIFICATIVA, resultado.getInfInut().getXJust()); + } + + @Test + void montaInutilizacao_cnpj_preenchido() { + TInutNFe resultado = InutilizacaoUtil.montaInutilizacao( + DocumentoEnum.NFE, CNPJ, 1, 1, 1, JUSTIFICATIVA, dataInut, config); + + assertEquals(CNPJ, resultado.getInfInut().getCNPJ()); + } + + @Test + void montaInutilizacao_xServ_inutilizar() { + TInutNFe resultado = InutilizacaoUtil.montaInutilizacao( + DocumentoEnum.NFE, CNPJ, 1, 1, 1, JUSTIFICATIVA, dataInut, config); + + assertEquals("INUTILIZAR", resultado.getInfInut().getXServ()); + } + + @Test + void montaInutilizacao_ambiente_homologacao() { + TInutNFe resultado = InutilizacaoUtil.montaInutilizacao( + DocumentoEnum.NFE, CNPJ, 1, 1, 1, JUSTIFICATIVA, dataInut, config); + + assertEquals(AmbienteEnum.HOMOLOGACAO.getCodigo(), resultado.getInfInut().getTpAmb()); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/util/ManifestacaoUtilTest.java b/src/test/java/br/com/swconsultoria/nfe/util/ManifestacaoUtilTest.java new file mode 100644 index 00000000..5a3a539a --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/util/ManifestacaoUtilTest.java @@ -0,0 +1,122 @@ +package br.com.swconsultoria.nfe.util; + +import br.com.swconsultoria.nfe.dom.ConfiguracoesNfe; +import br.com.swconsultoria.nfe.dom.Evento; +import br.com.swconsultoria.nfe.dom.enuns.AmbienteEnum; +import br.com.swconsultoria.nfe.dom.enuns.EstadosEnum; +import br.com.swconsultoria.nfe.dom.enuns.ManifestacaoEnum; +import br.com.swconsultoria.nfe.exception.NfeException; +import br.com.swconsultoria.nfe.schema.envConfRecebto.TEnvEvento; +import br.com.swconsultoria.nfe.schema.envConfRecebto.TEvento; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; + +class ManifestacaoUtilTest { + + private static final String CHAVE = "52230309158456000159550010000731791567812345"; + private static final String CNPJ = "09158456000159"; + + private ConfiguracoesNfe config; + + @BeforeEach + void setUp() { + config = new ConfiguracoesNfe(); + config.setEstado(EstadosEnum.GO); + config.setAmbiente(AmbienteEnum.HOMOLOGACAO); + config.setZoneId(ZoneId.of("America/Sao_Paulo")); + } + + private Evento novoEvento(ManifestacaoEnum tipo) { + Evento e = new Evento(); + e.setChave(CHAVE); + e.setCnpj(CNPJ); + e.setTipoManifestacao(tipo); + e.setSequencia(1); + e.setDataEvento(LocalDateTime.of(2024, 4, 1, 12, 0, 0)); + return e; + } + + @Test + void montaManifestacao_confirmacao_retornaTEnvEvento() throws NfeException { + TEnvEvento resultado = ManifestacaoUtil.montaManifestacao( + novoEvento(ManifestacaoEnum.CONFIRMACAO_DA_OPERACAO), config); + assertNotNull(resultado); + assertEquals(1, resultado.getEvento().size()); + } + + @Test + void montaManifestacao_tpEvento_confirmacao() throws NfeException { + TEnvEvento resultado = ManifestacaoUtil.montaManifestacao( + novoEvento(ManifestacaoEnum.CONFIRMACAO_DA_OPERACAO), config); + TEvento.InfEvento info = resultado.getEvento().get(0).getInfEvento(); + assertEquals(ManifestacaoEnum.CONFIRMACAO_DA_OPERACAO.getCodigo(), info.getTpEvento()); + } + + @Test + void montaManifestacao_ciencia_tpEvento() throws NfeException { + TEnvEvento resultado = ManifestacaoUtil.montaManifestacao( + novoEvento(ManifestacaoEnum.CIENCIA_DA_OPERACAO), config); + assertEquals(ManifestacaoEnum.CIENCIA_DA_OPERACAO.getCodigo(), + resultado.getEvento().get(0).getInfEvento().getTpEvento()); + } + + @Test + void montaManifestacao_desconhecimento_tpEvento() throws NfeException { + TEnvEvento resultado = ManifestacaoUtil.montaManifestacao( + novoEvento(ManifestacaoEnum.DESCONHECIMENTO_DA_OPERACAO), config); + assertEquals(ManifestacaoEnum.DESCONHECIMENTO_DA_OPERACAO.getCodigo(), + resultado.getEvento().get(0).getInfEvento().getTpEvento()); + } + + @Test + void montaManifestacao_operacaoNaoRealizada_comJustificativa() throws NfeException { + Evento e = novoEvento(ManifestacaoEnum.OPERACAO_NAO_REALIZADA); + e.setMotivo("Mercadoria nao recebida"); + + TEnvEvento resultado = ManifestacaoUtil.montaManifestacao(e, config); + TEvento.InfEvento.DetEvento det = resultado.getEvento().get(0).getInfEvento().getDetEvento(); + assertEquals("Mercadoria nao recebida", det.getXJust()); + } + + @Test + void montaManifestacao_sequenciaZero_usaUm() throws NfeException { + Evento e = novoEvento(ManifestacaoEnum.CONFIRMACAO_DA_OPERACAO); + e.setSequencia(0); // deve ser corrigido para 1 + + TEnvEvento resultado = ManifestacaoUtil.montaManifestacao(e, config); + assertEquals("1", resultado.getEvento().get(0).getInfEvento().getNSeqEvento()); + } + + @Test + void montaManifestacao_lote_retornaMultiplosEventos() throws NfeException { + List lista = new ArrayList<>(); + lista.add(novoEvento(ManifestacaoEnum.CONFIRMACAO_DA_OPERACAO)); + lista.add(novoEvento(ManifestacaoEnum.CIENCIA_DA_OPERACAO)); + + TEnvEvento resultado = ManifestacaoUtil.montaManifestacao(lista, config); + assertEquals(2, resultado.getEvento().size()); + } + + @Test + void montaManifestacao_loteAcimaDe20_lancaExcecao() { + List lista = new ArrayList<>(); + for (int i = 0; i < 21; i++) + lista.add(novoEvento(ManifestacaoEnum.CIENCIA_DA_OPERACAO)); + + assertThrows(NfeException.class, () -> ManifestacaoUtil.montaManifestacao(lista, config)); + } + + @Test + void montaManifestacao_chaveNFe_preenchida() throws NfeException { + TEnvEvento resultado = ManifestacaoUtil.montaManifestacao( + novoEvento(ManifestacaoEnum.CONFIRMACAO_DA_OPERACAO), config); + assertEquals(CHAVE, resultado.getEvento().get(0).getInfEvento().getChNFe()); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/util/ObjetoUtilTest.java b/src/test/java/br/com/swconsultoria/nfe/util/ObjetoUtilTest.java new file mode 100644 index 00000000..9d007faa --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/util/ObjetoUtilTest.java @@ -0,0 +1,157 @@ +package br.com.swconsultoria.nfe.util; + +import org.junit.jupiter.api.Test; + +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.Collections; +import java.util.Optional; + +import static org.junit.jupiter.api.Assertions.*; + +class ObjetoUtilTest { + + // ------------------------------------------------------------------------- + // verifica(T) + // ------------------------------------------------------------------------- + + @Test + void verifica_null_retornaVazio() { + Optional result = ObjetoUtil.verifica(null); + assertFalse(result.isPresent()); + } + + @Test + void verifica_stringVazia_retornaVazio() { + assertFalse(ObjetoUtil.verifica("").isPresent()); + } + + @Test + void verifica_stringBrancos_retornaVazio() { + assertFalse(ObjetoUtil.verifica(" ").isPresent()); + } + + @Test + void verifica_stringNull_retornaVazio() { + assertFalse(ObjetoUtil.verifica("null").isPresent()); + } + + @Test + void verifica_stringNullCaseInsensitive_retornaVazio() { + assertFalse(ObjetoUtil.verifica("NULL").isPresent()); + } + + @Test + void verifica_stringValida_retornaPresente() { + Optional result = ObjetoUtil.verifica("valor"); + assertTrue(result.isPresent()); + assertEquals("valor", result.get()); + } + + @Test + void verifica_colecaoVazia_retornaVazio() { + assertFalse(ObjetoUtil.verifica(Collections.emptyList()).isPresent()); + } + + @Test + void verifica_colecaoComElementos_retornaPresente() { + assertTrue(ObjetoUtil.verifica(Arrays.asList("a", "b")).isPresent()); + } + + // ------------------------------------------------------------------------- + // getBigDecimalOrZero(String) + // ------------------------------------------------------------------------- + + @Test + void getBigDecimalOrZero_null_retornaZero() { + assertEquals(BigDecimal.ZERO, ObjetoUtil.getBigDecimalOrZero(null)); + } + + @Test + void getBigDecimalOrZero_stringVazia_retornaZero() { + assertEquals(BigDecimal.ZERO, ObjetoUtil.getBigDecimalOrZero("")); + } + + @Test + void getBigDecimalOrZero_stringInvalida_retornaZero() { + assertEquals(BigDecimal.ZERO, ObjetoUtil.getBigDecimalOrZero("abc")); + } + + @Test + void getBigDecimalOrZero_valorValido_retornaValor() { + assertEquals(new BigDecimal("1.50"), ObjetoUtil.getBigDecimalOrZero("1.50")); + } + + @Test + void getBigDecimalOrZero_valorInteiro_retornaValor() { + assertEquals(new BigDecimal("100"), ObjetoUtil.getBigDecimalOrZero("100")); + } + + // ------------------------------------------------------------------------- + // getOrZero(BigDecimal) + // ------------------------------------------------------------------------- + + @Test + void getOrZero_null_retornaZero() { + assertEquals(BigDecimal.ZERO, ObjetoUtil.getOrZero(null)); + } + + @Test + void getOrZero_valorPositivo_retornaValor() { + BigDecimal valor = new BigDecimal("25.99"); + assertEquals(valor, ObjetoUtil.getOrZero(valor)); + } + + @Test + void getOrZero_zero_retornaZero() { + assertEquals(BigDecimal.ZERO, ObjetoUtil.getOrZero(BigDecimal.ZERO)); + } + + // ------------------------------------------------------------------------- + // getValor2Casas(BigDecimal) + // ------------------------------------------------------------------------- + + @Test + void getValor2Casas_null_retornaZeroFormatado() { + assertEquals("0.00", ObjetoUtil.getValor2Casas(null)); + } + + @Test + void getValor2Casas_negativo_retornaZeroFormatado() { + assertEquals("0.00", ObjetoUtil.getValor2Casas(new BigDecimal("-1"))); + } + + @Test + void getValor2Casas_arredondaHalfUp() { + assertEquals("1.24", ObjetoUtil.getValor2Casas(new BigDecimal("1.235"))); + } + + @Test + void getValor2Casas_valorExato() { + assertEquals("13.00", ObjetoUtil.getValor2Casas(new BigDecimal("13"))); + } + + // ------------------------------------------------------------------------- + // getValor4Casas(BigDecimal) + // ------------------------------------------------------------------------- + + @Test + void getValor4Casas_null_retornaZeroFormatado() { + assertEquals("0.0000", ObjetoUtil.getValor4Casas(null)); + } + + @Test + void getValor4Casas_negativo_retornaZeroFormatado() { + assertEquals("0.0000", ObjetoUtil.getValor4Casas(new BigDecimal("-0.01"))); + } + + @Test + void getValor4Casas_arredondaHalfUp() { + assertEquals("5.0140", ObjetoUtil.getValor4Casas(new BigDecimal("5.01395"))); + } + + @Test + void getValor4Casas_valorExato() { + assertEquals("1.0000", ObjetoUtil.getValor4Casas(BigDecimal.ONE)); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/util/RetornoUtilTest.java b/src/test/java/br/com/swconsultoria/nfe/util/RetornoUtilTest.java new file mode 100644 index 00000000..d9d7f372 --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/util/RetornoUtilTest.java @@ -0,0 +1,221 @@ +package br.com.swconsultoria.nfe.util; + +import br.com.swconsultoria.nfe.dom.enuns.StatusEnum; +import br.com.swconsultoria.nfe.exception.NfeException; +import br.com.swconsultoria.nfe.schema.envEventoCancNFe.TRetEnvEvento; +import br.com.swconsultoria.nfe.schema.envEventoCancNFe.TRetEvento; +import br.com.swconsultoria.nfe.schema_4.consReciNFe.TProtNFe; +import br.com.swconsultoria.nfe.schema_4.consReciNFe.TRetConsReciNFe; +import br.com.swconsultoria.nfe.schema_4.enviNFe.TRetEnviNFe; +import br.com.swconsultoria.nfe.schema_4.inutNFe.TRetInutNFe; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class RetornoUtilTest { + + // ------------------------------------------------------------------------- + // isRetornoAssincrono + // ------------------------------------------------------------------------- + + @Test + void isRetornoAssincrono_loteRecebido_retornaTrue() throws NfeException { + TRetEnviNFe retorno = criaRetEnviNFe(StatusEnum.LOTE_RECEBIDO.getCodigo(), "Lote recebido"); + assertTrue(RetornoUtil.isRetornoAssincrono(retorno)); + } + + @Test + void isRetornoAssincrono_loteProcessado_retornaFalse() throws NfeException { + TRetEnviNFe retorno = criaRetEnviNFeComProt( + StatusEnum.LOTE_PROCESSADO.getCodigo(), "Lote processado", + StatusEnum.AUTORIZADO.getCodigo(), "Autorizado"); + assertFalse(RetornoUtil.isRetornoAssincrono(retorno)); + } + + @Test + void isRetornoAssincrono_cStatErrado_lancaExcecao() { + TRetEnviNFe retorno = criaRetEnviNFe("999", "Erro generico"); + assertThrows(NfeException.class, () -> RetornoUtil.isRetornoAssincrono(retorno)); + } + + // ------------------------------------------------------------------------- + // validaSincrono + // ------------------------------------------------------------------------- + + @Test + void validaSincrono_autorizado_naoLancaExcecao() { + TRetEnviNFe retorno = criaRetEnviNFeComProt( + StatusEnum.LOTE_PROCESSADO.getCodigo(), "Lote processado", + StatusEnum.AUTORIZADO.getCodigo(), "Autorizado o uso da NF-e"); + assertDoesNotThrow(() -> RetornoUtil.validaSincrono(retorno)); + } + + @Test + void validaSincrono_autorizadoForaPrazo_naoLancaExcecao() { + TRetEnviNFe retorno = criaRetEnviNFeComProt( + StatusEnum.LOTE_PROCESSADO.getCodigo(), "Lote processado", + StatusEnum.AUTORIZADO_FORA_PRAZO.getCodigo(), "Autorizado fora do prazo"); + assertDoesNotThrow(() -> RetornoUtil.validaSincrono(retorno)); + } + + @Test + void validaSincrono_cStatEnvelopeErrado_lancaExcecao() { + TRetEnviNFe retorno = criaRetEnviNFe("999", "Servico indisponivel"); + assertThrows(NfeException.class, () -> RetornoUtil.validaSincrono(retorno)); + } + + @Test + void validaSincrono_cStatProtocoloErrado_lancaExcecao() { + TRetEnviNFe retorno = criaRetEnviNFeComProt( + StatusEnum.LOTE_PROCESSADO.getCodigo(), "Lote processado", + "204", "Duplicidade de NF-e"); + assertThrows(NfeException.class, () -> RetornoUtil.validaSincrono(retorno)); + } + + // ------------------------------------------------------------------------- + // validaAssincrono + // ------------------------------------------------------------------------- + + @Test + void validaAssincrono_loteProcessadoAutorizado_naoLancaExcecao() { + TRetConsReciNFe retorno = criaRetConsReciNFe( + StatusEnum.LOTE_PROCESSADO.getCodigo(), "Lote processado", + StatusEnum.AUTORIZADO.getCodigo(), "Autorizado"); + assertDoesNotThrow(() -> RetornoUtil.validaAssincrono(retorno)); + } + + @Test + void validaAssincrono_loteEmProcessamento_lancaExcecao() { + TRetConsReciNFe retorno = new TRetConsReciNFe(); + retorno.setCStat(StatusEnum.LOTE_EM_PROCESSAMENTO.getCodigo()); + retorno.setXMotivo("Lote em processamento"); + assertThrows(NfeException.class, () -> RetornoUtil.validaAssincrono(retorno)); + } + + @Test + void validaAssincrono_protocoloComErro_lancaExcecao() { + TRetConsReciNFe retorno = criaRetConsReciNFe( + StatusEnum.LOTE_PROCESSADO.getCodigo(), "Lote processado", + "204", "Duplicidade de NF-e"); + assertThrows(NfeException.class, () -> RetornoUtil.validaAssincrono(retorno)); + } + + // ------------------------------------------------------------------------- + // validaCancelamento + // ------------------------------------------------------------------------- + + @Test + void validaCancelamento_eventoVinculado_naoLancaExcecao() { + TRetEnvEvento retorno = criaRetEnvEvento( + StatusEnum.LOTE_EVENTO_PROCESSADO.getCodigo(), + StatusEnum.EVENTO_VINCULADO.getCodigo()); + assertDoesNotThrow(() -> RetornoUtil.validaCancelamento(retorno)); + } + + @Test + void validaCancelamento_cancelamentoForaPrazo_naoLancaExcecao() { + TRetEnvEvento retorno = criaRetEnvEvento( + StatusEnum.LOTE_EVENTO_PROCESSADO.getCodigo(), + StatusEnum.CANCELAMENTO_FORA_PRAZO.getCodigo()); + assertDoesNotThrow(() -> RetornoUtil.validaCancelamento(retorno)); + } + + @Test + void validaCancelamento_envelopeErrado_lancaExcecao() { + TRetEnvEvento retorno = criaRetEnvEvento("999", StatusEnum.EVENTO_VINCULADO.getCodigo()); + assertThrows(NfeException.class, () -> RetornoUtil.validaCancelamento(retorno)); + } + + @Test + void validaCancelamento_eventoErrado_lancaExcecao() { + TRetEnvEvento retorno = criaRetEnvEvento( + StatusEnum.LOTE_EVENTO_PROCESSADO.getCodigo(), "999"); + assertThrows(NfeException.class, () -> RetornoUtil.validaCancelamento(retorno)); + } + + // ------------------------------------------------------------------------- + // validaInutilizacao + // ------------------------------------------------------------------------- + + @Test + void validaInutilizacao_inutilizado_naoLancaExcecao() { + TRetInutNFe retorno = new TRetInutNFe(); + TRetInutNFe.InfInut infInut = new TRetInutNFe.InfInut(); + infInut.setCStat(StatusEnum.INUTILIZADO.getCodigo()); + infInut.setXMotivo("Inutilizacao de numero de NF-e homologada"); + retorno.setInfInut(infInut); + + assertDoesNotThrow(() -> RetornoUtil.validaInutilizacao(retorno)); + } + + @Test + void validaInutilizacao_cStatErrado_lancaExcecao() { + TRetInutNFe retorno = new TRetInutNFe(); + TRetInutNFe.InfInut infInut = new TRetInutNFe.InfInut(); + infInut.setCStat("999"); + infInut.setXMotivo("Erro"); + retorno.setInfInut(infInut); + + assertThrows(NfeException.class, () -> RetornoUtil.validaInutilizacao(retorno)); + } + + // ------------------------------------------------------------------------- + // Helpers + // ------------------------------------------------------------------------- + + private TRetEnviNFe criaRetEnviNFe(String cStat, String xMotivo) { + TRetEnviNFe retorno = new TRetEnviNFe(); + retorno.setCStat(cStat); + retorno.setXMotivo(xMotivo); + return retorno; + } + + private TRetEnviNFe criaRetEnviNFeComProt(String cStatEnvelope, String xMotivoEnvelope, + String cStatProt, String xMotivoProt) { + TRetEnviNFe retorno = criaRetEnviNFe(cStatEnvelope, xMotivoEnvelope); + + br.com.swconsultoria.nfe.schema_4.enviNFe.TProtNFe protNFe = + new br.com.swconsultoria.nfe.schema_4.enviNFe.TProtNFe(); + br.com.swconsultoria.nfe.schema_4.enviNFe.TProtNFe.InfProt infProt = + new br.com.swconsultoria.nfe.schema_4.enviNFe.TProtNFe.InfProt(); + infProt.setCStat(cStatProt); + infProt.setXMotivo(xMotivoProt); + protNFe.setInfProt(infProt); + retorno.setProtNFe(protNFe); + + return retorno; + } + + private TRetConsReciNFe criaRetConsReciNFe(String cStatEnvelope, String xMotivoEnvelope, + String cStatProt, String xMotivoProt) { + TRetConsReciNFe retorno = new TRetConsReciNFe(); + retorno.setCStat(cStatEnvelope); + retorno.setXMotivo(xMotivoEnvelope); + + TProtNFe protNFe = new TProtNFe(); + TProtNFe.InfProt infProt = new TProtNFe.InfProt(); + infProt.setCStat(cStatProt); + infProt.setXMotivo(xMotivoProt); + infProt.setChNFe("52240310732644000128550010000000011234567890"); + protNFe.setInfProt(infProt); + retorno.getProtNFe().add(protNFe); + + return retorno; + } + + private TRetEnvEvento criaRetEnvEvento(String cStatEnvelope, String cStatEvento) { + TRetEnvEvento retorno = new TRetEnvEvento(); + retorno.setCStat(cStatEnvelope); + retorno.setXMotivo("Lote de Evento Processado"); + + TRetEvento retEvento = new TRetEvento(); + TRetEvento.InfEvento infEvento = new TRetEvento.InfEvento(); + infEvento.setCStat(cStatEvento); + infEvento.setXMotivo("Evento registrado"); + infEvento.setChNFe("52240310732644000128550010000000011234567890"); + retEvento.setInfEvento(infEvento); + retorno.getRetEvento().add(retEvento); + + return retorno; + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/util/XmlImpostoUtilTest.java b/src/test/java/br/com/swconsultoria/nfe/util/XmlImpostoUtilTest.java new file mode 100644 index 00000000..101e59b1 --- /dev/null +++ b/src/test/java/br/com/swconsultoria/nfe/util/XmlImpostoUtilTest.java @@ -0,0 +1,247 @@ +package br.com.swconsultoria.nfe.util; + +import br.com.swconsultoria.nfe.schema_4.enviNFe.ObjectFactory; +import br.com.swconsultoria.nfe.schema_4.enviNFe.TNFe.InfNFe.Det.Imposto.*; +import br.com.swconsultoria.nfe.schema_4.enviNFe.TNFe.InfNFe.Det.Imposto.COFINS.COFINSAliq; +import br.com.swconsultoria.nfe.schema_4.enviNFe.TNFe.InfNFe.Det.Imposto.COFINS.COFINSQtde; +import br.com.swconsultoria.nfe.schema_4.enviNFe.TNFe.InfNFe.Det.Imposto.PIS.PISAliq; +import br.com.swconsultoria.nfe.schema_4.enviNFe.TNFe.InfNFe.Det.Imposto.PIS.PISQtde; +import org.junit.jupiter.api.Test; + +import javax.xml.bind.JAXBElement; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class XmlImpostoUtilTest { + + private static final ObjectFactory FACTORY = new ObjectFactory(); + + // ------------------------------------------------------------------------- + // getVPIS + // ------------------------------------------------------------------------- + + @Test + void getVPIS_listaVazia_retornaZero() { + assertEquals(BigDecimal.ZERO, XmlImpostoUtil.getVPIS(Collections.emptyList())); + } + + @Test + void getVPIS_pisAliq_retornaValor() { + PIS pis = new PIS(); + PISAliq pisAliq = new PISAliq(); + pisAliq.setVPIS("16.81"); + pis.setPISAliq(pisAliq); + + List> impostos = new ArrayList<>(); + impostos.add(FACTORY.createTNFeInfNFeDetImpostoPIS(pis)); + + assertEquals(new BigDecimal("16.81"), XmlImpostoUtil.getVPIS(impostos)); + } + + @Test + void getVPIS_pisQtde_retornaValor() { + PIS pis = new PIS(); + PISQtde pisQtde = new PISQtde(); + pisQtde.setVPIS("5.00"); + pis.setPISQtde(pisQtde); + + List> impostos = new ArrayList<>(); + impostos.add(FACTORY.createTNFeInfNFeDetImpostoPIS(pis)); + + assertEquals(new BigDecimal("5.00"), XmlImpostoUtil.getVPIS(impostos)); + } + + @Test + void getVPIS_tipoErrado_retornaZero() { + List> impostos = new ArrayList<>(); + impostos.add(FACTORY.createTNFeInfNFeDetImpostoICMS(new ICMS())); + + assertEquals(BigDecimal.ZERO, XmlImpostoUtil.getVPIS(impostos)); + } + + // ------------------------------------------------------------------------- + // getVCOFINS + // ------------------------------------------------------------------------- + + @Test + void getVCOFINS_listaVazia_retornaZero() { + assertEquals(BigDecimal.ZERO, XmlImpostoUtil.getVCOFINS(Collections.emptyList())); + } + + @Test + void getVCOFINS_cofinsAliq_retornaValor() { + COFINS cofins = new COFINS(); + COFINSAliq cofinsAliq = new COFINSAliq(); + cofinsAliq.setVCOFINS("77.41"); + cofins.setCOFINSAliq(cofinsAliq); + + List> impostos = new ArrayList<>(); + impostos.add(FACTORY.createTNFeInfNFeDetImpostoCOFINS(cofins)); + + assertEquals(new BigDecimal("77.41"), XmlImpostoUtil.getVCOFINS(impostos)); + } + + @Test + void getVCOFINS_cofinsQtde_retornaValor() { + COFINS cofins = new COFINS(); + COFINSQtde cofinsQtde = new COFINSQtde(); + cofinsQtde.setVCOFINS("10.00"); + cofins.setCOFINSQtde(cofinsQtde); + + List> impostos = new ArrayList<>(); + impostos.add(FACTORY.createTNFeInfNFeDetImpostoCOFINS(cofins)); + + assertEquals(new BigDecimal("10.00"), XmlImpostoUtil.getVCOFINS(impostos)); + } + + // ------------------------------------------------------------------------- + // getVICMS + // ------------------------------------------------------------------------- + + @Test + void getVICMS_listaVazia_retornaZero() { + assertEquals(BigDecimal.ZERO, XmlImpostoUtil.getVICMS(Collections.emptyList())); + } + + @Test + void getVICMS_icms00_retornaValor() { + ICMS icms = new ICMS(); + ICMS.ICMS00 icms00 = new ICMS.ICMS00(); + icms00.setVICMS("208.63"); + icms.setICMS00(icms00); + + List> impostos = new ArrayList<>(); + impostos.add(FACTORY.createTNFeInfNFeDetImpostoICMS(icms)); + + assertEquals(new BigDecimal("208.63"), XmlImpostoUtil.getVICMS(impostos)); + } + + @Test + void getVICMS_icms10_retornaValor() { + ICMS icms = new ICMS(); + ICMS.ICMS10 icms10 = new ICMS.ICMS10(); + icms10.setVICMS("100.00"); + icms.setICMS10(icms10); + + List> impostos = new ArrayList<>(); + impostos.add(FACTORY.createTNFeInfNFeDetImpostoICMS(icms)); + + assertEquals(new BigDecimal("100.00"), XmlImpostoUtil.getVICMS(impostos)); + } + + @Test + void getVICMS_semVICMSPreenchido_retornaZero() { + List> impostos = new ArrayList<>(); + impostos.add(FACTORY.createTNFeInfNFeDetImpostoICMS(new ICMS())); + + assertEquals(BigDecimal.ZERO, XmlImpostoUtil.getVICMS(impostos)); + } + + // ------------------------------------------------------------------------- + // getVICMSUFDest + // ------------------------------------------------------------------------- + + @Test + void getVICMSUFDest_listaVazia_retornaZero() { + assertEquals(BigDecimal.ZERO, XmlImpostoUtil.getVICMSUFDest(Collections.emptyList())); + } + + @Test + void getVICMSUFDest_comValor_retornaValor() { + ICMSUFDest icmsUfDest = new ICMSUFDest(); + icmsUfDest.setVICMSUFDest("45.00"); + + List> impostos = new ArrayList<>(); + impostos.add(FACTORY.createTNFeInfNFeDetImpostoICMSUFDest(icmsUfDest)); + + assertEquals(new BigDecimal("45.00"), XmlImpostoUtil.getVICMSUFDest(impostos)); + } + + // ------------------------------------------------------------------------- + // getVFCP + // ------------------------------------------------------------------------- + + @Test + void getVFCP_listaVazia_retornaZero() { + assertEquals(BigDecimal.ZERO, XmlImpostoUtil.getVFCP(Collections.emptyList())); + } + + @Test + void getVFCP_icms00ComFCP_retornaValor() { + ICMS icms = new ICMS(); + ICMS.ICMS00 icms00 = new ICMS.ICMS00(); + icms00.setVFCP("12.50"); + icms.setICMS00(icms00); + + List> impostos = new ArrayList<>(); + impostos.add(FACTORY.createTNFeInfNFeDetImpostoICMS(icms)); + + assertEquals(new BigDecimal("12.50"), XmlImpostoUtil.getVFCP(impostos)); + } + + // ------------------------------------------------------------------------- + // getVFCPUFDest + // ------------------------------------------------------------------------- + + @Test + void getVFCPUFDest_listaVazia_retornaZero() { + assertEquals(BigDecimal.ZERO, XmlImpostoUtil.getVFCPUFDest(Collections.emptyList())); + } + + @Test + void getVFCPUFDest_comValor_retornaValor() { + ICMSUFDest icmsUfDest = new ICMSUFDest(); + icmsUfDest.setVFCPUFDest("8.00"); + + List> impostos = new ArrayList<>(); + impostos.add(FACTORY.createTNFeInfNFeDetImpostoICMSUFDest(icmsUfDest)); + + assertEquals(new BigDecimal("8.00"), XmlImpostoUtil.getVFCPUFDest(impostos)); + } + + // ------------------------------------------------------------------------- + // getVICMSMono + // ------------------------------------------------------------------------- + + @Test + void getVICMSMono_listaVazia_retornaZero() { + assertEquals(BigDecimal.ZERO, XmlImpostoUtil.getVICMSMono(Collections.emptyList())); + } + + @Test + void getVICMSMono_icms02_retornaValor() { + ICMS icms = new ICMS(); + ICMS.ICMS02 icms02 = new ICMS.ICMS02(); + icms02.setVICMSMono("30.00"); + icms.setICMS02(icms02); + + List> impostos = new ArrayList<>(); + impostos.add(FACTORY.createTNFeInfNFeDetImpostoICMS(icms)); + + assertEquals(new BigDecimal("30.00"), XmlImpostoUtil.getVICMSMono(impostos)); + } + + // ------------------------------------------------------------------------- + // getVISSQN + // ------------------------------------------------------------------------- + + @Test + void getVISSQN_listaVazia_retornaZero() { + assertEquals(BigDecimal.ZERO, XmlImpostoUtil.getVISSQN(Collections.emptyList())); + } + + @Test + void getVISSQN_comValor_retornaValor() { + ISSQN issqn = new ISSQN(); + issqn.setVISSQN("99.99"); + + List> impostos = new ArrayList<>(); + impostos.add(FACTORY.createTNFeInfNFeDetImpostoISSQN(issqn)); + + assertEquals(new BigDecimal("99.99"), XmlImpostoUtil.getVISSQN(impostos)); + } +} diff --git a/src/test/java/br/com/swconsultoria/nfe/util/XmlNfeUtilTest.java b/src/test/java/br/com/swconsultoria/nfe/util/XmlNfeUtilTest.java index 44fcb810..44603095 100644 --- a/src/test/java/br/com/swconsultoria/nfe/util/XmlNfeUtilTest.java +++ b/src/test/java/br/com/swconsultoria/nfe/util/XmlNfeUtilTest.java @@ -98,4 +98,84 @@ void deveLancarExcecaoQuandoXmlEhVazio() { assertEquals("XML de entrada está vazio.", exception.getMessage()); } + // ------------------------------------------------------------------------- + // objectToXml / xmlToObject + // ------------------------------------------------------------------------- + + @Test + void objectToXml_retornaXmlComDeclaracaoETagRaiz() throws Exception { + br.com.swconsultoria.nfe.schema_4.consStatServ.TRetConsStatServ obj = + new br.com.swconsultoria.nfe.schema_4.consStatServ.TRetConsStatServ(); + obj.setCStat("107"); + obj.setXMotivo("Servico em Operacao"); + + String xml = XmlNfeUtil.objectToXml(obj); + + assertTrue(xml.startsWith("" + + "2GO4.0107" + + "Servico em Operacao52" + + "2024-01-01T10:00:00-03:00"; + + br.com.swconsultoria.nfe.schema_4.consStatServ.TRetConsStatServ obj = + XmlNfeUtil.xmlToObject(xml, br.com.swconsultoria.nfe.schema_4.consStatServ.TRetConsStatServ.class); + + assertNotNull(obj); + assertEquals("107", obj.getCStat()); + assertEquals("Servico em Operacao", obj.getXMotivo()); + } + + // ------------------------------------------------------------------------- + // dataNfe + // ------------------------------------------------------------------------- + + @Test + void dataNfe_comZoneId_retornaFormatoISO() { + java.time.LocalDateTime dt = java.time.LocalDateTime.of(2024, 3, 15, 10, 30, 0); + java.time.ZoneId zone = java.time.ZoneId.of("America/Sao_Paulo"); + + String resultado = XmlNfeUtil.dataNfe(dt, zone); + + assertNotNull(resultado); + assertTrue(resultado.startsWith("2024-03-15T10:30:00")); + } + + @Test + void dataNfe_zoneIdNulo_usaFallback() { + java.time.LocalDateTime dt = java.time.LocalDateTime.of(2024, 6, 1, 8, 0, 0); + assertNotNull(XmlNfeUtil.dataNfe(dt, null)); + } + + // ------------------------------------------------------------------------- + // gZipToXml + // ------------------------------------------------------------------------- + + @Test + void gZipToXml_descomprimeBytesGzip() throws Exception { + String conteudo = "teste"; + java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(); + try (java.util.zip.GZIPOutputStream gos = new java.util.zip.GZIPOutputStream(baos)) { + gos.write(conteudo.getBytes(java.nio.charset.StandardCharsets.UTF_8)); + } + + String resultado = XmlNfeUtil.gZipToXml(baos.toByteArray()); + assertEquals(conteudo, resultado); + } + + @Test + void gZipToXml_bytesNulos_retornaVazio() throws Exception { + assertEquals("", XmlNfeUtil.gZipToXml(null)); + } + + @Test + void gZipToXml_bytesVazios_retornaVazio() throws Exception { + assertEquals("", XmlNfeUtil.gZipToXml(new byte[0])); + } + } diff --git a/src/test/resources/IbsCbs.xml b/src/test/resources/IbsCbs.xml index 953cb6ff..f66e3927 100644 --- a/src/test/resources/IbsCbs.xml +++ b/src/test/resources/IbsCbs.xml @@ -1 +1 @@ -113544039674VENDA DE PRODUÇÃO55112452026-01-12T11:27:13-03:0011353780011311100Bridi.4.0.3410732644000128ALUMINIO SUL DESC RESID IND EIRELIRODOVIA JOSE DE CARVALHOS/NFUNIL3537800PIEDADESP181700001058Brasil1532996276526082602118356558703000275BENTOMAR INDUSTRIA E COMERCIO DE MINERIOS LTDARUA 4331FERRAZ3543907RIO CLAROSP135080001058Brasil193539127315871243791161SEM GTINPO COM ALUMINIO INDUSTRIAL NAO LAMELAR760310005101KG1.000100.00100.00SEM GTINKG1.000100.001020333.3367.0018.0012.0099950100.002.603.000188.000.650.570188.003.002.6400000000184.790.10000.080.00000.000.080.90000.7667.0012.000.000.000.000.000.000.000.000.000.000.000.00100.000.000.000.000.003.000.000.572.640.00103.0084.790.000.000.080.000.000.000.080.000.000.000.000.760.000.00103.8490011.03Base de Cálculo do ICMS Reduzida conforme Art.15 do Anexo II do RICMSY58yC1c4Rx9N0msxhzbVb0DU3w0=O7W/975rjKEkn6vUTBqoNNnJMfnaDjiHz9oeDc/5vUmMyzXKf6cTfCq8Iq2jkDg9kvQOG+pDIYfVb2vQ0Ni3r1MbopYpZsYB2IMJ2brtOTfH3ZzNJH7Ixza/sPs5TgcSqkCgYfZJ8ySsqwXsy/iZqelUt8FsFwfARu4tZ4AFf4agnenA4KFAo99CmvkkD9QhNDBjQRebGDShBOMa64B23uHZVgt8OrKQyxnVkAlYJAm+VZMUH0a2WmTgh+oLmM0WRXG/2v9gD6is2gWc/lr/Zb0rmisY7++pTF5ktFv3TlHo7olhHeR1Rdh/23wZBeZ7BScFGvt6sr1S2V5vOQMonQ==MIIHgjCCBWqgAwIBAgIIdgLRoox7RC8wDQYJKoZIhvcNAQELBQAwczELMAkGA1UEBhMCQlIxEzARBgNVBAoTCklDUC1CcmFzaWwxNjA0BgNVBAsTLVNlY3JldGFyaWEgZGEgUmVjZWl0YSBGZWRlcmFsIGRvIEJyYXNpbCAtIFJGQjEXMBUGA1UEAxMOQUMgQ05ETCBSRkIgdjMwHhcNMjUxMDA5MTgxNjIzWhcNMjYxMDA5MTgxNjIzWjCCAQExCzAJBgNVBAYTAkJSMRMwEQYDVQQKEwpJQ1AtQnJhc2lsMQswCQYDVQQIEwJHTzEkMCI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1qbN/pPtVbBmBAc+MMNSuEiArzxkob1/S8CrrkJYIYcf3NjDDGZ1xz6RPhB0b4Nn5YdMvRwU/nLvumjl/8+8JJaGI17eBuDqAijW9W2qBBk \ No newline at end of file +113544039674VENDA DE PRODUÇÃO55112452026-01-12T11:27:13-03:0011353780011311100Bridi.4.0.3499999999999999ALUMINIO SUL DESC RESID IND EIRELIRODOVIA JOSE DE CARVALHOS/NFUNIL3537800PIEDADESP181700001058Brasil1532996276526082602118356558703000275BENTOMAR INDUSTRIA E COMERCIO DE MINERIOS LTDARUA 4331FERRAZ3543907RIO CLAROSP135080001058Brasil193539127315871243791161SEM GTINPO COM ALUMINIO INDUSTRIAL NAO LAMELAR760310005101KG1.000100.00100.00SEM GTINKG1.000100.001020333.3367.0018.0012.0099950100.002.603.000188.000.650.570188.003.002.6400000000184.790.10000.080.00000.000.080.90000.7667.0012.000.000.000.000.000.000.000.000.000.000.000.00100.000.000.000.000.003.000.000.572.640.00103.0084.790.000.000.080.000.000.000.080.000.000.000.000.760.000.00103.8490011.03Base de Cálculo do ICMS Reduzida conforme Art.15 do Anexo II do RICMSiwYcsB6cCjrHE2rATM0IwbAlKqo=WJT6fM00eVd9rmODkQYCK2SHHxo/p9Gu4/RybayzdspGITsH/OyYb47LJIdUTEHHeYJKkH3KR0aPCnRdV59rIwISLs0UgMzUyAafDg6Rr5tswi8+cnYU1/NjMUFhSLgJYxFc6PIdy7Nhxni21lOU/VCKtrSBn8TQ3iMVFAfTnRBjVqJXovIj9iQO8g/zrGiAQZHjLPaq8HRFO+fZI6intbNi1QKVkJvGan2c3BJ6peikaCbjDW4xUTK00O+hhlZW0Y/KnSunERVKOOixhnLKgXHmt7OS69ZExVpBEtp6TEnUhpDGepQfup9lkbyN+DPOXqm83yVWMLkVHeyx0frO9g==MIIFRTCCAy2gAwIBAgIFMzMzMzMwDQYJKoZIhvcNAQELBQAwLjELMAkGA1UEBhMCQlIxDTALBgNVBAoMBFRSVDIxEDAOBgNVBAMMB0FD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+n4E8mI7EXvEjMRQDyebzp+aWyyjoqnft9k2h2nyidSuy7wt5zGGwyKUdIPCRPerbu9+ylZenznXDNCxtPI3cWIuwiE7d9p4ih9/8beAZ6WryYxUC1G3B/MaKVGCFR9KJrKQw8QbHl5Vaovjse7hrWjYRdgLifzQYK8ExGtqraIFLqIa020UUE1xLVPDyOrMAh22B+EzjcfkmEeSK6o3UrvKRDsUivE2+RxWu1FHwVHoEcF209M5RDtyRsNHR8iLWW+e/dzEtTGClPSwLm3OFu0/PbvFhFbA3IpyWoDLuSonluOVBtlAeJEf1eUQSGQoYBt33d3FyVqunYhEFu4vBE1tu8tJdbi2WqbePOajlMqKwmPgjyGUBfRWKloCkiw2yM/sbWDeErz7isaOYhyty/Y84DYIJV/uhHYWqL/qanid6yI54ZpjhYsb7GemjYRwdLd3kUq81/R5nKAlgjnTzOYWKTiLCuSo5svSWht5ENiAr2zUq08txX5wQ8FHMkw87EjkrNpxR2bIGbY+j34YD5l+m83yC/kPoZKn+AE4CKCRexlNYwXymHsBcG5UzrSYxvXeJWc006HxLJEobaeGkamG5HlNh7DaG/u7k7xOmLQUy7B804sneE23GRJ2AbulJk7e \ No newline at end of file diff --git a/src/test/resources/IbsCbsDiferimento.xml b/src/test/resources/IbsCbsDiferimento.xml index 172fdb40..fc545bbe 100644 --- a/src/test/resources/IbsCbsDiferimento.xml +++ b/src/test/resources/IbsCbsDiferimento.xml @@ -1 +1 @@ -113544039674VENDA DE PRODUÇÃO55112452026-01-12T11:27:13-03:0011353780011311100Bridi.4.0.3410732644000128ALUMINIO SUL DESC RESID IND EIRELIRODOVIA JOSE DE CARVALHOS/NFUNIL3537800PIEDADESP181700001058Brasil1532996276526082602118356558703000275BENTOMAR INDUSTRIA E COMERCIO DE MINERIOS LTDARUA 4331FERRAZ3543907RIO CLAROSP135080001058Brasil193539127315871243791161SEM GTINPO COM ALUMINIO INDUSTRIAL NAO LAMELAR760310005101KG1.000100.00100.00SEM GTINKG1.000100.001020333.3367.0018.0012.0099950100.002.603.000188.000.650.570188.003.002.6451551500184.790.1000100.00000.0360.00000.04000.000.0000100.00000.0060.00000.00000.000.000.9000100.00000.3160.00000.36000.0067.0012.000.000.000.000.000.000.000.000.000.000.000.00100.000.000.000.000.003.000.000.572.640.00103.0084.790.030.000.000.000.000.000.000.000.000.310.000.000.000.00103.0090011.03Base de Cálculo do ICMS Reduzida conforme Art.15 do Anexo II do RICMS/wZ1P50RYVhs4Bd1JyIlAFH+LY4=MGhEZYPj7S8Ije2PtcGZ8fgEZqgVt/FVob+81FZJi/zWMNjhUSNNepYci3w14opwlaVmRdbcOW7kwE87Ia2GJylN/uV6AW/acr1z5t8YuIA55USDIV8xb0lsyvoIhKMQhI7cXw04bKZJeixcK8yM6HTVZHOeC11ZzTfskNxNCrijdPUNFCMmWm/y+tl7Bg2OGnNMDStyucVP2R5rmmiRP2IArwhs98hyIuDbb8srNVON39N4F6rI+J9ym53Q+1Cif6G7Sm6goKM3/J4gFJilJ5rcDfsXk3GtLU1GK9FRE8vMSSry2LzKc/9wFmJo0cpf5D1YW6jAfigqJr9CaCuJ6A==MIIHgjCCBWqgAwIBAgIIdgLRoox7RC8wDQYJKoZIhvcNAQELBQAwczELMAkGA1UEBhMCQlIxEzARBgNVBAoTCklDUC1CcmFzaWwxNjA0BgNVBAsTLVNlY3JldGFyaWEgZGEgUmVjZWl0YSBGZWRlcmFsIGRvIEJyYXNpbCAtIFJGQjEXMBUGA1UEAxMOQUMgQ05ETCBSRkIgdjMwHhcNMjUxMDA5MTgxNjIzWhcNMjYxMDA5MTgxNjIzWjCCAQExCzAJBgNVBAYTAkJSMRMwEQYDVQQKEwpJQ1AtQnJhc2lsMQswCQYDVQQIEwJHTzEkMCIGA1UEBxMbU0FOVE8gQU5UT05JTyBETyBERVNDT0JFUlRPMRcwFQYDVQQLEw4zNDE3MzY4MjAwMDMxODE2MDQGA1UECxMtU2VjcmV0YXJpYSBkYSBSZWNlaXRhIEZlZGVyYWwgZG8gQnJhc2lsIC0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:27:13-03:0011353780011311100Bridi.4.0.3499999999999999ALUMINIO SUL DESC RESID IND EIRELIRODOVIA JOSE DE CARVALHOS/NFUNIL3537800PIEDADESP181700001058Brasil1532996276526082602118356558703000275BENTOMAR INDUSTRIA E COMERCIO DE MINERIOS LTDARUA 4331FERRAZ3543907RIO CLAROSP135080001058Brasil193539127315871243791161SEM GTINPO COM ALUMINIO INDUSTRIAL NAO LAMELAR760310005101KG1.000100.00100.00SEM GTINKG1.000100.001020333.3367.0018.0012.0099950100.002.603.000188.000.650.570188.003.002.6451551500184.790.1000100.00000.0360.00000.04000.000.0000100.00000.0060.00000.00000.000.000.9000100.00000.3160.00000.36000.0067.0012.000.000.000.000.000.000.000.000.000.000.000.00100.000.000.000.000.003.000.000.572.640.00103.0084.790.030.000.000.000.000.000.000.000.000.310.000.000.000.00103.0090011.03Base de Cálculo do ICMS Reduzida conforme Art.15 do Anexo II do RICMS90ioDn5W07CN9m1Ajc/sj3e+TtM=qobZEqqXRfpS8wdDwKko20FudsaUcOoW3Se+kyuwT+Mtr4lRAY7+by5GPqGt88cI1RUiG5bjQ68QcefevlXZizDkVJEIgNUSeKKUbgsUQ5SvXoAF4z9RTNMuGg7Of/VendLS+sVrVJmUvxdUNDoMzoAmJniswl4gVjmkCLzXC+aNsA+1rQuwEQ7AT6GPq9jma3tsBanY1DIpwfr/PXttyt8VlGl7fZ8HMoEWDY9dZRO/8g95oQ95VZmrGcG2j5O+vKu8RZrGluEK1rB/E6+Own8MHvaEuxMNnuAD5lkQMSqkZS7EDeiHcLqvcoCv41T3a2F9fm0qrwKINLuHEb/eFw==MIIFRTCCAy2gAwIBAgIFMzMzMzMwDQYJKoZIhvcNAQELBQAwLjELMAkGA1UEBhMCQlIxDTALBgNVBAoMBFRSVDIxEDAOBgNVBAMMB0FDIFRlc3QwHhcNMTkwNTE5MDMzNjAxWhcNMjkwNTE2MDMzNjAxWjCBjDELMAkGA1UEBhMCQlIxEzARBgNVBAoMCklDUC1CcmFzaWwxETA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6WryYxUC1G3B/MaKVGCFR9KJrKQw8QbHl5Vaovjse7hrWjYRdgLifzQYK8ExGtqraIFLqIa020UUE1xLVPDyOrMAh22B+EzjcfkmEeSK6o3UrvKRDsUivE2+RxWu1FHwVHoEcF209M5RDtyRsNHR8iLWW+e/dzEtTGClPSwLm3OFu0/PbvFhFbA3IpyWoDLuSonluOVBtlAeJEf1eUQSGQoYBt33d3FyVqunYhEFu4vBE1tu8tJdbi2WqbePOajlMqKwmPgjyGUBfRWKloCkiw2yM/sbWDeErz7isaOYhyty/Y84DYIJV/uhHYWqL/qanid6yI54ZpjhYsb7GemjYRwdLd3kUq81/R5nKAlgjnTzOYWKTiLCuSo5svSWht5ENiAr2zUq08txX5wQ8FHMkw87EjkrNpxR2bIGbY+j34YD5l+m83yC/kPoZKn+AE4CKCRexlNYwXymHsBcG5UzrSYxvXeJWc006HxLJEobaeGkamG5HlNh7DaG/u7k7xOmLQUy7B804sneE23GRJ2AbulJk7e \ No newline at end of file diff --git a/src/test/resources/IbsCbsMonofasico.xml b/src/test/resources/IbsCbsMonofasico.xml index 507faa4a..177ef1a5 100644 --- a/src/test/resources/IbsCbsMonofasico.xml +++ b/src/test/resources/IbsCbsMonofasico.xml @@ -1 +1 @@ -113544039674VENDA DE PRODUÇÃO55112452026-01-12T11:27:13-03:0011353780011311100Bridi.4.0.3410732644000128ALUMINIO SUL DESC RESID IND EIRELIRODOVIA JOSE DE CARVALHOS/NFUNIL3537800PIEDADESP181700001058Brasil1532996276526082602118356558703000275BENTOMAR INDUSTRIA E COMERCIO DE MINERIOS LTDARUA 4331FERRAZ3543907RIO CLAROSP135080001058Brasil193539127315871243791161SEM GTINPO COM ALUMINIO INDUSTRIAL NAO LAMELAR760310005101KG1.000100.00100.00SEM GTINKG1.000100.001020333.3367.0018.0012.0099950100.002.603.000188.000.650.570188.003.002.646206200061.00000.000.000.000.000.000.0067.0012.000.000.000.000.000.000.000.000.000.000.000.00100.000.000.000.000.003.000.000.572.640.00103.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.00103.0090011.03Base de Cálculo do ICMS Reduzida conforme Art.15 do Anexo II do RICMS3v8Vobtq42/Bge87f6IW+SPVt0s=YUPjmT3Mr7Uu9SZmEOqo0jHEXjNJRO2MtqSgnfZe/LbUDEY8jcVh+rViikmJxE2g5Rjj5sLUPoc1Brax7ASRUGLx9UVCkqXgVnGaRlVwV2lY6ZNrWNjLORX8pe6atdggdFK4XDxsmnzweczK4cnaKau25PTQUvhpXgDcwEoLVmFUp7bDhrD+6Jv5r5sTck2EWVkIO9KndKhFovgIJ8s6TOVmL197kl6ML1aRVMXBoLkFAu9ahIwehzsMhhgkVeIjBorBGupozKByzy2yNQm+m5UNg8KossFj/6b8V/RnhoCnwS6DDLvrxx908z4eiJq9vESZtwB8LNlTsmksO2MAVQ==MIIHgjCCBWqgAwIBAgIIdgLRoox7RC8wDQYJKoZIhvcNAQELBQAwczELMAkGA1UEBhMCQlIxEzARBgNVBAoTCklDUC1CcmFzaWwxNjA0BgNVBAsTLVNlY3JldGFyaWEgZGEgUmVjZWl0YSBGZWRlcmFsIGRvIEJyYXNpbCAtIFJGQjEXMBUGA1UEAxMOQUMgQ05ETCBSRkIgdjMwHhcNMjUxMDA5MTgxNjIzWhcNMjYxMDA5MTgxNjIzWjCCAQExCzAJBgNVBAYTAkJSMRMwEQYDVQQKEwpJQ1AtQnJhc2lsMQswCQYDVQQIEwJHTzEkMCIGA1UEBxMbU0FOVE8gQU5UT05JTyBETyBERVNDT0JFUlRPMRcwFQYDVQQLEw4zNDE3MzY4MjAwMDMxODE2MDQGA1UECxMtU2VjcmV0YXJpYSBkYSBSZWNlaXRhIEZlZGVyYWwgZG8gQnJhc2lsIC0gUkZCMRYwFAYDVQQLEw1SRkIgZS1DTlBKIEExMRMwEQYDVQQLEwpwcmVzZW5jaWFsMSwwKgYDVQQDEyNQT1NUTyBQQVJLIFhJSUkgTFREQToxMDczMjY0NDAwMDEyODCCASIwDQYJKoZIhvcNAQEBBQAD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gGBWBMAQMEoC8TLTAzMDQxOTUzMDg1NDA3NDgxMzQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMKAXBgVgTAEDB6AOEwwwMDAwMDAwMDAwMDAwHQYDVR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMEMAkGA1UdEwQCMAAwDQYJKoZIhvcNAQELBQADggIBACyajKy5o1ODOUdjM2yIHrbuGtoVGMnQjoHpqZyLJWL6Kbh8LcxwYf/y5S0VqVu4upaSSdd+Q6i+DlpJU3h9FKtyEnrb1tK4iuMi0gvXDc3h7mHgA67aPX2nSp+0rvuvpwTN8rixhCXVflxSa7/ULsVMsxs9XS8gWfmIRlTqtsfG1THZ3//ePggGxuJb0dAh9/qcOhBSXYY0A/4c2bJTKoN/C+Xgy1u/LUstTFeblPqkNOf6Qq8qd/3MXfY7WRFX9ijnla98FsQvGo/RX3/S7xG5O/zbifof8AU45qR78sZ8kUBHCezxecteSGzvXGiOBIXiflmf/AjVeEeZZxDEL8BRT2Cmil2SAQ+p17kDqVrIoZZxhu3VEPreghgLGMOF3f7sJuHuK9qemygpDeV1Q5tdT1tQkxLA6EO8iPdKuebp+PtndJHalr+6K06gDHl/8TFb+tfMK3XwFNBiJ/TdL2QU0tirbPI8Fun5+drpYOG4/1k973qrlKFJaKo5bOPPZOPe1kmCLHNd8c99bTxt0Drickc6ahT9s1d48H4BQxoo24H3fMbUFNQWu+CMZ3DGc1qbN/pPtVbBmBAc+MMNSuEiArzxkob1/S8CrrkJYIYcf3NjDDGZ1xz6RPhB0b4Nn5YdMvRwU/nLvumjl/8+8JJaGI17eBuDqAijW9W2qBBk \ No newline at end of file +113544039674VENDA DE PRODUÇÃO55112452026-01-12T11:27:13-03:0011353780011311100Bridi.4.0.3499999999999999ALUMINIO SUL DESC RESID IND EIRELIRODOVIA JOSE DE CARVALHOS/NFUNIL3537800PIEDADESP181700001058Brasil1532996276526082602118356558703000275BENTOMAR INDUSTRIA E COMERCIO DE MINERIOS LTDARUA 4331FERRAZ3543907RIO CLAROSP135080001058Brasil193539127315871243791161SEM GTINPO COM ALUMINIO INDUSTRIAL NAO LAMELAR760310005101KG1.000100.00100.00SEM GTINKG1.000100.001020333.3367.0018.0012.0099950100.002.603.000188.000.650.570188.003.002.646206200061.00000.000.000.000.000.000.0067.0012.000.000.000.000.000.000.000.000.000.000.000.00100.000.000.000.000.003.000.000.572.640.00103.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.00103.0090011.03Base de Cálculo do ICMS Reduzida conforme Art.15 do Anexo II do RICMS5a+GoQw7bId3FOqKlwtxxA5a2F4=QpsHL9SbRvZgODskHCthr5Tm1dW9wGhrfFOBLyEZklu80tb28R5P3gcsJ3Btyhkx9E9tvs1VfilNxqgwvU501I0YRBgNPMJQ1kaXurwjLu1/Pz8vQzg1QxSi0I+Fnw9TzB0KYa1aaIRoEq3bIDd/LA8YDlTJXf1QecCPhOhzDLqTY53S+m7SVgBonvcVCm16lDGdyKmViKoPHL9uR4ZetYKW8c1MZBrcoc6BM4QEdEnwQJLoRfZK/wYbzjUbvPoU8s8uUo6w6kgAT6Eku6HRc8OKVkTHps+aJWXK600Lyf29Xd5qOKX8CbAGA4C4Zl5tiWj7fd47Nio3AexhAYmuvA==MIIFRTCCAy2gAwIBAgIFMzMzMzMwDQYJKoZIhvcNAQELBQAwLjELMAkGA1UEBhMCQlIxDTALBgNVBAoMBFRSVDIxEDAOBgNVBAMMB0FDIFRlc3QwHhcNMTkwNTE5MDMzNjAxWhcNMjkwNTE2MDMzNjAxWjCBjDELMAkGA1UEBhMCQlIxEzARBgNVBAoMCklDUC1CcmFzaWwxETAPBgNVBAsMCEFSIFRlc3RlMRUwEwYDVQQLDAxSRkIgZS1DUEYgQTMxDjAMBgNVBAsMBVRFU1RFMS4wLAYDVQQDDCVDRVJUSUZJQ0FETyBDTlBKIFRFU1RFOjk5OTk5OTk5OTk5OTk5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsvU5zU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tlAeJEf1eUQSGQoYBt33d3FyVqunYhEFu4vBE1tu8tJdbi2WqbePOajlMqKwmPgjyGUBfRWKloCkiw2yM/sbWDeErz7isaOYhyty/Y84DYIJV/uhHYWqL/qanid6yI54ZpjhYsb7GemjYRwdLd3kUq81/R5nKAlgjnTzOYWKTiLCuSo5svSWht5ENiAr2zUq08txX5wQ8FHMkw87EjkrNpxR2bIGbY+j34YD5l+m83yC/kPoZKn+AE4CKCRexlNYwXymHsBcG5UzrSYxvXeJWc006HxLJEobaeGkamG5HlNh7DaG/u7k7xOmLQUy7B804sneE23GRJ2AbulJk7e \ No newline at end of file diff --git a/src/test/resources/IbsCbsRegular.xml b/src/test/resources/IbsCbsRegular.xml index 67617f12..a5dd13da 100644 --- a/src/test/resources/IbsCbsRegular.xml +++ b/src/test/resources/IbsCbsRegular.xml @@ -1 +1 @@ -113544039674VENDA DE PRODUÇÃO55112452026-01-12T11:27:13-03:0011353780011311100Bridi.4.0.3410732644000128ALUMINIO SUL DESC RESID IND EIRELIRODOVIA JOSE DE CARVALHOS/NFUNIL3537800PIEDADESP181700001058Brasil1532996276526082602118356558703000275BENTOMAR INDUSTRIA E COMERCIO DE MINERIOS LTDARUA 4331FERRAZ3543907RIO CLAROSP135080001058Brasil193539127315871243791161SEM GTINPO COM ALUMINIO INDUSTRIAL NAO LAMELAR760310005101KG1.000100.00100.00SEM GTINKG1.000100.001020333.3367.0018.0012.0099950100.002.603.000188.000.650.570188.003.002.6455055000184.790.00000.000.00000.000.000.00000.000000000010.10000.080.00000.000.90000.7667.0012.000.000.000.000.000.000.000.000.000.000.000.00100.000.000.000.000.003.000.000.572.640.00103.0084.790.000.000.000.000.000.000.000.000.000.000.000.000.000.00103.0090011.03Base de Cálculo do ICMS Reduzida conforme Art.15 do Anexo II do RICMSoqwiOUseitPSyMzfV33cP4BRKdg=gvtu1o8stkictj3k6YeW5+rQYDC3ounr/w1LZ1AQt0l0PdwgR3sX90ART9aGbsdV3CuT8tg9Vr10+2gJv+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vcNAQELBQADggIBACyajKy5o1ODOUdjM2yIHrbuGtoVGMnQjoHpqZyLJWL6Kbh8LcxwYf/y5S0VqVu4upaSSdd+Q6i+DlpJU3h9FKtyEnrb1tK4iuMi0gvXDc3h7mHgA67aPX2nSp+0rvuvpwTN8rixhCXVflxSa7/ULsVMsxs9XS8gWfmIRlTqtsfG1THZ3//ePggGxuJb0dAh9/qcOhBSXYY0A/4c2bJTKoN/C+Xgy1u/LUstTFeblPqkNOf6Qq8qd/3MXfY7WRFX9ijnla98FsQvGo/RX3/S7xG5O/zbifof8AU45qR78sZ8kUBHCezxecteSGzvXGiOBIXiflmf/AjVeEeZZxDEL8BRT2Cmil2SAQ+p17kDqVrIoZZxhu3VEPreghgLGMOF3f7sJuHuK9qemygpDeV1Q5tdT1tQkxLA6EO8iPdKuebp+PtndJHalr+6K06gDHl/8TFb+tfMK3XwFNBiJ/TdL2QU0tirbPI8Fun5+drpYOG4/1k973qrlKFJaKo5bOPPZOPe1kmCLHNd8c99bTxt0Drickc6ahT9s1d48H4BQxoo24H3fMbUFNQWu+CMZ3DGc1qbN/pPtVbBmBAc+MMNSuEiArzxkob1/S8CrrkJYIYcf3NjDDGZ1xz6RPhB0b4Nn5YdMvRwU/nLvumjl/8+8JJaGI17eBuDqAijW9W2qBBk \ No newline at end of file +113544039674VENDA DE PRODUÇÃO55112452026-01-12T11:27:13-03:0011353780011311100Bridi.4.0.3499999999999999ALUMINIO SUL DESC RESID IND EIRELIRODOVIA JOSE DE CARVALHOS/NFUNIL3537800PIEDADESP181700001058Brasil1532996276526082602118356558703000275BENTOMAR INDUSTRIA E COMERCIO DE MINERIOS LTDARUA 4331FERRAZ3543907RIO CLAROSP135080001058Brasil193539127315871243791161SEM GTINPO COM ALUMINIO INDUSTRIAL NAO LAMELAR760310005101KG1.000100.00100.00SEM GTINKG1.000100.001020333.3367.0018.0012.0099950100.002.603.000188.000.650.570188.003.002.6455055000184.790.00000.000.00000.000.000.00000.000000000010.10000.080.00000.000.90000.7667.0012.000.000.000.000.000.000.000.000.000.000.000.00100.000.000.000.000.003.000.000.572.640.00103.0084.790.000.000.000.000.000.000.000.000.000.000.000.000.000.00103.0090011.03Base de Cálculo do ICMS Reduzida conforme Art.15 do Anexo II do RICMStHE8fyHqixaezaQmkHgZxd+9Hxs=MTHNusC64sljHxDDygWYv+jYYowciItdSUWfdoiSiYGLyLQEudDlBZNTgj5tYaZ4qQ2vTvrQgYhsbGYTrYT4ujp5vPFh9DzFTaRgdLvhKTS285kZkRjDTZ2rD4B30aCeqUGBanNYeLLqnRNE9ZlieZfIfuuJzy1uUBHrwQ3wO8248mCGF0Mxk+YjQwtQcu5XaT/wRqxaKdEYhNfoH0h/Y7MndIIvozeSLS404N9a7HRfSACSNsnKaSaKZJ9gD7PZ32g8yIACiWiM0VddMDolbPY16EEE4Xm2ls/DBa6fCjgnJmOXyRDEo24WifjiiOaKnlzZi5Oowx1zpmbXNzEqhg==MIIFRTCCAy2gAwIBAgIFMzMzMzMwDQYJKoZIhvcNAQELBQAwLjELMAkGA1UEBhMCQlIxDTALBgNVBAoMBFRSVDIxEDAOBgNVBAMMB0FDIFRlc3QwHhcNMTkwNTE5MDMzNjAxWhcNMjkwNTE2MDMzNjAxWjCBjDELMAkGA1UEBhMCQlIxEzARBgNVBAoMCklDUC1CcmFzaWwxETAPBgNVBAsMCEFSIFRlc3RlMRUwEwYDVQQLDAxSRkIgZS1DUEYgQTMxDjAMBgNVBAsMBVRFU1RFMS4wLAYDVQQDDCVDRVJUSUZJQ0FETyBDTlBKIFRFU1RFOjk5OTk5OTk5OTk5OTk5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsvU5zUaIR8aMbgxYMPplTdDTN3a7SsSbWw3vhzFaKoi4DtQ7BgnLiRTpi55Ju6gVGAGoO/AbDgvB3RN3QZmShDCziAm+6/yfjXfKCgZxLFbU06BFvZgH74fGaBxw0XTgB+0b4ybvEcesowwJ5TabNbF/wfdzws9FiIMgLbTKD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TiLCuSo5svSWht5ENiAr2zUq08txX5wQ8FHMkw87EjkrNpxR2bIGbY+j34YD5l+m83yC/kPoZKn+AE4CKCRexlNYwXymHsBcG5UzrSYxvXeJWc006HxLJEobaeGkamG5HlNh7DaG/u7k7xOmLQUy7B804sneE23GRJ2AbulJk7e \ No newline at end of file diff --git a/src/test/resources/TesteXml.xml b/src/test/resources/TesteXml.xml index 1658262d..c8c22d75 100644 --- a/src/test/resources/TesteXml.xml +++ b/src/test/resources/TesteXml.xml @@ -26,7 +26,7 @@ Bridi.4.0.34 - 10732644000128 + 99999999999999 ALUMINIO SUL DESC RESID IND EIRELI RODOVIA JOSE DE CARVALHO