python-getpaid-payu 3.0.0a4__tar.gz → 3.0.0a5__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 (48) hide show
  1. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/PKG-INFO +3 -3
  2. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/README.md +1 -1
  3. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/pyproject.toml +1 -1
  4. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/src/getpaid_payu/__init__.py +1 -1
  5. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/src/getpaid_payu/simulator/plugin.py +1 -0
  6. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/src/getpaid_payu/simulator/routes.py +23 -8
  7. python_getpaid_payu-3.0.0a5/tests/test_public_api.py +18 -0
  8. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/tests/test_simulator_plugin.py +4 -0
  9. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/uv.lock +4 -4
  10. python_getpaid_payu-3.0.0a4/tests/test_public_api.py +0 -7
  11. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/.github/workflows/ci.yml +0 -0
  12. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/.gitignore +0 -0
  13. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/.pre-commit-config.yaml +0 -0
  14. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/.python-version +0 -0
  15. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/.readthedocs.yml +0 -0
  16. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/.sisyphus/evidence/task-26-readme-payu.txt +0 -0
  17. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/.sisyphus/evidence/task-5-baseline-payu.txt +0 -0
  18. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/CODE_OF_CONDUCT.md +0 -0
  19. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/CONTRIBUTING.md +0 -0
  20. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/LICENSE +0 -0
  21. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/docs/changelog.md +0 -0
  22. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/docs/codeofconduct.md +0 -0
  23. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/docs/concepts.md +0 -0
  24. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/docs/conf.py +0 -0
  25. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/docs/configuration.md +0 -0
  26. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/docs/contributing.md +0 -0
  27. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/docs/getting-started.md +0 -0
  28. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/docs/index.md +0 -0
  29. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/docs/license.md +0 -0
  30. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/docs/reference.md +0 -0
  31. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/docs/requirements.txt +0 -0
  32. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/sandbox_keys.txt +0 -0
  33. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/src/getpaid_payu/client.py +0 -0
  34. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/src/getpaid_payu/processor.py +0 -0
  35. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/src/getpaid_payu/py.typed +0 -0
  36. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/src/getpaid_payu/simulator/__init__.py +0 -0
  37. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/src/getpaid_payu/simulator/signing.py +0 -0
  38. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/src/getpaid_payu/simulator/transitions.py +0 -0
  39. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/src/getpaid_payu/simulator/webhooks.py +0 -0
  40. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/src/getpaid_payu/types.py +0 -0
  41. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/tests/__init__.py +0 -0
  42. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/tests/conftest.py +0 -0
  43. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/tests/test_callback.py +0 -0
  44. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/tests/test_client.py +0 -0
  45. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/tests/test_entry_points.py +0 -0
  46. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/tests/test_processor.py +0 -0
  47. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/tests/test_types.py +0 -0
  48. {python_getpaid_payu-3.0.0a4 → python_getpaid_payu-3.0.0a5}/tests/test_url_construction.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-getpaid-payu
3
- Version: 3.0.0a4
3
+ Version: 3.0.0a5
4
4
  Summary: PayU payment gateway integration for python-getpaid ecosystem.
5
5
  Project-URL: Homepage, https://github.com/django-getpaid/python-getpaid-payu
6
6
  Project-URL: Repository, https://github.com/django-getpaid/python-getpaid-payu
@@ -19,7 +19,7 @@ Classifier: Topic :: Office/Business :: Financial :: Point-Of-Sale
19
19
  Classifier: Typing :: Typed
20
20
  Requires-Python: >=3.12
21
21
  Requires-Dist: httpx>=0.27.0
22
- Requires-Dist: python-getpaid-core>=3.0.0a3
22
+ Requires-Dist: python-getpaid-core>=3.0.0a4
23
23
  Provides-Extra: simulator
24
24
  Requires-Dist: litestar>=2.0; extra == 'simulator'
25
25
  Requires-Dist: python-getpaid-simulator>=3.0.0a3; extra == 'simulator'
@@ -134,7 +134,7 @@ PayU provides a sandbox environment for testing. You can use the example keys pr
134
134
  ## Requirements
135
135
 
