spei-python 0.31.1__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.
Files changed (32) hide show
  1. {spei_python-0.31.1 → spei_python-0.33.0}/PKG-INFO +1 -1
  2. {spei_python-0.31.1 → spei_python-0.33.0}/pyproject.toml +2 -2
  3. {spei_python-0.31.1 → spei_python-0.33.0}/spei/requests/cda.py +2 -4
  4. {spei_python-0.31.1 → spei_python-0.33.0}/spei/resources/acuse.py +16 -2
  5. {spei_python-0.31.1 → spei_python-0.33.0}/spei/resources/cda.py +7 -5
  6. {spei_python-0.31.1 → spei_python-0.33.0}/spei/responses/acuse.py +3 -12
  7. {spei_python-0.31.1 → spei_python-0.33.0}/README.md +0 -0
  8. {spei_python-0.31.1 → spei_python-0.33.0}/spei/README.md +0 -0
  9. {spei_python-0.31.1 → spei_python-0.33.0}/spei/__init__.py +0 -0
  10. {spei_python-0.31.1 → spei_python-0.33.0}/spei/cep_generator.py +0 -0
  11. {spei_python-0.31.1 → spei_python-0.33.0}/spei/client.py +0 -0
  12. {spei_python-0.31.1 → spei_python-0.33.0}/spei/errors/__init__.py +0 -0
  13. {spei_python-0.31.1 → spei_python-0.33.0}/spei/errors/sice.py +0 -0
  14. {spei_python-0.31.1 → spei_python-0.33.0}/spei/errors/spei.py +0 -0
  15. {spei_python-0.31.1 → spei_python-0.33.0}/spei/mappings.py +0 -0
  16. {spei_python-0.31.1 → spei_python-0.33.0}/spei/requests/__init__.py +0 -0
  17. {spei_python-0.31.1 → spei_python-0.33.0}/spei/requests/acuse.py +0 -0
  18. {spei_python-0.31.1 → spei_python-0.33.0}/spei/requests/orden.py +0 -0
  19. {spei_python-0.31.1 → spei_python-0.33.0}/spei/requests/respuesta.py +0 -0
  20. {spei_python-0.31.1 → spei_python-0.33.0}/spei/resources/__init__.py +0 -0
  21. {spei_python-0.31.1 → spei_python-0.33.0}/spei/resources/mensaje.py +0 -0
  22. {spei_python-0.31.1 → spei_python-0.33.0}/spei/resources/orden.py +0 -0
  23. {spei_python-0.31.1 → spei_python-0.33.0}/spei/resources/respuesta.py +0 -0
  24. {spei_python-0.31.1 → spei_python-0.33.0}/spei/responses/__init__.py +0 -0
  25. {spei_python-0.31.1 → spei_python-0.33.0}/spei/responses/orden.py +0 -0
  26. {spei_python-0.31.1 → spei_python-0.33.0}/spei/responses/respuesta.py +0 -0
  27. {spei_python-0.31.1 → spei_python-0.33.0}/spei/sice.py +0 -0
  28. {spei_python-0.31.1 → spei_python-0.33.0}/spei/types/__init__.py +0 -0
  29. {spei_python-0.31.1 → spei_python-0.33.0}/spei/types/sice.py +0 -0
  30. {spei_python-0.31.1 → spei_python-0.33.0}/spei/types/spei.py +0 -0
  31. {spei_python-0.31.1 → spei_python-0.33.0}/spei/utils.py +0 -0
  32. {spei_python-0.31.1 → spei_python-0.33.0}/spei/validators.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spei-python
3
- Version: 0.31.1
3
+ Version: 0.33.0
4
4
  Summary:
5
5
  Author: tech
6
6
  Author-email: tech@fondeadora.com
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "spei-python"
3
- version = "0.31.1"
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.31.1"
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 = [
@@ -10,10 +10,8 @@ class CDAElement(object):
10
10
  def __new__(cls, element):
11
11
  cda = etree.Element(
12
12
  etree.QName(PRAXIS_NS, 'generaCda'),
13
- nsmap={None: PRAXIS_NS},
14
13
  )
15
- mensaje = etree.tostring(element, xml_declaration=False, encoding='cp850')
16
- cda.text = mensaje
14
+ cda.append(element)
17
15
  return cda
18
16
 
19
17
 
@@ -40,7 +38,7 @@ class EnvelopeElement(object):
40
38
 
41
39
  class CDARequest(object):
42
40
  def __new__(cls, mensaje: CDA, as_string=True):
43
- envelope = EnvelopeElement(BodyElement(CDAElement(mensaje.build_xml())))
41
+ envelope = EnvelopeElement(BodyElement(CDAElement(mensaje.build_xml()))) # noqa: E501
44
42
  if not as_string:
45
43
  return envelope
46
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
- tag = to_snake_case(element.tag)
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
@@ -6,13 +6,14 @@ from spei.utils import to_snake_case, to_upper_camel_case # noqa: WPS347
6
6
 
7
7
  SOAP_NS = 'http://schemas.xmlsoap.org/soap/envelope/'
8
8
  PRAXIS_NS = 'http://www.praxis.com.mx/'
9
+ ENVIO_PRAXIS_NS = 'http://www.praxis.com.mx/EnvioCda/'
9
10
 
10
11
 
11
12
  class CDA(BaseModel):
12
13
  id: int
13
14
  mensaje_id: int
14
- op_fecha_oper: int
15
- op_hora_abono: int
15
+ op_fecha_oper: str
16
+ op_hora_abono: str
16
17
  op_cve_rastreo: str
17
18
 
18
19
  op_clave_emisor: str
@@ -46,17 +47,18 @@ class CDA(BaseModel):
46
47
 
47
48
  def build_xml(self):
48
49
  mensaje = etree.Element(
49
- 'datosCda',
50
+ etree.QName(ENVIO_PRAXIS_NS, 'datosCda'),
50
51
  idCda=str(self.id),
51
52
  idMensaje=str(self.mensaje_id),
53
+ nsmap={'env': ENVIO_PRAXIS_NS},
52
54
  )
53
55
 
54
- elements = self.dict(exclude={'id', 'mensaje_id'})
56
+ elements = self.dict(exclude_none=True, exclude={'id', 'mensaje_id'})
55
57
 
56
58
  for element, value in elements.items(): # noqa: WPS110
57
59
  if element in self.__fields__:
58
60
  upper_camel_case_element = to_upper_camel_case(element)
59
- subelement = etree.SubElement(mensaje, upper_camel_case_element)
61
+ subelement = etree.SubElement(mensaje, etree.QName(ENVIO_PRAXIS_NS, upper_camel_case_element)) # noqa: E501
60
62
  subelement.text = str(value)
61
63
 
62
64
  return mensaje
@@ -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://cep.fyg.com/}respuestaCDA',
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 = XMLElement(RespuestaElement(BodyElement((mensaje))))
33
- return acuse_cls.parse_xml(mensaje_element)
23
+ mensaje_element = RespuestaElement(BodyElement((mensaje)))
24
+ return acuse_cls.parse_synchronous_xml(mensaje_element)
File without changes
File without changes
File without changes