Skip to content

Commit

Permalink
Merge pull request #103 from Engenere/integration/erpbrasil-edoc
Browse files Browse the repository at this point in the history
Adapt for erpbrasil.edoc integration
  • Loading branch information
rvalyi authored May 15, 2024
2 parents cfda1e1 + 8c13bf3 commit cda030e
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions nfelib/nfe/ws/edoc_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,31 @@ def consulta_documento(self, chave):
xServ="CONSULTAR",
chNFe=chave,
)
return self._post(
raiz=raiz,
url=localizar_url(

# Check if the method ´_get_ws_endpoint´ exists to ensure compatibility
# with different versions of the erpbrasil.edoc library.
if hasattr(self, '_get_ws_endpoint'):
url = self._get_ws_endpoint(WS_NFE_CONSULTA)
else:
# TODO: Remove this fallback in the next few months.
# The following block is a temporary solution to support older versions.
# After transitioning, remove the localizar_url method call.
url = localizar_url(
WS_NFE_CONSULTA,
str(self.uf),
self.mod,
int(self.ambiente)
),
)

return self._post(
raiz=raiz,
url=url,
operacao="nfeConsultaNF",
classe=RetConsSitNfe,
)



class NFCeAdapter(DocumentoElectronicoAdapter, NFCe):
pass

Expand Down

0 comments on commit cda030e

Please sign in to comment.