Browse Source

Simpliss - metodos de consulta validados em relação ao schema

pull/46/head
Danimar Ribeiro 9 years ago
parent
commit
a6b8fcd86d
  1. 15
      pytrustnfe/nfse/simpliss/__init__.py
  2. 16
      pytrustnfe/nfse/simpliss/templates/CancelarNFSe.xml
  3. 11
      pytrustnfe/nfse/simpliss/templates/CancelarNFSe.xsd
  4. 8
      pytrustnfe/nfse/simpliss/templates/ConsultarLote.xml
  5. 12
      pytrustnfe/nfse/simpliss/templates/ConsultarLote.xsd
  6. 10
      pytrustnfe/nfse/simpliss/templates/ConsultarNFSe.xml
  7. 22
      pytrustnfe/nfse/simpliss/templates/ConsultarNFSe.xsd
  8. 14
      pytrustnfe/nfse/simpliss/templates/ConsultarNFSePorRps.xml
  9. 12
      pytrustnfe/nfse/simpliss/templates/ConsultarNFSePorRps.xsd
  10. 11
      pytrustnfe/nfse/simpliss/templates/ConsultarSituacaoLote.xml
  11. 12
      pytrustnfe/nfse/simpliss/templates/ConsultarSituacaoLote.xsd
  12. 0
      pytrustnfe/nfse/simpliss/templates/EnviarLoteRps.xml
  13. 11
      pytrustnfe/nfse/simpliss/templates/EnviarLoteRps.xsd
  14. 735
      pytrustnfe/nfse/simpliss/templates/nfse_3.xsd
  15. 316
      pytrustnfe/nfse/simpliss/templates/xmldsig-core-schema20020212.xsd
  16. 4
      pytrustnfe/test/test_ginfes.py
  17. 61
      pytrustnfe/test/test_simpliss.py

15
pytrustnfe/nfse/simpliss/__init__.py

@ -15,8 +15,17 @@ def _send(certificado, method, **kwargs):
path = os.path.join(os.path.dirname(__file__), 'templates')
xml_send = render_xml(path, '%s.xml' % method, False, **kwargs)
schema = os.path.join(path, '%s.xsd' % method)
base_url = 'Achar URL'
from lxml import etree
nfe = etree.fromstring(xml_send)
esquema = etree.XMLSchema(etree.parse(schema))
esquema.validate(nfe)
erros = [x.message for x in esquema.error_log]
if erros:
raise Exception('\n'.join(erros))
base_url = 'http://sistemas.pmp.sp.gov.br/semfi/simpliss/ws_nfse/nfseservice.svc?wsdl'
cert, key = extract_cert_and_key_from_pfx(
certificado.pfx, certificado.password)
@ -44,8 +53,8 @@ def _send(certificado, method, **kwargs):
}
def envio_lote_rps(certificado, **kwargs):
return _send(certificado, 'EnvioLoteRps', **kwargs)
def enviar_lote_rps(certificado, **kwargs):
return _send(certificado, 'EnviarLoteRps', **kwargs)
def consultar_situacao_lote(certificado, **kwargs):

16
pytrustnfe/nfse/simpliss/templates/CancelarNFSe.xml

@ -1,15 +1,13 @@
<CancelarNfseEnvio xmlns = "http://www.betha.com.br/e-nota-contribuinte-ws">
<CancelarNfseEnvio xmlns="http://www.sistema.com.br/Nfse/arquivos/nfse_3.xsd">
<Pedido>
<InfPedidoCancelamento Id="1">
<InfPedidoCancelamento>
<IdentificacaoNfse>
<Numero>58</Numero>
<CpfCnpj>
<Cnpj>45111111111100</Cnpj>
</CpfCnpj>
<InscricaoMunicipal>123498</InscricaoMunicipal>
<CodigoMunicipio>4204608</CodigoMunicipio>
<Numero>{{ cancelar.numero_nfse }}</Numero>
<Cnpj>{{ cancelar.cnpj_prestador }}</Cnpj>
<InscricaoMunicipal>{{ cancelar.inscricao_prestador }}</InscricaoMunicipal>
<CodigoMunicipio>{{ cancelar.codigo_municipio }}</CodigoMunicipio>
</IdentificacaoNfse>
<CodigoCancelamento>1</CodigoCancelamento>
<CodigoCancelamento>{{ cancelar.codigo_cancelamento }}</CodigoCancelamento>
</InfPedidoCancelamento>
</Pedido>
</CancelarNfseEnvio>

11
pytrustnfe/nfse/simpliss/templates/CancelarNFSe.xsd

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<xsd:schema xmlns:tipo="http://www.sistema.com.br/Nfse/arquivos/nfse_3.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.abrasf.org.br/nfse" targetNamespace="http://www.abrasf.org.br/nfse" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsd:import schemaLocation="nfse_3.xsd" namespace="http://www.sistema.com.br/Nfse/arquivos/nfse_3.xsd" />
<xsd:element name="CancelarNfseEnvio">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Pedido" type="tipo:tcPedidoCancelamento" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

8
pytrustnfe/nfse/simpliss/templates/ConsultarLote.xml

@ -1,8 +1,6 @@
<ConsultarLoteRpsEnvio xmlns="http://www.betha.com.br/e-nota-contribuinte-ws">
<ConsultarLoteRpsEnvio xmlns="http://www.sistema.com.br/Nfse/arquivos/nfse_3.xsd">
<Prestador>
<CpfCnpj>
<Cnpj>45111111111100</Cnpj>
</CpfCnpj>
<Cnpj>{{ consulta.cnpj_prestador }}</Cnpj>
</Prestador>
<Protocolo>141542179222170</Protocolo>
<Protocolo>{{ consulta.protocolo }}</Protocolo>
</ConsultarLoteRpsEnvio>

12
pytrustnfe/nfse/simpliss/templates/ConsultarLote.xsd

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<xsd:schema xmlns:tipo="http://www.sistema.com.br/Nfse/arquivos/nfse_3.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.abrasf.org.br/nfse" targetNamespace="http://www.abrasf.org.br/nfse" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsd:import schemaLocation="nfse_3.xsd" namespace="http://www.sistema.com.br/Nfse/arquivos/nfse_3.xsd" />
<xsd:element name="ConsultarLoteRpsEnvio">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Prestador" type="tipo:tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1" />
<xsd:element name="Protocolo" type="tipo:tsNumeroProtocolo" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

10
pytrustnfe/nfse/simpliss/templates/ConsultarNFSe.xml