136
136
  - Python 3.12+
137
- - `python-getpaid-core >= 3.0.0a3`
137
+ - `python-getpaid-core >= 3.0.0a4`
138
138
  - `httpx >= 0.27.0`
139
139
 
140
140
  ## License
@@ -107,7 +107,7 @@ PayU provides a sandbox environment for testing. You can use the example keys pr
107
107
  ## Requirements
108
108
 
109
109
  - Python 3.12+
110
- - `python-getpaid-core >= 3.0.0a3`
110
+ - `python-getpaid-core >= 3.0.0a4`
111
111
  - `httpx >= 0.27.0`
112
112
 
113
113
  ## License
@@ -19,7 +19,7 @@ classifiers = [
19
19
  'Typing :: Typed',
20
20
  ]
21
21
  dependencies = [
22
- 'python-getpaid-core>=3.0.0a3',
22
+ 'python-getpaid-core>=3.0.0a4',
23
23
  'httpx>=0.27.0',
24
24
  ]
25
25
 
@@ -9,4 +9,4 @@ __all__ = [
9
9
  "PayUProcessor",
10
10
  ]
11
11
 
12
- __version__ = "3.0.0a4"
12
+ __version__ = "3.0.0a5"
@@ -30,6 +30,7 @@ def load_provider_config(
30
30
  ) -> dict[str, Any]:
31
31
  environment = env or os.environ
