spei-python 0.53.0__py3-none-any.whl → 0.53.1__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/client.py CHANGED
@@ -34,7 +34,12 @@ class BaseClient(object):
34
34
  self.priv_key_passphrase = priv_key_passphrase or None
35
35
  self.host = host
36
36
  self.session = http_client.Session()
37
- self.session.headers.update({'Content-Type': 'application/xml'})
37
+ self.session.headers.update(
38
+ {
39
+ 'Content-Type': 'application/xml; charset=cp850',
40
+ 'User-Agent': 'Fondeadora/Karpay/v0.52.0',
41
+ },
42
+ )
38
43
  self.session.verify = verify
39
44
  self.session.auth = (username, password)
40
45
 
@@ -49,19 +54,6 @@ class BaseClient(object):
49
54
 
50
55
  self.checksum_generator_factory = checksum_generator_factory
51
56
 
52
- def generate_checksum(self, message_data):
53
- orden = Orden(**message_data, op_firma_dig='')
54
- generator = self.checksum_generator_factory(orden.op_tp_clave)
55
- message_as_bytes = generator.format_data(orden)
56
-
57
- signed_message = self.pkey.sign(
58
- message_as_bytes,
59
- padding.PKCS1v15(),
60
- SHA256(),
61
- )
62
-
63
- return base64.b64encode(signed_message)
64
-
65
57
  def registra_orden(
66
58
  self,
67
59
  orden_data,
@@ -70,19 +62,41 @@ class BaseClient(object):
70
62
  ):
71
63
  checksum = self.generate_checksum(orden_data)
72
64
  orden = orden_cls(op_firma_dig=checksum, **orden_data)
73
- soap_request = OrdenRequest(orden)
65
+ soap_request = OrdenRequest(orden).to_string()
74
66
  logger.info(soap_request)
67
+
75
68
  response = self.session.post(data=soap_request, url=self.host)
76
69
  logger.info(response.text)
77
70
  response.raise_for_status()
71
+
78
72
  respuesta = respuesta_response_cls(response.text)
73
+
79
74
  if respuesta.err_codigo != errors.GenericoCodigoError.exitoso:
80
75
  self._raise_error(respuesta)
76
+
81
77
  return respuesta
82
78
 
79
+ def generate_checksum(self, message_data):
80
+ orden = Orden(**message_data, op_firma_dig='')
81
+ generator = self.checksum_generator_factory(orden.op_tp_clave)
82
+ message_as_bytes = generator.format_data(orden)
83
+
84
+ signed_message = self.pkey.sign(
85
+ message_as_bytes,
86
+ padding.PKCS1v15(),
87
+ SHA256(),
88
+ )
89
+
90
+ return base64.b64encode(signed_message)
91
+
83
92
  def _raise_error(self, respuesta: Respuesta):
84
93
  if respuesta.err_codigo == errors.GenericoCodigoError.tipo_pago_invalido:
85
94
  raise exceptions.TipoPagoInvalidoError(respuesta)
86
- if (respuesta.err_codigo == errors.OtrosCodigoError.otros_fecha_operacion_incorrecta): # noqa: E501
95
+
96
+ if ( # noqa: WPS337
97
+ respuesta.err_codigo
98
+ == errors.OtrosCodigoError.otros_fecha_operacion_incorrecta
99
+ ):
87
100
  raise exceptions.FechaOperacionIncorrectaError(respuesta)
101
+
88
102
  raise exceptions.SPEIError(respuesta)
spei/errors/sice.py CHANGED
@@ -99,6 +99,7 @@ class CodigoErrorAcuseServidor(str, Enum):
99
99
  tipo_pago_no_catalogado = 'EV03'
100
100
  clasificacion_operacion_obligatoria = 'EW01'
101
101
  clasificacion_operacion_maximo_2_digitos = 'EW02'
102
+ emisor_remesa_vacio = 'EW13'
102
103
 
103
104
  folio_codi_no_corresponde = 'EY01'
104
105
  folio_codi_invalido = 'EY02'
spei/errors/spei.py CHANGED
@@ -1,4 +1,5 @@
1
1
  from enum import Enum
2
+ from typing import List, Tuple
2
3
 
3
4
 
4
5
  class GenericoCodigoError(str, Enum):
