Total Complexity | 1 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Coverage | 50% |
Changes | 0 |
1 | 1 | from ..models import Signer, Certificate |
|
2 | |||
3 | |||
4 | # class Issuer: |
||
5 | # """ |
||
6 | # Instancia generica de Emisor para usar en la creacion y sellado de comprobantes |
||
7 | # """ |
||
8 | # |
||
9 | # def __init__(self, tax_system: str, signer: Signer | Certificate = None, legal_name: str = None, rfc: str = None, certificate_number: str = None): |
||
10 | # """ |
||
11 | # Issuer to issue and stamp CFDIs |
||
12 | # |
||
13 | # :param signer: Llave y Certificado del Emisor |
||
14 | # :param legal_name: Legal Name (Razon Social) |
||
15 | # :param tax_system: Atributo requerido para incorporar la clave del régimen del contribuyente emisor al que aplicará el efecto fiscal de este comprobante. |
||
16 | # """ |
||
17 | # self.signer = signer if isinstance(signer, Signer) else None |
||
18 | # self.certificate = signer |
||
19 | # self.rfc = rfc or signer.rfc |
||
20 | # self.legal_name = legal_name or signer.legal_name |
||
21 | # self.tax_system = tax_system |
||
22 | # self.certificate_number = certificate_number or (signer.certificate_number if signer else "") |
||
23 | |||
24 | |||
25 | 1 | class Signable256(dict): |
|
26 | 1 | def sign(self, signer: Signer): |
|
27 | self['NoCertificado'] = signer.certificate_number |
||
28 | self['Certificado'] = signer.certificate_base64() |
||
29 | self['Sello'] = signer.sign_sha256( |
||
30 | self.cadena_original().encode() |
||
31 | ) |