python-redsys 1.2.0__tar.gz → 1.2.1__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.
- {python_redsys-1.2.0 → python_redsys-1.2.1}/PKG-INFO +10 -5
- {python_redsys-1.2.0 → python_redsys-1.2.1}/pyproject.toml +3 -3
- {python_redsys-1.2.0 → python_redsys-1.2.1}/redsys/__init__.py +1 -1
- {python_redsys-1.2.0 → python_redsys-1.2.1}/redsys/request.py +4 -2
- {python_redsys-1.2.0 → python_redsys-1.2.1}/redsys/response.py +4 -2
- {python_redsys-1.2.0 → python_redsys-1.2.1}/redsys/tests/test_request.py +9 -0
- {python_redsys-1.2.0 → python_redsys-1.2.1}/redsys/tests/test_response.py +9 -0
- {python_redsys-1.2.0 → python_redsys-1.2.1}/LICENSE +0 -0
- {python_redsys-1.2.0 → python_redsys-1.2.1}/README.md +0 -0
- {python_redsys-1.2.0 → python_redsys-1.2.1}/redsys/client.py +0 -0
- {python_redsys-1.2.0 → python_redsys-1.2.1}/redsys/constants.py +0 -0
- {python_redsys-1.2.0 → python_redsys-1.2.1}/redsys/tests/__init__.py +0 -0
- {python_redsys-1.2.0 → python_redsys-1.2.1}/redsys/tests/test_client.py +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: python-redsys
|
|
3
|
-
Version: 1.2.
|
|
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
|
-
|
|
8
|
-
Author
|
|
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
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "python-redsys"
|
|
3
|
-
version = "1.2.
|
|
3
|
+
version = "1.2.1"
|
|
4
4
|
description = "A simple, clean and less dependant client to handle payments through Redsys."
|
|
5
|
-
authors = ["
|
|
5
|
+
authors = ["David Díaz <d.diazp@gmail.com>", "Andrés Reverón Molina <andres@reveronmolina.me>"]
|
|
6
6
|
license = "MIT"
|
|
7
7
|
readme = "README.md"
|
|
8
|
-
homepage = "https://github.com/
|
|
8
|
+
homepage = "https://github.com/ddiazpinto/python-redsys"
|
|
9
9
|
classifiers = [
|
|
10
10
|
'Intended Audience :: Developers',
|
|
11
11
|
'License :: OSI Approved :: MIT License',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
__version__ = "1.2.
|
|
1
|
+
__version__ = "1.2.1"
|
|
2
2
|
__version_info__ = tuple(int(num) if num.isdigit() else num for num in __version__.replace("-", ".", 1).split("."))
|
|
@@ -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
|
|
95
|
+
return self._parameters.get(item)
|
|
94
96
|
|
|
95
97
|
def __setattr__(self, key, value):
|
|
96
98
|
if key in MERCHANT_PARAMETERS_MAP:
|
|
@@ -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
|
|
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")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|