spei-python 0.51.2__tar.gz → 0.53.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.51.2 → spei_python-0.53.0}/PKG-INFO +4 -4
- {spei_python-0.51.2 → spei_python-0.53.0}/pyproject.toml +12 -8
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/checksum/generator.py +2 -2
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/client.py +1 -1
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/mappings.py +1 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/resources/acuse.py +1 -1
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/resources/cda.py +1 -1
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/resources/ensesion.py +1 -1
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/resources/mensaje.py +1 -1
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/resources/orden.py +1 -1
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/resources/payments.py +2 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/resources/respuesta.py +1 -1
- spei_python-0.53.0/spei/responses/respuesta.py +72 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/sice.py +19 -12
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/validators.py +1 -1
- spei_python-0.51.2/spei/responses/respuesta.py +0 -37
- {spei_python-0.51.2 → spei_python-0.53.0}/README.md +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/README.md +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/__init__.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/cep_generator.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/checksum/__init__.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/checksum/factory.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/checksum/types.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/errors/__init__.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/errors/sice.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/errors/spei.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/exceptions.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/requests/__init__.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/requests/acuse.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/requests/cda.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/requests/orden.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/requests/respuesta.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/resources/__init__.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/responses/__init__.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/responses/acuse.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/responses/orden.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/types/__init__.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/types/sice.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/types/spei.py +0 -0
- {spei_python-0.51.2 → spei_python-0.53.0}/spei/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: spei-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.53.0
|
|
4
4
|
Summary:
|
|
5
5
|
Author: tech
|
|
6
6
|
Author-email: tech@fondeadora.com
|
|
@@ -11,9 +11,9 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
-
Requires-Dist: cryptography (>=3.0,<
|
|
15
|
-
Requires-Dist: lxml (>=
|
|
16
|
-
Requires-Dist: pydantic (>=1.
|
|
14
|
+
Requires-Dist: cryptography (>=3.0,<44.1)
|
|
15
|
+
Requires-Dist: lxml (>=5.0.0,<6.0.0)
|
|
16
|
+
Requires-Dist: pydantic (>=1.10.17,<3)
|
|
17
17
|
Requires-Dist: requests (>=2.32.2,<3.0.0)
|
|
18
18
|
Requires-Dist: unidecode (>=1.3.8,<2.0.0)
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "spei-python"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.53.0"
|
|
4
4
|
description = ""
|
|
5
5
|
authors = ["tech <tech@fondeadora.com>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -8,15 +8,15 @@ packages = [{include = "spei"}]
|
|
|
8
8
|
|
|
9
9
|
[tool.poetry.dependencies]
|
|
10
10
|
python = ">=3.8.1,<4.0"
|
|
11
|
-
lxml = "^
|
|
12
|
-
pydantic = ">=1.
|
|
11
|
+
lxml = "^5.0.0"
|
|
12
|
+
pydantic = ">=1.10.17,<3"
|
|
13
13
|
requests = "^2.32.2"
|
|
14
|
-
cryptography = ">=3.0,<
|
|
14
|
+
cryptography = ">=3.0,<44.1"
|
|
15
15
|
unidecode = "^1.3.8"
|
|
16
16
|
|
|
17
|
-
[tool.poetry.dev
|
|
17
|
+
[tool.poetry.group.dev.dependencies]
|
|
18
18
|
add-trailing-comma = "^2.2.3"
|
|
19
|
-
commitizen = "^
|
|
19
|
+
commitizen = "^3.31.0"
|
|
20
20
|
docformatter = "1.5.0"
|
|
21
21
|
expects = "^0.9.0"
|
|
22
22
|
Faker = "^13.12.0"
|
|
@@ -30,10 +30,9 @@ mypy = "^1.10"
|
|
|
30
30
|
requires = ["poetry-core>=1.0.0"]
|
|
31
31
|
build-backend = "poetry.core.masonry.api"
|
|
32
32
|
|
|
33
|
-
|
|
34
33
|
[tool.commitizen]
|
|
35
34
|
name = "cz_conventional_commits"
|
|
36
|
-
version = "0.
|
|
35
|
+
version = "0.53.0"
|
|
37
36
|
tag_format = "v$version"
|
|
38
37
|
bump_message = "bump: Semantic Release Bot: Release Version: $new_version 🤖🚀 [skip ci]"
|
|
39
38
|
version_files = [
|
|
@@ -43,3 +42,8 @@ version_files = [
|
|
|
43
42
|
[tool.black]
|
|
44
43
|
skip-string-normalization = true
|
|
45
44
|
line-length = 88
|
|
45
|
+
|
|
46
|
+
# this was added to fix the issue: Package docutils (0.21.post1) not found.
|
|
47
|
+
[[tool.poetry.source]]
|
|
48
|
+
name = "pypi-public"
|
|
49
|
+
url = "https://pypi.org/simple/"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
2
|
from decimal import Decimal
|
|
3
|
-
from typing import Optional
|
|
3
|
+
from typing import Optional, Tuple
|
|
4
4
|
|
|
5
5
|
from spei.resources import Orden
|
|
6
6
|
|
|
@@ -56,7 +56,7 @@ class ChecksumGenerator(object):
|
|
|
56
56
|
|
|
57
57
|
def _list_to_bytes(
|
|
58
58
|
self,
|
|
59
|
-
message_data:
|
|
59
|
+
message_data: Tuple[bytearray, ...],
|
|
60
60
|
) -> bytes:
|
|
61
61
|
res = bytearray()
|
|
62
62
|
for field in message_data:
|
|
@@ -83,6 +83,6 @@ class BaseClient(object):
|
|
|
83
83
|
def _raise_error(self, respuesta: Respuesta):
|
|
84
84
|
if respuesta.err_codigo == errors.GenericoCodigoError.tipo_pago_invalido:
|
|
85
85
|
raise exceptions.TipoPagoInvalidoError(respuesta)
|
|
86
|
-
if respuesta.err_codigo == errors.OtrosCodigoError.otros_fecha_operacion_incorrecta: # noqa: E501
|
|
86
|
+
if (respuesta.err_codigo == errors.OtrosCodigoError.otros_fecha_operacion_incorrecta): # noqa: E501
|
|
87
87
|
raise exceptions.FechaOperacionIncorrectaError(respuesta)
|
|
88
88
|
raise exceptions.SPEIError(respuesta)
|
|
@@ -11,6 +11,7 @@ ORDEN_RESPONSES = MappingProxyType(
|
|
|
11
11
|
CategoriaOrdenPago.odps_liquidadas_cargos: CategoriaOrdenPago.odps_liquidadas_cargos_respuesta, # noqa: E501
|
|
12
12
|
CategoriaOrdenPago.odps_canceladas_local: CategoriaOrdenPago.odps_canceladas_local_respuesta, # noqa: E501
|
|
13
13
|
CategoriaOrdenPago.odps_canceladas_x_banxico: CategoriaOrdenPago.odps_canceladas_x_banxico_respuesta, # noqa: E501
|
|
14
|
+
CategoriaOrdenPago.cargar_odp: CategoriaOrdenPago.cargar_odp_respuesta,
|
|
14
15
|
},
|
|
15
16
|
)
|
|
16
17
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from typing import Any, Optional, Union
|
|
2
2
|
|
|
3
3
|
from lxml import etree
|
|
4
|
-
from pydantic import BaseModel
|
|
4
|
+
from pydantic.v1 import BaseModel
|
|
5
5
|
|
|
6
6
|
from spei.errors.sice import CodigoErrorAcuseBanxico, CodigoErrorAcuseServidor
|
|
7
7
|
from spei.types.sice import CodigoRespuestaAcuse, TipoRespuestaAcuse
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
from typing import Type
|
|
2
|
+
|
|
3
|
+
from lxml import etree
|
|
4
|
+
|
|
5
|
+
from spei.requests.respuesta import XML_SCHEMA_NS
|
|
6
|
+
from spei.requests.respuesta import BodyElement as BodyElementP2P
|
|
7
|
+
from spei.requests.respuesta import EnvelopeElement as EnvelopeElementP2P
|
|
8
|
+
from spei.requests.respuesta import RespuestaElement as RespuestaElementP2P
|
|
9
|
+
from spei.resources import Respuesta
|
|
10
|
+
from spei.types import CategoriaOrdenPago
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class RespuestaElement(object):
|
|
14
|
+
def __new__(cls, mensaje_element, respuesta_cls: Type[Respuesta] = Respuesta):
|
|
15
|
+
respuesta = mensaje_element.find('respuesta')
|
|
16
|
+
categoria = mensaje_element.attrib['categoria']
|
|
17
|
+
return respuesta_cls.parse_xml(respuesta, categoria)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class MensajeElement(object):
|
|
21
|
+
def __new__(cls, respuesta):
|
|
22
|
+
return etree.fromstring( # noqa: S320
|
|
23
|
+
bytes(respuesta.text, encoding='cp850'),
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class MensajeElementP2P(object):
|
|
28
|
+
def __new__(cls, respuesta: str, categoria: CategoriaOrdenPago):
|
|
29
|
+
qname = etree.QName(XML_SCHEMA_NS, 'type')
|
|
30
|
+
|
|
31
|
+
mensaje = etree.Element(
|
|
32
|
+
'mensaje',
|
|
33
|
+
{qname: 'mensaje'},
|
|
34
|
+
categoria=categoria,
|
|
35
|
+
)
|
|
36
|
+
mensaje.append(respuesta)
|
|
37
|
+
return mensaje
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class RootElement(object):
|
|
41
|
+
def __new__(cls, body):
|
|
42
|
+
return body.find('{http://www.praxis.com.mx/}respuesta')
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class BodyElement(object):
|
|
46
|
+
def __new__(cls, mensaje):
|
|
47
|
+
return mensaje.find(
|
|
48
|
+
'{http://schemas.xmlsoap.org/soap/envelope/}Body',
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class RespuestaResponse(object):
|
|
53
|
+
def __new__(cls, respuesta):
|
|
54
|
+
mensaje = etree.fromstring(respuesta) # noqa: S320
|
|
55
|
+
return RespuestaElement(MensajeElement(RootElement(BodyElement((mensaje)))))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class RespuestaResponseP2P(object):
|
|
59
|
+
def __init__(self, respuesta, categoria):
|
|
60
|
+
self.tree = EnvelopeElementP2P(
|
|
61
|
+
BodyElementP2P(
|
|
62
|
+
RespuestaElementP2P(
|
|
63
|
+
MensajeElementP2P(respuesta, categoria),
|
|
64
|
+
),
|
|
65
|
+
),
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
def __bytes__(self):
|
|
69
|
+
return etree.tostring(self.tree, encoding='utf-8')
|
|
70
|
+
|
|
71
|
+
def __str__(self):
|
|
72
|
+
return etree.tostring(self.tree, encoding='unicode')
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
from typing import Optional, Tuple, Type
|
|
2
3
|
from urllib.parse import urljoin
|
|
3
4
|
|
|
4
5
|
import requests
|
|
@@ -14,27 +15,33 @@ logger.setLevel(logging.DEBUG)
|
|
|
14
15
|
class BaseClient(object):
|
|
15
16
|
def __init__(
|
|
16
17
|
self,
|
|
17
|
-
host,
|
|
18
|
-
verify=False,
|
|
19
|
-
http_client=requests,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
self.
|
|
18
|
+
host: str,
|
|
19
|
+
verify: bool = False,
|
|
20
|
+
http_client: Type[requests.Session] = requests.Session,
|
|
21
|
+
auth: Optional[Tuple[str, str]] = None,
|
|
22
|
+
) -> None:
|
|
23
|
+
self.host: str = host
|
|
24
|
+
self.session: requests.Session = http_client()
|
|
23
25
|
self.session.headers.update({'Content-Type': 'application/xml'})
|
|
24
26
|
self.session.verify = verify
|
|
27
|
+
if auth:
|
|
28
|
+
self.session.auth = auth
|
|
25
29
|
|
|
26
30
|
def registra_cda(
|
|
27
31
|
self,
|
|
28
|
-
cda_data,
|
|
29
|
-
cda_cls=CDA,
|
|
30
|
-
acuse_response_cls=AcuseResponse,
|
|
31
|
-
endpoint='/enlace-cep/EnvioCdaPortTypeImpl?wsdl',
|
|
32
|
-
):
|
|
32
|
+
cda_data: dict,
|
|
33
|
+
cda_cls: Type[CDA] = CDA,
|
|
34
|
+
acuse_response_cls: Type[AcuseResponse] = AcuseResponse,
|
|
35
|
+
endpoint: str = '/enlace-cep/EnvioCdaPortTypeImpl?wsdl',
|
|
36
|
+
) -> AcuseResponse:
|
|
33
37
|
orden = cda_cls(**cda_data)
|
|
34
38
|
soap_request = CDARequest(orden)
|
|
35
39
|
logger.info(soap_request)
|
|
36
40
|
cda_url = urljoin(self.host, endpoint)
|
|
37
|
-
response = self.session.post(
|
|
41
|
+
response: requests.Response = self.session.post(
|
|
42
|
+
data=soap_request, # type: ignore
|
|
43
|
+
url=cda_url,
|
|
44
|
+
)
|
|
38
45
|
logger.info(response.text)
|
|
39
46
|
response.raise_for_status()
|
|
40
47
|
return acuse_response_cls(response.text)
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
from typing import Type
|
|
2
|
-
|
|
3
|
-
from lxml import etree
|
|
4
|
-
|
|
5
|
-
from spei.resources import Respuesta
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class RespuestaElement(object):
|
|
9
|
-
def __new__(cls, mensaje_element, respuesta_cls: Type[Respuesta] = Respuesta):
|
|
10
|
-
respuesta = mensaje_element.find('respuesta')
|
|
11
|
-
categoria = mensaje_element.attrib['categoria']
|
|
12
|
-
return respuesta_cls.parse_xml(respuesta, categoria)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class MensajeElement(object):
|
|
16
|
-
def __new__(cls, respuesta):
|
|
17
|
-
return etree.fromstring( # noqa: S320
|
|
18
|
-
bytes(respuesta.text, encoding='cp850'),
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class RootElement(object):
|
|
23
|
-
def __new__(cls, body):
|
|
24
|
-
return body.find('{http://www.praxis.com.mx/}respuesta')
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class BodyElement(object):
|
|
28
|
-
def __new__(cls, mensaje):
|
|
29
|
-
return mensaje.find(
|
|
30
|
-
'{http://schemas.xmlsoap.org/soap/envelope/}Body',
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class RespuestaResponse(object):
|
|
35
|
-
def __new__(cls, respuesta):
|
|
36
|
-
mensaje = etree.fromstring(respuesta) # noqa: S320
|
|
37
|
-
return RespuestaElement(MensajeElement(RootElement(BodyElement((mensaje)))))
|
|
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
|