Skip to content

Commit

Permalink
Adapt for erpbrasil.edoc integration
Browse files Browse the repository at this point in the history
Adapted the current library to ensure compatibility with the new erpbrasil.edoc library that is pending release. This change is on a feature branch to support the upcoming integration.

See the related PR: erpbrasil/erpbrasil.edoc#77
  • Loading branch information
antoniospneto committed May 15, 2024
1 parent cfda1e1 commit 8c13bf3
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 8c13bf3

Please sign in to comment.