Skip to content

Commit

Permalink
Merge pull request #93 from Engenere/nfe-add-consulta-situacao
Browse files Browse the repository at this point in the history
Consultar situação da NF-e com objetos XSDATA
  • Loading branch information
rvalyi committed Mar 8, 2024
2 parents 07141ad + fe36a9c commit 1442dfd
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions nfelib/nfe/ws/edoc_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import base64
from lxml import etree

from nfelib.nfe.bindings.v4_0.cons_sit_nfe_v4_00 import ConsSitNfe
from nfelib.nfe.bindings.v4_0.ret_cons_sit_nfe_v4_00 import RetConsSitNfe


from erpbrasil.assinatura.assinatura import Assinatura

Expand All @@ -13,7 +16,7 @@
from erpbrasil.edoc.mde import MDe
from erpbrasil.edoc.mdfe import MDFe
from erpbrasil.edoc.nfce import NFCe
from erpbrasil.edoc.nfe import NFe
from erpbrasil.edoc.nfe import NFe, localizar_url, WS_NFE_CONSULTA
from erpbrasil.edoc.resposta import RetornoSoap, analisar_retorno_raw


Expand Down Expand Up @@ -98,7 +101,24 @@ def assina_raiz(self, raiz, id, getchildren=False):


class NFeAdapter(DocumentoElectronicoAdapter, NFe):
pass
def consulta_documento(self, chave):
raiz = ConsSitNfe(
versao=self.versao,
tpAmb=self.ambiente,
xServ="CONSULTAR",
chNFe=chave,
)
return self._post(
raiz=raiz,
url=localizar_url(
WS_NFE_CONSULTA,
str(self.uf),
self.mod,
int(self.ambiente)
),
operacao="nfeConsultaNF",
classe=RetConsSitNfe,
)


class NFCeAdapter(DocumentoElectronicoAdapter, NFCe):
Expand Down

0 comments on commit 1442dfd

Please sign in to comment.