spei-python 0.45.0__tar.gz → 0.47.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 (39) hide show
  1. {spei_python-0.45.0 → spei_python-0.47.0}/PKG-INFO +1 -1
  2. {spei_python-0.45.0 → spei_python-0.47.0}/pyproject.toml +2 -2
  3. {spei_python-0.45.0 → spei_python-0.47.0}/spei/resources/__init__.py +1 -0
  4. spei_python-0.47.0/spei/resources/ensesion.py +50 -0
  5. {spei_python-0.45.0 → spei_python-0.47.0}/spei/resources/mensaje.py +10 -5
  6. {spei_python-0.45.0 → spei_python-0.47.0}/spei/types/spei.py +2 -0
  7. {spei_python-0.45.0 → spei_python-0.47.0}/README.md +0 -0
  8. {spei_python-0.45.0 → spei_python-0.47.0}/spei/README.md +0 -0
  9. {spei_python-0.45.0 → spei_python-0.47.0}/spei/__init__.py +0 -0
  10. {spei_python-0.45.0 → spei_python-0.47.0}/spei/cep_generator.py +0 -0
  11. {spei_python-0.45.0 → spei_python-0.47.0}/spei/checksum/__init__.py +0 -0
  12. {spei_python-0.45.0 → spei_python-0.47.0}/spei/checksum/factory.py +0 -0
  13. {spei_python-0.45.0 → spei_python-0.47.0}/spei/checksum/generator.py +0 -0
  14. {spei_python-0.45.0 → spei_python-0.47.0}/spei/checksum/types.py +0 -0
  15. {spei_python-0.45.0 → spei_python-0.47.0}/spei/client.py +0 -0
  16. {spei_python-0.45.0 → spei_python-0.47.0}/spei/errors/__init__.py +0 -0
  17. {spei_python-0.45.0 → spei_python-0.47.0}/spei/errors/sice.py +0 -0
  18. {spei_python-0.45.0 → spei_python-0.47.0}/spei/errors/spei.py +0 -0
  19. {spei_python-0.45.0 → spei_python-0.47.0}/spei/exceptions.py +0 -0
  20. {spei_python-0.45.0 → spei_python-0.47.0}/spei/mappings.py +0 -0
  21. {spei_python-0.45.0 → spei_python-0.47.0}/spei/requests/__init__.py +0 -0
  22. {spei_python-0.45.0 → spei_python-0.47.0}/spei/requests/acuse.py +0 -0
  23. {spei_python-0.45.0 → spei_python-0.47.0}/spei/requests/cda.py +0 -0
  24. {spei_python-0.45.0 → spei_python-0.47.0}/spei/requests/orden.py +0 -0
  25. {spei_python-0.45.0 → spei_python-0.47.0}/spei/requests/respuesta.py +0 -0
  26. {spei_python-0.45.0 → spei_python-0.47.0}/spei/resources/acuse.py +0 -0
  27. {spei_python-0.45.0 → spei_python-0.47.0}/spei/resources/cda.py +0 -0
  28. {spei_python-0.45.0 → spei_python-0.47.0}/spei/resources/orden.py +0 -0
  29. {spei_python-0.45.0 → spei_python-0.47.0}/spei/resources/payments.py +0 -0
  30. {spei_python-0.45.0 → spei_python-0.47.0}/spei/resources/respuesta.py +0 -0
  31. {spei_python-0.45.0 → spei_python-0.47.0}/spei/responses/__init__.py +0 -0
  32. {spei_python-0.45.0 → spei_python-0.47.0}/spei/responses/acuse.py +0 -0
  33. {spei_python-0.45.0 → spei_python-0.47.0}/spei/responses/orden.py +0 -0
  34. {spei_python-0.45.0 → spei_python-0.47.0}/spei/responses/respuesta.py +0 -0
  35. {spei_python-0.45.0 → spei_python-0.47.0}/spei/sice.py +0 -0
  36. {spei_python-0.45.0 → spei_python-0.47.0}/spei/types/__init__.py +0 -0
  37. {spei_python-0.45.0 → spei_python-0.47.0}/spei/types/sice.py +0 -0
  38. {spei_python-0.45.0 → spei_python-0.47.0}/spei/utils.py +0 -0
  39. {spei_python-0.45.0 → spei_python-0.47.0}/spei/validators.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spei-python
3
- Version: 0.45.0
3
+ Version: 0.47.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.45.0"
3
+ version = "0.47.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.45.0"
35
+ version = "0.47.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 = [
@@ -5,6 +5,7 @@ from spei.resources.acuse import ( # noqa: F401
5
5
  ResultadoServidor,
6
6
  )
7
7
  from spei.resources.cda import CDA # noqa: F401
8
+ from spei.resources.ensesion import Ensesion, Institucion # noqa: F401
8
9
  from spei.resources.mensaje import Mensaje # noqa: F401