32
32
  return {
33
+ "amount_minor_unit_places": 2,
33
34
  "second_key": environment.get(
34
35
  "SIMULATOR_PAYU_SECOND_KEY",
35
36
  "b6ca15b0d1020e8094d9b5f8d163db54",
@@ -4,6 +4,8 @@ from __future__ import annotations
4
4
 
5
5
  from datetime import UTC
6
6
  from datetime import datetime
7
+ from decimal import Decimal
8
+ from decimal import InvalidOperation
7
9
  from inspect import isawaitable
8
10
  from typing import Any
9
11
  from urllib.parse import parse_qsl
@@ -31,6 +33,23 @@ def _provider_config(request: Request[Any, Any, Any]) -> dict[str, Any]:
31
33
  return dict(request.app.state.provider_configs["payu"])
32
34
 
33
35
 
36
+ def _format_amount_for_display(
37
+ order: dict[str, Any],
38
+ provider_config: dict[str, Any],
39
+ ) -> str:
40
+ amount_raw = order.get("totalAmount", 0)
41
+ try:
42
+ amount_value = Decimal(str(amount_raw))
43
+ except (InvalidOperation, TypeError, ValueError):
44
+ return str(amount_raw)
45
+
46
+ minor_unit_places = int(provider_config.get("amount_minor_unit_places", 2))
47
+ if minor_unit_places >= 0:
48
+ amount_value /= Decimal(10) ** minor_unit_places
49
+
50
+ return f"{amount_value:.2f} {order.get('currencyCode', 'PLN')}"
51
+
52
+
34
53
  def _unauthorized_response() -> Response[dict[str, dict[str, str]]]:
35
54
  return Response(
36
55
  content={
@@ -329,14 +348,10 @@ async def payu_authorize_get(
329
348
  if order.get("status") in ("COMPLETED", "CANCELED"):
330
349
  raise HTTPException(status_code=400, detail="Payment already processed")
331
350
 
332
- amount_raw = order.get("totalAmount", 0)
333
- try:
334
- amount_value = float(amount_raw) / 100
335
- formatted_amount = (
336
- f"{amount_value:.2f} {order.get('currencyCode', 'PLN')}"
337
- )
338
- except (ValueError, TypeError):
339
- formatted_amount = str(amount_raw)
351
+ formatted_amount = _format_amount_for_display(
352
+ order,
353
+ _provider_config(request),
354
+ )
340
355
 
341
356
  return Template(
342
357
  template_name="authorize.html",
@@ -0,0 +1,18 @@
1
+ """Tests for the public package API."""
2
+
3
+ import tomllib
4
+ from pathlib import Path
5
+
6
+ import getpaid_payu
7
+
8
+
9
+ def test_version() -> None:
10
+ assert getpaid_payu.__version__ == "3.0.0a4"
11
+
12
+
13
+ def test_core_dependency_floor() -> None:
14
+ pyproject_data = tomllib.loads(Path("pyproject.toml").read_text())
15
+ assert (
16
+ "python-getpaid-core>=3.0.0a4"
17
+ in pyproject_data["project"]["dependencies"]
18
+ )
@@ -94,6 +94,10 @@ def test_load_provider_config_reads_env_override(
94
94
  assert load_provider_config()["second_key"] == "override-second-key"
95
95
 
96
96
 
97
+ def test_load_provider_config_includes_amount_minor_unit_places() -> None:
98
+ assert load_provider_config()["amount_minor_unit_places"] == 2
99
+
100
+
97
101
  @pytest.mark.asyncio
98
102
  async def test_trigger_payu_webhook_signs_and_delivers_payload() -> None:
99
103
  storage = FakeStorage(
@@ -829,16 +829,16 @@ wheels = [
829
829
 
830
830
  [[package]]
831
831
  name = "python-getpaid-core"
832
- version = "3.0.0a3"
832
+ version = "3.0.0a4"
833
833
  source = { registry = "https://pypi.org/simple" }
834
834
  dependencies = [
835
835
  { name = "anyio" },
836
836
  { name = "httpx" },
837
837
  { name = "transitions" },
838
838
  ]
839
- sdist = { url = "https://files.pythonhosted.org/packages/d6/0a/e0fd72ed27879c7d6fe7282a4a160479c5dabcd1c1a20b89b213d370e42f/python_getpaid_core-3.0.0a3.tar.gz", hash = "sha256:dc98dcfe1bd581500b6ab96db28653b384cc2b24eb30b30824e7ac5b6703f2cb", size = 52540, upload-time = "2026-03-21T00:00:46.313Z" }
839
+ sdist = { url = "https://files.pythonhosted.org/packages/5c/22/c7a3d249398b609022179299f1cde51207db8e4e9556d4cfe7112f276422/python_getpaid_core-3.0.0a4.tar.gz", hash = "sha256:7784ce418391efe3ec1b6c7fddbfe4d8e1741991a9d0ca3a00ada7807ecb8230", size = 52993, upload-time = "2026-03-25T19:06:56.261Z" }
840
840
  wheels = [
841
- { url = "https://files.pythonhosted.org/packages/ba/c6/cb0ef9e36d6fa91723eff288733d47deb5c338476944d007aaa7db855547/python_getpaid_core-3.0.0a3-py3-none-any.whl", hash = "sha256:d45b5e0b2b5cb867f9f4357ce7b8abd047759a4cc1ff5624b68ce1bfdcb56e96", size = 14748, upload-time = "2026-03-21T00:00:44.719Z" },
841
+ { url = "https://files.pythonhosted.org/packages/9e/42/e52551b13b91474e02bcda4517adc2ea21bbb4920f7daae292a5ef795279/python_getpaid_core-3.0.0a4-py3-none-any.whl", hash = "sha256:322afe2a3a777958c1956d1c6ce576f42c93c0cf6ecd1a260bae189a9fa6a97f", size = 15077, upload-time = "2026-03-25T19:06:57.081Z" },
842
842
  ]
843
843
 
844
844
  [[package]]
@@ -875,7 +875,7 @@ docs = [
875
875
  requires-dist = [
876
876
  { name = "httpx", specifier = ">=0.27.0" },
877
877
  { name = "litestar", marker = "extra == 'simulator'", specifier = ">=2.0" },
878
- { name = "python-getpaid-core", specifier = ">=3.0.0a3" },
878
+ { name = "python-getpaid-core", specifier = ">=3.0.0a4" },
879
879
  { name = "python-getpaid-simulator", marker = "extra == 'simulator'", specifier = ">=3.0.0a3" },
880
880
  ]
881
881
  provides-extras = ["simulator"]
@@ -1,7 +0,0 @@
1
- """Tests for the public package API."""
2
-
3
- import getpaid_payu
4
-
5
-
6
- def test_version() -> None:
7
- assert getpaid_payu.__version__ == "3.0.0a4"