19 changed files with 454 additions and 0 deletions
-
69pytrustnfe/nfse/ginfes/__init__.py
-
15pytrustnfe/nfse/ginfes/templates/CancelarNfseV3.xml
-
8pytrustnfe/nfse/ginfes/templates/ConsultarLoteRpsV3.xml
-
13pytrustnfe/nfse/ginfes/templates/ConsultarNfsePorRpsV3.xml
-
8pytrustnfe/nfse/ginfes/templates/ConsultarNfseV3.xml
-
7pytrustnfe/nfse/ginfes/templates/ConsultarSituacaoLoteRpsV3.xml
-
11pytrustnfe/nfse/ginfes/templates/RecepcionarLoteRpsV3.xml
-
82pytrustnfe/nfse/ginfes/templates/Rps.xml
-
68pytrustnfe/nfse/simpliss/__init__.py
-
15pytrustnfe/nfse/simpliss/templates/CancelarNFSe.xml
-
8pytrustnfe/nfse/simpliss/templates/ConsultarLote.xml
-
8pytrustnfe/nfse/simpliss/templates/ConsultarNFSe.xml
-
13pytrustnfe/nfse/simpliss/templates/ConsultarNFSePorRps.xml
-
8pytrustnfe/nfse/simpliss/templates/ConsultarSituacaoLote.xml
-
11pytrustnfe/nfse/simpliss/templates/EnvioLoteRps.xml
-
82pytrustnfe/nfse/simpliss/templates/Rps.xml
-
25pytrustnfe/test/test_ginfes.py
-
0pytrustnfe/test/test_simpliss.py
-
3setup.py
@ -1,3 +1,72 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
# © 2016 Danimar Ribeiro, Trustcode |
# © 2016 Danimar Ribeiro, Trustcode |
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
|
import os |
||||
|
import suds |
||||
|
from pytrustnfe.xml import render_xml, sanitize_response |
||||
|
from pytrustnfe.client import get_authenticated_client |
||||
|
from pytrustnfe.certificado import extract_cert_and_key_from_pfx, save_cert_key |
||||
|
from pytrustnfe.nfse.assinatura import Assinatura |
||||
|
|
||||
|
|
||||
|
def _send(certificado, method, **kwargs): |
||||
|
path = os.path.join(os.path.dirname(__file__), 'templates') |
||||
|
xml_send = render_xml(path, '%s.xml' % method, False, **kwargs) |
||||
|
|
||||
|
base_url = '' |
||||
|
if kwargs['ambiente'] == 'producao': |
||||
|
base_url = 'https://producao.ginfes.com.br/ServiceGinfesImpl?wsdl' |
||||
|
else: |
||||
|
base_url = 'https://homologacao.ginfes.com.br/ServiceGinfesImpl?wsdl' |
||||
|
|
||||
|
cert, key = extract_cert_and_key_from_pfx( |
||||
|
certificado.pfx, certificado.password) |
||||
|
cert, key = save_cert_key(cert, key) |
||||
|
|
||||
|
client = get_authenticated_client(base_url, cert, key) |
||||
|
|
||||
|
pfx_path = certificado.save_pfx() |
||||
|
signer = Assinatura(pfx_path, certificado.password) |
||||
|
xml_send = signer.assina_xml(xml_send, '') |
||||
|
|
||||
|
try: |
||||
|
header = '<ns2:cabecalho xmlns:ns2="http://www.ginfes.com.br/cabecalho_v03.xsd" versao="3"><versaoDados>3</versaoDados></ns2:cabecalho>' #noqa |
||||
|
response = getattr(client.service, method)(header, xml_send) |
||||
|
except suds.WebFault, e: |
||||
|
return { |
||||
|
'sent_xml': xml_send, |
||||
|
'received_xml': e.fault.faultstring, |
||||
|
'object': None |
||||
|
} |
||||
|
|
||||
|
response, obj = sanitize_response(response) |
||||
|
return { |
||||
|
'sent_xml': xml_send, |
||||
|
'received_xml': response, |
||||
|
'object': obj |
||||
|
} |
||||
|
|
||||
|
|
||||
|
def envio_lote_rps(certificado, **kwargs): |
||||
|
return _send(certificado, 'RecepcionarLoteRpsV3', **kwargs) |
||||
|
|
||||
|
|
||||
|
def consultar_situacao_lote(certificado, **kwargs): |
||||
|
return _send(certificado, 'ConsultarSituacaoLoteRpsV3', **kwargs) |
||||
|
|
||||
|
|
||||
|
def consultar_nfse_por_rps(certificado, **kwargs): |
||||
|
return _send(certificado, 'ConsultarNfsePorRpsV3', **kwargs) |
||||
|
|
||||
|
|
||||
|
def consultar_lote(certificado, **kwargs): |
||||
|
return _send(certificado, 'ConsultarLoteRpsV3', **kwargs) |
||||
|
|
||||
|
|
||||
|
def consultar_nfse(certificado, **kwargs): |
||||
|
return _send(certificado, 'ConsultarNfseV3', **kwargs) |
||||
|
|
||||
|
|
||||
|
def cancelar_nfse(certificado, **kwargs): |
||||
|
return _send(certificado, 'CancelarNfseV3', **kwargs) |
||||
@ -0,0 +1,15 @@ |
|||||
|
<CancelarNfseEnvio xmlns = "http://www.betha.com.br/e-nota-contribuinte-ws"> |
||||
|
<Pedido> |
||||
|
<InfPedidoCancelamento Id="1"> |
||||
|
<IdentificacaoNfse> |
||||
|
<Numero>58</Numero> |
||||
|
<CpfCnpj> |
||||
|
<Cnpj>45111111111100</Cnpj> |
||||
|
</CpfCnpj> |
||||
|
<InscricaoMunicipal>123498</InscricaoMunicipal> |
||||
|
<CodigoMunicipio>4204608</CodigoMunicipio> |
||||
|
</IdentificacaoNfse> |
||||
|
<CodigoCancelamento>1</CodigoCancelamento> |
||||
|
</InfPedidoCancelamento> |
||||
|
</Pedido> |
||||
|
</CancelarNfseEnvio> |
||||
@ -0,0 +1,8 @@ |
|||||
|
<ConsultarLoteRpsEnvio xmlns="http://www.betha.com.br/e-nota-contribuinte-ws"> |
||||
|
<Prestador> |
||||
|
<CpfCnpj> |
||||
|
<Cnpj>45111111111100</Cnpj> |
||||
|
</CpfCnpj> |
||||
|
</Prestador> |
||||
|
<Protocolo>141542179222170</Protocolo> |
||||
|
</ConsultarLoteRpsEnvio> |
||||
@ -0,0 +1,13 @@ |
|||||
|
<ConsultarNfseRpsEnvio xmlns="http://www.betha.com.br/e-nota-contribuinte-ws"> |
||||
|
<IdentificacaoRps> |
||||
|
<Numero>24</Numero> |
||||
|
<Serie>A1</Serie> |
||||
|
<Tipo>1</Tipo> |
||||
|
</IdentificacaoRps> |
||||
|
<Prestador> |
||||
|
<CpfCnpj> |
||||
|
<Cnpj>45111111111100</Cnpj> |
||||
|
</CpfCnpj> |
||||
|
<InscricaoMunicipal>123498</InscricaoMunicipal> |
||||
|
</Prestador> |
||||
|
</ConsultarNfseRpsEnvio> |
||||
@ -0,0 +1,8 @@ |
|||||
|
<ConsultarLoteRpsEnvio xmlns="http://www.betha.com.br/e-nota-contribuinte-ws"> |
||||
|
<Prestador> |
||||
|
<CpfCnpj> |
||||
|
<Cnpj>45111111111100</Cnpj> |
||||
|
</CpfCnpj> |
||||
|
</Prestador> |
||||
|
<Protocolo>141542179222170</Protocolo> |
||||
|
</ConsultarLoteRpsEnvio> |
||||
@ -0,0 +1,7 @@ |
|||||
|
<ConsultarSituacaoLoteRpsEnvio xmlns="http://www.ginfes.com.br/servico_consultar_situacao_lote_rps_envio_v03.xsd" xmlns:tipos="http://www.ginfes.com.br/tipos_v03.xsd"> |
||||
|
<Prestador> |
||||
|
<tipos:Cnpj>45111111111100</tipos:Cnpj> |
||||
|
<tipos:InscricaoMunicipal>123456</tipos:InscricaoMunicipal> |
||||
|
</Prestador> |
||||
|
<Protocolo>141542179222170</Protocolo> |
||||
|
</ConsultarSituacaoLoteRpsEnvio> |
||||
@ -0,0 +1,11 @@ |
|||||
|
<EnviarLoteRpsEnvio xmlns = "http://www.betha.com.br/e-nota-contribuinte-ws"> |
||||
|
<LoteRps Id="lote1" versao="2.02"> |
||||
|
<NumeroLote>2012024</NumeroLote> |
||||
|
<Cnpj>45111111111100</Cnpj> |
||||
|
<InscricaoMunicipal>123498</InscricaoMunicipal> |
||||
|
<QuantidadeRps>1</QuantidadeRps> |
||||
|
<ListaRps> |
||||
|
{% include 'rps.xml' %} |
||||
|
</ListaRps> |
||||
|
</LoteRps> |
||||
|
</EnviarLoteRpsEnvio> |
||||
@ -0,0 +1,82 @@ |
|||||
|
<Rps> |
||||
|
<InfRps Id="rps1"> |
||||
|
<IdentificacaoRps> |
||||
|
<Numero>25</Numero> |
||||
|
<Serie>A1</Serie> |
||||
|
<Tipo>1</Tipo> |
||||
|
</IdentificacaoRps> |
||||
|
<DataEmissao>2014-12-06</DataEmissao> |
||||
|
<NaturezaOperacao>1</NaturezaOperacao> |
||||
|
<RegimeEspecialTributacao>1</RegimeEspecialTributacao> |
||||
|
<OptanteSimplesNacional>1</OptanteSimplesNacional> |
||||
|
<IncentivadorCultural>1</IncentivadorCultural> |
||||
|
<Status>1</Status> |
||||
|
<RpsSubstituido> |
||||
|
<Numero>1</Numero> |
||||
|
<Serie>1</Serie> |
||||
|
<Tipo>1</Tipo> |
||||
|
</RpsSubstituido> |
||||
|
<OutrasInformacoes>1</OutrasInformacoes> |
||||
|
<Servico> |
||||
|
<Valores> |
||||
|
<ValorServicos>100</ValorServicos> |
||||
|
<ValorDeducoes>0</ValorDeducoes> |
||||
|
<ValorPis>0</ValorPis> |
||||
|
<ValorCofins>0</ValorCofins> |
||||
|
<ValorInss>0</ValorInss> |
||||
|
<ValorIr>0</ValorIr> |
||||
|
<ValorCsll>0</ValorCsll> |
||||
|
<OutrasRetencoes>0</OutrasRetencoes> |
||||
|
<DescontoIncondicionado>0</DescontoIncondicionado> |
||||
|
<DescontoCondicionado>0</DescontoCondicionado> |
||||
|
</Valores> |
||||
|
<IssRetido>2</IssRetido> |
||||
|
<ItemListaServico>0702</ItemListaServico> |
||||
|
<CodigoTributacaoMunicipio>2525</CodigoTributacaoMunicipio> |
||||
|
<Discriminacao>Prog.</Discriminacao> |
||||
|
<CodigoMunicipio>4204608</CodigoMunicipio> |
||||
|
<ExigibilidadeISS>1</ExigibilidadeISS> |
||||
|
<MunicipioIncidencia>4204608</MunicipioIncidencia> |
||||
|
</Servico> |
||||
|
<Prestador> |
||||
|
<CpfCnpj> |
||||
|
<Cnpj>45111111111100</Cnpj> |
||||
|
</CpfCnpj> |
||||
|
<InscricaoMunicipal>123498</InscricaoMunicipal> |
||||
|
</Prestador> |
||||
|
<Tomador> |
||||
|
<IdentificacaoTomador> |
||||
|
<CpfCnpj> |
||||
|
<Cnpj>83787494000123</Cnpj> |
||||
|
</CpfCnpj> |
||||
|
</IdentificacaoTomador> |
||||
|
<RazaoSocial>INSTITUICAO FINANCEIRA</RazaoSocial> |
||||
|
<Endereco> |
||||
|
<Endereco>AV. 7 DE SETEMBRO</Endereco> |
||||
|
<Numero>1505</Numero> |
||||
|
<Complemento>AO LADO DO JOAO AUTOMOVEIS</Complemento> |
||||
|
<Bairro>CENTRO</Bairro> |
||||
|
<CodigoMunicipio>4201406</CodigoMunicipio> |
||||
|
<Uf>SC</Uf> |
||||
|
<Cep>88900000</Cep> |
||||
|
</Endereco> |
||||
|
<Contato> |
||||
|
<Telefone>4835220026</Telefone> |
||||
|
<Email>luiz.alves@cxpostal.com</Email> |
||||
|
</Contato> |
||||
|
</Tomador> |
||||
|
<IntermediarioServico> |
||||
|
<IdentificacaoIntermediario> |
||||
|
<CpfCnpj> |
||||
|
<Cnpj>06410987065144</Cnpj> |
||||
|
</CpfCnpj> |
||||
|
<InscricaoMunicipal>22252</InscricaoMunicipal> |
||||
|
</IdentificacaoIntermediario> |
||||
|
<RazaoSocial>CONSTRUTORA TERRA FIRME</RazaoSocial> |
||||
|
</IntermediarioServico> |
||||
|
<ConstrucaoCivil> |
||||
|
<CodigoObra>142</CodigoObra> |
||||
|
<Art>1/2014</Art> |
||||
|
</ConstrucaoCivil> |
||||
|
</InfDeclaracaoPrestacaoServico> |
||||
|
</Rps> |
||||
@ -0,0 +1,68 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# © 2016 Danimar Ribeiro, Trustcode |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
|
import os |
||||
|
import suds |
||||
|
from pytrustnfe.xml import render_xml, sanitize_response |
||||
|
from pytrustnfe.client import get_authenticated_client |
||||
|
from pytrustnfe.certificado import extract_cert_and_key_from_pfx, save_cert_key |
||||
|
from pytrustnfe.nfse.assinatura import Assinatura |
||||
|
|
||||
|
|
||||
|
def _send(certificado, method, **kwargs): |
||||
|
# A little hack to test |
||||
|
path = os.path.join(os.path.dirname(__file__), 'templates') |
||||
|
|
||||
|
xml_send = render_xml(path, '%s.xml' % method, False, **kwargs) |
||||
|
|
||||
|
base_url = 'Achar URL' |
||||
|
|
||||
|
cert, key = extract_cert_and_key_from_pfx( |
||||
|
certificado.pfx, certificado.password) |
||||
|
cert, key = save_cert_key(cert, key) |
||||
|
client = get_authenticated_client(base_url, cert, key) |
||||
|
|
||||
|
pfx_path = certificado.save_pfx() |
||||
|
signer = Assinatura(pfx_path, certificado.password) |
||||
|
xml_send = signer.assina_xml(xml_send, '') |
||||
|
|
||||
|
try: |
||||
|
response = getattr(client.service, method)(1, xml_send) |
||||
|
except suds.WebFault, e: |
||||
|
return { |
||||
|
'sent_xml': xml_send, |
||||
|
'received_xml': e.fault.faultstring, |
||||
|
'object': None |
||||
|
} |
||||
|
|
||||
|
response, obj = sanitize_response(response) |
||||
|
return { |
||||
|
'sent_xml': xml_send, |
||||
|
'received_xml': response, |
||||
|
'object': obj |
||||
|
} |
||||
|
|
||||
|
|
||||
|
def envio_lote_rps(certificado, **kwargs): |
||||
|
return _send(certificado, 'EnvioLoteRps', **kwargs) |
||||
|
|
||||
|
|
||||
|
def consultar_situacao_lote(certificado, **kwargs): |
||||
|
return _send(certificado, 'ConsultarSituacaoLote', **kwargs) |
||||
|
|
||||
|
|
||||
|
def consultar_nfse_por_rps(certificado, **kwargs): |
||||
|
return _send(certificado, 'ConsultarNFSePorRps', **kwargs) |
||||
|
|
||||
|
|
||||
|
def consultar_lote(certificado, **kwargs): |
||||
|
return _send(certificado, 'ConsultarLote', **kwargs) |
||||
|
|
||||
|
|
||||
|
def consultar_nfse(certificado, **kwargs): |
||||
|
return _send(certificado, 'ConsultarNFSe', **kwargs) |
||||
|
|
||||
|
|
||||
|
def cancelar_nfse(certificado, **kwargs): |
||||
|
return _send(certificado, 'CancelarNFSe', **kwargs) |
||||
@ -0,0 +1,15 @@ |
|||||
|
<CancelarNfseEnvio xmlns = "http://www.betha.com.br/e-nota-contribuinte-ws"> |
||||
|
<Pedido> |
||||
|
<InfPedidoCancelamento Id="1"> |
||||
|
<IdentificacaoNfse> |
||||
|
<Numero>58</Numero> |
||||
|
<CpfCnpj> |
||||
|
<Cnpj>45111111111100</Cnpj> |
||||
|
</CpfCnpj> |
||||
|
<InscricaoMunicipal>123498</InscricaoMunicipal> |
||||
|
<CodigoMunicipio>4204608</CodigoMunicipio> |
||||
|
</IdentificacaoNfse> |
||||
|
<CodigoCancelamento>1</CodigoCancelamento> |
||||
|
</InfPedidoCancelamento> |
||||
|
</Pedido> |
||||
|
</CancelarNfseEnvio> |
||||
@ -0,0 +1,8 @@ |
|||||
|
<ConsultarLoteRpsEnvio xmlns="http://www.betha.com.br/e-nota-contribuinte-ws"> |
||||
|
<Prestador> |
||||
|
<CpfCnpj> |
||||
|
<Cnpj>45111111111100</Cnpj> |
||||
|
</CpfCnpj> |
||||
|
</Prestador> |
||||
|
<Protocolo>141542179222170</Protocolo> |
||||
|
</ConsultarLoteRpsEnvio> |
||||
@ -0,0 +1,8 @@ |
|||||
|
<ConsultarLoteRpsEnvio xmlns="http://www.betha.com.br/e-nota-contribuinte-ws"> |
||||
|
<Prestador> |
||||
|
<CpfCnpj> |
||||
|
<Cnpj>45111111111100</Cnpj> |
||||
|
</CpfCnpj> |
||||
|
</Prestador> |
||||
|
<Protocolo>141542179222170</Protocolo> |
||||
|
</ConsultarLoteRpsEnvio> |
||||
@ -0,0 +1,13 @@ |
|||||
|
<ConsultarNfseRpsEnvio xmlns="http://www.betha.com.br/e-nota-contribuinte-ws"> |
||||
|
<IdentificacaoRps> |
||||
|
<Numero>24</Numero> |
||||
|
<Serie>A1</Serie> |
||||
|
<Tipo>1</Tipo> |
||||
|
</IdentificacaoRps> |
||||
|
<Prestador> |
||||
|
<CpfCnpj> |
||||
|
<Cnpj>45111111111100</Cnpj> |
||||
|
</CpfCnpj> |
||||
|
<InscricaoMunicipal>123498</InscricaoMunicipal> |
||||
|
</Prestador> |
||||
|
</ConsultarNfseRpsEnvio> |
||||
@ -0,0 +1,8 @@ |
|||||
|
<ConsultarLoteRpsEnvio xmlns="http://www.betha.com.br/e-nota-contribuinte-ws"> |
||||
|
<Prestador> |
||||
|
<CpfCnpj> |
||||
|
<Cnpj>45111111111100</Cnpj> |
||||
|
</CpfCnpj> |
||||
|
</Prestador> |
||||
|
<Protocolo>141542179222170</Protocolo> |
||||
|
</ConsultarLoteRpsEnvio> |
||||
@ -0,0 +1,11 @@ |
|||||
|
<EnviarLoteRpsEnvio xmlns = "http://www.betha.com.br/e-nota-contribuinte-ws"> |
||||
|
<LoteRps Id="lote1" versao="2.02"> |
||||
|
<NumeroLote>2012024</NumeroLote> |
||||
|
<Cnpj>45111111111100</Cnpj> |
||||
|
<InscricaoMunicipal>123498</InscricaoMunicipal> |
||||
|
<QuantidadeRps>1</QuantidadeRps> |
||||
|
<ListaRps> |
||||
|
{% include 'rps.xml' %} |
||||
|
</ListaRps> |
||||
|
</LoteRps> |
||||
|
</EnviarLoteRpsEnvio> |
||||
@ -0,0 +1,82 @@ |
|||||
|
<Rps> |
||||
|
<InfRps Id="rps1"> |
||||
|
<IdentificacaoRps> |
||||
|
<Numero>25</Numero> |
||||
|
<Serie>A1</Serie> |
||||
|
<Tipo>1</Tipo> |
||||
|
</IdentificacaoRps> |
||||
|
<DataEmissao>2014-12-06</DataEmissao> |
||||
|
<NaturezaOperacao>1</NaturezaOperacao> |
||||
|
<RegimeEspecialTributacao>1</RegimeEspecialTributacao> |
||||
|
<OptanteSimplesNacional>1</OptanteSimplesNacional> |
||||
|
<IncentivadorCultural>1</IncentivadorCultural> |
||||
|
<Status>1</Status> |
||||
|
<RpsSubstituido> |
||||
|
<Numero>1</Numero> |
||||
|
<Serie>1</Serie> |
||||
|
<Tipo>1</Tipo> |
||||
|
</RpsSubstituido> |
||||
|
<OutrasInformacoes>1</OutrasInformacoes> |
||||
|
<Servico> |
||||
|
<Valores> |
||||
|
<ValorServicos>100</ValorServicos> |
||||
|
<ValorDeducoes>0</ValorDeducoes> |
||||
|
<ValorPis>0</ValorPis> |
||||
|
<ValorCofins>0</ValorCofins> |
||||
|
<ValorInss>0</ValorInss> |
||||
|
<ValorIr>0</ValorIr> |
||||
|
<ValorCsll>0</ValorCsll> |
||||
|
<OutrasRetencoes>0</OutrasRetencoes> |
||||
|
<DescontoIncondicionado>0</DescontoIncondicionado> |
||||
|
<DescontoCondicionado>0</DescontoCondicionado> |
||||
|
</Valores> |
||||
|
<IssRetido>2</IssRetido> |
||||
|
<ItemListaServico>0702</ItemListaServico> |
||||
|
<CodigoTributacaoMunicipio>2525</CodigoTributacaoMunicipio> |
||||
|
<Discriminacao>Prog.</Discriminacao> |
||||
|
<CodigoMunicipio>4204608</CodigoMunicipio> |
||||
|
<ExigibilidadeISS>1</ExigibilidadeISS> |
||||
|
<MunicipioIncidencia>4204608</MunicipioIncidencia> |
||||
|
</Servico> |
||||
|
<Prestador> |
||||
|
<CpfCnpj> |
||||
|
<Cnpj>45111111111100</Cnpj> |
||||
|
</CpfCnpj> |
||||
|
<InscricaoMunicipal>123498</InscricaoMunicipal> |
||||
|
</Prestador> |
||||
|
<Tomador> |
||||
|
<IdentificacaoTomador> |
||||
|
<CpfCnpj> |
||||
|
<Cnpj>83787494000123</Cnpj> |
||||
|
</CpfCnpj> |
||||
|
</IdentificacaoTomador> |
||||
|
<RazaoSocial>INSTITUICAO FINANCEIRA</RazaoSocial> |
||||
|
<Endereco> |
||||
|
<Endereco>AV. 7 DE SETEMBRO</Endereco> |
||||
|
<Numero>1505</Numero> |
||||
|
<Complemento>AO LADO DO JOAO AUTOMOVEIS</Complemento> |
||||
|
<Bairro>CENTRO</Bairro> |
||||
|
<CodigoMunicipio>4201406</CodigoMunicipio> |
||||
|
<Uf>SC</Uf> |
||||
|
<Cep>88900000</Cep> |
||||
|
</Endereco> |
||||
|
<Contato> |
||||
|
<Telefone>4835220026</Telefone> |
||||
|
<Email>luiz.alves@cxpostal.com</Email> |
||||
|
</Contato> |
||||
|
</Tomador> |
||||
|
<IntermediarioServico> |
||||
|
<IdentificacaoIntermediario> |
||||
|
<CpfCnpj> |
||||
|
<Cnpj>06410987065144</Cnpj> |
||||
|
</CpfCnpj> |
||||
|
<InscricaoMunicipal>22252</InscricaoMunicipal> |
||||
|
</IdentificacaoIntermediario> |
||||
|
<RazaoSocial>CONSTRUTORA TERRA FIRME</RazaoSocial> |
||||
|
</IntermediarioServico> |
||||
|
<ConstrucaoCivil> |
||||
|
<CodigoObra>142</CodigoObra> |
||||
|
<Art>1/2014</Art> |
||||
|
</ConstrucaoCivil> |
||||
|
</InfDeclaracaoPrestacaoServico> |
||||
|
</Rps> |
||||
@ -0,0 +1,25 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# © 2016 Danimar Ribeiro, Trustcode |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
import os.path |
||||
|
import unittest |
||||
|
from pytrustnfe.certificado import Certificado |
||||
|
from pytrustnfe.nfse.ginfes import consultar_situacao_lote |
||||
|
from pytrustnfe.nfse.ginfes import consultar_nfse |
||||
|
|
||||
|
|
||||
|
class test_nfse_ginfes(unittest.TestCase): |
||||
|
|
||||
|
caminho = os.path.dirname(__file__) |
||||
|
|
||||
|
def test_consulta_situacao_lote(self): |
||||
|
pfx_source = open('/home/danimar/Downloads/machado.pfx', 'r').read() |
||||
|
pfx = Certificado(pfx_source, '123456789') |
||||
|
|
||||
|
dados = {'ambiente': 'homologacao'} |
||||
|
retorno = consultar_situacao_lote( |
||||
|
pfx, consulta=dados, ambiente='homologacao') |
||||
|
|
||||
|
print retorno |
||||
|
self.assertNotEqual(retorno['received_xml'], '') |
||||
|
self.assertEqual(retorno['object'].Cabecalho.Sucesso, True) |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue