diff --git a/pytrustnfe/nfe/__init__.py b/pytrustnfe/nfe/__init__.py index f1bfc52..8395f24 100644 --- a/pytrustnfe/nfe/__init__.py +++ b/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) diff --git a/pytrustnfe/nfe/patch.py b/pytrustnfe/nfe/patch.py index 489ad81..a354b21 100644 --- a/pytrustnfe/nfe/patch.py +++ b/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 = '\ ' + xml_send + '' @@ -10,9 +10,14 @@ def nfeInutilizacaoCE(session, xml_send): 'SOAPAction': "", 'Content-Type': 'application/soap+xml; charset="utf-8"' } - response = session.post( - 'https://nfe.sefaz.ce.gov.br/nfe4/services/NFeInutilizacao4', - data=soap, headers=headers) + 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) response, obj = sanitize_response(response.text) return { 'sent_xml': xml_send,