@ -1,8 +1,6 @@
<ConsultarLoteRpsEnvio xmlns="http://www.betha.com.br/e-nota-contribuinte-ws">
<ConsultarNfseEnvio xmlns="http://www.sistema.com.br/Nfse/arquivos/nfse_3.xsd">
<Prestador>
<CpfCnpj>
<Cnpj>45111111111100</Cnpj>
</CpfCnpj>
<Cnpj>{{ consulta.cnpj_prestador }}</Cnpj>
</Prestador>
<Protocolo>141542179222170</Protocolo>
</ConsultarLoteRpsEnvio>
<NumeroNfse>{{ consulta.numero_nfse }}</NumeroNfse>
</ConsultarNfseEnvio>

22
pytrustnfe/nfse/simpliss/templates/ConsultarNFSe.xsd

@ -0,0 +1,22 @@
<?xml version="1.0"?>
<xsd:schema xmlns:tipo="http://www.sistema.com.br/Nfse/arquivos/nfse_3.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.abrasf.org.br/nfse" targetNamespace="http://www.abrasf.org.br/nfse" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsd:import schemaLocation="nfse_3.xsd" namespace="http://www.sistema.com.br/Nfse/arquivos/nfse_3.xsd" />
<xsd:element name="ConsultarNfseEnvio">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Prestador" type="tipo:tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1" />
<xsd:element name="NumeroNfse" type="tipo:tsNumeroNfse" minOccurs="0" maxOccurs="1" />
<xsd:element name="PeriodoEmissao" minOccurs="0" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="DataInicial" type="xsd:date" minOccurs="1" maxOccurs="1" />
<xsd:element name="DataFinal" type="xsd:date" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Tomador" type="tipo:tcIdentificacaoTomador" minOccurs="0" maxOccurs="1" />
<xsd:element name="IntermediarioServico" type="tipo:tcIdentificacaoIntermediarioServico" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

14
pytrustnfe/nfse/simpliss/templates/ConsultarNFSePorRps.xml

@ -1,13 +1,11 @@
<ConsultarNfseRpsEnvio xmlns="http://www.betha.com.br/e-nota-contribuinte-ws">
<ConsultarNfseRpsEnvio xmlns="http://www.sistema.com.br/Nfse/arquivos/nfse_3.xsd">
<IdentificacaoRps>
<Numero>24</Numero>
<Serie>A1</Serie>
<Tipo>1</Tipo>
<Numero>{{ consulta.numero_rps }}</Numero>
<Serie>{{ consulta.serie_rps }}</Serie>
<Tipo>{{ consulta.tipo_rps }}</Tipo>
</IdentificacaoRps>
<Prestador>
<CpfCnpj>
<Cnpj>45111111111100</Cnpj>
</CpfCnpj>
<InscricaoMunicipal>123498</InscricaoMunicipal>
<Cnpj>{{ consulta.cnpj_prestador }}</Cnpj>
<InscricaoMunicipal>{{ consulta.inscricao_prestador }}</InscricaoMunicipal>
</Prestador>
</ConsultarNfseRpsEnvio>

12
pytrustnfe/nfse/simpliss/templates/ConsultarNFSePorRps.xsd

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<xsd:schema xmlns:tipo="http://www.sistema.com.br/Nfse/arquivos/nfse_3.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.abrasf.org.br/nfse" targetNamespace="http://www.abrasf.org.br/nfse" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsd:import schemaLocation="nfse_3.xsd" namespace="http://www.sistema.com.br/Nfse/arquivos/nfse_3.xsd" />
<xsd:element name="ConsultarNfseRpsEnvio">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="IdentificacaoRps" type="tipo:tcIdentificacaoRps" minOccurs="1" maxOccurs="1" />
<xsd:element name="Prestador" type="tipo:tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

11
pytrustnfe/nfse/simpliss/templates/ConsultarSituacaoLote.xml

@ -1,8 +1,7 @@
<ConsultarLoteRpsEnvio xmlns="http://www.betha.com.br/e-nota-contribuinte-ws">
<ConsultarSituacaoLoteRpsEnvio xmlns="http://www.sistema.com.br/Nfse/arquivos/nfse_3.xsd">
<Prestador>
<CpfCnpj>
<Cnpj>45111111111100</Cnpj>
</CpfCnpj>
<Cnpj>{{ consulta.cnpj_prestador }}</Cnpj>
<InscricaoMunicipal>{{ consulta.inscricao_prestador }}</InscricaoMunicipal>
</Prestador>
<Protocolo>141542179222170</Protocolo>
</ConsultarLoteRpsEnvio>
<Protocolo>{{ consulta.protocolo }}</Protocolo>
</ConsultarSituacaoLoteRpsEnvio>

12
pytrustnfe/nfse/simpliss/templates/ConsultarSituacaoLote.xsd

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<xsd:schema xmlns:tipo="http://www.sistema.com.br/Nfse/arquivos/nfse_3.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.abrasf.org.br/nfse" targetNamespace="http://www.abrasf.org.br/nfse" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsd:import schemaLocation="nfse_3.xsd" namespace="http://www.sistema.com.br/Nfse/arquivos/nfse_3.xsd" />
<xsd:element name="ConsultarSituacaoLoteRpsEnvio">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Prestador" type="tipo:tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1" />
<xsd:element name="Protocolo" type="tipo:tsNumeroProtocolo" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

0
pytrustnfe/nfse/simpliss/templates/EnvioLoteRps.xml → pytrustnfe/nfse/simpliss/templates/EnviarLoteRps.xml

11
pytrustnfe/nfse/simpliss/templates/EnviarLoteRps.xsd

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.abrasf.org.br/nfse" targetNamespace="http://www.abrasf.org.br/nfse" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsd:element name="EnviarLoteRpsEnvio">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="LoteRps" type="tcLoteRps" />
<xsd:element ref="dsig:Signature" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

735
pytrustnfe/nfse/simpliss/templates/nfse_3.xsd

