spei-python 1.0.7__tar.gz → 1.0.9__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-1.0.7 → spei_python-1.0.9}/PKG-INFO +1 -1
- {spei_python-1.0.7 → spei_python-1.0.9}/pyproject.toml +2 -2
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/README.md +1 -1
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/client.py +35 -8
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/responses/orden.py +8 -4
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/responses/respuesta.py +14 -4
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/signature/factory.py +2 -2
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/signature/types.py +3 -1
- {spei_python-1.0.7 → spei_python-1.0.9}/README.md +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/__init__.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/cep_generator.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/checksum/__init__.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/checksum/factory.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/checksum/generator.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/checksum/types.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/errors/__init__.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/errors/sice.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/errors/spei.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/exceptions.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/mappings.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/requests/__init__.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/requests/acuse.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/requests/cda.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/requests/orden.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/requests/respuesta.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/resources/__init__.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/resources/acuse.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/resources/cda.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/resources/ensesion.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/resources/mensaje.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/resources/orden.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/resources/payments.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/resources/respuesta.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/resources/validators.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/responses/__init__.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/sice.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/signature/__init__.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/signature/payload.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/types/__init__.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/types/common.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/types/sice.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/types/spei.py +0 -0
- {spei_python-1.0.7 → spei_python-1.0.9}/spei/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "spei-python"
|
|
3
|
-
version = "1.0.
|
|
3
|
+
version = "1.0.9"
|
|
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 = "1.0.
|
|
35
|
+
version = "1.0.9"
|
|
36
36
|
tag_format = "v$version"
|
|
37
37
|
bump_message = "bump: Semantic Release Bot: Release Version: $new_version 🤖🚀 [skip ci]"
|
|
38
38
|
version_files = ["pyproject.toml:version"]
|
|
@@ -111,7 +111,7 @@ Optional depending on order type
|
|
|
111
111
|
|
|
112
112
|
**op_info_factura** - str Bill information
|
|
113
113
|
|
|
114
|
-
**op_indica_ben_rec** -
|
|
114
|
+
**op_indica_ben_rec** - int Indicates if the final beneficiary of the special return is the issuing participant or the issuing client of the original transfer. Valid values: `1` (issuing participant) or `2` (issuing client)
|
|
115
115
|
|
|
116
116
|
**op_firma_dig** - str Order signature generated through algorithm.
|
|
117
117
|
|
|
@@ -42,6 +42,7 @@ class BaseClient(object):
|
|
|
42
42
|
http_client=requests,
|
|
43
43
|
checksum_generator_factory=None,
|
|
44
44
|
signature_builder_factory=None,
|
|
45
|
+
**factories,
|
|
45
46
|
):
|
|
46
47
|
self.priv_key = priv_key
|
|
47
48
|
self.priv_key_passphrase = priv_key_passphrase or None
|
|
@@ -90,6 +91,21 @@ class BaseClient(object):
|
|
|
90
91
|
|
|
91
92
|
self._signature_builder_factory = signature_builder_factory
|
|
92
93
|
|
|
94
|
+
unexpected_factories = set(factories) - {
|
|
95
|
+
'orden_factory',
|
|
96
|
+
'respuesta_response_factory',
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if unexpected_factories:
|
|
100
|
+
unexpected = ', '.join(sorted(unexpected_factories))
|
|
101
|
+
raise TypeError(f'Unexpected factory arguments: {unexpected}')
|
|
102
|
+
|
|
103
|
+
self._orden_factory = factories.get('orden_factory', Orden)
|
|
104
|
+
self._respuesta_response_factory = factories.get(
|
|
105
|
+
'respuesta_response_factory',
|
|
106
|
+
RespuestaResponse,
|
|
107
|
+
)
|
|
108
|
+
|
|
93
109
|
@property
|
|
94
110
|
def signature_builder_factory(self):
|
|
95
111
|
return self._signature_builder_factory
|
|
@@ -116,14 +132,25 @@ class BaseClient(object):
|
|
|
116
132
|
)
|
|
117
133
|
self._signature_builder_factory = factory
|
|
118
134
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
):
|
|
135
|
+
@property
|
|
136
|
+
def orden_factory(self):
|
|
137
|
+
return self._orden_factory
|
|
138
|
+
|
|
139
|
+
@orden_factory.setter
|
|
140
|
+
def orden_factory(self, factory):
|
|
141
|
+
self._orden_factory = factory
|
|
142
|
+
|
|
143
|
+
@property
|
|
144
|
+
def respuesta_response_factory(self):
|
|
145
|
+
return self._respuesta_response_factory
|
|
146
|
+
|
|
147
|
+
@respuesta_response_factory.setter
|
|
148
|
+
def respuesta_response_factory(self, factory):
|
|
149
|
+
self._respuesta_response_factory = factory
|
|
150
|
+
|
|
151
|
+
def registra_orden(self, orden_data):
|
|
125
152
|
signature = self.generate_signature(orden_data)
|
|
126
|
-
orden =
|
|
153
|
+
orden = self._orden_factory(op_firma_dig=signature, **orden_data)
|
|
127
154
|
soap_request = OrdenRequest(orden).to_string()
|
|
128
155
|
logger.info(soap_request)
|
|
129
156
|
|
|
@@ -131,7 +158,7 @@ class BaseClient(object):
|
|
|
131
158
|
logger.info(response.text)
|
|
132
159
|
response.raise_for_status()
|
|
133
160
|
|
|
134
|
-
respuesta =
|
|
161
|
+
respuesta = self._respuesta_response_factory(response.text)
|
|
135
162
|
|
|
136
163
|
if respuesta.err_codigo != errors.GenericoCodigoError.exitoso:
|
|
137
164
|
self._raise_error(respuesta)
|
|
@@ -6,10 +6,13 @@ from spei.resources import Orden
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class OrdenPagoElement(object):
|
|
9
|
-
def
|
|
9
|
+
def __init__(self, orden_parser: Type[Orden] = Orden):
|
|
10
|
+
self._orden_parser = orden_parser
|
|
11
|
+
|
|
12
|
+
def __call__(self, mensaje_element):
|
|
10
13
|
ordenpago = mensaje_element.find('ordenpago')
|
|
11
14
|
categoria = mensaje_element.attrib['categoria']
|
|
12
|
-
return
|
|
15
|
+
return self._orden_parser.parse_xml(ordenpago, categoria)
|
|
13
16
|
|
|
14
17
|
|
|
15
18
|
class MensajeElement(object):
|
|
@@ -32,8 +35,9 @@ class BodyElement(object):
|
|
|
32
35
|
|
|
33
36
|
|
|
34
37
|
class OrdenResponse(object):
|
|
35
|
-
def __new__(cls, orden):
|
|
38
|
+
def __new__(cls, orden, orden_parser: Type[Orden] = Orden):
|
|
36
39
|
mensaje = etree.fromstring( # noqa: S320
|
|
37
40
|
bytes(orden, encoding='cp850'),
|
|
38
41
|
)
|
|
39
|
-
|
|
42
|
+
element = OrdenPagoElement(orden_parser)
|
|
43
|
+
return element(MensajeElement(RootElement(BodyElement(mensaje))))
|
|
@@ -11,10 +11,13 @@ from spei.types import CategoriaOrdenPago
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class RespuestaElement(object):
|
|
14
|
-
def
|
|
14
|
+
def __init__(self, respuesta_parser: Type[Respuesta] = Respuesta):
|
|
15
|
+
self._respuesta_parser = respuesta_parser
|
|
16
|
+
|
|
17
|
+
def __call__(self, mensaje_element):
|
|
15
18
|
respuesta = mensaje_element.find('respuesta')
|
|
16
19
|
categoria = mensaje_element.attrib['categoria']
|
|
17
|
-
return
|
|
20
|
+
return self._respuesta_parser.parse_xml(respuesta, categoria)
|
|
18
21
|
|
|
19
22
|
|
|
20
23
|
class MensajeElement(object):
|
|
@@ -50,9 +53,16 @@ class BodyElement(object):
|
|
|
50
53
|
|
|
51
54
|
|
|
52
55
|
class RespuestaResponse(object):
|
|
53
|
-
def __new__(
|
|
56
|
+
def __new__(
|
|
57
|
+
cls,
|
|
58
|
+
respuesta,
|
|
59
|
+
respuesta_parser: Type[Respuesta] = Respuesta,
|
|
60
|
+
):
|
|
54
61
|
mensaje = etree.fromstring(respuesta) # noqa: S320
|
|
55
|
-
|
|
62
|
+
element = RespuestaElement(respuesta_parser)
|
|
63
|
+
return element(
|
|
64
|
+
MensajeElement(RootElement(BodyElement((mensaje)))),
|
|
65
|
+
)
|
|
56
66
|
|
|
57
67
|
|
|
58
68
|
class RespuestaResponseP2P(object):
|
|
@@ -58,9 +58,9 @@ _BUILDER_BY_PAYMENT_GROUP = (
|
|
|
58
58
|
def get_signature_builder(
|
|
59
59
|
payment_type: TipoPagoOrdenPago,
|
|
60
60
|
) -> SignaturePayloadBuilder:
|
|
61
|
-
for payment_group,
|
|
61
|
+
for payment_group, builder_factory in _BUILDER_BY_PAYMENT_GROUP:
|
|
62
62
|
if payment_type in payment_group:
|
|
63
|
-
return
|
|
63
|
+
return builder_factory()
|
|
64
64
|
|
|
65
65
|
if payment_type == TipoPagoOrdenPago.tercero_indirecto_a_participante:
|
|
66
66
|
return signature_payload.IndirectToParticipantSignaturePayloadBuilder()
|
|
@@ -5,6 +5,9 @@ PAYMENT_TYPES_WITH_DEFAULT_FIELDS = (
|
|
|
5
5
|
TipoPagoOrdenPago.devolucion_extemporanea_no_acreditada,
|
|
6
6
|
TipoPagoOrdenPago.participante_a_participante,
|
|
7
7
|
TipoPagoOrdenPago.devolucion_acreditada,
|
|
8
|
+
# Retorno especial orders do not include op_cuenta_ord in the SPEI XML,
|
|
9
|
+
# so the signature is computed with default fields only.
|
|
10
|
+
TipoPagoOrdenPago.devolucion_especial_acreditada,
|
|
8
11
|
)
|
|
9
12
|
|
|
10
13
|
PAYMENT_TYPES_WITH_ORIGIN_ACCOUNT = (
|
|
@@ -12,7 +15,6 @@ PAYMENT_TYPES_WITH_ORIGIN_ACCOUNT = (
|
|
|
12
15
|
TipoPagoOrdenPago.tercero_a_participante,
|
|
13
16
|
TipoPagoOrdenPago.devolucion_extemporanea_acreditada,
|
|
14
17
|
TipoPagoOrdenPago.devolucion_extemporanea_especial_acreditada,
|
|
15
|
-
TipoPagoOrdenPago.devolucion_especial_acreditada,
|
|
16
18
|
)
|
|
17
19
|
|
|
18
20
|
PAYMENT_TYPES_WITH_BENEFICIARY_ACCOUNT = (
|
|
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
|
|
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
|