9
10
  from spei.resources.orden import Orden # noqa: F401
10
11
  from spei.resources.payments import TerceroATercero # noqa: F401
@@ -0,0 +1,50 @@
1
+ from typing import List
2
+
3
+ from pydantic import BaseModel
4
+
5
+ from spei import types
6
+ from spei.utils import to_snake_case # noqa: WPS347
7
+
8
+
9
+ class Institucion(BaseModel):
10
+ clave_cesif: str
11
+ ins_nombre: str
12
+ estado_receptivo: str
13
+ estado_institucion: str
14
+
15
+ @classmethod
16
+ def parse_xml(cls, institucion_info):
17
+ return cls(
18
+ clave_cesif=institucion_info.find('clave_cesif').text,
19
+ ins_nombre=institucion_info.find('ins_nombre').text,
20
+ estado_receptivo=institucion_info.find('estado_receptivo').text,
21
+ estado_institucion=institucion_info.find('estado_institucion').text,
22
+ )
23
+
24
+
25
+ class Ensesion(BaseModel):
26
+ categoria: types.CategoriaOrdenPago
27
+ fecha_operacion_banxico: int
28
+ inst_bancarias: List[Institucion]
29
+
30
+ @classmethod
31
+ def parse_xml(cls, mensaje_element):
32
+ ensesion_element = mensaje_element.find('ensesion')
33
+
34
+ ensesion_data = {
35
+ 'categoria': types.CategoriaOrdenPago.ensesion,
36
+ 'inst_bancarias': [],
37
+ }
38
+
39
+ for element in ensesion_element.getchildren():
40
+ tag = to_snake_case(element.tag)
41
+ if tag == 'inst_bancarias':
42
+ instituciones = element.xpath('//institucion')
43
+ for institucion_info in instituciones:
44
+ institucion = Institucion.parse_xml(institucion_info)
45
+ ensesion_data['inst_bancarias'].append(institucion)
46
+ continue
47
+ if tag in cls.__fields__:
48
+ ensesion_data[tag] = element.text
49
+
50
+ return cls(**ensesion_data)
@@ -16,20 +16,27 @@ class Mensaje(BaseModel):
16
16
  extra = Extra.allow
17
17
 
18
18
  @classmethod
19
- def parse_xml(cls, mensaje):
19
+ def parse_xml(cls, mensaje): # noqa: WPS210
20
+ parser = etree.XMLParser(recover=True)
20
21
  mensaje = etree.fromstring(mensaje) # noqa: S320
21
22
  body = mensaje.find(
22
23
  '{http://schemas.xmlsoap.org/soap/envelope/}Body',
23
24
  )
24
25
  ordenpago = body.find('{http://www.praxis.com.mx/}ordenpago')
25
26
  respuesta = body.find('{http://www.praxis.com.mx/}respuesta')
26
- ensesion = body.find('{http://www.praxis.com.mx/}ensesion')
27
27
 
28
28
  if ordenpago is not None:
29
29
  element = etree.fromstring( # noqa: S320
30
30
  bytes(ordenpago.text, encoding='cp850'),
31
+ parser,
31
32
  )
32
33
  categoria = element.attrib['categoria']
34
+
35
+ if categoria == CategoriaOrdenPago.ensesion:
36
+ return cls(
37
+ categoria=categoria, ensesion=element,
38
+ )
39
+
33
40
  return cls(categoria=categoria, ordenpago=element)
34
41
 
35
42
  if respuesta is not None:
@@ -39,6 +46,4 @@ class Mensaje(BaseModel):
39
46
  categoria = element.attrib['categoria']
40
47
  return cls(categoria=categoria, respuesta=element)
41
48
 
42
- return cls(
43
- ensesion=ensesion,
44
- )
49
+ raise NotImplementedError
@@ -73,6 +73,7 @@ class PrioridadOrdenPago(str, Enum):
73
73
 
74
74
 
75
75
  class CategoriaOrdenPago(str, Enum):
76
+ ensesion = 'ENSESION'
76
77
  respuesta = 'RESPUESTA'
77
78
  cargar_odp = 'CARGAR_ODP'
78
79
  cargar_odp_respuesta = 'CARGAR_ODP_RESPUESTA'
@@ -84,6 +85,7 @@ class CategoriaOrdenPago(str, Enum):
84
85
  odps_canceladas_local_respuesta = 'ODPS_CANCELADAS_LOCAL_RESPUESTA'
85
86
  odps_canceladas_x_banxico = 'ODPS_CANCELADAS_X_BANXICO'
86
87
  odps_canceladas_x_banxico_respuesta = 'ODPS_CANCELADAS_X_BANXICO_RESPUESTA'
88
+ ensesion_respuesta = 'ENSESION_RESPUESTA'
87
89
 
88
90
 
89
91
  class EstadoOrdenPago(str, Enum):
File without changes
File without changes
File without changes