@@ -445,8 +446,9 @@ ERROR_CODES = (
445
446
 
446
447
 
447
448
  def generate_error_codes():
448
- error_codes = []
449
+ error_codes: List[Tuple[str, int]] = []
449
450
  for error_code in ERROR_CODES:
450
451
  for err in error_code:
451
452
  error_codes.append((err.name, err.value))
453
+
452
454
  return Enum('CodigoError', dict(error_codes))
spei/requests/cda.py CHANGED
@@ -37,8 +37,15 @@ class EnvelopeElement(object):
37
37
 
38
38
 
39
39
  class CDARequest(object):
40
- def __new__(cls, mensaje: CDA, as_string=True):
41
- envelope = EnvelopeElement(BodyElement(CDAElement(mensaje.build_xml()))) # noqa: E501
42
- if not as_string:
43
- return envelope
44
- return etree.tostring(envelope, xml_declaration=True)
40
+ def __init__(self, mensaje: CDA):
41
+ self._envelope = EnvelopeElement(BodyElement(CDAElement(mensaje.build_xml())))
42
+
43
+ @property
44
+ def tree(self):
45
+ return self._envelope
46
+
47
+ def to_string(self) -> bytes:
48
+ """
49
+ Returns the SOAP request as a string encoded in cp850 (bytes).
50
+ """
51
+ return etree.tostring(self._envelope, encoding='cp850', xml_declaration=True)
spei/requests/orden.py CHANGED
@@ -10,14 +10,17 @@ class MensajeElement(object):
10
10
  def __new__(cls, orden: Orden):
11
11
  mensaje = etree.Element('mensaje', categoria=orden.categoria)
12
12
  mensaje.append(orden.build_xml())
13
+
13
14
  return mensaje
14
15
 
15
16
 
16
17
  class OrdenPagoElement(object):
17
18
  def __new__(cls, mensaje):
18
19
  ordenpago = etree.Element(etree.QName(PRAXIS_NS, 'ordenpago'))
19
- mensaje = etree.tostring(mensaje, xml_declaration=True, encoding='cp850')
20
- ordenpago.text = etree.CDATA(mensaje)
20
+
21
+ mensaje_str = etree.tostring(mensaje, encoding='cp850')
22
+ ordenpago.text = etree.CDATA(mensaje_str.decode('cp850'))
23
+
21
24
  return ordenpago
22
25
 
23
26
 
@@ -25,6 +28,7 @@ class BodyElement(object):
25
28
  def __new__(cls, ordenpago):
26
29
  body = etree.Element(etree.QName(SOAP_NS, 'Body'))
27
30
  body.append(ordenpago)
31
+
28
32
  return body
29
33
 
30
34
 
@@ -39,12 +43,19 @@ class EnvelopeElement(object):
39
43
  nsmap=namespaces_uris,
40
44
  )
41
45
  envelope.append(body)
46
+
42
47
  return envelope
43
48
 
44
49
 
45
50
  class OrdenRequest(object):
46
- def __new__(cls, orden: Orden, as_string=True):
47
- envelope = EnvelopeElement(BodyElement(OrdenPagoElement(MensajeElement(orden))))
48
- if not as_string:
49
- return envelope
50
- return etree.tostring(envelope, xml_declaration=True)
51
+ def __init__(self, orden: Orden):
52
+ self._envelope: etree._Element = EnvelopeElement( # noqa: WPS437
53
+ BodyElement(OrdenPagoElement(MensajeElement(orden))),
54
+ )
55
+
56
+ @property
57
+ def tree(self) -> etree._Element: # noqa: WPS437
58
+ return self._envelope
59
+
60
+ def to_string(self) -> bytes:
61
+ return etree.tostring(self._envelope, encoding='cp850', xml_declaration=True)
spei/resources/cda.py CHANGED
@@ -4,7 +4,7 @@ from lxml import etree
4
4
  from pydantic.v1 import BaseModel
5
5
 
6
6
  from spei import types
7
- from spei.utils import to_snake_case, to_upper_camel_case # noqa: WPS347
7
+ from spei.utils import to_pascal_case, to_snake_case # noqa: WPS347
8
8
 
9
9
  SOAP_NS = 'http://schemas.xmlsoap.org/soap/envelope/'
