spei-python 0.32.0__tar.gz → 0.33.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {spei_python-0.32.0 → spei_python-0.33.0}/PKG-INFO +1 -1
- {spei_python-0.32.0 → spei_python-0.33.0}/pyproject.toml +2 -2
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/requests/cda.py +1 -1
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/resources/acuse.py +16 -2
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/resources/cda.py +4 -5
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/responses/acuse.py +3 -12
- {spei_python-0.32.0 → spei_python-0.33.0}/README.md +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/README.md +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/__init__.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/cep_generator.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/client.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/errors/__init__.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/errors/sice.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/errors/spei.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/mappings.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/requests/__init__.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/requests/acuse.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/requests/orden.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/requests/respuesta.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/resources/__init__.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/resources/mensaje.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/resources/orden.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/resources/respuesta.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/responses/__init__.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/responses/orden.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/responses/respuesta.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/sice.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/types/__init__.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/types/sice.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/types/spei.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/utils.py +0 -0
- {spei_python-0.32.0 → spei_python-0.33.0}/spei/validators.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "spei-python"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.33.0"
|
|
4
4
|
description = ""
|
|
5
5
|
authors = ["tech <tech@fondeadora.com>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -32,7 +32,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
32
32
|
|
|
33
33
|
[tool.commitizen]
|
|
34
34
|
name = "cz_conventional_commits"
|
|
35
|
-
version = "0.
|
|
35
|
+
version = "0.33.0"
|
|
36
36
|
tag_format = "v$version"
|
|
37
37
|
bump_message = "bump: Semantic Release Bot: Release Version: $new_version 🤖🚀 [skip ci]"
|
|
38
38
|
version_files = [
|
|
@@ -38,7 +38,7 @@ class EnvelopeElement(object):
|
|
|
38
38
|
|
|
39
39
|
class CDARequest(object):
|
|
40
40
|
def __new__(cls, mensaje: CDA, as_string=True):
|
|
41
|
-
envelope = EnvelopeElement(BodyElement(CDAElement(mensaje.build_xml())))
|
|
41
|
+
envelope = EnvelopeElement(BodyElement(CDAElement(mensaje.build_xml()))) # noqa: E501
|
|
42
42
|
if not as_string:
|
|
43
43
|
return envelope
|
|
44
44
|
return etree.tostring(envelope, xml_declaration=True)
|
|
@@ -57,6 +57,19 @@ class Acuse(BaseModel):
|
|
|
57
57
|
class Config: # noqa: WPS306, WPS431
|
|
58
58
|
use_enum_values = True
|
|
59
59
|
|
|
60
|
+
@classmethod
|
|
61
|
+
def parse_synchronous_xml(cls, mensaje_element):
|
|
62
|
+
acuse_element = mensaje_element.find('{http://www.praxis.com.mx/EnvioCda/}acuseCda') # noqa: E501
|
|
63
|
+
cda_data = cls._find_mensaje_attributes(mensaje_element, acuse_element)
|
|
64
|
+
resultado_element = acuse_element.find('{http://www.praxis.com.mx/EnvioCda/}resultadoEnlaceCep') # noqa: E501
|
|
65
|
+
codigo = resultado_element.find('{http://www.praxis.com.mx/EnvioCda/}codigo')
|
|
66
|
+
descripcion = resultado_element.find('{http://www.praxis.com.mx/EnvioCda/}descripcion') # noqa: E501
|
|
67
|
+
enlace_cep_data = {
|
|
68
|
+
'codigo': codigo.text,
|
|
69
|
+
'descripcion': descripcion.text,
|
|
70
|
+
}
|
|
71
|
+
return cls._build_acuse(acuse_element, cda_data, enlace_cep_data)
|
|
72
|
+
|
|
60
73
|
def build_xml(self):
|
|
61
74
|
acuse = etree.Element(
|
|
62
75
|
'acuse',
|
|
@@ -122,9 +135,10 @@ class Acuse(BaseModel):
|
|
|
122
135
|
}
|
|
123
136
|
|
|
124
137
|
@classmethod
|
|
125
|
-
def _build_acuse(cls, acuse_element, cda_data, enlace_cep_data, banxico_data):
|
|
138
|
+
def _build_acuse(cls, acuse_element, cda_data, enlace_cep_data, banxico_data=None):
|
|
126
139
|
for element in acuse_element.getchildren():
|
|
127
|
-
|
|
140
|
+
localname = etree.QName(element).localname
|
|
141
|
+
tag = to_snake_case(localname)
|
|
128
142
|
if tag == 'resultado_enlace_cep':
|
|
129
143
|
cda_data[tag] = ResultadoServidor(**enlace_cep_data)
|
|
130
144
|
continue
|
|
@@ -12,8 +12,8 @@ ENVIO_PRAXIS_NS = 'http://www.praxis.com.mx/EnvioCda/'
|
|
|
12
12
|
class CDA(BaseModel):
|
|
13
13
|
id: int
|
|
14
14
|
mensaje_id: int
|
|
15
|
-
op_fecha_oper:
|
|
16
|
-
op_hora_abono:
|
|
15
|
+
op_fecha_oper: str
|
|
16
|
+
op_hora_abono: str
|
|
17
17
|
op_cve_rastreo: str
|
|
18
18
|
|
|
19
19
|
op_clave_emisor: str
|
|
@@ -53,15 +53,14 @@ class CDA(BaseModel):
|
|
|
53
53
|
nsmap={'env': ENVIO_PRAXIS_NS},
|
|
54
54
|
)
|
|
55
55
|
|
|
56
|
-
elements = self.dict(exclude={'id', 'mensaje_id'})
|
|
56
|
+
elements = self.dict(exclude_none=True, exclude={'id', 'mensaje_id'})
|
|
57
57
|
|
|
58
58
|
for element, value in elements.items(): # noqa: WPS110
|
|
59
59
|
if element in self.__fields__:
|
|
60
60
|
upper_camel_case_element = to_upper_camel_case(element)
|
|
61
|
-
subelement = etree.SubElement(mensaje, etree.QName(ENVIO_PRAXIS_NS, upper_camel_case_element))
|
|
61
|
+
subelement = etree.SubElement(mensaje, etree.QName(ENVIO_PRAXIS_NS, upper_camel_case_element)) # noqa: E501
|
|
62
62
|
subelement.text = str(value)
|
|
63
63
|
|
|
64
|
-
print(etree.tostring(mensaje))
|
|
65
64
|
return mensaje
|
|
66
65
|
|
|
67
66
|
@classmethod
|
|
@@ -3,19 +3,10 @@ from lxml import etree
|
|
|
3
3
|
from spei.resources import Acuse
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
class XMLElement(object):
|
|
7
|
-
def __new__(cls, respuesta):
|
|
8
|
-
xml_element = respuesta.find(
|
|
9
|
-
'xml',
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
return etree.fromstring(xml_element.text) # noqa: S320
|
|
13
|
-
|
|
14
|
-
|
|
15
6
|
class RespuestaElement(object):
|
|
16
7
|
def __new__(cls, body):
|
|
17
8
|
return body.find(
|
|
18
|
-
'{http://
|
|
9
|
+
'{http://www.praxis.com.mx/EnvioCda/}generaCdaResponse',
|
|
19
10
|
)
|
|
20
11
|
|
|
21
12
|
|
|
@@ -29,5 +20,5 @@ class BodyElement(object):
|
|
|
29
20
|
class AcuseResponse(object):
|
|
30
21
|
def __new__(cls, acuse, acuse_cls=Acuse):
|
|
31
22
|
mensaje = etree.fromstring(acuse) # noqa: S320
|
|
32
|
-
mensaje_element =
|
|
33
|
-
return acuse_cls.
|
|
23
|
+
mensaje_element = RespuestaElement(BodyElement((mensaje)))
|
|
24
|
+
return acuse_cls.parse_synchronous_xml(mensaje_element)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|