spei-python 0.41.0__py3-none-any.whl → 0.43.0__py3-none-any.whl

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/checksum/types.py CHANGED
@@ -24,6 +24,8 @@ PAYMENT_TYPES_WITH_BENEFICIARY_ACCOUNT = (
24
24
  PAYMENT_TYPES_WITH_ORIGIN_AND_BENEFICIARY_ACCOUNT = (
25
25
  TipoPagoOrdenPago.tercero_a_tercero,
26
26
  TipoPagoOrdenPago.tercero_a_tercero_fsw,
27
+ TipoPagoOrdenPago.tercero_indirecto_a_tercero,
28
+ TipoPagoOrdenPago.tercero_indirecto_a_participante,
27
29
  TipoPagoOrdenPago.nomina,
28
30
  TipoPagoOrdenPago.pago_factura,
29
31
  TipoPagoOrdenPago.cobros_no_presenciales_de_una_ocasion,
spei/client.py CHANGED
@@ -7,9 +7,11 @@ from cryptography.hazmat.primitives import serialization
7
7
  from cryptography.hazmat.primitives.asymmetric import padding
8
8
  from cryptography.hazmat.primitives.hashes import SHA256
9
9
 
10
+ from spei import exceptions
10
11
  from spei.checksum.factory import get_checksum_generator
12
+ from spei.errors import spei as errors
11
13
  from spei.requests import OrdenRequest
12
- from spei.resources import Orden
14
+ from spei.resources import Orden, Respuesta
13
15
  from spei.responses import RespuestaResponse
14
16
 
15
17
  logger = logging.getLogger('spei')
@@ -73,4 +75,14 @@ class BaseClient(object):
73
75
  response = self.session.post(data=soap_request, url=self.host)
74
76
  logger.info(response.text)
75
77
  response.raise_for_status()
76
- return respuesta_response_cls(response.text)
78
+ respuesta = respuesta_response_cls(response.text)
79
+ if respuesta.err_codigo != errors.GenericoCodigoError.exitoso:
80
+ self._raise_error(respuesta)
81
+ return respuesta
82
+
83
+ def _raise_error(self, respuesta: Respuesta):
84
+ if respuesta.err_codigo == errors.GenericoCodigoError.tipo_pago_invalido:
85
+ raise exceptions.TipoPagoInvalidoError(respuesta)
86
+ if respuesta.err_codigo == errors.OtrosCodigoError.otros_fecha_operacion_incorrecta: # noqa: E501
87
+ raise exceptions.FechaOperacionIncorrectaError(respuesta)
88
+ raise exceptions.SPEIError(respuesta)
spei/exceptions.py ADDED
@@ -0,0 +1,15 @@
1
+ from spei.resources import Respuesta
2
+
3
+
4
+ class SPEIError(Exception):
5
+ def __init__(self, respuesta: Respuesta):
6
+ self.error_code = respuesta.err_codigo
7
+ self.error_description = respuesta.err_descripcion
8
+
9
+
10
+ class TipoPagoInvalidoError(SPEIError):
11
+ """Tipo pago es invalido."""
12
+
13
+
14
+ class FechaOperacionIncorrectaError(SPEIError):
15
+ """Fecha operacion incorrecta."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spei-python
3
- Version: 0.41.0
3
+ Version: 0.43.0
4
4
  Summary:
5
5
  Author: tech
6
6
  Author-email: tech@fondeadora.com
@@ -4,11 +4,12 @@ spei/cep_generator.py,sha256=J9MEoDEzb8N-5_1YROdv4EIaN7wGK5xZdyY6nn0-df4,2604
4
4
  spei/checksum/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  spei/checksum/factory.py,sha256=W_7ylBrQE3BSmp8-sUrLw3E4ph5OwmOIbnX8TgMbMJ0,1608
6
6
  spei/checksum/generator.py,sha256=j4hMNA3iC0zlSztUAEsNOEqBh5i6YNYHo08EXLe0RMQ,5746
7
- spei/checksum/types.py,sha256=d5loNNHj_BRKCmvJFMAIVL7exbB7wiiHPedkwCUd_-g,1543
8
- spei/client.py,sha256=DkeulNdlhj_qihn2GBpGLjyKpCCBfJqFa8K8Bf7-T2A,2386
7
+ spei/checksum/types.py,sha256=MdD_SHONvUWrvN6yNG82g-AKJWPOADN4QH34Y4tC-rY,1650
8
+ spei/client.py,sha256=iAXD6rtEQdGm-qK7JbZ5TgHlQCaSDZgfRgP7wxxGujE,3024
9
9
  spei/errors/__init__.py,sha256=cITvjJIb5QzHvGne0pJSVhpOVT4YuWyi74zp970uagU,107
10
10
  spei/errors/sice.py,sha256=xtAiw6aETZm8nR922Rj1H_6xJBaJ_nWcd_7taDLQldA,4284
11
11
  spei/errors/spei.py,sha256=ne3Qg5ciRo_4TkiR4xJOSK7WQ-teeG6I9-dxqykUH-0,16065
12
+ spei/exceptions.py,sha256=1T0FJydzgXwvctCxw9qlqqxhil74CaEfmPlVkmmFbvU,382
12
13
  spei/mappings.py,sha256=7NjLCYidc4u7lZR47dPaK2lVuM0b-4WOlII9sBeMUbI,2643
13
14
  spei/requests/__init__.py,sha256=dD68SgnGmIjxuDibAGyBf7_tJnetUxU4QPa2ujr9OpY,240
14
15
  spei/requests/acuse.py,sha256=uoik_Eo51zMEs9_mKHbKGFvyjvr-kwA-6y9dWw54a0Q,2249
@@ -32,6 +33,6 @@ spei/types/sice.py,sha256=xFSoiLklRNWXoWwZXpSN8-SdkliNK23_MZbhcOc7a9s,222
32
33
  spei/types/spei.py,sha256=rzlTrAwVdUpk9-Z4tIEkWVPW_mEE9vBkcRtKczOCm84,4622
33
34
  spei/utils.py,sha256=Lje_sg6hLKQxsPmqf7ovVKKVcGZi7LlgNNg1MRtWnRo,247
34
35
  spei/validators.py,sha256=1b-brOmNesdiUi2X0LV0-Km4Sh6RGNeKNeAxshQXtOs,742
35
- spei_python-0.41.0.dist-info/METADATA,sha256=6BS8JG8NGj4w71FvbNgd9sQjG7hNu90h00bM_4zMup4,3812
36
- spei_python-0.41.0.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
37
- spei_python-0.41.0.dist-info/RECORD,,
36
+ spei_python-0.43.0.dist-info/METADATA,sha256=ao_L0uvPIa99Nn03f6A3oriRGeKKXt88NhDdMG7AQKs,3812
37
+ spei_python-0.43.0.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
38
+ spei_python-0.43.0.dist-info/RECORD,,