spei-python 0.48.4__tar.gz → 0.48.6__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.48.4 → spei_python-0.48.6}/PKG-INFO +2 -2
  2. {spei_python-0.48.4 → spei_python-0.48.6}/pyproject.toml +3 -3
  3. {spei_python-0.48.4 → spei_python-0.48.6}/spei/cep_generator.py +24 -16
  4. {spei_python-0.48.4 → spei_python-0.48.6}/spei/resources/orden.py +5 -0
  5. {spei_python-0.48.4 → spei_python-0.48.6}/README.md +0 -0
  6. {spei_python-0.48.4 → spei_python-0.48.6}/spei/README.md +0 -0
  7. {spei_python-0.48.4 → spei_python-0.48.6}/spei/__init__.py +0 -0
  8. {spei_python-0.48.4 → spei_python-0.48.6}/spei/checksum/__init__.py +0 -0
  9. {spei_python-0.48.4 → spei_python-0.48.6}/spei/checksum/factory.py +0 -0
  10. {spei_python-0.48.4 → spei_python-0.48.6}/spei/checksum/generator.py +0 -0
  11. {spei_python-0.48.4 → spei_python-0.48.6}/spei/checksum/types.py +0 -0
  12. {spei_python-0.48.4 → spei_python-0.48.6}/spei/client.py +0 -0
  13. {spei_python-0.48.4 → spei_python-0.48.6}/spei/errors/__init__.py +0 -0
  14. {spei_python-0.48.4 → spei_python-0.48.6}/spei/errors/sice.py +0 -0
  15. {spei_python-0.48.4 → spei_python-0.48.6}/spei/errors/spei.py +0 -0
  16. {spei_python-0.48.4 → spei_python-0.48.6}/spei/exceptions.py +0 -0
  17. {spei_python-0.48.4 → spei_python-0.48.6}/spei/mappings.py +0 -0
  18. {spei_python-0.48.4 → spei_python-0.48.6}/spei/requests/__init__.py +0 -0
  19. {spei_python-0.48.4 → spei_python-0.48.6}/spei/requests/acuse.py +0 -0
  20. {spei_python-0.48.4 → spei_python-0.48.6}/spei/requests/cda.py +0 -0
  21. {spei_python-0.48.4 → spei_python-0.48.6}/spei/requests/orden.py +0 -0
  22. {spei_python-0.48.4 → spei_python-0.48.6}/spei/requests/respuesta.py +0 -0
  23. {spei_python-0.48.4 → spei_python-0.48.6}/spei/resources/__init__.py +0 -0
  24. {spei_python-0.48.4 → spei_python-0.48.6}/spei/resources/acuse.py +0 -0
  25. {spei_python-0.48.4 → spei_python-0.48.6}/spei/resources/cda.py +0 -0
  26. {spei_python-0.48.4 → spei_python-0.48.6}/spei/resources/ensesion.py +0 -0
  27. {spei_python-0.48.4 → spei_python-0.48.6}/spei/resources/mensaje.py +0 -0
  28. {spei_python-0.48.4 → spei_python-0.48.6}/spei/resources/payments.py +0 -0
  29. {spei_python-0.48.4 → spei_python-0.48.6}/spei/resources/respuesta.py +0 -0
  30. {spei_python-0.48.4 → spei_python-0.48.6}/spei/responses/__init__.py +0 -0
  31. {spei_python-0.48.4 → spei_python-0.48.6}/spei/responses/acuse.py +0 -0
  32. {spei_python-0.48.4 → spei_python-0.48.6}/spei/responses/orden.py +0 -0
  33. {spei_python-0.48.4 → spei_python-0.48.6}/spei/responses/respuesta.py +0 -0
  34. {spei_python-0.48.4 → spei_python-0.48.6}/spei/sice.py +0 -0
  35. {spei_python-0.48.4 → spei_python-0.48.6}/spei/types/__init__.py +0 -0
  36. {spei_python-0.48.4 → spei_python-0.48.6}/spei/types/sice.py +0 -0
  37. {spei_python-0.48.4 → spei_python-0.48.6}/spei/types/spei.py +0 -0
  38. {spei_python-0.48.4 → spei_python-0.48.6}/spei/utils.py +0 -0
  39. {spei_python-0.48.4 → spei_python-0.48.6}/spei/validators.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spei-python
3
- Version: 0.48.4
3
+ Version: 0.48.6
4
4
  Summary:
5
5
  Author: tech
6
6
  Author-email: tech@fondeadora.com
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3.11
12
12
  Requires-Dist: cryptography (>=3.0,<42.1)
13
13
  Requires-Dist: lxml (>=4.7.1,<5.0.0)
14
14
  Requires-Dist: pydantic (>=1.8.2,<2.0.0)
