Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt for erpbrasil.edoc integration #103

Merged
merged 1 commit into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading