From 7b7e72cce43629742355f848d7fa5c70d30108b6 Mon Sep 17 00:00:00 2001
From: marinaGD <36993009+marinaGD@users.noreply.github.com>
Date: Mon, 22 Jul 2019 18:31:45 -0300
Subject: [PATCH 1/4] * [ADD] vICMSSubstituto tag in nfe xml
---
pytrustnfe/nfe/templates/NfeAutorizacao.xml | 1 +
requirements.txt | 7 ++++---
setup.py | 4 ++--
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/pytrustnfe/nfe/templates/NfeAutorizacao.xml b/pytrustnfe/nfe/templates/NfeAutorizacao.xml
index bf1cc8b..a4e9af8 100644
--- a/pytrustnfe/nfe/templates/NfeAutorizacao.xml
+++ b/pytrustnfe/nfe/templates/NfeAutorizacao.xml
@@ -500,6 +500,7 @@
{{ imposto.ICMS.CST }}
{{ imposto.ICMS.vBCSTRet }}
{{ imposto.ICMS.pST }}
+ {{imposto.ICMS.vICMSSubstituto}}
{{ imposto.ICMS.vICMSSTRet }}
{{ imposto.ICMS.vBCFCPSTRet }}
{{ imposto.ICMS.pFCPSTRet }}
diff --git a/requirements.txt b/requirements.txt
index 428cdb7..4a3ce46 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@
-lxml >= 3.5.0, < 4
+lxml
nose
mock
coveralls
@@ -10,8 +10,9 @@ suds >= 0.4
suds_requests >= 0.3
defusedxml >= 0.4.1, < 0.6
eight >= 0.3.0, < 0.5
-cryptography >= 1.8, < 1.10
-pyOpenSSL >= 16.0.0, < 17
+cryptography >= 1.8, < 3
+pyOpenSSL < 19, >= 17.5.0
certifi >= 2015.11.20.1
reportlab
pytz
+zeep
\ No newline at end of file
diff --git a/setup.py b/setup.py
index 5dd4489..6a575a3 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
# coding=utf-8
from setuptools import setup, find_packages
-VERSION = "1.0.1"
+VERSION = "1.0.2"
setup(
@@ -38,10 +38,10 @@ later (LGPLv2+)',
install_requires=[
'Jinja2 >= 2.8',
'signxml >= 2.4.0',
- 'lxml >= 3.5.0, < 4',
'suds >= 0.4',
'suds_requests >= 0.3',
'reportlab',
+ 'lxml',
'pytz',
'zeep'
],
From 7e7333d0674462287d46f6e1ded65fe77fc66beb Mon Sep 17 00:00:00 2001
From: Danimar Ribeiro
Date: Mon, 22 Jul 2019 18:51:25 -0300
Subject: [PATCH 2/4] [FIX] Corrige readme para que seja publicado no pypi
(#236)
---
README.md | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
setup.py | 2 +-
2 files changed, 107 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
index d16772c..6c4854b 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,6 @@
Biblioteca Python que tem por objetivo enviar NFe, NFCe e NFSe no Brasil
[](https://coveralls.io/r/danimaribeiro/PyTrustNFe?branch=master)
-[](https://landscape.io/github/danimaribeiro/PyTrustNFe/master)
[](https://travis-ci.org/danimaribeiro/PyTrustNFe)
[](https://badge.fury.io/py/PyTrustNFe)
@@ -10,28 +9,28 @@ Dependências:
* PyXmlSec
* lxml
* signxml
-* suds
-* suds_requests
+* suds-jurko
+* suds-jurko-requests
* reportlab
* Jinja2
+
NFSe - Cidades atendidas
---------------
-* [Ariss](cidades/ariss.md) - 4 cidades atendidas
+-----------------------------
+* **Paulistana** - São Paulo/SP
+* **Nota Carioca** - Rio de Janeiro/RJ
+* **Imperial** - Petrópolis/RH
+* [Susesu](cidades/susesu.md) - 3 cidades atendidas
* [Simpliss](cidades/simpliss.md) - 18 cidade atendidas
-
+* [GINFES](cidaes/ginfes.md) - 79 cidades atendidas
+* [DSF](cidades/dsf.md) - 7 cidades atendidas
Roadmap
--------------
Teste unitários
-Emissão de NFCe
-
-Compatibilidade [python 2 e 3](https://github.com/danimaribeiro/PyTrustNFe/pull/6)
-
Implementar novos provedores de NFSe
* [Betha](cidades/betha.md) - 81 cidades atendidas WIP
-* [GINFES](cidades/ginfes.md) - 79 cidades atendidas
* [WebISS](cidades/webiss.md) - 51 cidades atendidas
* [ISSIntel](cidades/issintel.md) - 32 cidades atendidas
* [ISSNET](cidades/issnet.md) - 32 cidades atendidas
@@ -39,7 +38,7 @@ Implementar novos provedores de NFSe
Exemplos de uso da NFe
----------------
+-----------------------------
Consulta Cadastro por CNPJ:
@@ -52,7 +51,102 @@ certificado = Certificado(certificado, 'senha_pfx')
obj = {'cnpj': '12345678901234', 'estado': '42'}
resposta = consulta_cadastro(certificado, obj=obj, ambiente=1, estado='42')
```
+Consulta Distribuição NF-e sem Validação de Esquema:
+```python
+from pytrustnfe.certificado import Certificado
+from pytrustnfe.nfe import consulta_distribuicao_nfe, xml_consulta_distribuicao_nfe
+
+certificado = open("/path/certificado.pfx", "r").read()
+certificado = Certificado(certificado, 'senha_pfx')
+# Gerando xml e enviado consulta por Ultimo NSU
+response1 = consulta_distribuicao_nfe(
+ certificado,
+ ambiente=1,
+ estado='42',
+ modelo='55',
+ cnpj_cpf='12345678901234',
+ ultimo_nsu='123456789101213'
+)
+
+# Gerando xml e enviado consulta por Chave
+response2 = consulta_distribuicao_nfe(
+ certificado,
+ ambiente=1,
+ estado='42',
+ modelo='55',
+ cnpj_cpf='12345678901234',
+ chave_nfe='012345678901234567890123456789012345678912'
+)
+
+# Gerando xml e enviado consulta por NSU
+response3 = consulta_distribuicao_nfe(
+ certificado,
+ ambiente=1,
+ estado='42',
+ modelo='55',
+ cnpj_cpf='12345678901234',
+ nsu='123456789101213'
+)
+```
+
+Consulta Distribuição NF-e com Validação de Esquema:
+```python
+from pytrustnfe.certificado import Certificado
+from pytrustnfe.nfe import consulta_distribuicao_nfe, xml_consulta_distribuicao_nfe
+from pytrustnfe.xml.validate import valida_nfe, SCHEMA_DFE
+
+certificado = open("/path/certificado.pfx", "r").read()
+certificado = Certificado(certificado, 'senha_pfx')
+
+# Gerando XML para Consulta por Ultimo NSU
+xml1 = xml_consulta_distribuicao_nfe(
+ certificado,
+ ambiente=1,
+ estado='42',
+ cnpj_cpf='12345678901234',
+ ultimo_nsu='123456789101213'
+)
+
+# Validando o XML com Esquema
+if valida_nfe(xml1, SCHEMA_DFE):
+ Warning("Erro na validação do esquema")
+
+# Gerando XML para Consulta por Chave
+xml2 = xml_consulta_distribuicao_nfe(
+ certificado,
+ ambiente=1,
+ estado='42',
+ cnpj_cpf='12345678901234',
+ chave_nfe='012345678901234567890123456789012345678912'
+)
+
+# Validando o XML com Esquema
+if valida_nfe(xml2, SCHEMA_DFE):
+ Warning("Erro na validação do esquema")
+
+# Gerando XML para Consulta por NSU
+xml3 = xml_consulta_distribuicao_nfe(
+ certificado,
+ ambiente=1,
+ estado='42',
+ cnpj_cpf='12345678901234',
+ nsu='123456789101213'
+)
+
+# Validando o XML com Esquema
+if valida_nfe(xml3, SCHEMA_DFE):
+ Warning("Erro na validação do esquema")
+
+# Enviando xml de consulta para sefaz
+response = consulta_distribuicao_nfe(
+ certificado,
+ ambiente=1,
+ estado='42',
+ modelo='55',
+ xml=xml1
+)
+```
Exemplo de uso da NFSe Paulistana
---------------------------------
diff --git a/setup.py b/setup.py
index 6a575a3..366b9ed 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
# coding=utf-8
from setuptools import setup, find_packages
-VERSION = "1.0.2"
+VERSION = "1.0.4"
setup(
From 6b15bb458308b0c80a5d6765dad96dfd209d5059 Mon Sep 17 00:00:00 2001
From: Danimar Ribeiro
Date: Mon, 22 Jul 2019 19:05:04 -0300
Subject: [PATCH 3/4] [FIX] Corrige formato do conteudo do readme (#237)
---
setup.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index 366b9ed..dbb446c 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
# coding=utf-8
from setuptools import setup, find_packages
-VERSION = "1.0.4"
+VERSION = "1.0.5"
setup(
@@ -35,6 +35,7 @@ later (LGPLv2+)',
license='LGPL-v2.1+',
description='PyTrustNFe é uma biblioteca para envio de NF-e',
long_description=open('README.md', 'r').read(),
+ long_description_content_type='text/markdown',
install_requires=[
'Jinja2 >= 2.8',
'signxml >= 2.4.0',
From e30f40cdd6f6405efab74d9bd0a63f7068d59245 Mon Sep 17 00:00:00 2001
From: Danimar Ribeiro
Date: Wed, 24 Jul 2019 19:04:43 -0300
Subject: [PATCH 4/4] =?UTF-8?q?[FIX]=20Novas=20tags=20da=20NT2018=5F005=20?=
=?UTF-8?q?-=20Respons=C3=A1vel=20t=C3=A9cnico?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pytrustnfe/nfe/templates/NfeAutorizacao.xml | 155 ++++++++++++++++++----------
setup.py | 2 +-
2 files changed, 101 insertions(+), 56 deletions(-)
diff --git a/pytrustnfe/nfe/templates/NfeAutorizacao.xml b/pytrustnfe/nfe/templates/NfeAutorizacao.xml
index a4e9af8..0eb2e3c 100644
--- a/pytrustnfe/nfe/templates/NfeAutorizacao.xml
+++ b/pytrustnfe/nfe/templates/NfeAutorizacao.xml
@@ -116,6 +116,7 @@
{% endif %}
{% endif %}
{{ dest.xNome|normalize|escape }}
+ {% if dest.enderDest is defined %}
{{ dest.enderDest.xLgr|normalize|escape }}
{{ dest.enderDest.nro }}
@@ -129,6 +130,7 @@
{{ dest.enderDest.xPais }}
{{ dest.enderDest.fone }}
+ {% endif %}
{{ dest.indIEDest }}
{% if dest.IE != '' -%}{{ dest.IE }}{% endif %}
{{ dest.ISUF }}
@@ -141,6 +143,7 @@
{{ NFe.infNFe.retirada.CNPJ }}
{{ NFe.infNFe.retirada.CPF }}
+ {{ NFe.infNFe.retirada.xNome|normalize|escape }}
{{ NFe.infNFe.retirada.xLgr|normalize|escape }}
{{ NFe.infNFe.retirada.nro }}
{{ NFe.infNFe.retirada.xCpl|normalize|escape }}
@@ -148,12 +151,19 @@
{{ NFe.infNFe.retirada.cMun }}
{{ NFe.infNFe.retirada.xMun|normalize }}
{{ NFe.infNFe.retirada.UF }}
+ {{ NFe.infNFe.retirada.CEP }}
+ {{ NFe.infNFe.retirada.cPais }}
+ {{ NFe.infNFe.retirada.xPais|normalize|escape }}
+ {{ NFe.infNFe.retirada.fone }}
+ {{ NFe.infNFe.retirada.email }}
+ {{ NFe.infNFe.retirada.IE }}
{% endif %}
{% if NFe.infNFe.entrega is defined %}
{{ NFe.infNFe.entrega.CNPJ }}
{{ NFe.infNFe.entrega.CPF }}
+ {{ NFe.infNFe.entrega.xNome|normalize|escape }}
{{ NFe.infNFe.entrega.xLgr|normalize|escape }}
{{ NFe.infNFe.entrega.nro }}
{{ NFe.infNFe.entrega.xCpl|normalize|escape }}
@@ -161,6 +171,12 @@
{{ NFe.infNFe.entrega.cMun }}
{{ NFe.infNFe.entrega.xMun }}
{{ NFe.infNFe.entrega.UF }}
+ {{ NFe.infNFe.entrega.CEP }}
+ {{ NFe.infNFe.entrega.cPais }}
+ {{ NFe.infNFe.entrega.xPais|normalize|escape }}
+ {{ NFe.infNFe.entrega.fone }}
+ {{ NFe.infNFe.entrega.email }}
+ {{ NFe.infNFe.entrega.IE }}
{% endif %}
{% if NFe.infNFe.autXML %}
@@ -243,7 +259,9 @@
{% endfor %}
{% endif %}
- {{ prod.xPed }}
+ {% if NFe.infNFe.compra is defined %}
+ {{ NFe.infNFe.compra.xPed }}
+ {% endif %}
{{ prod.nItemPed }}
{{ prod.nFCI }}
{% for rastro in prod.rastro %}
@@ -258,6 +276,7 @@
{% for med in prod.med %}
{{ med.cProdANVISA }}
+ {{ med.xMotivoIsencao }}
{{ med.vPMC }}
{% endfor %}
@@ -266,6 +285,7 @@
{% with imposto = det.imposto %}
{{ imposto.vTotTrib }}
+ {% if imposto.ICMS is defined %}
{% if imposto.ICMS.CST == '00' -%}
@@ -365,6 +385,7 @@
{{ imposto.ICMS.CST }}
{{ imposto.ICMS.vBCSTRet }}
{{ imposto.ICMS.pST }}
+ {{ imposto.ICMS.vICMSSubstituto }}
{{ imposto.ICMS.vICMSSTRet }}
{{ imposto.ICMS.vBCFCPSTRet }}
{{ imposto.ICMS.pFCPSTRet }}
@@ -443,9 +464,18 @@
{{ imposto.ICMSST.orig }}
{{ imposto.ICMSST.CST }}
{{ imposto.ICMSST.vBCSTRet }}
+ {{ imposto.ICMSST.pST }}
+ {{ imposto.ICMSST.vICMSSubstituto }}
{{ imposto.ICMSST.vICMSSTRet }}
+ {{ imposto.ICMSST.vBCFCPSTRet }}
+ {{ imposto.ICMSST.pFCPSTRet }}
+ {{ imposto.ICMSST.vFCPSTRet }}
{{ imposto.ICMSST.vBCSTDest }}
{{ imposto.ICMSST.vICMSSTDest }}
+ {{ imposto.ICMSST.pRedBCEfet }}
+ {{ imposto.ICMSST.vBCEfet }}
+ {{ imposto.ICMSST.pICMSEfet }}
+ {{ imposto.ICMSST.vICMSEfet }}
{% endif %}
{% if imposto.ICMS.CST == '101' -%}
@@ -500,7 +530,7 @@
{{ imposto.ICMS.CST }}
{{ imposto.ICMS.vBCSTRet }}
{{ imposto.ICMS.pST }}
- {{imposto.ICMS.vICMSSubstituto}}
+ {{ imposto.ICMS.vICMSSubstituto }}
{{ imposto.ICMS.vICMSSTRet }}
{{ imposto.ICMS.vBCFCPSTRet }}
{{ imposto.ICMS.pFCPSTRet }}
@@ -530,37 +560,58 @@
{% endif %}
- {% if NFe.infNFe.ide.mod != '65' %}
-
- {{ imposto.IPI.clEnq }}
- {{ imposto.IPI.CNPJProd }}
- {{ imposto.IPI.cSelo }}
- {{ imposto.IPI.qSelo }}
- {{ imposto.IPI.cEnq }}
- {% if imposto.IPI.CST in ('00', '49', '50', '99') %}
-
- {{ imposto.IPI.CST }}
- {{ imposto.IPI.vBC }}
- {{ imposto.IPI.pIPI }}
- {{ imposto.IPI.qUnid }}
- {{ imposto.IPI.vUnid }}
- {{ imposto.IPI.vIPI }}
-
- {% endif %}
- {% if imposto.IPI.CST in ('01', '02', '03', '04', '51', '52', '53', '54', '55') %}
-
- {{ imposto.IPI.CST }}
-
- {% endif %}
-
- {% if imposto.II is defined %}
-
- {{ imposto.II.vBC }}
- {{ imposto.II.vDespAdu }}
- {{ imposto.II.vII }}
- {{ imposto.II.vIOF }}
-
{% endif %}
+ {% if NFe.infNFe.ide.mod != '65' and imposto.IPI is defined %}
+
+ {{ imposto.IPI.clEnq }}
+ {{ imposto.IPI.CNPJProd }}
+ {{ imposto.IPI.cSelo }}
+ {{ imposto.IPI.qSelo }}
+ {{ imposto.IPI.cEnq }}
+ {% if imposto.IPI.CST in ('00', '49', '50', '99') %}
+
+ {{ imposto.IPI.CST }}
+ {{ imposto.IPI.vBC }}
+ {{ imposto.IPI.pIPI }}
+ {{ imposto.IPI.qUnid }}
+ {{ imposto.IPI.vUnid }}
+ {{ imposto.IPI.vIPI }}
+
+ {% endif %}
+ {% if imposto.IPI.CST in ('01', '02', '03', '04', '51', '52', '53', '54', '55') %}
+
+ {{ imposto.IPI.CST }}
+
+ {% endif %}
+
+ {% if imposto.II is defined %}
+
+ {{ imposto.II.vBC }}
+ {{ imposto.II.vDespAdu }}
+ {{ imposto.II.vII }}
+ {{ imposto.II.vIOF }}
+
+ {% endif %}
+ {% endif %}
+ {% if imposto.ISSQN is defined %}
+
+ {{ imposto.ISSQN.vBC }}
+ {{ imposto.ISSQN.vAliq }}
+ {{ imposto.ISSQN.vISSQN }}
+ {{ imposto.ISSQN.cMunFG }}
+ {{ imposto.ISSQN.cListServ }}
+ {{ imposto.ISSQN.vDeducao }}
+ {{ imposto.ISSQN.vOutro }}
+ {{ imposto.ISSQN.vDescIncond }}
+ {{ imposto.ISSQN.vDescCond }}
+ {{ imposto.ISSQN.vDeducao }}
+ {{ imposto.ISSQN.indISS }}
+ {{ imposto.ISSQN.cServico }}
+ {{ imposto.ISSQN.cMun }}
+ {{ imposto.ISSQN.cPais }}
+ {{ imposto.ISSQN.nProcesso }}
+ {{ imposto.ISSQN.indIncentivo }}
+
{% endif %}
{% if imposto.PIS.CST in ('01', '02') %}
@@ -638,33 +689,13 @@
{% endif %}
{% if imposto.COFINSST is defined %}
-
+
{{ imposto.COFINSST.vBC }}
{{ imposto.COFINSST.pCOFINS }}
{{ imposto.COFINSST.qBCProd }}
{{ imposto.COFINSST.vAliqProd }}
{{ imposto.COFINSST.vCOFINS }}
-
- {% endif %}
- {% if imposto.ISSQN is defined %}
-
- {{ imposto.ISSQN.vBC }}
- {{ imposto.ISSQN.vAliq }}
- {{ imposto.ISSQN.vISSQN }}
- {{ imposto.ISSQN.cMunFG }}
- {{ imposto.ISSQN.cListServ }}
- {{ imposto.ISSQN.vDeducao }}
- {{ imposto.ISSQN.vOutro }}
- {{ imposto.ISSQN.vDescIncond }}
- {{ imposto.ISSQN.vDescCond }}
- {{ imposto.ISSQN.vDeducao }}
- {{ imposto.ISSQN.indISS }}
- {{ imposto.ISSQN.cServico }}
- {{ imposto.ISSQN.cMun }}
- {{ imposto.ISSQN.cPais }}
- {{ imposto.ISSQN.nProcesso }}
- {{ imposto.ISSQN.vDeducao }}
-
+
{% endif %}
{% if imposto.ICMSUFDest is defined %}
@@ -831,8 +862,8 @@
{{ pag.card.cAut }}
{% endif %}
- {{ pag.vTroco }}
+ {{ pag.vTroco }}
{% endfor %}
{% endif %}
@@ -856,6 +887,16 @@
{% endfor %}
{% endif %}
+ {% if NFe.infNFe.infRespTec is defined %}
+
+ {{ NFe.infNFe.infRespTec.CNPJ }}
+ {{ NFe.infNFe.infRespTec.xContato }}
+ {{ NFe.infNFe.infRespTec.email }}
+ {{ NFe.infNFe.infRespTec.fone }}
+ {{ NFe.infNFe.infRespTec.idCSRT }}
+ {{ NFe.infNFe.infRespTec.hashCSRT }}
+
+ {% endif %}
{% if NFe.infNFe.exporta is defined %}
{{ NFe.infNFe.exporta.UFSaidaPais }}
@@ -871,6 +912,10 @@
{% endif %}
+
+ {{ NFe.infNFe.qrCode }}
+ {{ NFe.infNFe.urlChave }}
+
{% endfor %}
diff --git a/setup.py b/setup.py
index dbb446c..aaffe35 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
# coding=utf-8
from setuptools import setup, find_packages
-VERSION = "1.0.5"
+VERSION = "1.0.6"
setup(