python-getpaid-paynow 0.1.2__tar.gz → 3.0.0a4__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/.github/workflows/ci.yml +33 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/.gitignore +1 -0
- python_getpaid_paynow-3.0.0a4/.pre-commit-config.yaml +15 -0
- python_getpaid_paynow-3.0.0a4/PKG-INFO +187 -0
- python_getpaid_paynow-3.0.0a4/README.md +161 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/docs/concepts.md +13 -12
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/docs/getting-started.md +1 -1
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/pyproject.toml +14 -4
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/src/getpaid_paynow/__init__.py +2 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/src/getpaid_paynow/processor.py +73 -66
- python_getpaid_paynow-3.0.0a4/src/getpaid_paynow/simulator/__init__.py +6 -0
- python_getpaid_paynow-3.0.0a4/src/getpaid_paynow/simulator/plugin.py +61 -0
- python_getpaid_paynow-3.0.0a4/src/getpaid_paynow/simulator/routes.py +406 -0
- python_getpaid_paynow-3.0.0a4/src/getpaid_paynow/simulator/signing.py +49 -0
- python_getpaid_paynow-3.0.0a4/src/getpaid_paynow/simulator/transitions.py +17 -0
- python_getpaid_paynow-3.0.0a4/src/getpaid_paynow/simulator/webhooks.py +59 -0
- python_getpaid_paynow-3.0.0a4/tests/conftest.py +120 -0
- python_getpaid_paynow-3.0.0a4/tests/test_callback.py +144 -0
- python_getpaid_paynow-3.0.0a4/tests/test_processor.py +208 -0
- python_getpaid_paynow-3.0.0a4/tests/test_public_api.py +7 -0
- python_getpaid_paynow-3.0.0a4/tests/test_simulator_plugin.py +158 -0
- python_getpaid_paynow-0.1.2/PKG-INFO +0 -154
- python_getpaid_paynow-0.1.2/README.md +0 -131
- python_getpaid_paynow-0.1.2/tests/conftest.py +0 -143
- python_getpaid_paynow-0.1.2/tests/test_callback.py +0 -337
- python_getpaid_paynow-0.1.2/tests/test_processor.py +0 -375
- python_getpaid_paynow-0.1.2/uv.lock +0 -925
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/.readthedocs.yml +0 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/CODE_OF_CONDUCT.md +0 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/CONTRIBUTING.md +0 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/LICENSE +0 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/docs/changelog.md +0 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/docs/codeofconduct.md +0 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/docs/conf.py +0 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/docs/configuration.md +0 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/docs/contributing.md +0 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/docs/index.md +0 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/docs/license.md +0 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/docs/reference.md +0 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/docs/requirements.txt +0 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/src/getpaid_paynow/client.py +0 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/src/getpaid_paynow/py.typed +0 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/src/getpaid_paynow/types.py +0 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/tests/__init__.py +0 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/tests/test_client.py +0 -0
- {python_getpaid_paynow-0.1.2 → python_getpaid_paynow-3.0.0a4}/tests/test_types.py +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
python-version: ["3.12", "3.13"]
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python-version }}
|
|
22
|
+
|
|
23
|
+
- name: Install uv
|
|
24
|
+
run: pip install uv
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: uv sync
|
|
28
|
+
|
|
29
|
+
- name: Lint with ruff
|
|
30
|
+
run: uv run ruff check .
|
|
31
|
+
|
|
32
|
+
- name: Run tests
|
|
33
|
+
run: uv run pytest --tb=short
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v5.0.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: check-yaml
|
|
8
|
+
- id: check-added-large-files
|
|
9
|
+
|
|
10
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
11
|
+
rev: v0.11.12
|
|
12
|
+
hooks:
|
|
13
|
+
- id: ruff
|
|
14
|
+
args: [--fix]
|
|
15
|
+
- id: ruff-format
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python-getpaid-paynow
|
|
3
|
+
Version: 3.0.0a4
|
|
4
|
+
Summary: Paynow payment gateway integration for python-getpaid ecosystem.
|
|
5
|
+
Project-URL: Homepage, https://github.com/django-getpaid/python-getpaid-paynow
|
|
6
|
+
Project-URL: Repository, https://github.com/django-getpaid/python-getpaid-paynow
|
|
7
|
+
Project-URL: Changelog, https://github.com/django-getpaid/python-getpaid-paynow/releases
|
|
8
|
+
Author-email: Dominik Kozaczko <dominik@kozaczko.info>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
17
|
+
Classifier: Topic :: Office/Business :: Financial :: Point-Of-Sale
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.12
|
|
20
|
+
Requires-Dist: httpx>=0.27.0
|
|
21
|
+
Requires-Dist: python-getpaid-core>=3.0.0a3
|
|
22
|
+
Provides-Extra: simulator
|
|
23
|
+
Requires-Dist: litestar>=2.0; extra == 'simulator'
|
|
24
|
+
Requires-Dist: python-getpaid-simulator>=3.0.0a3; extra == 'simulator'
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# python-getpaid-paynow
|
|
28
|
+
|
|
29
|
+
[](https://pypi.org/project/python-getpaid-paynow/)
|
|
30
|
+
[](https://opensource.org/licenses/MIT)
|
|
31
|
+
[](https://pypi.org/project/python-getpaid-paynow/)
|
|
32
|
+
|
|
33
|
+
Paynow payment processor for [python-getpaid](https://github.com/django-getpaid/python-getpaid-core) ecosystem.
|
|
34
|
+
Paynow is a modern Polish payment provider and a subsidiary of mBank.
|
|
35
|
+
|
|
36
|
+
## Architecture
|
|
37
|
+
|
|
38
|
+
The plugin is split into two layers:
|
|
39
|
+
|
|
40
|
+
- **`PaynowClient`** -- low-level async HTTP client wrapping the Paynow V3 REST API. Uses `httpx.AsyncClient` with API Key authentication and HMAC-SHA256 request signing. Can be used standalone or as an async context manager for connection reuse.
|
|
41
|
+
- **`PaynowProcessor`** -- high-level payment processor implementing `BaseProcessor`. Orchestrates payment creation, callback/notification handling, status polling, and refunds using semantic payment updates.
|
|
42
|
+
|
|
43
|
+
## Key Features
|
|
44
|
+
|
|
45
|
+
- **Create payment** -- register a payment and get a redirect URL
|
|
46
|
+
- **Notification handling** -- verify HMAC-SHA256 signature and process status changes
|
|
47
|
+
- **Status polling** -- fetch current payment status via API (PULL flow)
|
|
48
|
+
- **Refund** -- create, check, and cancel refunds
|
|
49
|
+
- **Payment methods** -- retrieve available payment methods
|
|
50
|
+
- **Sandbox mode** -- full support for testing environment
|
|
51
|
+
|
|
52
|
+
**Note:** Paynow does not support pre-authorization flows. Immediate capture is used for all transactions. The `charge()` and `release_lock()` methods raise `NotImplementedError`.
|
|
53
|
+
|
|
54
|
+
## Supported Currencies
|
|
55
|
+
|
|
56
|
+
The processor supports the following 4 currencies:
|
|
57
|
+
- **PLN** (Polish Złoty)
|
|
58
|
+
- **EUR** (Euro)
|
|
59
|
+
- **GBP** (British Pound)
|
|
60
|
+
- **USD** (US Dollar)
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
Install the package using pip:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install python-getpaid-paynow
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Install simulator support only when you want this package to register its local
|
|
71
|
+
simulator plugin with `python-getpaid-simulator`:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pip install python-getpaid-paynow[simulator]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
This extra installs the simulator host and Litestar dependencies, then exposes
|
|
78
|
+
the `paynow` plugin through the `getpaid.simulator.providers` entry point.
|
|
79
|
+
|
|
80
|
+
## Simulator Plugin
|
|
81
|
+
|
|
82
|
+
When `python-getpaid-paynow[simulator]` is installed alongside
|
|
83
|
+
`python-getpaid-simulator`, the simulator host auto-discovers the PayNow
|
|
84
|
+
plugin.
|
|
85
|
+
|
|
86
|
+
Typical local setup:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
pip install python-getpaid-simulator python-getpaid-paynow[simulator]
|
|
90
|
+
getpaid-simulator
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The plugin contributes:
|
|
94
|
+
|
|
95
|
+
- PayNow payment and refund simulator API routes under `/paynow/v3/...`
|
|
96
|
+
- PayNow authorization UI at `/sim/paynow/authorize/{payment_id}`
|
|
97
|
+
- PayNow-specific webhook signing and state transitions
|
|
98
|
+
|
|
99
|
+
Useful simulator environment variables:
|
|
100
|
+
|
|
101
|
+
- `SIMULATOR_PAYNOW_API_KEY`
|
|
102
|
+
- `SIMULATOR_PAYNOW_SIGNATURE_KEY`
|
|
103
|
+
- `SIMULATOR_PAYNOW_NOTIFY_URL`
|
|
104
|
+
- `SIMULATOR_PLUGIN_FAILURE_MODE` (`warn` or `strict`)
|
|
105
|
+
|
|
106
|
+
## Quick Usage
|
|
107
|
+
|
|
108
|
+
### Standalone Client
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
import anyio
|
|
112
|
+
from decimal import Decimal
|
|
113
|
+
from getpaid_paynow import PaynowClient
|
|
114
|
+
|
|
115
|
+
async def main():
|
|
116
|
+
async with PaynowClient(
|
|
117
|
+
api_key="your-api-key",
|
|
118
|
+
signature_key="your-signature-key",
|
|
119
|
+
api_url="https://api.sandbox.paynow.pl",
|
|
120
|
+
) as client:
|
|
121
|
+
# Create a payment
|
|
122
|
+
response = await client.create_payment(
|
|
123
|
+
amount=Decimal("49.99"),
|
|
124
|
+
currency="PLN",
|
|
125
|
+
external_id="order-001",
|
|
126
|
+
description="Order #001",
|
|
127
|
+
buyer_email="buyer@example.com",
|
|
128
|
+
continue_url="https://shop.example.com/return/order-001",
|
|
129
|
+
)
|
|
130
|
+
redirect_url = response["redirectUrl"]
|
|
131
|
+
print(f"Redirect buyer to: {redirect_url}")
|
|
132
|
+
|
|
133
|
+
anyio.run(main)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### With python-getpaid
|
|
137
|
+
|
|
138
|
+
Register the plugin via entry point in `pyproject.toml` (if not using the pre-packaged version):
|
|
139
|
+
|
|
140
|
+
```toml
|
|
141
|
+
[project.entry-points."getpaid.backends"]
|
|
142
|
+
paynow = "getpaid_paynow.processor:PaynowProcessor"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Then configure in your project settings:
|
|
146
|
+
|
|
147
|
+
```python
|
|
148
|
+
GETPAID_BACKEND_SETTINGS = {
|
|
149
|
+
"paynow": {
|
|
150
|
+
"api_key": "your-api-key",
|
|
151
|
+
"signature_key": "your-signature-key",
|
|
152
|
+
"sandbox": True,
|
|
153
|
+
"notification_url": "https://your-site.com/payments/{payment_id}/callback/",
|
|
154
|
+
"continue_url": "https://your-site.com/payments/{payment_id}/return/",
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Configuration Reference
|
|
160
|
+
|
|
161
|
+
| Key | Type | Default | Description |
|
|
162
|
+
|-----|------|---------|-------------|
|
|
163
|
+
| `api_key` | `str` | *required* | API key from Paynow merchant panel |
|
|
164
|
+
| `signature_key` | `str` | *required* | Signature key for HMAC calculation |
|
|
165
|
+
| `sandbox` | `bool` | `True` | Use sandbox or production API |
|
|
166
|
+
| `notification_url` | `str` | `""` | Notification URL template; use `{payment_id}` placeholder |
|
|
167
|
+
| `continue_url` | `str` | `""` | Return URL template; use `{payment_id}` placeholder |
|
|
168
|
+
|
|
169
|
+
## Requirements
|
|
170
|
+
|
|
171
|
+
- Python 3.12+
|
|
172
|
+
- `python-getpaid-core >= 3.0.0a3`
|
|
173
|
+
- `httpx >= 0.27.0`
|
|
174
|
+
|
|
175
|
+
## Links
|
|
176
|
+
|
|
177
|
+
- **Core Library:** [python-getpaid-core](https://github.com/django-getpaid/python-getpaid-core)
|
|
178
|
+
- **Official Paynow Documentation:** [docs.paynow.pl](https://docs.paynow.pl/)
|
|
179
|
+
- **GitHub Repository:** [django-getpaid/python-getpaid-paynow](https://github.com/django-getpaid/python-getpaid-paynow)
|
|
180
|
+
|
|
181
|
+
## License
|
|
182
|
+
|
|
183
|
+
This project is licensed under the MIT License.
|
|
184
|
+
|
|
185
|
+
## Credits
|
|
186
|
+
|
|
187
|
+
Created by [Dominik Kozaczko](https://github.com/dekoza).
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# python-getpaid-paynow
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/python-getpaid-paynow/)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://pypi.org/project/python-getpaid-paynow/)
|
|
6
|
+
|
|
7
|
+
Paynow payment processor for [python-getpaid](https://github.com/django-getpaid/python-getpaid-core) ecosystem.
|
|
8
|
+
Paynow is a modern Polish payment provider and a subsidiary of mBank.
|
|
9
|
+
|
|
10
|
+
## Architecture
|
|
11
|
+
|
|
12
|
+
The plugin is split into two layers:
|
|
13
|
+
|
|
14
|
+
- **`PaynowClient`** -- low-level async HTTP client wrapping the Paynow V3 REST API. Uses `httpx.AsyncClient` with API Key authentication and HMAC-SHA256 request signing. Can be used standalone or as an async context manager for connection reuse.
|
|
15
|
+
- **`PaynowProcessor`** -- high-level payment processor implementing `BaseProcessor`. Orchestrates payment creation, callback/notification handling, status polling, and refunds using semantic payment updates.
|
|
16
|
+
|
|
17
|
+
## Key Features
|
|
18
|
+
|
|
19
|
+
- **Create payment** -- register a payment and get a redirect URL
|
|
20
|
+
- **Notification handling** -- verify HMAC-SHA256 signature and process status changes
|
|
21
|
+
- **Status polling** -- fetch current payment status via API (PULL flow)
|
|
22
|
+
- **Refund** -- create, check, and cancel refunds
|
|
23
|
+
- **Payment methods** -- retrieve available payment methods
|
|
24
|
+
- **Sandbox mode** -- full support for testing environment
|
|
25
|
+
|
|
26
|
+
**Note:** Paynow does not support pre-authorization flows. Immediate capture is used for all transactions. The `charge()` and `release_lock()` methods raise `NotImplementedError`.
|
|
27
|
+
|
|
28
|
+
## Supported Currencies
|
|
29
|
+
|
|
30
|
+
The processor supports the following 4 currencies:
|
|
31
|
+
- **PLN** (Polish Złoty)
|
|
32
|
+
- **EUR** (Euro)
|
|
33
|
+
- **GBP** (British Pound)
|
|
34
|
+
- **USD** (US Dollar)
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
Install the package using pip:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install python-getpaid-paynow
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Install simulator support only when you want this package to register its local
|
|
45
|
+
simulator plugin with `python-getpaid-simulator`:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install python-getpaid-paynow[simulator]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This extra installs the simulator host and Litestar dependencies, then exposes
|
|
52
|
+
the `paynow` plugin through the `getpaid.simulator.providers` entry point.
|
|
53
|
+
|
|
54
|
+
## Simulator Plugin
|
|
55
|
+
|
|
56
|
+
When `python-getpaid-paynow[simulator]` is installed alongside
|
|
57
|
+
`python-getpaid-simulator`, the simulator host auto-discovers the PayNow
|
|
58
|
+
plugin.
|
|
59
|
+
|
|
60
|
+
Typical local setup:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install python-getpaid-simulator python-getpaid-paynow[simulator]
|
|
64
|
+
getpaid-simulator
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The plugin contributes:
|
|
68
|
+
|
|
69
|
+
- PayNow payment and refund simulator API routes under `/paynow/v3/...`
|
|
70
|
+
- PayNow authorization UI at `/sim/paynow/authorize/{payment_id}`
|
|
71
|
+
- PayNow-specific webhook signing and state transitions
|
|
72
|
+
|
|
73
|
+
Useful simulator environment variables:
|
|
74
|
+
|
|
75
|
+
- `SIMULATOR_PAYNOW_API_KEY`
|
|
76
|
+
- `SIMULATOR_PAYNOW_SIGNATURE_KEY`
|
|
77
|
+
- `SIMULATOR_PAYNOW_NOTIFY_URL`
|
|
78
|
+
- `SIMULATOR_PLUGIN_FAILURE_MODE` (`warn` or `strict`)
|
|
79
|
+
|
|
80
|
+
## Quick Usage
|
|
81
|
+
|
|
82
|
+
### Standalone Client
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
import anyio
|
|
86
|
+
from decimal import Decimal
|
|
87
|
+
from getpaid_paynow import PaynowClient
|
|
88
|
+
|
|
89
|
+
async def main():
|
|
90
|
+
async with PaynowClient(
|
|
91
|
+
api_key="your-api-key",
|
|
92
|
+
signature_key="your-signature-key",
|
|
93
|
+
api_url="https://api.sandbox.paynow.pl",
|
|
94
|
+
) as client:
|
|
95
|
+
# Create a payment
|
|
96
|
+
response = await client.create_payment(
|
|
97
|
+
amount=Decimal("49.99"),
|
|
98
|
+
currency="PLN",
|
|
99
|
+
external_id="order-001",
|
|
100
|
+
description="Order #001",
|
|
101
|
+
buyer_email="buyer@example.com",
|
|
102
|
+
continue_url="https://shop.example.com/return/order-001",
|
|
103
|
+
)
|
|
104
|
+
redirect_url = response["redirectUrl"]
|
|
105
|
+
print(f"Redirect buyer to: {redirect_url}")
|
|
106
|
+
|
|
107
|
+
anyio.run(main)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### With python-getpaid
|
|
111
|
+
|
|
112
|
+
Register the plugin via entry point in `pyproject.toml` (if not using the pre-packaged version):
|
|
113
|
+
|
|
114
|
+
```toml
|
|
115
|
+
[project.entry-points."getpaid.backends"]
|
|
116
|
+
paynow = "getpaid_paynow.processor:PaynowProcessor"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Then configure in your project settings:
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
GETPAID_BACKEND_SETTINGS = {
|
|
123
|
+
"paynow": {
|
|
124
|
+
"api_key": "your-api-key",
|
|
125
|
+
"signature_key": "your-signature-key",
|
|
126
|
+
"sandbox": True,
|
|
127
|
+
"notification_url": "https://your-site.com/payments/{payment_id}/callback/",
|
|
128
|
+
"continue_url": "https://your-site.com/payments/{payment_id}/return/",
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Configuration Reference
|
|
134
|
+
|
|
135
|
+
| Key | Type | Default | Description |
|
|
136
|
+
|-----|------|---------|-------------|
|
|
137
|
+
| `api_key` | `str` | *required* | API key from Paynow merchant panel |
|
|
138
|
+
| `signature_key` | `str` | *required* | Signature key for HMAC calculation |
|
|
139
|
+
| `sandbox` | `bool` | `True` | Use sandbox or production API |
|
|
140
|
+
| `notification_url` | `str` | `""` | Notification URL template; use `{payment_id}` placeholder |
|
|
141
|
+
| `continue_url` | `str` | `""` | Return URL template; use `{payment_id}` placeholder |
|
|
142
|
+
|
|
143
|
+
## Requirements
|
|
144
|
+
|
|
145
|
+
- Python 3.12+
|
|
146
|
+
- `python-getpaid-core >= 3.0.0a3`
|
|
147
|
+
- `httpx >= 0.27.0`
|
|
148
|
+
|
|
149
|
+
## Links
|
|
150
|
+
|
|
151
|
+
- **Core Library:** [python-getpaid-core](https://github.com/django-getpaid/python-getpaid-core)
|
|
152
|
+
- **Official Paynow Documentation:** [docs.paynow.pl](https://docs.paynow.pl/)
|
|
153
|
+
- **GitHub Repository:** [django-getpaid/python-getpaid-paynow](https://github.com/django-getpaid/python-getpaid-paynow)
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
This project is licensed under the MIT License.
|
|
158
|
+
|
|
159
|
+
## Credits
|
|
160
|
+
|
|
161
|
+
Created by [Dominik Kozaczko](https://github.com/dekoza).
|
|
@@ -23,7 +23,7 @@ The Paynow payment flow follows a create-redirect-notify pattern:
|
|
|
23
23
|
┌──────────┐ ◄────────────────────────────────┘
|
|
24
24
|
│ Your │
|
|
25
25
|
│ Server │ 1. verify_callback (check HMAC signature)
|
|
26
|
-
│ │ 2. handle_callback (
|
|
26
|
+
│ │ 2. handle_callback (return semantic payment update)
|
|
27
27
|
└──────────┘
|
|
28
28
|
```
|
|
29
29
|
|
|
@@ -46,8 +46,9 @@ The Paynow payment flow follows a create-redirect-notify pattern:
|
|
|
46
46
|
mismatch.
|
|
47
47
|
|
|
48
48
|
5. **Handle callback** — `PaynowProcessor.handle_callback()` maps the Paynow
|
|
49
|
-
status to
|
|
50
|
-
`
|
|
49
|
+
status to semantic updates: `CONFIRMED` returns `payment_captured`,
|
|
50
|
+
`PENDING` returns `prepared`, and `REJECTED`, `ERROR`, `EXPIRED`,
|
|
51
|
+
`ABANDONED` return `failed`.
|
|
51
52
|
|
|
52
53
|
:::{note}
|
|
53
54
|
Unlike Przelewy24, Paynow does **not** require a separate verification step
|
|
@@ -154,17 +155,17 @@ The plugin supports both notification models:
|
|
|
154
155
|
|
|
155
156
|
- **PULL** — `PaynowProcessor.fetch_payment_status()` calls
|
|
156
157
|
`PaynowClient.get_payment_status()` to poll the payment status. Returns a
|
|
157
|
-
`
|
|
158
|
+
semantic `PaymentUpdate`.
|
|
158
159
|
|
|
159
|
-
| Paynow Status |
|
|
160
|
-
|
|
160
|
+
| Paynow Status | Semantic Event |
|
|
161
|
+
|---------------|----------------|
|
|
161
162
|
| `NEW` | `None` |
|
|
162
|
-
| `PENDING` | `
|
|
163
|
-
| `CONFIRMED` | `
|
|
164
|
-
| `REJECTED` | `
|
|
165
|
-
| `ERROR` | `
|
|
166
|
-
| `EXPIRED` | `
|
|
167
|
-
| `ABANDONED` | `
|
|
163
|
+
| `PENDING` | `prepared` |
|
|
164
|
+
| `CONFIRMED` | `payment_captured` |
|
|
165
|
+
| `REJECTED` | `failed` |
|
|
166
|
+
| `ERROR` | `failed` |
|
|
167
|
+
| `EXPIRED` | `failed` |
|
|
168
|
+
| `ABANDONED` | `failed` |
|
|
168
169
|
|
|
169
170
|
## Supported Operations
|
|
170
171
|
|
|
@@ -92,7 +92,7 @@ payment ID at runtime.
|
|
|
92
92
|
### 3. Process payments
|
|
93
93
|
|
|
94
94
|
The framework adapter handles the rest — creating payments, redirecting
|
|
95
|
-
buyers, receiving notifications, and
|
|
95
|
+
buyers, receiving notifications, and applying semantic payment updates.
|
|
96
96
|
|
|
97
97
|
## Sandbox vs Production
|
|
98
98
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = 'python-getpaid-paynow'
|
|
3
|
-
|
|
3
|
+
dynamic = ["version"]
|
|
4
4
|
description = 'Paynow payment gateway integration for python-getpaid ecosystem.'
|
|
5
5
|
readme = 'README.md'
|
|
6
6
|
license = {text = 'MIT'}
|
|
@@ -19,10 +19,16 @@ classifiers = [
|
|
|
19
19
|
'Typing :: Typed',
|
|
20
20
|
]
|
|
21
21
|
dependencies = [
|
|
22
|
-
'python-getpaid-core>=0.
|
|
22
|
+
'python-getpaid-core>=3.0.0a3',
|
|
23
23
|
'httpx>=0.27.0',
|
|
24
24
|
]
|
|
25
25
|
|
|
26
|
+
[project.optional-dependencies]
|
|
27
|
+
simulator = [
|
|
28
|
+
'python-getpaid-simulator>=3.0.0a3',
|
|
29
|
+
'litestar>=2.0',
|
|
30
|
+
]
|
|
31
|
+
|
|
26
32
|
[dependency-groups]
|
|
27
33
|
dev = [
|
|
28
34
|
'pytest>=8.0',
|
|
@@ -45,6 +51,9 @@ Changelog = 'https://github.com/django-getpaid/python-getpaid-paynow/releases'
|
|
|
45
51
|
[project.entry-points."getpaid.backends"]
|
|
46
52
|
paynow = 'getpaid_paynow.processor:PaynowProcessor'
|
|
47
53
|
|
|
54
|
+
[project.entry-points."getpaid.simulator.providers"]
|
|
55
|
+
paynow = 'getpaid_paynow.simulator:get_plugin'
|
|
56
|
+
|
|
48
57
|
[build-system]
|
|
49
58
|
requires = ['hatchling']
|
|
50
59
|
build-backend = 'hatchling.build'
|
|
@@ -52,6 +61,9 @@ build-backend = 'hatchling.build'
|
|
|
52
61
|
[tool.hatch.build.targets.wheel]
|
|
53
62
|
packages = ['src/getpaid_paynow']
|
|
54
63
|
|
|
64
|
+
[tool.hatch.version]
|
|
65
|
+
path = "src/getpaid_paynow/__init__.py"
|
|
66
|
+
|
|
55
67
|
[tool.pytest.ini_options]
|
|
56
68
|
testpaths = ['tests']
|
|
57
69
|
asyncio_mode = 'auto'
|
|
@@ -108,8 +120,6 @@ include = ['tests/**']
|
|
|
108
120
|
unresolved-attribute = 'ignore'
|
|
109
121
|
invalid-argument-type = 'ignore'
|
|
110
122
|
|
|
111
|
-
# The processor uses FSM methods (may_trigger, confirm_payment,
|
|
112
|
-
# mark_as_paid, fail) dynamically bound by the transitions library.
|
|
113
123
|
[[tool.ty.overrides]]
|
|
114
124
|
include = ['src/getpaid_paynow/processor.py']
|
|
115
125
|
[tool.ty.overrides.rules]
|