Skip to content

Commit

Permalink
Merge pull request #111 from Escodoo/add/cte_adapter_escodoo
Browse files Browse the repository at this point in the history
[ADD] CTe Adapter
  • Loading branch information
rvalyi authored Jul 18, 2024
2 parents 5d7188f + 65d40d3 commit b4bcd6c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions nfelib/nfe/ws/edoc_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from erpbrasil.edoc.edoc import DocumentoEletronico
from erpbrasil.edoc.mde import MDe
from erpbrasil.edoc.mdfe import MDFe
from erpbrasil.edoc.cte import CTe
from erpbrasil.edoc.nfce import NFCe
from erpbrasil.edoc.nfe import NFe, localizar_url, WS_NFE_CONSULTA
from erpbrasil.edoc.resposta import RetornoSoap, analisar_retorno_raw
Expand Down Expand Up @@ -141,6 +142,24 @@ class MDeAdapter(DocumentoElectronicoAdapter, MDe):
pass


class CTeAdapter(DocumentoElectronicoAdapter, CTe):

def _post(self, raiz, url, operacao, classe):

if is_dataclass(raiz):
xml_string, xml_etree = self.render_edoc_xsdata(raiz)
else:
xml_etree = xml_string = raiz
with self._transmissao.cliente(url):
retorno = self._transmissao.enviar(operacao, xml_etree)
if is_dataclass(classe):
return analisar_retorno_raw_xsdata(
operacao, raiz, xml_string, retorno, classe
)
else:
return analisar_retorno_raw(operacao, raiz, xml_string, retorno, classe)


class MDFeAdapter(DocumentoElectronicoAdapter, MDFe):
NAMESPACES = {
"mdfe": "http://www.portalfiscal.inf.br/mdfe",
Expand Down

0 comments on commit b4bcd6c

Please sign in to comment.