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

satcfdi.create   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 31
ccs 3
cts 6
cp 0.5
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A Signable256.sign() 0 5 1
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
        )