Skip to content

Commit

Permalink
pedido executa cliente
Browse files Browse the repository at this point in the history
  • Loading branch information
brunovcosta committed Nov 8, 2024
1 parent b8755c1 commit ca32ded
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
7 changes: 6 additions & 1 deletion abstra_notas/nfse/sp/sao_paulo/cancelamento_nfe.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from .pedido import Pedido
from .retorno import Retorno
from dataclasses import dataclass
from typing import Literal
from typing import Literal, Union
from lxml.etree import Element, fromstring
from abstra_notas.validacoes.cpfcnpj import cpf_ou_cnpj, normalizar_cpf_ou_cnpj
from .cliente import Cliente
from abstra_notas.assinatura import Assinador
import base64

Expand Down Expand Up @@ -81,3 +82,7 @@ def classe_retorno(self):
@property
def remetente_tipo(self) -> Literal["CPF", "CNPJ"]:
return cpf_ou_cnpj(self.remetente)


def executar(cliente: Cliente) -> Union[RetornoCancelamentoNFeSucesso, RetornoCancelamentoNFeErro]:
return cliente.executar(self)
8 changes: 6 additions & 2 deletions abstra_notas/nfse/sp/sao_paulo/consulta_cnpj.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from .pedido import Pedido
from .retorno import Retorno
from dataclasses import dataclass
from .cliente import Cliente
from lxml.etree import Element, fromstring
from abstra_notas.assinatura import Assinador
from typing import Literal
from typing import Literal, Union
from abstra_notas.validacoes.cpfcnpj import cpf_ou_cnpj, normalizar_cpf_ou_cnpj

@dataclass
Expand Down Expand Up @@ -76,4 +77,7 @@ def remetente_tipo(self) -> Literal["CPF", "CNPJ"]:

@property
def contribuinte_tipo(self) -> Literal["CPF", "CNPJ"]:
return cpf_ou_cnpj(self.contribuinte)
return cpf_ou_cnpj(self.contribuinte)

def executar(self, cliente: Cliente) -> Union[RetornoConsultaCNPJSucesso, RetornoConsultaCNPJErro]:
return cliente.executar(self)
6 changes: 5 additions & 1 deletion abstra_notas/nfse/sp/sao_paulo/envio_rps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dataclasses import dataclass
from typing import Literal
from typing import Literal, Union
from lxml.etree import Element, fromstring
import base64
from abstra_notas.validacoes.email import validar_email
Expand Down Expand Up @@ -253,3 +253,7 @@ def remetente_tipo(self) -> Literal["CPF", "CNPJ"]:
@property
def tomador_tipo(self) -> Literal["CPF", "CNPJ"]:
return cpf_ou_cnpj(self.tomador)


def executar(cliente: Cliente) -> Union[RetornoEnvioRPS.RetornoEnvioRpsSucesso, RetornoEnvioRPS.RetornoEnvioRpsErro]:
return cliente.executar(self)
3 changes: 1 addition & 2 deletions abstra_notas/nfse/sp/sao_paulo/exemplos/cancelamento_nfe.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from abstra_notas.nfse.sp.sao_paulo import (
CancelamentoNFe,
RetornoCancelamentoNFe,
Cliente,
)

Expand All @@ -13,7 +12,7 @@
transacao="true",
)

retorno: RetornoCancelamentoNFe = cliente.executar(pedido)
retorno = pedido.executar(cliente)

if retorno.sucesso:
print("Cancelamento realizado com sucesso")
Expand Down

0 comments on commit ca32ded

Please sign in to comment.