Passed
Push — main ( 6f6a85...6aa252 )
by Sat CFDI
05:20
created

satcfdi.create.Signable256.sign()   A

Complexity

Conditions 1

Size

Total Lines 5
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1.4218

Importance

Changes 0
Metric Value
cc 1
eloc 5
nop 2
dl 0
loc 5
ccs 1
cts 4
cp 0.25
crap 1.4218
rs 10
c 0
b 0
f 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
        )