spei-python 1.0.9__py3-none-any.whl → 1.0.11__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/signature/payload.py CHANGED
@@ -38,9 +38,12 @@ class SignaturePayloadBuilder(object):
38
38
  return bytearray(day + month + year)
39
39
 
40
40
  def _clave_to_bytearray(self, clave: Optional[str]) -> bytearray:
41
- clave = clave or ''
41
+ # Falsy (None, '', or the literal string 'None' from an unguarded str()
42
+ # at a call site) means "no institution clave" — e.g. a card destination,
43
+ # which has no CLABE institution code. Encode that as 0, not a crash.
44
+ clave_int = int(clave) if clave and clave != 'None' else 0
42
45
 
43
- return bytearray(int.to_bytes(int(clave), 4, 'big'))
46
+ return bytearray(int.to_bytes(clave_int, 4, 'big'))
44
47
 
45
48
  def _monto_to_bytearray(self, amount: str) -> bytearray:
46
49
  high_value, low_value = self.split_amount(amount)
@@ -78,7 +81,7 @@ class RemittanceSignaturePayloadBuilder(
78
81
  SignaturePayloadBuilder,
79
82
  ):
80
83
  def build(self, orden: Orden) -> bytes:
81
- message_data = (
84
+ message_data = [
82
85
  self._fecha_to_bytearray(orden.op_fecha_oper),
83
86
  self._clave_to_bytearray(str(orden.op_ins_clave_ord)),
84
87
  self._clave_to_bytearray(str(orden.op_ins_clave_ben)),
@@ -86,12 +89,13 @@ class RemittanceSignaturePayloadBuilder(
86
89
  self._monto_to_bytearray(orden.op_monto),
87
90
  self._to_byte_array(orden.op_cuenta_ord, add_zero_byte=True),
88
91
  self._to_byte_array(orden.op_cuenta_ben, add_zero_byte=True),
89
- self._to_byte_array(
90
- orden.op_cuenta_participante_ord,
91
- add_zero_byte=True,
92
- ),
93
- )
94
- return self._list_to_bytes(message_data)
92
+ ]
93
+ participante = orden.op_cuenta_participante_ord
94
+ if participante and participante != '0':
95
+ message_data.append(
96
+ self._to_byte_array(participante, add_zero_byte=True),
97
+ )
98
+ return self._list_to_bytes(tuple(message_data))
95
99
 
96
100
 
97
101
  class DefaultSignaturePayloadBuilder(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spei-python
3
- Version: 1.0.9
3
+ Version: 1.0.11
4
4
  Summary:
5
5
  Author: tech
6
6
  Author-email: tech@fondeadora.com
@@ -10,8 +10,9 @@ Classifier: Programming Language :: Python :: 3.11
10
10
  Classifier: Programming Language :: Python :: 3.12
11
11
  Classifier: Programming Language :: Python :: 3.13
12
12
  Classifier: Programming Language :: Python :: 3.14
13
- Requires-Dist: cryptography (>=3.0,<44.1)
14
- Requires-Dist: lxml (>=5.0.0,<6.0.0)
13
+ Classifier: Programming Language :: Python :: 3.15
14
+ Requires-Dist: cryptography (>=50.0.0)
15
+ Requires-Dist: lxml (>=6.1.0)
15
16
  Requires-Dist: pydantic (>=1.10.17,<3)
16
17
  Requires-Dist: requests (>=2.32.2,<3.0.0)
17
18
  Requires-Dist: unidecode (>=1.3.8,<2.0.0)
@@ -31,13 +31,13 @@ spei/responses/respuesta.py,sha256=diufoshWUn7ZJV21tKnxrzs8vP-SHBNsgWsfucFKa5Y,2
31
31
  spei/sice.py,sha256=uNWzbDc9hM351cqG-yJ9exbGeZooAXSSS1VWXlV5m_4,1691
32
32
  spei/signature/__init__.py,sha256=laPhfbP0GusqtJU2f4BQMOssySo-3P712w1BoNx7sNk,2763
33
33
  spei/signature/factory.py,sha256=FXO97y5pr9QzMdMiAM0yZVMkqFOYO9Noslr15q0BWlY,2233
34
- spei/signature/payload.py,sha256=vKskwRP3NfBhmWzhhaZyns-9xEIl_zo2QDxc2nesDOQ,8894
34
+ spei/signature/payload.py,sha256=ac6FrztsUXKDJhhv0Au_xWAG4CxBCQf5q4uxwdJM1PE,9270
35
35
  spei/signature/types.py,sha256=i7biH2L1hRQ5H5QhaUAF9Psl9xPaMvB0ouf7nIH31gU,2410
36
36
  spei/types/__init__.py,sha256=U_4HiFBZ5rsaV5UkD60YArQhaENj_sh1HBGAeuI7ytA,686
37
37
  spei/types/common.py,sha256=TfqIOXH1UbNA0nplji521LFiWR76l2quv-RaUj542OY,551
38
38
  spei/types/sice.py,sha256=xFSoiLklRNWXoWwZXpSN8-SdkliNK23_MZbhcOc7a9s,222
39
39
  spei/types/spei.py,sha256=NW6glbYd52d1cbYQ3j-FC7bjpr0Z4u9jbmFvQhzY8lw,4718
40
40
  spei/utils.py,sha256=DtJAWf3tUvjRFC2G-L3ylm7ogBGwugNaBZtJI52jDME,455
41
- spei_python-1.0.9.dist-info/METADATA,sha256=7v0tkH7RN921cRmN-PQ4JIKA3JG5mLbbOoJyXCU5bJo,3883
42
- spei_python-1.0.9.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
43
- spei_python-1.0.9.dist-info/RECORD,,
41
+ spei_python-1.0.11.dist-info/METADATA,sha256=8mJ1Ew49ZYciLek9C3xmEYOwUVlZZrUWu5qag6bcQ-o,3925
42
+ spei_python-1.0.11.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
43
+ spei_python-1.0.11.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.3.1
2
+ Generator: poetry-core 2.5.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any