python-redsys 1.2.0__py3-none-any.whl → 1.2.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.
@@ -1,11 +1,11 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: python-redsys
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: A simple, clean and less dependant client to handle payments through Redsys.
5
- Home-page: https://github.com/systemallica/python-redsys
6
5
  License: MIT
7
- Author: Andrés Reverón Molina
8
- Author-email: andres@reveronmolina.me
6
+ License-File: LICENSE
7
+ Author: David Díaz
8
+ Author-email: d.diazp@gmail.com
9
9
  Requires-Python: >=3.8,<4.0
10
10
  Classifier: Intended Audience :: Developers
11
11
  Classifier: License :: OSI Approved :: MIT License
@@ -15,7 +15,12 @@ Classifier: Programming Language :: Python :: 3.8
15
15
  Classifier: Programming Language :: Python :: 3.9
16
16
  Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Programming Language :: Python :: 3.15
18
22
  Requires-Dist: pycryptodome (>=3.19.0,<4.0.0)
23
+ Project-URL: Homepage, https://github.com/ddiazpinto/python-redsys
19
24
  Description-Content-Type: text/markdown
20
25
 
21
26
 
@@ -0,0 +1,13 @@
1
+ redsys/__init__.py,sha256=kRuS8epm885TJGvdrjNc9xwT70glq_h9x71_bUgT68s,138
2
+ redsys/client.py,sha256=ervLX4FbzDfWjh_SO2SFyY9IT0PZ5aIcVZdYy4mUO7Q,3937
3
+ redsys/constants.py,sha256=lJYgbmikxh0b9iVM4M5XFWBWVvdFY27OkcXSLluHSsQ,2497
4
+ redsys/request.py,sha256=IEzlRi34JgDBRRyaBHtIrAZ38fADL977RdBFaeWDdbY,5304
5
+ redsys/response.py,sha256=leDhlDlnVLGeruxlN2_3DQ-V56xAbIiFkvoqYDmz9S0,5430
6
+ redsys/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ redsys/tests/test_client.py,sha256=oND8W9y6O6MkDLNxnBpd8UDShwKWoAW3SgKmWDOXHrw,3858
8
+ redsys/tests/test_request.py,sha256=FONigjMNdaug2DwillYKCLPK-gzIYZSVUZmcm9QkCms,3110
9
+ redsys/tests/test_response.py,sha256=V8WdZ1oR4Ed5ZKmi2R-Hpgnr3AyYZy-jFH1yn2S0lA4,1220
10
+ python_redsys-1.2.1.dist-info/METADATA,sha256=Wn6Z7SG3HtRu0PIaxBwEzsDomMFzxO_BH9M4NpFu-uA,4631
11
+ python_redsys-1.2.1.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
12
+ python_redsys-1.2.1.dist-info/licenses/LICENSE,sha256=Ku6mJcUOcHd2aZ4o2Jh4Tjkx1oZT-iT0VCyUNvm2IXU,1257
13
+ python_redsys-1.2.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.7.0
2
+ Generator: poetry-core 2.5.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
redsys/__init__.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "1.2.0"
1
+ __version__ = "1.2.1"
2
2
  __version_info__ = tuple(int(num) if num.isdigit() else num for num in __version__.replace("-", ".", 1).split("."))
redsys/request.py CHANGED
@@ -77,9 +77,11 @@ class Request:
77
77
  their values according to the platform specifications
78
78
  """
79
79
 
80
- _parameters: Dict[str, Any] = {}
80
+ _parameters: Dict[str, Any]
81
81
 
82
82
  def __init__(self, parameters: Dict[str, Any]) -> None:
83
+ # __setattr__ only handles merchant parameters, so the per-instance store is set directly.
84
+ object.__setattr__(self, "_parameters", {})
83
85
  for key, value in parameters.items():
84
86
  if key in MERCHANT_PARAMETERS_MAP:
85
87
  if check := getattr(self, f"check_{str(key)}", None):
@@ -90,7 +92,7 @@ class Request:
90
92
 
91
93
  def __getattr__(self, item: str) -> Any:
92
94
  if item in MERCHANT_PARAMETERS_MAP:
93
- return self._parameters[item]
95
+ return self._parameters.get(item)
94
96
 
95
97
  def __setattr__(self, key, value):
96
98
  if key in MERCHANT_PARAMETERS_MAP:
redsys/response.py CHANGED
@@ -93,9 +93,11 @@ class Response:
93
93
  Defines a response
94
94
  """
95
95
 