15
- Requires-Dist: requests (>=2.31.0,<3.0.0)
15
+ Requires-Dist: requests (>=2.32.2,<3.0.0)
16
16
  Description-Content-Type: text/markdown
17
17
 
18
18
  [![wemake-python-styleguide](https://img.shields.io/badge/style-wemake-000000.svg)](https://github.com/wemake-services/wemake-python-styleguide)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "spei-python"
3
- version = "0.48.4"
3
+ version = "0.48.6"
4
4
  description = ""
5
5
  authors = ["tech <tech@fondeadora.com>"]
6
6
  readme = "README.md"
@@ -10,7 +10,7 @@ packages = [{include = "spei"}]
10
10
  python = ">=3.8.1,<4.0"
11
11
  lxml = "^4.7.1"
12
12
  pydantic = ">=1.8.2, <2.0.0"
13
- requests = "^2.31.0"
13
+ requests = "^2.32.2"
14
14
  cryptography = ">=3.0,<42.1"
15
15
 
16
16
  [tool.poetry.dev-dependencies]
@@ -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.48.4"
35
+ version = "0.48.6"
36
36
  tag_format = "v$version"
37
37
  bump_message = "bump: Semantic Release Bot: Release Version: $new_version 🤖🚀 [skip ci]"
38
38
  version_files = [
@@ -44,37 +44,45 @@ class CepGenerator(object):
44
44
  return self._encrypt_string(string)
45
45
 
46
46
  def decrypt_string(self, encrypted_data_base64: str) -> str: # noqa: WPS210
47
- backend = default_backend()
48
47
  encrypted_data = base64.b64decode(encrypted_data_base64)
49
48
  iv = encrypted_data[:IV_LIMIT]
50
- cipher = Cipher(
51
- algorithms.AES(base64.b64decode(self.key_base64)),
52
- modes.CBC(iv),
53
- backend=backend,
49
+ decryptor = self.decryptor(iv)
50
+
51
+ decrypted_data = (
52
+ decryptor.update(
53
+ encrypted_data[IV_LIMIT:],
54
+ )
55
+ + decryptor.finalize()
54
56
  )
55
- decryptor = cipher.decryptor()
56
- decrypted_data = decryptor.update(
57
- encrypted_data[IV_LIMIT:],
58
- ) + decryptor.finalize()
57
+
59
58
  unpadder = padding.PKCS7(algorithms.AES.block_size).unpadder()
60
59
  unpadded_data = unpadder.update(decrypted_data) + unpadder.finalize()
61
60
 
62
61
  return unpadded_data.decode()
63
62
 
63
+ def encryptor(self, iv: bytes, backend=None):
64
+ return self.cipher(iv, backend=backend).encryptor()
65
+
66
+ def decryptor(self, iv: bytes, backend=None):
67
+ return self.cipher(iv, backend=backend).decryptor()
68
+
69
+ def cipher(self, iv: bytes, backend=None):
70
+ return Cipher(
71
+ algorithms.AES(base64.b64decode(self.key_base64)),
72
+ modes.CBC(iv),
73
+ backend=backend or default_backend(),
74
+ )
75
+
64
76
  def _format_date(self, date: datetime.datetime) -> str:
65
77
  return date.strftime('%Y%m%d')
66
78
 
67
79
  def _encrypt_string(self, string: str) -> str: # noqa: WPS210
68
- backend = default_backend()
69
80
  iv = self.rng(IV_LIMIT)
70
- cipher = Cipher(
71
- algorithms.AES(base64.b64decode(self.key_base64)),
72
- modes.CBC(iv),
73
- backend=backend,
74
- )
75
- encryptor = cipher.encryptor()
81
+ encryptor = self.encryptor(iv)
82
+
76
83
  padder = padding.PKCS7(algorithms.AES.block_size).padder()
77
84
  padded_data = padder.update(string.encode()) + padder.finalize()
85
+
78
86
  encrypted_data = encryptor.update(padded_data) + encryptor.finalize()
79
87
  encrypted_data_base64 = base64.b64encode(iv + encrypted_data)
80
88
 
@@ -106,6 +106,11 @@ class Orden(BaseModel):
106
106
  class Config: # noqa: WPS306, WPS431
107
107
  use_enum_values = True
108
108
 
109
+ @validator('op_monto', always=True)
110
+ def set_amount(cls, value): # noqa: WPS110, N805
111
+ amount = float(value)
112
+ return '{amount:.2f}'.format(amount=amount)
113
+
109
114
  @validator('op_fecha_oper')
110
115
  def op_fecha_oper_must_be_iso_format(cls, value): # noqa: WPS110, N805
111
116
  regex = re.compile(r'^\d{4}(0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])$')
File without changes
File without changes
File without changes