Browse Source

Tests for sending the xml

tags/0.1.5
Danimar Ribeiro 10 years ago
parent
commit
0460dcb519
  1. 8
      pytrustnfe/servicos/assinatura.py
  2. 8
      pytrustnfe/servicos/nfe_autorizacao.py
  3. 1
      pytrustnfe/xml/nfeEnv.xml

8
pytrustnfe/servicos/assinatura.py

@ -35,12 +35,8 @@ def assinar(xml, cert, key, reference):
if recursively_empty(elem):
parent.remove(elem)
element = xml.find('{' + xml.nsmap[None] + '}NFe')
not_signed = etree.tostring(element)
not_signed = "<!DOCTYPE NFe [<!ATTLIST infNFe Id ID #IMPLIED>]>" + \
not_signed
signer = xmldsig(element, digest_algorithm=u'sha1')
# element = xml.find('{' + xml.nsmap[None] + '}NFe')
signer = xmldsig(xml, digest_algorithm=u'sha1')
ns = {}
ns[None] = signer.namespaces['ds']
signer.namespaces = ns

8
pytrustnfe/servicos/nfe_autorizacao.py

@ -6,6 +6,8 @@ Created on 21/06/2015
'''
from lxml import etree
from suds.sax.element import Element
from suds.sax.text import Raw
from suds.sax.parser import Parser
from pytrustnfe.servicos.comunicacao import Comunicacao
from pytrustnfe import utils
from pytrustnfe.xml import render_xml
@ -31,7 +33,11 @@ class NfeAutorizacao(Comunicacao):
cabecalho.versaoDados = '3.10'
client.set_options(soapheaders=cabecalho)
resposta = client.service.nfeAutorizacaoLote(xml_signed)
p = Parser()
import ipdb; ipdb.set_trace()
resposta = client.service.nfeAutorizacaoLote(
p.parse(string=xml_signed).root())
print client.last_sent()
print client.last_received()

1
pytrustnfe/xml/nfeEnv.xml

@ -169,6 +169,7 @@
<infCpl>{{ NFe.infNFe.infAdic.infCpl }}</infCpl>
</infAdic>
</infNFe>
<Signature Id="placeholder"></Signature>
</NFe>
{% endfor %}
</enviNFe>
Loading…
Cancel
Save