Skip to content

Commit

Permalink
feat: add init validation to Folios class
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahuahuachi committed Jun 17, 2024
1 parent ac513fb commit d108f89
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions satcfdi/create/cancela/aceptacionrechazo.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections.abc import Sequence
from datetime import datetime
from typing import Literal

from ..w3.signature import signature_c14n_sha1
from ...models import Signer
Expand All @@ -8,22 +9,23 @@


class Folios(ScalarMap):
def __init__(
self,
respuesta: str,
uuid: str = None,
):
def __init__(self, respuesta: Literal["Aceptacion", "Rechazo"], uuid: str = None):
"""
:param respuesta:
:param uuid:
:param respuesta: "Rechazo" o "Aceptacion"
:param uuid: El UUID del documento que se desea aceptar o rechazar
"""

super().__init__({
'Respuesta': respuesta,
'UUID': uuid,
})

if respuesta not in ["Aceptacion", "Rechazo"]:
msg = f'respuesta must be "Aceptacion" or "Rechazo", found {respuesta} instead'
raise ValueError(msg)

super().__init__(
{
"Respuesta": respuesta,
"UUID": uuid,
}
)


class SolicitudAceptacionRechazo(XElement):
"""
Expand Down Expand Up @@ -70,8 +72,3 @@ def __init__(
}
)
self['Signature'] = sig





0 comments on commit d108f89

Please sign in to comment.