@ -0,0 +1,735 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--Created with Liquid XML Studio Developer Edition (Trial) 9.0.11.3078 (http://www.liquid-technologies.com)-->
<xsd:schema xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns="http://www.sistema.com.br/Nfse/arquivos/nfse_3.xsd" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.sistema.com.br/Nfse/arquivos/nfse_3.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import schemaLocation="xmldsig-core-schema20020212.xsd" namespace="http://www.w3.org/2000/09/xmldsig#" />
<xsd:simpleType name="tsCodigoVerificacao">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="9" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsStatusRps">
<xsd:restriction base="xsd:byte">
<xsd:pattern value="1|2" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsStatusNfse">
<xsd:restriction base="xsd:byte">
<xsd:pattern value="1|2" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsNaturezaOperacao">
<xsd:restriction base="xsd:byte">
<xsd:pattern value="1|2|3|4|5|6" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsRegimeEspecialTributacao">
<xsd:restriction base="xsd:byte">
<xsd:pattern value="1|2|3|4|5|6" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsSimNao">
<xsd:restriction base="xsd:byte">
<xsd:pattern value="1|2" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsNumeroRps">
<xsd:restriction base="xsd:nonNegativeInteger">
<xsd:totalDigits value="15" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsSerieRps">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="5" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsSerieNfse">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="5" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsTipoRps">
<xsd:restriction base="xsd:byte">
<xsd:pattern value="1|2|3" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsOutrasInformacoes">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="255" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsValor">
<xsd:restriction base="xsd:decimal">
<xsd:totalDigits value="15" />
<xsd:fractionDigits value="2" fixed="true" />
<xsd:minInclusive value="0" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsItemListaServico">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="5" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsCodigoCnae">
<xsd:restriction base="xsd:int">
<xsd:totalDigits value="7" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsCodigoTributacao">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="20" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsAliquota">
<xsd:restriction base="xsd:decimal">
<xsd:totalDigits value="5" />
<xsd:fractionDigits value="4" />
<xsd:minInclusive value="0" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsDiscriminacao">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="2000" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsCodigoMunicipioIbge">
<xsd:restriction base="xsd:int">
<xsd:totalDigits value="7" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsInscricaoMunicipal">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="15" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsInscricaoEstadual">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="20" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsRazaoSocial">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="115" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsNomeFantasia">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="60" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsCnpj">
<xsd:restriction base="xsd:string">
<xsd:length value="14" fixed="true" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsEndereco">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="125" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsNumeroEndereco">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsComplementoEndereco">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="60" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsBairro">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="60" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsUf">
<xsd:restriction base="xsd:string">
<xsd:length value="2" fixed="true" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsCep">
<xsd:restriction base="xsd:int">
<xsd:totalDigits value="8" fixed="true" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsEmail">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="80" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsTelefone">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="11" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsCpf">
<xsd:restriction base="xsd:string">
<xsd:length value="11" fixed="true" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsIndicacaoCpfCnpj">
<xsd:restriction base="xsd:byte">
<xsd:pattern value="1|2|3" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsCodigoObra">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="15" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsArt">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="15" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsNumeroLote">
<xsd:restriction base="xsd:nonNegativeInteger">
<xsd:totalDigits value="15" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsNumeroProtocolo">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsSituacaoLoteRps">
<xsd:restriction base="xsd:byte">
<xsd:pattern value="1|2|3|4" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsQuantidadeRps">
<xsd:restriction base="xsd:int" />
</xsd:simpleType>
<xsd:simpleType name="tsCodigoMensagemAlerta">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="4" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsDescricaoMensagemAlerta">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="200" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsCodigoCancelamentoNfse">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="4" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsIdTag">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="255" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsLink">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="200" />
<xsd:minLength value="1" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<!-- definition of complex elements -->
<xsd:complexType name="tcCpfCnpj">
<xsd:choice>
<xsd:element name="Cpf" type="tsCpf" minOccurs="1" maxOccurs="1" />
<xsd:element name="Cnpj" type="tsCnpj" minOccurs="1" maxOccurs="1" />
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="tcEndereco">
<xsd:sequence>
<xsd:element name="Endereco" type="tsEndereco" minOccurs="0" maxOccurs="1" />
<xsd:element name="Numero" type="tsNumeroEndereco" minOccurs="0" maxOccurs="1" />
<xsd:element name="Complemento" type="tsComplementoEndereco" minOccurs="0" maxOccurs="1" />
<xsd:element name="Bairro" type="tsBairro" minOccurs="0" maxOccurs="1" />
<xsd:element name="CodigoMunicipio" type="tsCodigoMunicipioIbge" minOccurs="0" maxOccurs="1" />
<xsd:element name="Uf" type="tsUf" minOccurs="0" maxOccurs="1" />
<xsd:element name="Cep" type="tsCep" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcContato">
<xsd:sequence>
<xsd:element name="Telefone" type="tsTelefone" minOccurs="0" maxOccurs="1" />
<xsd:element name="Email" type="tsEmail" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcIdentificacaoOrgaoGerador">
<xsd:sequence>
<xsd:element name="CodigoMunicipio" type="tsCodigoMunicipioIbge" minOccurs="1" maxOccurs="1" />
<xsd:element name="Uf" type="tsUf" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcIdentificacaoRps">
<xsd:sequence>
<xsd:element name="Numero" type="tsNumeroRps" minOccurs="1" maxOccurs="1" />
<xsd:element name="Serie" type="tsSerieRps" minOccurs="1" maxOccurs="1" />
<xsd:element name="Tipo" type="tsTipoRps" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcIdentificacaoPrestador">
<xsd:sequence>
<xsd:element name="Cnpj" type="tsCnpj" minOccurs="1" maxOccurs="1" />
<xsd:element name="InscricaoMunicipal" type="tsInscricaoMunicipal" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcIdentificacaoTomador">
<xsd:sequence>
<xsd:element name="CpfCnpj" type="tcCpfCnpj" minOccurs="0" maxOccurs="1" />
<xsd:element name="InscricaoMunicipal" type="tsInscricaoMunicipal" minOccurs="0" maxOccurs="1" />
<xsd:element name="InscricaoEstadual" type="tsInscricaoEstadual" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcDadosTomador">
<xsd:sequence>
<xsd:element name="IdentificacaoTomador" type="tcIdentificacaoTomador" minOccurs="0" maxOccurs="1" />
<xsd:element name="RazaoSocial" type="tsRazaoSocial" minOccurs="0" maxOccurs="1" />
<xsd:element name="Endereco" type="tcEndereco" minOccurs="0" maxOccurs="1" />
<xsd:element name="Contato" type="tcContato" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcIdentificacaoIntermediarioServico">
<xsd:sequence>
<xsd:element name="RazaoSocial" type="tsRazaoSocial" minOccurs="1" maxOccurs="1" />
<xsd:element name="CpfCnpj" type="tcCpfCnpj" minOccurs="1" maxOccurs="1" />
<xsd:element name="InscricaoMunicipal" type="tsInscricaoMunicipal" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcValores">
<xsd:sequence>
<xsd:element name="ValorServicos" type="tsValor" minOccurs="1" maxOccurs="1" />
<xsd:element name="ValorDeducoes" type="tsValor" minOccurs="0" maxOccurs="1" />
<xsd:element name="ValorPis" type="tsValor" minOccurs="0" maxOccurs="1" />
<xsd:element name="ValorCofins" type="tsValor" minOccurs="0" maxOccurs="1" />
<xsd:element name="ValorInss" type="tsValor" minOccurs="0" maxOccurs="1" />
<xsd:element name="ValorIr" type="tsValor" minOccurs="0" maxOccurs="1" />
<xsd:element name="ValorCsll" type="tsValor" minOccurs="0" maxOccurs="1" />
<xsd:element name="IssRetido" type="tsSimNao" minOccurs="1" maxOccurs="1" />
<xsd:element name="ValorIss" type="tsValor" minOccurs="0" maxOccurs="1" />
<xsd:element name="ValorIssRetido" type="tsValor" minOccurs="0" maxOccurs="1" />
<xsd:element name="OutrasRetencoes" type="tsValor" minOccurs="0" maxOccurs="1" />
<xsd:element name="BaseCalculo" type="tsValor" minOccurs="0" maxOccurs="1" />
<xsd:element name="Aliquota" type="tsAliquota" minOccurs="0" maxOccurs="1" />
<xsd:element name="ValorLiquidoNfse" type="tsValor" minOccurs="0" maxOccurs="1" />
<xsd:element name="DescontoIncondicionado" type="tsValor" minOccurs="0" maxOccurs="1" />
<xsd:element name="DescontoCondicionado" type="tsValor" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcDadosServico">
<xsd:sequence>
<xsd:element name="Valores" type="tcValores" minOccurs="1" maxOccurs="1" />
<xsd:element name="ItemListaServico" type="tsItemListaServico" minOccurs="1" maxOccurs="1" />
<xsd:element name="CodigoCnae" type="tsCodigoCnae" minOccurs="0" maxOccurs="1" />
<xsd:element name="CodigoTributacaoMunicipio" type="tsCodigoTributacao" minOccurs="0" maxOccurs="1" />
<xsd:element name="Discriminacao" type="tsDiscriminacao" minOccurs="1" maxOccurs="1" />
<xsd:element name="CodigoMunicipio" type="tsCodigoMunicipioIbge" minOccurs="1" maxOccurs="1" />
<xsd:element name="ItensServico" type="tcItemServico" minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcDadosConstrucaoCivil">
<xsd:sequence>
<xsd:element name="CodigoObra" type="tsCodigoObra" minOccurs="1" maxOccurs="1" />
<xsd:element name="Art" type="tsArt" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcDadosPrestador">
<xsd:sequence>
<xsd:element name="IdentificacaoPrestador" type="tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1" />
<xsd:element name="RazaoSocial" type="tsRazaoSocial" minOccurs="1" maxOccurs="1" />
<xsd:element name="NomeFantasia" type="tsNomeFantasia" minOccurs="0" maxOccurs="1" />
<xsd:element name="Endereco" type="tcEndereco" minOccurs="1" maxOccurs="1" />
<xsd:element name="Contato" type="tcContato" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcInfRps">
<xsd:sequence>
<xsd:element name="IdentificacaoRps" type="tcIdentificacaoRps" minOccurs="1" maxOccurs="1" />
<xsd:element name="DataEmissao" type="xsd:dateTime" minOccurs="1" maxOccurs="1" />
<xsd:element name="NaturezaOperacao" type="tsNaturezaOperacao" minOccurs="1" maxOccurs="1" />
<xsd:element name="RegimeEspecialTributacao" type="tsRegimeEspecialTributacao" minOccurs="0" maxOccurs="1" />
<xsd:element name="OptanteSimplesNacional" type="tsSimNao" minOccurs="1" maxOccurs="1" />
<xsd:element name="IncentivadorCultural" type="tsSimNao" minOccurs="1" maxOccurs="1" />
<xsd:element name="Status" type="tsStatusRps" minOccurs="1" maxOccurs="1" />
<xsd:element name="RpsSubstituido" type="tcIdentificacaoRps" minOccurs="0" maxOccurs="1" />
<xsd:element name="OutrasInformacoes" type="tsOutrasInformacoes" minOccurs="0" maxOccurs="1" />
<xsd:element name="Servico" type="tcDadosServico" minOccurs="1" maxOccurs="1" />
<xsd:element name="Prestador" type="tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1" />
<xsd:element name="Tomador" type="tcDadosTomador" minOccurs="0" maxOccurs="1" />
<xsd:element name="IntermediarioServico" type="tcIdentificacaoIntermediarioServico" minOccurs="0" maxOccurs="1" />
<xsd:element name="ContrucaoCivil" type="tcDadosConstrucaoCivil" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="id" type="tsIdTag" />
</xsd:complexType>
<xsd:complexType name="tcRps">
<xsd:sequence>
<xsd:element name="InfRps" type="tcInfRps" minOccurs="1" maxOccurs="1" />
<xsd:element ref="dsig:Signature" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcIdentificacaoNfse">
<xsd:sequence>
<xsd:element name="Numero" type="tsNumeroNfse" minOccurs="1" maxOccurs="1" />
<xsd:element name="Cnpj" type="tsCnpj" minOccurs="1" maxOccurs="1" />
<xsd:element name="InscricaoMunicipal" type="tsInscricaoMunicipal" minOccurs="0" maxOccurs="1" />
<xsd:element name="CodigoMunicipio" type="tsCodigoMunicipioIbge" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcInfNfse">
<xsd:sequence>
<xsd:element name="Numero" type="tsNumeroNfse" minOccurs="1" maxOccurs="1" />
<xsd:element name="CodigoVerificacao" type="tsCodigoVerificacao" minOccurs="1" maxOccurs="1" />
<xsd:element name="DataEmissao" type="xsd:dateTime" minOccurs="1" maxOccurs="1" />
<xsd:element name="IdentificacaoRps" type="tcIdentificacaoRps" minOccurs="0" maxOccurs="1" />
<xsd:element name="DataEmissaoRps" type="xsd:date" minOccurs="0" maxOccurs="1" />
<xsd:element name="NaturezaOperacao" type="tsNaturezaOperacao" minOccurs="1" maxOccurs="1" />
<xsd:element name="RegimeEspecialTributacao" type="tsRegimeEspecialTributacao" minOccurs="0" maxOccurs="1" />
<xsd:element name="OptanteSimplesNacional" type="tsSimNao" minOccurs="1" maxOccurs="1" />
<xsd:element name="IncentivadorCultural" type="tsSimNao" minOccurs="1" maxOccurs="1" />
<xsd:element name="Competencia" type="xsd:dateTime" minOccurs="1" maxOccurs="1" />
<xsd:element name="NfseSubstituida" type="tsNumeroNfse" minOccurs="0" maxOccurs="1" />
<xsd:element name="OutrasInformacoes" type="tsOutrasInformacoes" minOccurs="0" maxOccurs="1" />
<xsd:element name="Servico" type="tcDadosServico" minOccurs="1" maxOccurs="1" />
<xsd:element name="ValorCredito" type="tsValor" minOccurs="0" maxOccurs="1" />
<xsd:element name="PrestadorServico" type="tcDadosPrestador" minOccurs="1" maxOccurs="1" />
<xsd:element name="TomadorServico" type="tcDadosTomador" minOccurs="0" maxOccurs="1" />
<xsd:element name="IntermediarioServico" type="tcIdentificacaoIntermediarioServico" minOccurs="0" maxOccurs="1" />
<xsd:element name="OrgaoGerador" type="tcIdentificacaoOrgaoGerador" minOccurs="1" maxOccurs="1" />
<xsd:element name="ContrucaoCivil" type="tcDadosConstrucaoCivil" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="id" type="tsIdTag" />
</xsd:complexType>
<xsd:complexType name="tcNfse">
<xsd:sequence>
<xsd:element name="InfNfse" type="tcInfNfse" minOccurs="1" maxOccurs="1" />
<xsd:element ref="dsig:Signature" minOccurs="0" maxOccurs="2" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcInfPedidoCancelamento">
<xsd:sequence>
<xsd:element name="IdentificacaoNfse" type="tcIdentificacaoNfse" minOccurs="1" maxOccurs="1" />
<xsd:element name="CodigoCancelamento" type="tsCodigoCancelamentoNfse" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="id" type="tsIdTag" />
</xsd:complexType>
<xsd:complexType name="tcPedidoCancelamento">
<xsd:sequence>
<xsd:element name="InfPedidoCancelamento" type="tcInfPedidoCancelamento" minOccurs="1" maxOccurs="1" />
<xsd:element ref="dsig:Signature" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcConfirmacaoCancelamento">
<xsd:sequence>
<xsd:element name="Pedido" type="tcPedidoCancelamento" minOccurs="1" maxOccurs="1" />
<xsd:element name="DataHoraCancelamento" type="xsd:dateTime" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="id" type="tsIdTag" />
</xsd:complexType>
<xsd:complexType name="tcCancelamentoNfse">
<xsd:sequence>
<xsd:element name="Confirmacao" type="tcConfirmacaoCancelamento" minOccurs="1" maxOccurs="1" />
<xsd:element ref="dsig:Signature" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcInfSubstituicaoNfse">
<xsd:sequence>
<xsd:element name="NfseSubstituidora" type="tsNumeroNfse" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="id" type="tsIdTag" />
</xsd:complexType>
<xsd:complexType name="tcSubstituicaoNfse">
<xsd:sequence>
<xsd:element name="SubstituicaoNfse" type="tcInfSubstituicaoNfse" minOccurs="1" maxOccurs="1" />
<xsd:element ref="dsig:Signature" minOccurs="0" maxOccurs="2" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcCompNfse">
<xsd:sequence>
<xsd:element name="Nfse" type="tcNfse" minOccurs="1" maxOccurs="1" />
<xsd:element name="NfseCancelamento" type="tcCancelamentoNfse" minOccurs="0" maxOccurs="1" />
<xsd:element name="NfseSubstituicao" type="tcSubstituicaoNfse" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="CompNfse" type="tcCompNfse" />
<xsd:element name="ListaMensagemRetorno">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="MensagemRetorno" type="tcMensagemRetorno" minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="tcMensagemRetorno">
<xsd:sequence>
<xsd:element name="Codigo" type="tsCodigoMensagemAlerta" minOccurs="1" maxOccurs="1" />
<xsd:element name="Mensagem" type="tsDescricaoMensagemAlerta" minOccurs="1" maxOccurs="1" />
<xsd:element name="Correcao" type="tsDescricaoMensagemAlerta" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcMensagemRetornoLote">
<xsd:sequence>
<xsd:element name="IdentificacaoRps" type="tcIdentificacaoRps" minOccurs="1" maxOccurs="1" />
<xsd:element name="Codigo" type="tsCodigoMensagemAlerta" minOccurs="1" maxOccurs="1" />
<xsd:element name="Mensagem" type="tsDescricaoMensagemAlerta" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="tcLoteRps">
<xsd:sequence>
<xsd:element name="NumeroLote" type="tsNumeroLote" minOccurs="1" maxOccurs="1" />
<xsd:element name="Cnpj" type="tsCnpj" minOccurs="1" maxOccurs="1" />
<xsd:element name="InscricaoMunicipal" type="tsInscricaoMunicipal" minOccurs="1" maxOccurs="1" />
<xsd:element name="QuantidadeRps" type="tsQuantidadeRps" minOccurs="1" maxOccurs="1" />
<xsd:element name="ListaRps" minOccurs="1" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Rps" type="tcRps" minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="tsIdTag" />
</xsd:complexType>
<xsd:element name="EnviarLoteRpsResposta">
<xsd:complexType>
<xsd:choice>
<xsd:sequence>
<xsd:element name="NumeroLote" type="tsNumeroLote" minOccurs="1" maxOccurs="1" />
<xsd:element name="DataRecebimento" type="xsd:dateTime" minOccurs="1" maxOccurs="1" />
<xsd:element name="Protocolo" type="tsNumeroProtocolo" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
<xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1" />
</xsd:choice>
</xsd:complexType>
</xsd:element>
<!-- definition of simple elements -->
<xsd:simpleType name="tsItemServicoDescricao">
<xsd:restriction base="xsd:string">
<xsd:minLength value="1" />
<xsd:maxLength value="100" />
<xsd:whiteSpace value="collapse" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsItemServicoQuantidade">
<xsd:restriction base="tsValor" />
</xsd:simpleType>
<xsd:simpleType name="tsItemServicoIssTributavel">
<xsd:restriction base="xsd:byte">
<xsd:pattern value="1|2" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tsNumeroNfse">
<xsd:restriction base="xsd:nonNegativeInteger">
<xsd:totalDigits value="15" />
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="tcItemServico">
<xsd:sequence>
<xsd:element name="Descricao" type="tsItemServicoDescricao" minOccurs="1" maxOccurs="1" />
<xsd:element name="Quantidade" type="tsItemServicoQuantidade" minOccurs="1" maxOccurs="1" />
<xsd:element name="ValorUnitario" type="tsValor" minOccurs="1" maxOccurs="1" />
<xsd:element name="IssTributavel" type="tsItemServicoIssTributavel" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="EnviarLoteRpsEnvio">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="LoteRps" type="tcLoteRps" />
<xsd:element ref="dsig:Signature" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ConsultarSituacaoLoteRpsResposta">
<xsd:complexType>
<xsd:choice>
<xsd:sequence>
<xsd:element name="NumeroLote" type="tsNumeroLote" minOccurs="1" maxOccurs="1" />
<xsd:element name="Situacao" type="tsSituacaoLoteRps" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
<xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1" />
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="ConsultarSituacaoLoteRpsEnvio">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Prestador" type="tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1" />
<xsd:element name="Protocolo" type="tsNumeroProtocolo" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ConsultarNfseRpsResposta">
<xsd:complexType>
<xsd:choice>
<xsd:element name="CompNfse" type="tcCompNfse" minOccurs="1" maxOccurs="1" />
<xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1" />
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="ConsultarNfseRpsEnvio">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="IdentificacaoRps" type="tcIdentificacaoRps" minOccurs="1" maxOccurs="1" />
<xsd:element name="Prestador" type="tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ConsultarNfseResposta">
<xsd:complexType>
<xsd:choice>
<xsd:element name="ListaNfse" minOccurs="1" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CompNfse" type="tcCompNfse" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1" />
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="ConsultarNfseEnvio">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Prestador" type="tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1" />
<xsd:element name="NumeroNfse" type="tsNumeroNfse" minOccurs="0" maxOccurs="1" />
<xsd:element name="PeriodoEmissao" minOccurs="0" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="DataInicial" type="xsd:date" minOccurs="1" maxOccurs="1" />
<xsd:element name="DataFinal" type="xsd:date" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Tomador" type="tcIdentificacaoTomador" minOccurs="0" maxOccurs="1" />
<xsd:element name="IntermediarioServico" type="tcIdentificacaoIntermediarioServico" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ConsultarLoteRpsResposta">
<xsd:complexType>
<xsd:choice>
<xsd:element name="ListaNfse" minOccurs="1" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CompNfse" type="tcCompNfse" minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1" />
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="ConsultarLoteRpsEnvio">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Prestador" type="tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1" />
<xsd:element name="Protocolo" type="tsNumeroProtocolo" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CancelarNfseResposta">
<xsd:complexType>
<xsd:choice>
<xsd:element name="Cancelamento" type="tcCancelamentoNfse" />
<xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1" />
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="CancelarNfseEnvio">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Pedido" type="tcPedidoCancelamento" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="tcInfNovaNfse">
<xsd:sequence>
<xsd:element name="NaturezaOperacao" type="tsNaturezaOperacao" minOccurs="1" maxOccurs="1" />
<xsd:element name="RegimeEspecialTributacao" type="tsRegimeEspecialTributacao" minOccurs="0" maxOccurs="1" />
<xsd:element name="OptanteSimplesNacional" type="tsSimNao" minOccurs="1" maxOccurs="1" />
<xsd:element name="IncentivadorCultural" type="tsSimNao" minOccurs="1" maxOccurs="1" />
<xsd:element name="Status" type="tsStatusNfse" minOccurs="1" maxOccurs="1" />
<xsd:element name="Competencia" type="xsd:dateTime" minOccurs="1" maxOccurs="1" />
<xsd:element name="NfseSubstituida" type="tsNumeroNfse" minOccurs="0" maxOccurs="1" />
<xsd:element name="OutrasInformacoes" type="tsOutrasInformacoes" minOccurs="0" maxOccurs="1" />
<xsd:element name="Servico" type="tcDadosServico" minOccurs="1" maxOccurs="1" />
<xsd:element name="Tomador" type="tcDadosTomador" minOccurs="0" maxOccurs="1" />
<xsd:element name="IntermediarioServico" type="tcIdentificacaoIntermediarioServico" minOccurs="0" maxOccurs="1" />
<xsd:element name="ContrucaoCivil" type="tcDadosConstrucaoCivil" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="id" type="tsIdTag" />
</xsd:complexType>
<xsd:complexType name="tcIdentNovaNfse">
<xsd:sequence>
<xsd:element name="IdentificacaoPrestador" type="tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1" />
<xsd:element name="Numero" type="tsNumeroNfse" minOccurs="1" maxOccurs="1" />
<xsd:element name="Serie" type="tsSerieNfse" minOccurs="1" maxOccurs="1" />
<xsd:element name="CodigoVerificacao" type="tsCodigoVerificacao" minOccurs="1" maxOccurs="1" />
<xsd:element name="DataEmissao" type="xsd:dateTime" minOccurs="1" maxOccurs="1" />
<xsd:element name="Link" type="tsLink" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="id" type="tsIdTag" />
</xsd:complexType>
<xsd:complexType name="tcRespostaIdentNovaNfse">
<xsd:sequence>
<xsd:element name="IdentificacaoNfse" type="tcIdentNovaNfse" />
<xsd:element ref="dsig:Signature" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="GerarNovaNfseEnvio">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Prestador" type="tcIdentificacaoPrestador" minOccurs="1" maxOccurs="1" />
<xsd:element name="InformacaoNfse" type="tcInfNovaNfse" minOccurs="1" maxOccurs="1" />
<xsd:element ref="dsig:Signature" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GerarNovaNfseResposta">
<xsd:complexType>
<xsd:choice>
<xsd:element name="NovaNfse" type="tcRespostaIdentNovaNfse" minOccurs="1" maxOccurs="1" />
<xsd:element ref="ListaMensagemRetorno" minOccurs="1" maxOccurs="1" />
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>

316
pytrustnfe/nfse/simpliss/templates/xmldsig-core-schema20020212.xsd

@ -0,0 +1,316 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Schema for XML Signatures
http://www.w3.org/2000/09/xmldsig#
$Revision: 1.7 $ on $Date: 2007/09/20 19:06:50 $ by $Author: p052373 $
Copyright 2001 The Internet Society and W3C (Massachusetts Institute
of Technology, Institut National de Recherche en Informatique et en
Automatique, Keio University). All Rights Reserved.
http://www.w3.org/Consortium/Legal/
This document is governed by the W3C Software License [1] as described
in the FAQ [2].
[1] http://www.w3.org/Consortium/Legal/copyright-software-19980720
[2] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD
-->
<!--
Download em 23/02/2007
Link:
http://www.w3.org/TR/xmldsig-core/#sec-Schema
http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd
-->
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
targetNamespace="http://www.w3.org/2000/09/xmldsig#"
version="0.1" elementFormDefault="qualified">
<!-- Basic Types Defined for Signatures -->
<simpleType name="CryptoBinary">
<restriction base="base64Binary">
</restriction>
</simpleType>
<!-- Start Signature -->
<element name="Signature" type="ds:SignatureType"/>
<complexType name="SignatureType">
<sequence>
<element ref="ds:SignedInfo"/>
<element ref="ds:SignatureValue"/>
<element ref="ds:KeyInfo" minOccurs="0"/>
<element ref="ds:Object" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="Id" type="ID" use="optional"/>
</complexType>
<element name="SignatureValue" type="ds:SignatureValueType"/>
<complexType name="SignatureValueType">
<simpleContent>
<extension base="base64Binary">
<attribute name="Id" type="ID" use="optional"/>
</extension>
</simpleContent>
</complexType>
<!-- Start SignedInfo -->
<element name="SignedInfo" type="ds:SignedInfoType"/>
<complexType name="SignedInfoType">
<sequence>
<element ref="ds:CanonicalizationMethod"/>
<element ref="ds:SignatureMethod"/>
<element ref="ds:Reference" maxOccurs="unbounded"/>
</sequence>
<attribute name="Id" type="ID" use="optional"/>
</complexType>
<element name="CanonicalizationMethod" type="ds:CanonicalizationMethodType"/>
<complexType name="CanonicalizationMethodType" mixed="true">
<sequence>
<any namespace="##any" minOccurs="0" maxOccurs="unbounded"/>
<!-- (0,unbounded) elements from (1,1) namespace -->
</sequence>
<attribute name="Algorithm" type="anyURI" use="required"/>
</complexType>
<element name="SignatureMethod" type="ds:SignatureMethodType"/>
<complexType name="SignatureMethodType" mixed="true">
<sequence>
<element name="HMACOutputLength" minOccurs="0" type="ds:HMACOutputLengthType"/>
<any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
<!-- (0,unbounded) elements from (1,1) external namespace -->
</sequence>
<attribute name="Algorithm" type="anyURI" use="required"/>
</complexType>
<!-- Start Reference -->
<element name="Reference" type="ds:ReferenceType"/>
<complexType name="ReferenceType">
<sequence>
<element ref="ds:Transforms" minOccurs="0"/>
<element ref="ds:DigestMethod"/>
<element ref="ds:DigestValue"/>
</sequence>
<attribute name="Id" type="ID" use="optional"/>
<attribute name="URI" type="anyURI" use="optional"/>
<attribute name="Type" type="anyURI" use="optional"/>
</complexType>
<element name="Transforms" type="ds:TransformsType"/>
<complexType name="TransformsType">
<sequence>
<element ref="ds:Transform" maxOccurs="unbounded"/>
</sequence>
</complexType>
<element name="Transform" type="ds:TransformType"/>
<complexType name="TransformType" mixed="true">
<choice minOccurs="0" maxOccurs="unbounded">
<any namespace="##other" processContents="lax"/>
<!-- (1,1) elements from (0,unbounded) namespaces -->
<element name="XPath" type="string"/>
</choice>
<attribute name="Algorithm" type="anyURI" use="required"/>
</complexType>
<!-- End Reference -->
<element name="DigestMethod" type="ds:DigestMethodType"/>
<complexType name="DigestMethodType" mixed="true">
<sequence>
<any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="Algorithm" type="anyURI" use="required"/>
</complexType>
<element name="DigestValue" type="ds:DigestValueType"/>
<simpleType name="DigestValueType">
<restriction base="base64Binary"/>
</simpleType>
<!-- End SignedInfo -->
<!-- Start KeyInfo -->
<element name="KeyInfo" type="ds:KeyInfoType"/>
<complexType name="KeyInfoType" mixed="true">
<choice maxOccurs="unbounded">
<element ref="ds:KeyName"/>
<element ref="ds:KeyValue"/>
<element ref="ds:RetrievalMethod"/>
<element ref="ds:X509Data"/>
<element ref="ds:PGPData"/>
<element ref="ds:SPKIData"/>
<element ref="ds:MgmtData"/>
<any processContents="lax" namespace="##other"/>
<!-- (1,1) elements from (0,unbounded) namespaces -->
</choice>
<attribute name="Id" type="ID" use="optional"/>
</complexType>
<element name="KeyName" type="string"/>
<element name="MgmtData" type="string"/>
<element name="KeyValue" type="ds:KeyValueType"/>
<complexType name="KeyValueType" mixed="true">
<choice>
<element ref="ds:DSAKeyValue"/>
<element ref="ds:RSAKeyValue"/>
<any namespace="##other" processContents="lax"/>
</choice>
</complexType>
<element name="RetrievalMethod" type="ds:RetrievalMethodType"/>
<complexType name="RetrievalMethodType">
<sequence>
<element ref="ds:Transforms" minOccurs="0"/>
</sequence>
<attribute name="URI" type="anyURI"/>
<attribute name="Type" type="anyURI" use="optional"/>
</complexType>
<!-- Start X509Data -->
<element name="X509Data" type="ds:X509DataType"/>
<complexType name="X509DataType">
<sequence maxOccurs="unbounded">
<choice>
<element name="X509IssuerSerial" type="ds:X509IssuerSerialType"/>
<element name="X509SKI" type="base64Binary"/>
<element name="X509SubjectName" type="string"/>
<element name="X509Certificate" type="base64Binary"/>
<element name="X509CRL" type="base64Binary"/>
<any namespace="##other" processContents="lax"/>
</choice>
</sequence>
</complexType>
<complexType name="X509IssuerSerialType">
<sequence>
<element name="X509IssuerName" type="string"/>
<element name="X509SerialNumber" type="integer"/>
</sequence>
</complexType>
<!-- End X509Data -->
<!-- Begin PGPData -->
<element name="PGPData" type="ds:PGPDataType"/>
<complexType name="PGPDataType">
<choice>
<sequence>
<element name="PGPKeyID" type="base64Binary"/>
<element name="PGPKeyPacket" type="base64Binary" minOccurs="0"/>
<any namespace="##other" processContents="lax" minOccurs="0"
maxOccurs="unbounded"/>
</sequence>
<sequence>
<element name="PGPKeyPacket" type="base64Binary"/>
<any namespace="##other" processContents="lax" minOccurs="0"
maxOccurs="unbounded"/>
</sequence>
</choice>
</complexType>
<!-- End PGPData -->
<!-- Begin SPKIData -->
<element name="SPKIData" type="ds:SPKIDataType"/>
<complexType name="SPKIDataType">
<sequence maxOccurs="unbounded">
<element name="SPKISexp" type="base64Binary"/>
<any namespace="##other" processContents="lax" minOccurs="0"/>
</sequence>
</complexType>
<!-- End SPKIData -->
<!-- End KeyInfo -->
<!-- Start Object (Manifest, SignatureProperty) -->
<element name="Object" type="ds:ObjectType"/>
<complexType name="ObjectType" mixed="true">
<sequence minOccurs="0" maxOccurs="unbounded">
<any namespace="##any" processContents="lax"/>
</sequence>
<attribute name="Id" type="ID" use="optional"/>
<attribute name="MimeType" type="string" use="optional"/> <!-- add a grep facet -->
<attribute name="Encoding" type="anyURI" use="optional"/>
</complexType>
<element name="Manifest" type="ds:ManifestType"/>
<complexType name="ManifestType">
<sequence>
<element ref="ds:Reference" maxOccurs="unbounded"/>
</sequence>
<attribute name="Id" type="ID" use="optional"/>
</complexType>
<element name="SignatureProperties" type="ds:SignaturePropertiesType"/>
<complexType name="SignaturePropertiesType">
<sequence>
<element ref="ds:SignatureProperty" maxOccurs="unbounded"/>
</sequence>
<attribute name="Id" type="ID" use="optional"/>
</complexType>
<element name="SignatureProperty" type="ds:SignaturePropertyType"/>
<complexType name="SignaturePropertyType" mixed="true">
<choice maxOccurs="unbounded">
<any namespace="##other" processContents="lax"/>
<!-- (1,1) elements from (1,unbounded) namespaces -->
</choice>
<attribute name="Target" type="anyURI" use="required"/>
<attribute name="Id" type="ID" use="optional"/>
</complexType>
<!-- End Object (Manifest, SignatureProperty) -->
<!-- Start Algorithm Parameters -->
<simpleType name="HMACOutputLengthType">
<restriction base="integer"/>
</simpleType>
<!-- Start KeyValue Element-types -->
<element name="DSAKeyValue" type="ds:DSAKeyValueType"/>
<complexType name="DSAKeyValueType">
<sequence>
<sequence minOccurs="0">
<element name="P" type="ds:CryptoBinary"/>
<element name="Q" type="ds:CryptoBinary"/>
</sequence>
<element name="G" type="ds:CryptoBinary" minOccurs="0"/>
<element name="Y" type="ds:CryptoBinary"/>
<element name="J" type="ds:CryptoBinary" minOccurs="0"/>
<sequence minOccurs="0">
<element name="Seed" type="ds:CryptoBinary"/>
<element name="PgenCounter" type="ds:CryptoBinary"/>
</sequence>
</sequence>
</complexType>
<element name="RSAKeyValue" type="ds:RSAKeyValueType"/>
<complexType name="RSAKeyValueType">
<sequence>
<element name="Modulus" type="ds:CryptoBinary"/>
<element name="Exponent" type="ds:CryptoBinary"/>
</sequence>
</complexType>
<!-- End KeyValue Element-types -->
<!-- End Signature -->
</schema>

4
pytrustnfe/test/test_ginfes.py

@ -13,8 +13,8 @@ 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')
pfx_source = open('/home/danimar/Downloads/2016.pfx', 'r').read()
pfx = Certificado(pfx_source, '1234')
dados = {'ambiente': 'homologacao'}
retorno = consultar_situacao_lote(

61
pytrustnfe/test/test_simpliss.py

@ -0,0 +1,61 @@
# -*- 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.simpliss import consultar_situacao_lote
from pytrustnfe.nfse.simpliss import consultar_nfse_por_rps
from pytrustnfe.nfse.simpliss import consultar_lote
from pytrustnfe.nfse.simpliss import consultar_nfse
from pytrustnfe.nfse.simpliss import cancelar_nfse
class test_nfse_simpliss(unittest.TestCase):
caminho = os.path.dirname(__file__)
def test_consulta_situacao_lote(self):
pfx_source = open('/home/danimar/Downloads/2016.pfx', 'r').read()
pfx = Certificado(pfx_source, '1234')
dados = {'cnpj_prestador': '12345678910234', 'inscricao_prestador': '123', 'protocolo': '123'}
response = consultar_situacao_lote(
pfx, consulta=dados, ambiente='homologacao')
print response
def test_consultar_nfse_rps(self):
pfx_source = open('/home/danimar/Downloads/2016.pfx', 'r').read()
pfx = Certificado(pfx_source, '1234')
dados = {'cnpj_prestador': '01234567896589', 'inscricao_prestador': '123',
'tipo_rps': '1', 'serie_rps': 'AZ', 'numero_rps': 123}
consultar_nfse_por_rps(
pfx, consulta=dados, ambiente='homologacao')
def test_consultar_lote(self):
pfx_source = open('/home/danimar/Downloads/2016.pfx', 'r').read()
pfx = Certificado(pfx_source, '1234')
dados = {'cnpj_prestador': '01234567896589', 'protocolo': '545455451'}
consultar_lote(
pfx, consulta=dados, ambiente='homologacao')
def test_consultar_nfse(self):
pfx_source = open('/home/danimar/Downloads/2016.pfx', 'r').read()
pfx = Certificado(pfx_source, '1234')
dados = {'cnpj_prestador': '01234567896589', 'numero_nfse': '545455451'}
consultar_nfse(
pfx, consulta=dados, ambiente='homologacao')
def test_cancelar_nfse(self):
pfx_source = open('/home/danimar/Downloads/2016.pfx', 'r').read()
pfx = Certificado(pfx_source, '1234')
dados = {'cnpj_prestador': '01234567896589', 'numero_nfse': '545455451',
'inscricao_prestador': 454564, 'codigo_municipio': 1234567,
'codigo_cancelamento': '1'}
cancelar_nfse(
pfx, cancelar=dados, ambiente='homologacao')
Loading…
Cancel
Save