96
- _parameters: Dict[str, Any] = {}
96
+ _parameters: Dict[str, Any]
97
97
 
98
98
  def __init__(self, parameters: Dict[str, Any]):
99
+ # __setattr__ only handles merchant parameters, so the per-instance store is set directly.
100
+ object.__setattr__(self, "_parameters", {})
99
101
  MERCHANT_PARAMETERS_MAP_REVERSE = {value: key for key, value in MERCHANT_PARAMETERS_MAP.items()}
100
102
  for key, value in parameters.items():
101
103
  reversed_parameter = MERCHANT_PARAMETERS_MAP_REVERSE.get(key, key)
@@ -104,7 +106,7 @@ class Response:
104
106
 
105
107
  def __getattr__(self, item: str) -> Any:
106
108
  if item in MERCHANT_PARAMETERS_MAP:
107
- return self._parameters[item]
109
+ return self._parameters.get(item)
108
110
 
109
111
  def __setattr__(self, key: str, value: Any):
110
112
  if key in MERCHANT_PARAMETERS_MAP:
@@ -63,3 +63,12 @@ class TestRequest:
63
63
  merchant_url = "".join(choice("abcdefghijklmnopqrtsuvwxyz-0123456789") for _ in range(251))
64
64
  with pytest.raises(ValueError):
65
65
  assert Request.check_merchant_url(merchant_url)
66
+
67
+ def test_requests_do_not_share_parameters(self):
68
+ first = Request(
69
+ {"order": "000000000001", "amount": D("1.00"), "currency": EUR, "mobile_number": "+34700000000"}
70
+ )
71
+ second = Request({"order": "000000000002", "amount": D("2.00"), "currency": EUR})
72
+ assert "Ds_Merchant_Bizum_MobileNumber" not in second.prepare_parameters()
73
+ assert second.mobile_number is None
74
+ assert first.prepare_parameters()["Ds_Merchant_Bizum_MobileNumber"] == "+34700000000"
@@ -1,3 +1,5 @@
1
+ from decimal import Decimal
2
+
1
3
  from redsys.response import Response
2
4
 
3
5
 
@@ -21,3 +23,10 @@ class TestResponse:
21
23
  assert response.is_paid is True
22
24
  assert response.is_canceled is False
23
25
  assert response.is_refunded is False
26
+
27
+ def test_responses_do_not_share_parameters(self):
28
+ first = Response({"Ds_Response": "0000", "Ds_Order": "000000000001", "Ds_Amount": "100"})
29
+ second = Response({"Ds_Response": "0190", "Ds_Order": "000000000002"})
30
+ assert "amount" not in second.parameters
31
+ assert second.amount is None
32
+ assert first.amount == Decimal("1.00")
@@ -1,13 +0,0 @@
1
- redsys/__init__.py,sha256=mBK19nPR_NOqZ1AHA73PWWuxqU4gDY1nssPXujFjOo0,138
2
- redsys/client.py,sha256=ervLX4FbzDfWjh_SO2SFyY9IT0PZ5aIcVZdYy4mUO7Q,3937
3
- redsys/constants.py,sha256=lJYgbmikxh0b9iVM4M5XFWBWVvdFY27OkcXSLluHSsQ,2497
4
- redsys/request.py,sha256=t9zStQ4QcRfMA7xDU-Qt6zKAyUA5bzvmD0aoCjjHgi4,5154
5
- redsys/response.py,sha256=qJaeuCUfzGc3dBRS_yzBWGJ6yWtZLj0P4ioOGsr5e8Y,5280
6
- redsys/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- redsys/tests/test_client.py,sha256=oND8W9y6O6MkDLNxnBpd8UDShwKWoAW3SgKmWDOXHrw,3858
8
- redsys/tests/test_request.py,sha256=QRD-m7O9AVokpu2SgcirXqMU17GDn0tqzFyjkeneHHE,2601
9
- redsys/tests/test_response.py,sha256=Q7rQ6TXUWBnIoNlqTWAwzTFq5gv_naEYZ1r8RYid18c,826
10
- python_redsys-1.2.0.dist-info/LICENSE,sha256=Ku6mJcUOcHd2aZ4o2Jh4Tjkx1oZT-iT0VCyUNvm2IXU,1257
11
- python_redsys-1.2.0.dist-info/METADATA,sha256=tYputxvq5_laNsEPPSs-Y5A3gBjzhzzqljryn2KOdb4,4413
12
- python_redsys-1.2.0.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
13
- python_redsys-1.2.0.dist-info/RECORD,,