Browse Source

[FIX] nfeInutilizacaoCE url (#211)

* fix CE url in patch

* flake8

* verifiy environment before choose URI
pull/216/head
marinaGD 7 years ago
committed by Danimar Ribeiro
parent
commit
945dd77bea
  1. 2
      pytrustnfe/nfe/__init__.py
  2. 7
      pytrustnfe/nfe/patch.py

2
pytrustnfe/nfe/__init__.py

@ -92,7 +92,7 @@ def _send(certificado, method, **kwargs):
session = _get_session(certificado)
patch = has_patch(kwargs['estado'], method)
if patch:
return patch(session, xml_send)
return patch(session, xml_send, kwargs['ambiente'])
transport = Transport(session=session)
first_op, client = _get_client(base_url, transport)
return _send_zeep(first_op, client, xml_send)

7
pytrustnfe/nfe/patch.py

@ -2,7 +2,7 @@ from ..Servidores import SIGLA_ESTADO
from pytrustnfe.xml import sanitize_response
def nfeInutilizacaoCE(session, xml_send):
def nfeInutilizacaoCE(session, xml_send, ambiente):
soap = '<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope"><Body>\
<nfeDadosMsg xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/NFeInutilizacao4"\
>' + xml_send + '</nfeDadosMsg></Body></Envelope>'
@ -10,6 +10,11 @@ def nfeInutilizacaoCE(session, xml_send):
'SOAPAction': "",
'Content-Type': 'application/soap+xml; charset="utf-8"'
}
if ambiente == 1:
response = session.post(
'https://nfe.sefaz.ce.gov.br/nfe4/services/NFeInutilizacao4',
data=soap, headers=headers)
else:
response = session.post(
'https://nfeh.sefaz.ce.gov.br/nfe4/services/NFeInutilizacao4',
data=soap, headers=headers)

Loading…
Cancel
Save