10
10
  PRAXIS_NS = 'http://www.praxis.com.mx/'
@@ -52,10 +52,23 @@ class CDA(BaseModel):
52
52
  op_cta_part_indirecto_ord: Optional[str] = None
53
53
  op_rfc_curp_part_indirecto_ord: Optional[str] = None
54
54
 
55
+ # remesas
56
+ op_id_remesa: Optional[str] = None
57
+ op_pais: Optional[str] = None
58
+ op_divisa: Optional[str] = None
59
+ op_nom_emisor_rem: Optional[str] = None
60
+ op_cta_emisor_rem: Optional[str] = None
61
+ op_rfc_curp_emisor_rem: Optional[str] = None
62
+ op_nom_ben_rem: Optional[str] = None
63
+ op_cta_ben_rem: Optional[str] = None
64
+ op_rfc_curp_ben_rem: Optional[str] = None
65
+ op_nom_prov_rem_ext: Optional[str] = None
66
+ op_nom_prov_rem_nac: Optional[str] = None
67
+
55
68
  class Config: # noqa: WPS306, WPS431
56
69
  use_enum_values = True
57
70
 
58
- def build_xml(self):
71
+ def build_xml(self) -> etree._Element: # noqa: WPS437
59
72
  mensaje = etree.Element(
60
73
  etree.QName(ENVIO_PRAXIS_NS, 'datosCda'),
61
74
  idCda=str(self.id),
@@ -67,7 +80,7 @@ class CDA(BaseModel):
67
80
 
68
81
  for element, value in elements.items(): # noqa: WPS110
69
82
  if element in self.__fields__:
70
- upper_camel_case_element = to_upper_camel_case(element)
83
+ upper_camel_case_element = to_pascal_case(element)
71
84
  subelement = etree.SubElement(
72
85
  mensaje,
73
86
  etree.QName(ENVIO_PRAXIS_NS, upper_camel_case_element),
spei/resources/orden.py CHANGED
@@ -1,16 +1,28 @@
1
1
  import re
2
- from typing import Optional
2
+ from typing import Any, Dict, Optional
3
3
 
4
4
  from lxml import etree
5
+ from lxml.etree import _Element # noqa: WPS450, WPS458
5
6
  from pydantic.v1 import BaseModel, validator
6
- from unidecode import unidecode
7
7
 
8
8
  from spei import types
9
- from spei.utils import to_snake_case, to_upper_camel_case # noqa: WPS347
9
+ from spei.resources.validators import validate_alphanumeric
10
+ from spei.utils import to_camel_case, to_pascal_case, to_snake_case # noqa: WPS347
10
11
  from spei.validators import digits
11
12
 
12
13
  SOAP_NS = 'http://schemas.xmlsoap.org/soap/envelope/'
13
14
  PRAXIS_NS = 'http://www.praxis.com.mx/'
15
+ _DATE_PATTERN = re.compile(r'^\d{4}(0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])$')
16
+ _WHITESPACE_PATTERN = re.compile(r'\s+')
17
+ _CAMEL_CASE_FIELDS = frozenset(
18
+ (
19
+ 'op_rastreo_ori',
20
+ 'op_fecha_oper_ori',
21
+ 'op_monto_ori',
22
+ 'op_monto_intereses',
23
+ 'op_comision_trans',
24
+ ),
25
+ )
14
26
 
15
27
 
16
28
  class Orden(BaseModel):
@@ -36,6 +48,11 @@ class Orden(BaseModel):
36
48
  op_tc_clave_ord: Optional[types.TipoCuentaOrdenPago] = None
37
49
  op_cuenta_ord: Optional[str] = None
38
50
  op_rfc_curp_ord: Optional[str] = None
51
+ # In Karpay only OpInsClave exists.
52
+ # It is always the institution that generates the payment order.
53
+ # For deposits, it is the other institution.
54
+ # For transfers, it is Fondeadora.
55
+ # Here we use OpInsClaveOrd and OpInsClaveBen to differentiate between them.
39
56
  op_ins_clave_ord: Optional[digits(3, 5)] = None # type: ignore
40
57
  # destination info
41
58
  op_nom_ben: Optional[str] = None
@@ -105,6 +122,20 @@ class Orden(BaseModel):
105
122
  ah_ar_clave: Optional[int] = None
106
123
  emp_clave: Optional[int] = None
107
124
 
125
+ # remesas
126
+ op_id_remesa: Optional[str] = None
127
+ op_pais: Optional[str] = None
128
+ op_divisa: Optional[str] = None
129
+ op_tipo_cambio: Optional[float] = None
130
+ op_nom_emisor_remesa: Optional[str] = None
131
+ tc_clave_emisor_remesa: Optional[int] = None
132
+ op_cuenta_emisor_remesa: Optional[str] = None
133
+ op_rfc_curp_emisor_remesa: Optional[str] = None
134
+ op_nom_ben_remesa: Optional[str] = None
135
+ op_nom_prov_remesa_extranjera: Optional[str] = None
136
+ op_nom_prov_remesa_nacional: Optional[str] = None
137
+ op_nom_ben_indirecto_receptor: Optional[str] = None
138
+
108
139
  class Config: # noqa: WPS306, WPS431
109
140
  use_enum_values = True
110
141
 
@@ -115,14 +146,13 @@ class Orden(BaseModel):
115
146
 
116
147
  @validator('op_fecha_oper')
117
148
  def op_fecha_oper_must_be_iso_format(cls, value): # noqa: WPS110, N805
118
- regex = re.compile(r'^\d{4}(0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])$')
119
- if re.findall(regex, str(value)):
149
+ if _DATE_PATTERN.findall(str(value)):
120
150
  return value
121
151
 
122
152
  raise ValueError('must be in YYYYMMDD format')
123
153
 
124
- def build_xml(self): # noqa: WPS231, C901
125
- ordenpago = etree.Element('ordenpago', Id=str(self.id))
154
+ def build_xml(self) -> _Element: # noqa: WPS231, C901
155
+ ordenpago: _Element = etree.Element('ordenpago', Id=str(self.id))
126
156
 
127
157
  elements = self.dict(
128
158
  exclude_none=True,
@@ -131,55 +161,69 @@ class Orden(BaseModel):
131
161
 
132
162
  for element, value in elements.items(): # noqa: WPS110
133
163
  if element in self.__fields__:
134
- if element == 'op_firma_dig':
135
- subelement = etree.SubElement(ordenpago, 'opFirmaDig')
136
- subelement.text = str(value)
137
- continue
138
- if element == 'op_ins_clave_ben':
164
+ if element == 'op_ins_clave_ben': # We have a different name for this
139
165
  subelement = etree.SubElement(ordenpago, 'OpInsClave')
140
166
  subelement.text = str(value)
141
167
  continue
142
- if element == 'op_rastreo_ori':
143
- subelement = etree.SubElement(ordenpago, 'opRastreoOri')
144
- subelement.text = str(value)
145
- continue
146
- if element == 'op_fecha_oper_ori':
147
- subelement = etree.SubElement(ordenpago, 'opFechaOperOri')
148
- subelement.text = str(value)
149
- continue
150
- if element == 'op_monto_ori':
151
- subelement = etree.SubElement(ordenpago, 'opMontoOri')
152
- subelement.text = str(value)
153
- continue
154
- if element == 'op_monto_intereses':
155
- subelement = etree.SubElement(ordenpago, 'opMontoInteres')
168
+
169
+ if element == 'op_firma_dig': # Lower case o in op
170
+ subelement = etree.SubElement(ordenpago, 'opFirmaDig')
156
171
  subelement.text = str(value)
157
172
  continue
158
- if element == 'op_comision_trans':
159
- subelement = etree.SubElement(ordenpago, 'opComisionTrans')
160
- subelement.text = str(value)
173
+
174
+ text = self._process_text(str(value), element)
175
+
176
+ if element in _CAMEL_CASE_FIELDS:
177
+ subelement = etree.SubElement(ordenpago, to_camel_case(element))
178
+ subelement.text = text
161
179
  continue
162
- upper_camel_case_element = to_upper_camel_case(element)
163
- subelement = etree.SubElement(ordenpago, upper_camel_case_element)
164
- subelement.text = str(value)
180
+
181
+ subelement = etree.SubElement(ordenpago, to_pascal_case(element))
182
+ subelement.text = text
165
183
 
166
184
  return ordenpago
167
185
 
168
186
  @classmethod
169
- def parse_xml(cls, orden_element, categoria: types.CategoriaOrdenPago):
170
- orden_data = {
187
+ def parse_xml(cls, orden_element: _Element, categoria: types.CategoriaOrdenPago):
188
+ """Parse XML element into an Orden instance."""
189
+ orden_data: Dict[str, Any] = {
171
190
  'id': orden_element.attrib['Id'],
172
191
  'categoria': categoria,
173
192
  }
174
193
 
175
194
  for element in orden_element.getchildren():
176
- tag = to_snake_case(element.tag)
177
- if tag in cls.__fields__:
178
- if element.text:
179
- orden_data[tag] = unidecode(element.text.strip())
180
- else:
181
- orden_data[tag] = None
182
- if tag == 'op_ins_clave':
183
- orden_data['op_ins_clave_ord'] = element.text
195
+ cls._process_xml_element(element, orden_data)
184
196
 
185
197
  return cls(**orden_data)
198
+
199
+ @classmethod
200
+ def _process_xml_element(
201
+ cls,
202
+ element: _Element,
203
+ orden_data: Dict[str, Any],
204
+ ) -> None:
205
+ """Process a single XML element and update orden_data."""
206
+ if not element.text:
207
+ return
208
+
209
+ tag = to_snake_case(element.tag)
210
+ stripped = _WHITESPACE_PATTERN.sub(' ', element.text.strip())
211
+
212
+ if tag == 'op_ins_clave':
213
+ orden_data['op_ins_clave_ord'] = stripped
214
+ return
215
+
216
+ if tag == 'op_firma_dig':
217
+ orden_data['op_firma_dig'] = stripped
218
+ return
219
+
220
+ if tag in cls.__fields__:
221
+ orden_data[tag] = cls._process_text(stripped, tag)
222
+
223
+ @classmethod
224
+ def _process_text(cls, text: str, tag: str) -> Optional[str]:
225
+ """Process and validate the text content of an XML element."""
226
+ try:
227
+ return validate_alphanumeric(text)
228
+ except ValueError as error:
229
+ raise ValueError(f'{error} in {tag}') from error
@@ -4,7 +4,7 @@ from lxml import etree
4
4
  from pydantic.v1 import BaseModel
5
5
 
6
6
  from spei import types
7
- from spei.utils import to_snake_case, to_upper_camel_case # noqa: WPS347
7
+ from spei.utils import to_pascal_case, to_snake_case # noqa: WPS347
8
8
 
9
9
 
10
10
  class DataDict(TypedDict, total=False):
@@ -30,7 +30,7 @@ class Respuesta(BaseModel):
30
30
 
31
31
  for element, value in self.dict(exclude={'categoria'}).items(): # noqa: WPS110
32
32
  if element in self.__fields__:
33
- upper_camel_case_element = to_upper_camel_case(element)
33
+ upper_camel_case_element = to_pascal_case(element)
34
34
  subelement = etree.SubElement(respuesta, upper_camel_case_element)
35
35
  subelement.text = str(value)
36
36
 
@@ -0,0 +1,107 @@
1
+ # From “APÉNDICE B: TABLA DE CARACTERES VÁLIDOS Y CÓDIGOS ASCII RESPECTIVOS”
2
+ # in SPEI Manual.
3
+ VALID_CHARACTERS = frozenset(
4
+ (
5
+ ' ',
6
+ '!',
7
+ '"',
8
+ '#',
9
+ '$',
10
+ '%',
11
+ '&',
12
+ "'",
13
+ '(',
14
+ ')',
15
+ '*',
16
+ '+',
17
+ ',',
18
+ '-',
19
+ '.',
20
+ '/',
21
+ '0',
22
+ '1',
23
+ '2',
24
+ '3',
25
+ '4',
26
+ '5',
27
+ '6',
28
+ '7',
29
+ '8',
30
+ '9',
31
+ ':',
32
+ ';',
33
+ '?',
34
+ '@',
35
+ 'A',
36
+ 'B',
37
+ 'C',
38
+ 'D',
39
+ 'E',
40
+ 'F',
41
+ 'G',
42
+ 'H',
43
+ 'I',
44
+ 'J',
45
+ 'K',
46
+ 'L',
47
+ 'M',
48
+ 'N',
49
+ 'O',
50
+ 'P',
51
+ 'Q',
52
+ 'R',
53
+ 'S',
54
+ 'T',
55
+ 'U',
56
+ 'V',
57
+ 'W',
58
+ 'X',
59
+ 'Y',
60
+ 'Z',
61
+ '\\',
62
+ '_',
63
+ 'a',
64
+ 'b',
65
+ 'c',
66
+ 'd',
67
+ 'e',
68
+ 'f',
69
+ 'g',
70
+ 'h',
71
+ 'i',
72
+ 'j',
73
+ 'k',
74
+ 'l',
75
+ 'm',
76
+ 'n',
77
+ 'o',
78
+ 'p',
79
+ 'q',
80
+ 'r',
81
+ 's',
82
+ 't',
83
+ 'u',
84
+ 'v',
85
+ 'w',
86
+ 'x',
87
+ 'y',
88
+ 'z',
89
+ 'é',
90
+ 'á',
91
+ 'í',
92
+ 'ó',
93
+ 'ú',
94
+ 'ñ',
95
+ 'Ñ',
96
+ '¿',
97
+ '¡',
98
+ ),
99
+ )
100
+
101
+
102
+ def validate_alphanumeric(text: str) -> str:
103
+ if not all(char in VALID_CHARACTERS for char in text):
104
+ invalid_chars = set(text) - VALID_CHARACTERS
105
+ raise ValueError(f'Invalid characters found: {invalid_chars}')
106
+
107
+ return text
spei/sice.py CHANGED
@@ -1,5 +1,5 @@
1
1
  import logging
2
- from typing import Optional, Tuple, Type
2
+ from typing import Any, Dict, Optional, Tuple, Type
3
3
  from urllib.parse import urljoin
4
4
 
5
5
  import requests
@@ -20,28 +20,36 @@ class BaseClient(object):
20
20
  http_client: Type[requests.Session] = requests.Session,
21
21
  auth: Optional[Tuple[str, str]] = None,
22
22
  ) -> None:
23
- self.host: str = host
24
- self.session: requests.Session = http_client()
25
- self.session.headers.update({'Content-Type': 'application/xml'})
23
+ self.host = host
24
+ self.session = http_client()
25
+ self.session.headers.update(
26
+ {
27
+ 'Content-Type': 'application/xml; charset=cp850',
28
+ 'User-Agent': 'Fondeadora/SICE/v0.52.0',
29
+ },
30
+ )
26
31
  self.session.verify = verify
27
32
  if auth:
28
33
  self.session.auth = auth
29
34
 
30
35
  def registra_cda(
31
36
  self,
32
- cda_data: dict,
37
+ cda_data: Dict[str, Any],
33
38
  cda_cls: Type[CDA] = CDA,
34
39
  acuse_response_cls: Type[AcuseResponse] = AcuseResponse,
35
40
  endpoint: str = '/enlace-cep/EnvioCdaPortTypeImpl?wsdl',
36
41
  ) -> AcuseResponse:
37
42
  orden = cda_cls(**cda_data)
38
- soap_request = CDARequest(orden)
43
+ soap_request = CDARequest(orden).to_string()
39
44
  logger.info(soap_request)
40
- cda_url = urljoin(self.host, endpoint)
41
- response: requests.Response = self.session.post(
42
- data=soap_request, # type: ignore
43
- url=cda_url,
44
- )
45
+
46
+ response = self._make_request(soap_request, endpoint)
47
+ return acuse_response_cls(response.text)
48
+
49
+ def _make_request(self, soap_request: bytes, endpoint: str) -> requests.Response:
50
+ url = urljoin(self.host, endpoint)
51
+ response = self.session.post(data=soap_request, url=url)
45
52
  logger.info(response.text)
46
53
  response.raise_for_status()
47
- return acuse_response_cls(response.text)
54
+
55
+ return response
spei/utils.py CHANGED
@@ -1,11 +1,18 @@
1
1
  import re
2
2
 
3
+ _SNAKE_CASE_PATTERN = re.compile('(.)([A-Z0-9])')
3
4
 
4
- def to_upper_camel_case(string):
5
+
6
+ def to_pascal_case(string: str) -> str:
5
7
  temp = string.split('_')
6
8
  new_string = [ele.title() for ele in temp]
9
+
7
10
  return ''.join(new_string)
8
11
 
9
12
 
10
- def to_snake_case(string):
11
- return re.sub('(.)([A-Z0-9])', r'\1_\2', str(string)).lower()
13
+ def to_camel_case(string: str) -> str:
14
+ return to_pascal_case(string)[0].lower() + to_pascal_case(string)[1:] # noqa: E501, WPS221
15
+
16
+
17
+ def to_snake_case(string: str) -> str:
18
+ return _SNAKE_CASE_PATTERN.sub(r'\1_\2', str(string)).lower()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spei-python
3
- Version: 0.53.0
3
+ Version: 0.53.1
4
4
  Summary:
5
5
  Author: tech
6
6
  Author-email: tech@fondeadora.com
@@ -5,35 +5,36 @@ spei/checksum/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  spei/checksum/factory.py,sha256=wDZGjHYlcyQhsRSwYp87rNc7bL9eUNjRJu3-XvNhD2s,2092
6
6
  spei/checksum/generator.py,sha256=P_Aif9WxgGSeMHvCyhItgvDLPI0GjwQqnZDgWgXddT8,7831
7
7
  spei/checksum/types.py,sha256=7pvxGCB3IBHe9-bE_UnJQF1TfLtTDHchU4leLui32qI,1912
8
- spei/client.py,sha256=F13e1rnrtuiXJ7CCJJoRS7fF5D4ZI8nHfUQc_6Kr-ok,3063
8
+ spei/client.py,sha256=nbbLGQiLYSBbSmJDHkZedpUzzvQyFQVaA7gtnI3m7Q0,3245
9
9
  spei/errors/__init__.py,sha256=vEL39E44fDD2nkmhVi3lqC1P5nXUNQDX1_GtzR6d4jk,100
10
- spei/errors/sice.py,sha256=SZqA2DnkFxE7ux4obXXzED7AyQwOmOvxjTXB_etenI0,4363
11
- spei/errors/spei.py,sha256=ne3Qg5ciRo_4TkiR4xJOSK7WQ-teeG6I9-dxqykUH-0,16065
10
+ spei/errors/sice.py,sha256=LU285NsvRySUDWQ0nSYFFiCXR_iAmehGHAoY7YQFSqY,4396
11
+ spei/errors/spei.py,sha256=wKcOmQ6Mw7smBQ_4dzOn39RSiT5cJJySjhoyX9PIMns,16120
12
12
  spei/exceptions.py,sha256=1T0FJydzgXwvctCxw9qlqqxhil74CaEfmPlVkmmFbvU,382
13
13
  spei/mappings.py,sha256=YB7iAXIIXsQsKod05ENnT2UOYkMT3ij0K5HC6DR2_Pc,2966
14
14
  spei/requests/__init__.py,sha256=dD68SgnGmIjxuDibAGyBf7_tJnetUxU4QPa2ujr9OpY,240
15
15
  spei/requests/acuse.py,sha256=d4_7XKTsiGNnPHrFWTB_jStFUM3lMWOruqW87ZR0CrI,2311
16
- spei/requests/cda.py,sha256=RyVMnU19639BZyoccZeU39Rw8JmBLKmTkn8Zro9L7Ys,1156
17
- spei/requests/orden.py,sha256=iec7McxjUpJCB94_raStSSKMD1Od4AzrqoKj7uatGJk,1444
16
+ spei/requests/cda.py,sha256=7bu8hW9rPWGMJAjdouWWDHoYVlBfD6Cr--M9z-1bYe4,1299
17
+ spei/requests/orden.py,sha256=TIkTDr1pVvJ4TOX6hUXQhUparOOAVAJY_zv_bxPrxvU,1602
18
18
  spei/requests/respuesta.py,sha256=oH0EU4qJ7cPmYjMg5v_UBbZMf6ZdrXA7sZY7fOMtzs8,1724
19
19
  spei/resources/__init__.py,sha256=cJL9KI0ZBKHcDN5me8yuvschQMW1HH_bpLS7TnLXZw4,487
20
20
  spei/resources/acuse.py,sha256=eU8XA0qn4XUF9awhzWCIJhwNto3JKEdFQaXzmUyuCKM,5599
21
- spei/resources/cda.py,sha256=TWA0JsWLMeg-Tx6QICqsKag9hmwa0K-ejiJv_AUJ0P4,2700
21
+ spei/resources/cda.py,sha256=dP0eebcXWzbenpCkwNfVY3OCVJbxd904Uz_za9QhrAo,3205
22
22
  spei/resources/ensesion.py,sha256=F6hTuphIZUv8rND6aSMkb7zk-061HND4RwCZBYYEuLQ,1588
23
23
  spei/resources/mensaje.py,sha256=1gEbwDX_eSRDfry5Rh5bkBfxJSy5UaHzOEy-Y4pka90,1807
24
- spei/resources/orden.py,sha256=E7JKCittJmVHqkg_DaU7wJyFsk-p22TlVspAJYHlQKM,7070
24
+ spei/resources/orden.py,sha256=0fFoi8WAaKFFm7f6dnntt5BMdMvFwyWMgWXO7y6hF-4,8282
25
25
  spei/resources/payments.py,sha256=l32vrXuXP0VH0iY3adR0_C8_S8_3vOiaaSgLdd22tp4,8880
26
- spei/resources/respuesta.py,sha256=OoesLYZsxluZHjnwhSVBRYKKJSEWPxFVOH1pJIyu2Vk,1500
26
+ spei/resources/respuesta.py,sha256=N-NESbbGiSclReNgUrw2NCX5piARu54ohZlzKNV70E0,1490
27
+ spei/resources/validators.py,sha256=7HPEwAR1DCUnJoT_knGptb167zfdCDYIDp-DAWtAGOk,1613
27
28
  spei/responses/__init__.py,sha256=WxHb0KJ1sI5m6iLfxtf3h8MnqubQlxdtiaarXJvZdkM,247
28
29
  spei/responses/acuse.py,sha256=ZGfP45XYvDSDbgfSKWeraDpFApDc0oks05_tQH-bwzM,650
29
30
  spei/responses/orden.py,sha256=a-GE62-OBWVNpW2RuVKgNqWnY2cNy88shUDLQAL21dU,1068
30
31
  spei/responses/respuesta.py,sha256=cKK-46AimKEdqmMLOO1syGUWuBldnWFdAVNcsubpn6I,2162
31
- spei/sice.py,sha256=p0Y34sUZ2a8jECsutfbJupDus4n8CSPNsajGCl8_SKc,1434
32
+ spei/sice.py,sha256=liqzUZ4ClIgFefi8M-7uoyOcoKZvhPpUWHH88T9xwlc,1667
32
33
  spei/types/__init__.py,sha256=FKFSe-eTgKjf0qFSMqYZDkgYYIT3-5Je4Wc5QRNAp7U,643
33
34
  spei/types/sice.py,sha256=xFSoiLklRNWXoWwZXpSN8-SdkliNK23_MZbhcOc7a9s,222
34
35
  spei/types/spei.py,sha256=rgdbWEMqIHNuSBaCwWmpziK35JcQ-q3nDHZR7-rDpMU,4765
35
- spei/utils.py,sha256=Lje_sg6hLKQxsPmqf7ovVKKVcGZi7LlgNNg1MRtWnRo,247
36
+ spei/utils.py,sha256=DtJAWf3tUvjRFC2G-L3ylm7ogBGwugNaBZtJI52jDME,455
36
37
  spei/validators.py,sha256=wACDKfpyyuREvrNuUR20xcMyPSwDygWQX9oOQLiMwiE,745
37
- spei_python-0.53.0.dist-info/METADATA,sha256=7GjBI6hb7iI3Xbwf0i853j-Z8CdqOmzTkrgwTzlMuaI,3954
38
- spei_python-0.53.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
39
- spei_python-0.53.0.dist-info/RECORD,,
38
+ spei_python-0.53.1.dist-info/METADATA,sha256=FteM6-7IG3D0mqamSSwadRqFeqNeMYSpQJ_lOqMRhCA,3954
39
+ spei_python-0.53.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
40
+ spei_python-0.53.1.dist-info/RECORD,,