python-getpaid-paynow 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.
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/PKG-INFO +3 -3
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/README.md +1 -1
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/pyproject.toml +1 -1
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/src/getpaid_paynow/__init__.py +1 -1
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/src/getpaid_paynow/simulator/plugin.py +1 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/src/getpaid_paynow/simulator/routes.py +24 -9
- python_getpaid_paynow-3.0.0a5/tests/test_public_api.py +18 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/tests/test_simulator_plugin.py +5 -0
- python_getpaid_paynow-3.0.0a4/tests/test_public_api.py +0 -7
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/.github/workflows/ci.yml +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/.gitignore +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/.pre-commit-config.yaml +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/.readthedocs.yml +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/CODE_OF_CONDUCT.md +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/CONTRIBUTING.md +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/LICENSE +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/docs/changelog.md +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/docs/codeofconduct.md +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/docs/concepts.md +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/docs/conf.py +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/docs/configuration.md +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/docs/contributing.md +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/docs/getting-started.md +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/docs/index.md +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/docs/license.md +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/docs/reference.md +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/docs/requirements.txt +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/src/getpaid_paynow/client.py +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/src/getpaid_paynow/processor.py +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/src/getpaid_paynow/py.typed +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/src/getpaid_paynow/simulator/__init__.py +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/src/getpaid_paynow/simulator/signing.py +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/src/getpaid_paynow/simulator/transitions.py +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/src/getpaid_paynow/simulator/webhooks.py +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/src/getpaid_paynow/types.py +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/tests/__init__.py +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/tests/conftest.py +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/tests/test_callback.py +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/tests/test_client.py +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/tests/test_processor.py +0 -0
- {python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/tests/test_types.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-getpaid-paynow
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.0a5
|
|
4
4
|
Summary: Paynow payment gateway integration for python-getpaid ecosystem.
|
|
5
5
|
Project-URL: Homepage, https://github.com/django-getpaid/python-getpaid-paynow
|
|
6
6
|
Project-URL: Repository, https://github.com/django-getpaid/python-getpaid-paynow
|
|
@@ -18,7 +18,7 @@ Classifier: Topic :: Office/Business :: Financial :: Point-Of-Sale
|
|
|
18
18
|
Classifier: Typing :: Typed
|
|
19
19
|
Requires-Python: >=3.12
|
|
20
20
|
Requires-Dist: httpx>=0.27.0
|
|
21
|
-
Requires-Dist: python-getpaid-core>=3.0.
|
|
21
|
+
Requires-Dist: python-getpaid-core>=3.0.0a4
|
|
22
22
|
Provides-Extra: simulator
|
|
23
23
|
Requires-Dist: litestar>=2.0; extra == 'simulator'
|
|
24
24
|
Requires-Dist: python-getpaid-simulator>=3.0.0a3; extra == 'simulator'
|
|
@@ -169,7 +169,7 @@ GETPAID_BACKEND_SETTINGS = {
|
|
|
169
169
|
## Requirements
|
|
170
170
|
|
|
171
171
|
- Python 3.12+
|
|
172
|
-
- `python-getpaid-core >= 3.0.
|
|
172
|
+
- `python-getpaid-core >= 3.0.0a4`
|
|
173
173
|
- `httpx >= 0.27.0`
|
|
174
174
|
|
|
175
175
|
## Links
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import logging
|
|
6
|
+
from decimal import Decimal
|
|
7
|
+
from decimal import InvalidOperation
|
|
6
8
|
from typing import Any
|
|
7
9
|
from typing import TypedDict
|
|
8
10
|
from typing import cast
|
|
@@ -115,6 +117,24 @@ def _provider_config(request: Request[Any, Any, Any]) -> dict[str, Any]:
|
|
|
115
117
|
return dict(request.app.state.provider_configs["paynow"])
|
|
116
118
|
|
|
117
119
|
|
|
120
|
+
def _format_amount_for_display(
|
|
121
|
+
payment: dict[str, Any],
|
|
122
|
+
provider_config: dict[str, Any],
|
|
123
|
+
) -> str:
|
|
124
|
+
amount_raw = payment.get("amount", payment.get("totalAmount", 0))
|
|
125
|
+
try:
|
|
126
|
+
amount_value = Decimal(str(amount_raw))
|
|
127
|
+
except (InvalidOperation, TypeError, ValueError):
|
|
128
|
+
return str(amount_raw)
|
|
129
|
+
|
|
130
|
+
minor_unit_places = int(provider_config.get("amount_minor_unit_places", 2))
|
|
131
|
+
if minor_unit_places >= 0:
|
|
132
|
+
amount_value /= Decimal(10) ** minor_unit_places
|
|
133
|
+
|
|
134
|
+
currency = payment.get("currency", payment.get("currencyCode", "PLN"))
|
|
135
|
+
return f"{amount_value:.2f} {currency}"
|
|
136
|
+
|
|
137
|
+
|
|
118
138
|
def _error_response(
|
|
119
139
|
status_code: int,
|
|
120
140
|
error_type: str,
|
|
@@ -346,15 +366,10 @@ async def paynow_authorize_get(
|
|
|
346
366
|
if payment.get("status") in ("CONFIRMED", "REJECTED"):
|
|
347
367
|
raise HTTPException(status_code=400, detail="Payment already processed")
|
|
348
368
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
f"{amount_value:.2f} "
|
|
354
|
-
f"{payment.get('currency', payment.get('currencyCode', 'PLN'))}"
|
|
355
|
-
)
|
|
356
|
-
except (ValueError, TypeError):
|
|
357
|
-
formatted_amount = str(amount_raw)
|
|
369
|
+
formatted_amount = _format_amount_for_display(
|
|
370
|
+
payment,
|
|
371
|
+
_provider_config(request),
|
|
372
|
+
)
|
|
358
373
|
|
|
359
374
|
return Template(
|
|
360
375
|
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_paynow
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def test_version() -> None:
|
|
10
|
+
assert getpaid_paynow.__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
|
+
)
|
{python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/tests/test_simulator_plugin.py
RENAMED
|
@@ -96,12 +96,17 @@ def test_load_provider_config_reads_env_overrides(
|
|
|
96
96
|
)
|
|
97
97
|
|
|
98
98
|
assert load_provider_config() == {
|
|
99
|
+
"amount_minor_unit_places": 2,
|
|
99
100
|
"api_key": "override-api-key",
|
|
100
101
|
"signature_key": "override-signature",
|
|
101
102
|
"notify_url": "https://merchant.example/paynow/callback",
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
|
|
106
|
+
def test_load_provider_config_includes_amount_minor_unit_places() -> None:
|
|
107
|
+
assert load_provider_config()["amount_minor_unit_places"] == 2
|
|
108
|
+
|
|
109
|
+
|
|
105
110
|
@pytest.mark.asyncio
|
|
106
111
|
async def test_trigger_paynow_webhook_uses_provider_notify_url_fallback() -> (
|
|
107
112
|
None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/src/getpaid_paynow/client.py
RENAMED
|
File without changes
|
{python_getpaid_paynow-3.0.0a4 → python_getpaid_paynow-3.0.0a5}/src/getpaid_paynow/processor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|