python-getpaid-payu 0.1.0__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_payu-3.0.0a4/.github/workflows/ci.yml +33 -0
- python_getpaid_payu-3.0.0a4/.sisyphus/evidence/task-26-readme-payu.txt +3 -0
- python_getpaid_payu-3.0.0a4/.sisyphus/evidence/task-5-baseline-payu.txt +200 -0
- python_getpaid_payu-3.0.0a4/PKG-INFO +146 -0
- python_getpaid_payu-3.0.0a4/README.md +119 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/docs/changelog.md +1 -1
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/docs/concepts.md +10 -10
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/pyproject.toml +17 -2
- python_getpaid_payu-3.0.0a4/sandbox_keys.txt +17 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/src/getpaid_payu/__init__.py +1 -1
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/src/getpaid_payu/client.py +16 -18
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/src/getpaid_payu/processor.py +124 -75
- python_getpaid_payu-3.0.0a4/src/getpaid_payu/simulator/__init__.py +6 -0
- python_getpaid_payu-3.0.0a4/src/getpaid_payu/simulator/plugin.py +58 -0
- python_getpaid_payu-3.0.0a4/src/getpaid_payu/simulator/routes.py +394 -0
- python_getpaid_payu-3.0.0a4/src/getpaid_payu/simulator/signing.py +14 -0
- python_getpaid_payu-3.0.0a4/src/getpaid_payu/simulator/transitions.py +9 -0
- python_getpaid_payu-3.0.0a4/src/getpaid_payu/simulator/webhooks.py +77 -0
- python_getpaid_payu-3.0.0a4/tests/conftest.py +117 -0
- python_getpaid_payu-3.0.0a4/tests/test_callback.py +123 -0
- python_getpaid_payu-3.0.0a4/tests/test_entry_points.py +12 -0
- python_getpaid_payu-3.0.0a4/tests/test_processor.py +232 -0
- python_getpaid_payu-3.0.0a4/tests/test_public_api.py +7 -0
- python_getpaid_payu-3.0.0a4/tests/test_simulator_plugin.py +153 -0
- python_getpaid_payu-3.0.0a4/tests/test_url_construction.py +444 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/uv.lock +500 -5
- python_getpaid_payu-0.1.0/PKG-INFO +0 -152
- python_getpaid_payu-0.1.0/README.md +0 -128
- python_getpaid_payu-0.1.0/tests/conftest.py +0 -143
- python_getpaid_payu-0.1.0/tests/test_callback.py +0 -290
- python_getpaid_payu-0.1.0/tests/test_processor.py +0 -449
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/.gitignore +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/.pre-commit-config.yaml +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/.python-version +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/.readthedocs.yml +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/CODE_OF_CONDUCT.md +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/CONTRIBUTING.md +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/LICENSE +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/docs/codeofconduct.md +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/docs/conf.py +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/docs/configuration.md +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/docs/contributing.md +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/docs/getting-started.md +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/docs/index.md +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/docs/license.md +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/docs/reference.md +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/docs/requirements.txt +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/src/getpaid_payu/py.typed +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/src/getpaid_payu/types.py +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/tests/__init__.py +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-3.0.0a4}/tests/test_client.py +0 -0
- {python_getpaid_payu-0.1.0 → python_getpaid_payu-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,200 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
TASK 5 BASELINE: python-getpaid-payu
|
|
3
|
+
Executed: 2026-02-18
|
|
4
|
+
================================================================================
|
|
5
|
+
|
|
6
|
+
DIRECTORY: /home/minder/projekty/python-getpaid/getpaid-payu/
|
|
7
|
+
|
|
8
|
+
================================================================================
|
|
9
|
+
1. PYTEST RESULTS
|
|
10
|
+
================================================================================
|
|
11
|
+
|
|
12
|
+
Command: uv run pytest
|
|
13
|
+
|
|
14
|
+
Output:
|
|
15
|
+
============================= test session starts ==============================
|
|
16
|
+
platform linux -- Python 3.12.10, pytest-9.0.2, pluggy-1.6.0
|
|
17
|
+
rootdir: /home/minder/projekty/python-getpaid/getpaid-payu
|
|
18
|
+
configfile: pyproject.toml
|
|
19
|
+
testpaths: tests
|
|
20
|
+
plugins: asyncio-1.3.0, cov-7.0.0, anyio-4.12.1, respx-0.22.0
|
|
21
|
+
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=None, asyncio_default_test_fixture_scope=function
|
|
22
|
+
collected 115 items
|
|
23
|
+
|
|
24
|
+
tests/test_callback.py ................... [ 16%]
|
|
25
|
+
tests/test_client.py ................................................... [ 60%]
|
|
26
|
+
......... [ 68%]
|
|
27
|
+
tests/test_processor.py ......................... [ 90%]
|
|
28
|
+
tests/test_types.py ........... [100%]
|
|
29
|
+
|
|
30
|
+
============================= 115 passed in 2.57s ==============================
|
|
31
|
+
|
|
32
|
+
STATUS: ✓ ALL TESTS PASSED
|
|
33
|
+
|
|
34
|
+
================================================================================
|
|
35
|
+
2. BUILD RESULTS
|
|
36
|
+
================================================================================
|
|
37
|
+
|
|
38
|
+
Command: uv build
|
|
39
|
+
|
|
40
|
+
Output:
|
|
41
|
+
Building source distribution...
|
|
42
|
+
Building wheel from source distribution...
|
|
43
|
+
Successfully built dist/python_getpaid_payu-0.1.1.tar.gz
|
|
44
|
+
Successfully built dist/python_getpaid_payu-0.1.1-py3-none-any.whl
|
|
45
|
+
|
|
46
|
+
STATUS: ✓ BUILD SUCCESSFUL
|
|
47
|
+
|
|
48
|
+
Artifacts:
|
|
49
|
+
- dist/python_getpaid_payu-0.1.1.tar.gz (source distribution)
|
|
50
|
+
- dist/python_getpaid_payu-0.1.1-py3-none-any.whl (wheel)
|
|
51
|
+
|
|
52
|
+
================================================================================
|
|
53
|
+
3. PACKAGE METADATA INVENTORY
|
|
54
|
+
================================================================================
|
|
55
|
+
|
|
56
|
+
Project Name: python-getpaid-payu
|
|
57
|
+
Version: 0.1.1
|
|
58
|
+
Python Requirement: >= 3.12
|
|
59
|
+
License: MIT (text format)
|
|
60
|
+
Authors: Dominik Kozaczko <dominik@kozaczko.info>
|
|
61
|
+
|
|
62
|
+
Description: PayU payment gateway integration for python-getpaid ecosystem.
|
|
63
|
+
|
|
64
|
+
Dependencies:
|
|
65
|
+
- python-getpaid-core >= 0.1.0
|
|
66
|
+
- httpx >= 0.27.0
|
|
67
|
+
|
|
68
|
+
Development Dependencies:
|
|
69
|
+
- pytest >= 8.0
|
|
70
|
+
- pytest-asyncio >= 0.24.0
|
|
71
|
+
- pytest-cov >= 5.0
|
|
72
|
+
- respx >= 0.22.0
|
|
73
|
+
- ruff >= 0.9.0
|
|
74
|
+
- pre-commit >= 4.0
|
|
75
|
+
- ty >= 0.0.16
|
|
76
|
+
|
|
77
|
+
Documentation Dependencies:
|
|
78
|
+
- furo >= 2024.8.6
|
|
79
|
+
- sphinx >= 8.0
|
|
80
|
+
- myst-parser >= 4.0
|
|
81
|
+
|
|
82
|
+
URLs:
|
|
83
|
+
- Homepage: https://github.com/django-getpaid/python-getpaid-payu
|
|
84
|
+
- Repository: https://github.com/django-getpaid/python-getpaid-payu
|
|
85
|
+
- Documentation: https://getpaid-payu.readthedocs.io/
|
|
86
|
+
- Changelog: https://github.com/django-getpaid/python-getpaid-payu/releases
|
|
87
|
+
|
|
88
|
+
Build System: hatchling
|
|
89
|
+
|
|
90
|
+
Classifiers:
|
|
91
|
+
- Development Status :: 3 - Alpha
|
|
92
|
+
- Intended Audience :: Developers
|
|
93
|
+
- License :: OSI Approved :: MIT License
|
|
94
|
+
- Programming Language :: Python :: 3.12
|
|
95
|
+
- Programming Language :: Python :: 3.13
|
|
96
|
+
- Topic :: Office/Business :: Financial
|
|
97
|
+
- Topic :: Office/Business :: Financial :: Point-Of-Sale
|
|
98
|
+
- Typing :: Typed
|
|
99
|
+
|
|
100
|
+
================================================================================
|
|
101
|
+
4. LICENSE CHECK
|
|
102
|
+
================================================================================
|
|
103
|
+
|
|
104
|
+
LICENSE File Status: ✓ PRESENT
|
|
105
|
+
Format: MIT License
|
|
106
|
+
Copyright: 2022-2026 Dominik Kozaczko
|
|
107
|
+
Consistency: ✓ Matches pyproject.toml declaration (MIT)
|
|
108
|
+
|
|
109
|
+
================================================================================
|
|
110
|
+
5. README.MD CHECK
|
|
111
|
+
================================================================================
|
|
112
|
+
|
|
113
|
+
README File Status: ✓ PRESENT
|
|
114
|
+
Size: ~4.5 KB (129 lines)
|
|
115
|
+
Content Verification:
|
|
116
|
+
✓ Project description (PayU payment gateway plugin)
|
|
117
|
+
✓ Architecture section (PayUClient + PayUProcessor)
|
|
118
|
+
✓ Key features listed
|
|
119
|
+
✓ Quick usage examples (async context manager)
|
|
120
|
+
✓ Configuration table with all parameters
|
|
121
|
+
✓ Supported currencies listed
|
|
122
|
+
✓ Requirements section
|
|
123
|
+
✓ Related projects links
|
|
124
|
+
✓ License information
|
|
125
|
+
✓ Disclaimer section
|
|
126
|
+
✓ Credits
|
|
127
|
+
|
|
128
|
+
================================================================================
|
|
129
|
+
6. GITHUB WORKFLOWS (.github/workflows/)
|
|
130
|
+
================================================================================
|
|
131
|
+
|
|
132
|
+
Status: ✗ NOT PRESENT
|
|
133
|
+
|
|
134
|
+
No .github/workflows/ directory found in the repository.
|
|
135
|
+
Note: Project is part of the python-getpaid umbrella but does not have its own CI configuration.
|
|
136
|
+
|
|
137
|
+
================================================================================
|
|
138
|
+
7. ENTRY-POINTS ANALYSIS [CRITICAL]
|
|
139
|
+
================================================================================
|
|
140
|
+
|
|
141
|
+
Section Name: [project.entry-points."getpaid.backends"]
|
|
142
|
+
Status: ✗ ENTRY-POINTS NOT DEFINED
|
|
143
|
+
|
|
144
|
+
Current State:
|
|
145
|
+
- pyproject.toml does NOT contain any [project.entry-points] section
|
|
146
|
+
- grep search: "No entry-points found in pyproject.toml"
|
|
147
|
+
|
|
148
|
+
Impact Analysis:
|
|
149
|
+
The PayUProcessor is the main integration point with getpaid-core.
|
|
150
|
+
Entry-points are REQUIRED for plugin auto-discovery by framework adapters
|
|
151
|
+
(e.g., django-getpaid).
|
|
152
|
+
|
|
153
|
+
Expected Entry-Point (if needed):
|
|
154
|
+
[project.entry-points."getpaid.backends"]
|
|
155
|
+
payu = "getpaid_payu.processor:PayUProcessor"
|
|
156
|
+
|
|
157
|
+
OR (if supporting multiple backends):
|
|
158
|
+
[project.entry-points."getpaid.backends"]
|
|
159
|
+
payu = "getpaid_payu.processor:PayUProcessor"
|
|
160
|
+
|
|
161
|
+
Recommendation:
|
|
162
|
+
TASK 10 (Add entry-points configuration) IS REQUIRED
|
|
163
|
+
Current state prevents framework adapters from auto-discovering PayUProcessor.
|
|
164
|
+
|
|
165
|
+
================================================================================
|
|
166
|
+
8. PYPROJECT.TOML STRUCTURE
|
|
167
|
+
================================================================================
|
|
168
|
+
|
|
169
|
+
Build Section: ✓ Present (hatchling)
|
|
170
|
+
Test Configuration: ✓ Present (pytest)
|
|
171
|
+
Coverage Config: ✓ Present
|
|
172
|
+
Linter Config (ruff): ✓ Present
|
|
173
|
+
Type Checker (ty): ✓ Present
|
|
174
|
+
Project Metadata: ✓ Complete
|
|
175
|
+
|
|
176
|
+
Entry-Points Section: ✗ MISSING (BLOCKING FOR TASK 10)
|
|
177
|
+
|
|
178
|
+
================================================================================
|
|
179
|
+
SUMMARY
|
|
180
|
+
================================================================================
|
|
181
|
+
|
|
182
|
+
✓ Pytest: 115 passed (2.57s)
|
|
183
|
+
✓ Build: Successful (tarball + wheel)
|
|
184
|
+
✓ License: MIT, properly formatted
|
|
185
|
+
✓ README: Comprehensive documentation
|
|
186
|
+
✓ Version: 0.1.1 (consistent across build artifacts)
|
|
187
|
+
✓ Metadata: Complete and correct
|
|
188
|
+
|
|
189
|
+
✗ Entry-Points: NOT DEFINED
|
|
190
|
+
→ PayUProcessor cannot be auto-discovered by framework adapters
|
|
191
|
+
→ Task 10 required to add: [project.entry-points."getpaid.backends"]
|
|
192
|
+
|
|
193
|
+
BLOCKERS: Entry-points missing (expected, noted in Metis feedback)
|
|
194
|
+
|
|
195
|
+
NEXT STEPS:
|
|
196
|
+
- Task 10: Add entry-points configuration
|
|
197
|
+
- Ensure PayUProcessor class is properly exported for discovery
|
|
198
|
+
|
|
199
|
+
================================================================================
|
|
200
|
+
EOF
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python-getpaid-payu
|
|
3
|
+
Version: 3.0.0a4
|
|
4
|
+
Summary: PayU payment gateway integration for python-getpaid ecosystem.
|
|
5
|
+
Project-URL: Homepage, https://github.com/django-getpaid/python-getpaid-payu
|
|
6
|
+
Project-URL: Repository, https://github.com/django-getpaid/python-getpaid-payu
|
|
7
|
+
Project-URL: Documentation, https://getpaid-payu.readthedocs.io/
|
|
8
|
+
Project-URL: Changelog, https://github.com/django-getpaid/python-getpaid-payu/releases
|
|
9
|
+
Author-email: Dominik Kozaczko <dominik@kozaczko.info>
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
18
|
+
Classifier: Topic :: Office/Business :: Financial :: Point-Of-Sale
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.12
|
|
21
|
+
Requires-Dist: httpx>=0.27.0
|
|
22
|
+
Requires-Dist: python-getpaid-core>=3.0.0a3
|
|
23
|
+
Provides-Extra: simulator
|
|
24
|
+
Requires-Dist: litestar>=2.0; extra == 'simulator'
|
|
25
|
+
Requires-Dist: python-getpaid-simulator>=3.0.0a3; extra == 'simulator'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# python-getpaid-payu
|
|
29
|
+
|
|
30
|
+
[](https://pypi.org/project/python-getpaid-payu/)
|
|
31
|
+
[](https://pypi.org/project/python-getpaid-payu/)
|
|
32
|
+
[](https://opensource.org/licenses/MIT)
|
|
33
|
+
|
|
34
|
+
PayU payment processor plugin for the [python-getpaid](https://github.com/django-getpaid/python-getpaid-core) ecosystem.
|
|
35
|
+
|
|
36
|
+
Provides a fully async HTTP client (`PayUClient`) and a payment processor (`PayUProcessor`) implementing the [getpaid-core](https://github.com/django-getpaid/python-getpaid-core) `BaseProcessor` interface. Communicates with PayU via their REST API v2.1 using OAuth2 authentication.
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- **Full Payment Lifecycle**: Supports prepared, locked, paid, failed, and refunded states.
|
|
41
|
+
- **Pre-authorization**: Reserve funds on customer's card (lock) and capture them later (charge).
|
|
42
|
+
- **Refunds**: Full and partial refund support via API.
|
|
43
|
+
- **Multiple Currencies**: Support for 15 currencies across Europe and beyond.
|
|
44
|
+
- **Asynchronous**: Built with `httpx` for non-blocking API communication.
|
|
45
|
+
- **Security**: Robust callback signature verification (SHA-256 and MD5).
|
|
46
|
+
- **Comprehensive API**: Wraps every PayU REST API v2.1 endpoint.
|
|
47
|
+
|
|
48
|
+
## Supported Currencies
|
|
49
|
+
|
|
50
|
+
The following 15 currencies are supported:
|
|
51
|
+
BGN, CHF, CZK, DKK, EUR, GBP, HRK, HUF, NOK, PLN, RON, RUB, SEK, UAH, USD.
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install python-getpaid-payu
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Install simulator support only when you want this package to register its local
|
|
60
|
+
simulator plugin with `python-getpaid-simulator`:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install python-getpaid-payu[simulator]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
This extra installs the simulator host and Litestar dependencies, then exposes
|
|
67
|
+
the `payu` plugin through the `getpaid.simulator.providers` entry point.
|
|
68
|
+
|
|
69
|
+
## Simulator Plugin
|
|
70
|
+
|
|
71
|
+
When `python-getpaid-payu[simulator]` is installed alongside
|
|
72
|
+
`python-getpaid-simulator`, the simulator host auto-discovers the PayU plugin.
|
|
73
|
+
|
|
74
|
+
Typical local setup:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install python-getpaid-simulator python-getpaid-payu[simulator]
|
|
78
|
+
getpaid-simulator
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The plugin contributes:
|
|
82
|
+
|
|
83
|
+
- PayU OAuth and order/refund simulator API routes
|
|
84
|
+
- PayU authorization UI at `/sim/payu/authorize/{order_id}`
|
|
85
|
+
- PayU-specific webhook signing and state transitions
|
|
86
|
+
|
|
87
|
+
Useful simulator environment variables:
|
|
88
|
+
|
|
89
|
+
- `SIMULATOR_PAYU_SECOND_KEY`
|
|
90
|
+
- `SIMULATOR_PLUGIN_FAILURE_MODE` (`warn` or `strict`)
|
|
91
|
+
|
|
92
|
+
## Configuration
|
|
93
|
+
|
|
94
|
+
To use the PayU backend, register it in your `getpaid` configuration and provide the following settings:
|
|
95
|
+
|
|
96
|
+
| Key | Type | Default | Description |
|
|
97
|
+
|-----|------|---------|-------------|
|
|
98
|
+
| `pos_id` | `int` | — | PayU POS (point of sale) identifier |
|
|
99
|
+
| `second_key` | `str` | — | Second key (MD5) from PayU panel, used for signature verification |
|
|
100
|
+
| `oauth_id` | `int` | — | OAuth client ID from PayU panel |
|
|
101
|
+
| `oauth_secret` | `str` | — | OAuth client secret from PayU panel |
|
|
102
|
+
| `sandbox` | `bool` | `True` | Use sandbox (`secure.snd.payu.com`) or production (`secure.payu.com`) |
|
|
103
|
+
| `notify_url` | `str` | `None` | Notification callback URL template, e.g. `https://example.com/payments/{payment_id}/notify` |
|
|
104
|
+
| `continue_url` | `str` | `None` | Redirect URL template after payment, e.g. `https://example.com/payments/{payment_id}/continue` |
|
|
105
|
+
|
|
106
|
+
Example configuration:
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
GETPAID_BACKENDS = {
|
|
110
|
+
"payu": {
|
|
111
|
+
"pos_id": "300746",
|
|
112
|
+
"second_key": "b6ca15b0d1020e8094d9b5f8d163db54",
|
|
113
|
+
"oauth_id": "300746",
|
|
114
|
+
"oauth_secret": "2ee86a66e5d97e3fadc400c9f19b065d",
|
|
115
|
+
"notify_url": "https://your-domain.com/payments/payu/callback/",
|
|
116
|
+
"continue_url": "https://your-domain.com/payments/payu/success/",
|
|
117
|
+
"sandbox": True,
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Sandbox Mode
|
|
123
|
+
|
|
124
|
+
PayU provides a sandbox environment for testing. You can use the example keys provided above for testing in PLN.
|
|
125
|
+
|
|
126
|
+
## Ecosystem
|
|
127
|
+
|
|
128
|
+
`python-getpaid-payu` is part of the larger `python-getpaid` ecosystem. Use it with one of our web framework wrappers:
|
|
129
|
+
|
|
130
|
+
- [django-getpaid](https://github.com/django-getpaid/django-getpaid)
|
|
131
|
+
- [litestar-getpaid](https://github.com/django-getpaid/litestar-getpaid)
|
|
132
|
+
- [fastapi-getpaid](https://github.com/django-getpaid/fastapi-getpaid)
|
|
133
|
+
|
|
134
|
+
## Requirements
|
|
135
|
+
|
|
136
|
+
- Python 3.12+
|
|
137
|
+
- `python-getpaid-core >= 3.0.0a3`
|
|
138
|
+
- `httpx >= 0.27.0`
|
|
139
|
+
|
|
140
|
+
## License
|
|
141
|
+
|
|
142
|
+
MIT
|
|
143
|
+
|
|
144
|
+
## Credits
|
|
145
|
+
|
|
146
|
+
Created by [Dominik Kozaczko](https://github.com/dekoza).
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# python-getpaid-payu
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/python-getpaid-payu/)
|
|
4
|
+
[](https://pypi.org/project/python-getpaid-payu/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
PayU payment processor plugin for the [python-getpaid](https://github.com/django-getpaid/python-getpaid-core) ecosystem.
|
|
8
|
+
|
|
9
|
+
Provides a fully async HTTP client (`PayUClient`) and a payment processor (`PayUProcessor`) implementing the [getpaid-core](https://github.com/django-getpaid/python-getpaid-core) `BaseProcessor` interface. Communicates with PayU via their REST API v2.1 using OAuth2 authentication.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Full Payment Lifecycle**: Supports prepared, locked, paid, failed, and refunded states.
|
|
14
|
+
- **Pre-authorization**: Reserve funds on customer's card (lock) and capture them later (charge).
|
|
15
|
+
- **Refunds**: Full and partial refund support via API.
|
|
16
|
+
- **Multiple Currencies**: Support for 15 currencies across Europe and beyond.
|
|
17
|
+
- **Asynchronous**: Built with `httpx` for non-blocking API communication.
|
|
18
|
+
- **Security**: Robust callback signature verification (SHA-256 and MD5).
|
|
19
|
+
- **Comprehensive API**: Wraps every PayU REST API v2.1 endpoint.
|
|
20
|
+
|
|
21
|
+
## Supported Currencies
|
|
22
|
+
|
|
23
|
+
The following 15 currencies are supported:
|
|
24
|
+
BGN, CHF, CZK, DKK, EUR, GBP, HRK, HUF, NOK, PLN, RON, RUB, SEK, UAH, USD.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install python-getpaid-payu
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Install simulator support only when you want this package to register its local
|
|
33
|
+
simulator plugin with `python-getpaid-simulator`:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install python-getpaid-payu[simulator]
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
This extra installs the simulator host and Litestar dependencies, then exposes
|
|
40
|
+
the `payu` plugin through the `getpaid.simulator.providers` entry point.
|
|
41
|
+
|
|
42
|
+
## Simulator Plugin
|
|
43
|
+
|
|
44
|
+
When `python-getpaid-payu[simulator]` is installed alongside
|
|
45
|
+
`python-getpaid-simulator`, the simulator host auto-discovers the PayU plugin.
|
|
46
|
+
|
|
47
|
+
Typical local setup:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install python-getpaid-simulator python-getpaid-payu[simulator]
|
|
51
|
+
getpaid-simulator
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The plugin contributes:
|
|
55
|
+
|
|
56
|
+
- PayU OAuth and order/refund simulator API routes
|
|
57
|
+
- PayU authorization UI at `/sim/payu/authorize/{order_id}`
|
|
58
|
+
- PayU-specific webhook signing and state transitions
|
|
59
|
+
|
|
60
|
+
Useful simulator environment variables:
|
|
61
|
+
|
|
62
|
+
- `SIMULATOR_PAYU_SECOND_KEY`
|
|
63
|
+
- `SIMULATOR_PLUGIN_FAILURE_MODE` (`warn` or `strict`)
|
|
64
|
+
|
|
65
|
+
## Configuration
|
|
66
|
+
|
|
67
|
+
To use the PayU backend, register it in your `getpaid` configuration and provide the following settings:
|
|
68
|
+
|
|
69
|
+
| Key | Type | Default | Description |
|
|
70
|
+
|-----|------|---------|-------------|
|
|
71
|
+
| `pos_id` | `int` | — | PayU POS (point of sale) identifier |
|
|
72
|
+
| `second_key` | `str` | — | Second key (MD5) from PayU panel, used for signature verification |
|
|
73
|
+
| `oauth_id` | `int` | — | OAuth client ID from PayU panel |
|
|
74
|
+
| `oauth_secret` | `str` | — | OAuth client secret from PayU panel |
|
|
75
|
+
| `sandbox` | `bool` | `True` | Use sandbox (`secure.snd.payu.com`) or production (`secure.payu.com`) |
|
|
76
|
+
| `notify_url` | `str` | `None` | Notification callback URL template, e.g. `https://example.com/payments/{payment_id}/notify` |
|
|
77
|
+
| `continue_url` | `str` | `None` | Redirect URL template after payment, e.g. `https://example.com/payments/{payment_id}/continue` |
|
|
78
|
+
|
|
79
|
+
Example configuration:
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
GETPAID_BACKENDS = {
|
|
83
|
+
"payu": {
|
|
84
|
+
"pos_id": "300746",
|
|
85
|
+
"second_key": "b6ca15b0d1020e8094d9b5f8d163db54",
|
|
86
|
+
"oauth_id": "300746",
|
|
87
|
+
"oauth_secret": "2ee86a66e5d97e3fadc400c9f19b065d",
|
|
88
|
+
"notify_url": "https://your-domain.com/payments/payu/callback/",
|
|
89
|
+
"continue_url": "https://your-domain.com/payments/payu/success/",
|
|
90
|
+
"sandbox": True,
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Sandbox Mode
|
|
96
|
+
|
|
97
|
+
PayU provides a sandbox environment for testing. You can use the example keys provided above for testing in PLN.
|
|
98
|
+
|
|
99
|
+
## Ecosystem
|
|
100
|
+
|
|
101
|
+
`python-getpaid-payu` is part of the larger `python-getpaid` ecosystem. Use it with one of our web framework wrappers:
|
|
102
|
+
|
|
103
|
+
- [django-getpaid](https://github.com/django-getpaid/django-getpaid)
|
|
104
|
+
- [litestar-getpaid](https://github.com/django-getpaid/litestar-getpaid)
|
|
105
|
+
- [fastapi-getpaid](https://github.com/django-getpaid/fastapi-getpaid)
|
|
106
|
+
|
|
107
|
+
## Requirements
|
|
108
|
+
|
|
109
|
+
- Python 3.12+
|
|
110
|
+
- `python-getpaid-core >= 3.0.0a3`
|
|
111
|
+
- `httpx >= 0.27.0`
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
|
|
115
|
+
MIT
|
|
116
|
+
|
|
117
|
+
## Credits
|
|
118
|
+
|
|
119
|
+
Created by [Dominik Kozaczko](https://github.com/dekoza).
|
|
@@ -17,6 +17,6 @@ Initial release.
|
|
|
17
17
|
- Token deletion
|
|
18
18
|
- Automatic amount centification/normalization
|
|
19
19
|
- Signature verification (MD5 and SHA-256)
|
|
20
|
-
- PUSH callback handling with
|
|
20
|
+
- PUSH callback handling with semantic payment updates
|
|
21
21
|
- PULL status polling
|
|
22
22
|
- Full pre-authorization support (lock, charge, release)
|
|
@@ -17,9 +17,9 @@ The standard payment flow with PayU:
|
|
|
17
17
|
└── PayUProcessor.verify_callback()
|
|
18
18
|
└── Signature verification
|
|
19
19
|
└── PayUProcessor.handle_callback()
|
|
20
|
-
└──
|
|
21
|
-
COMPLETED →
|
|
22
|
-
CANCELED →
|
|
20
|
+
└── semantic updates:
|
|
21
|
+
COMPLETED → payment_captured
|
|
22
|
+
CANCELED → failed
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
### Step by Step
|
|
@@ -33,11 +33,11 @@ The standard payment flow with PayU:
|
|
|
33
33
|
|
|
34
34
|
3. **Notification** — PayU sends a PUSH notification (HTTP POST) to the
|
|
35
35
|
`notify_url` with the order status. The framework adapter passes this to
|
|
36
|
-
`verify_callback()` (signature check) and then `handle_callback()` (
|
|
37
|
-
|
|
36
|
+
`verify_callback()` (signature check) and then `handle_callback()` (semantic
|
|
37
|
+
update generation).
|
|
38
38
|
|
|
39
|
-
4. **Status update** — The payment status is updated
|
|
40
|
-
based on the PayU order status.
|
|
39
|
+
4. **Status update** — The payment status is updated by applying semantic
|
|
40
|
+
payment events based on the PayU order status.
|
|
41
41
|
|
|
42
42
|
## Pre-authorization Flow
|
|
43
43
|
|
|
@@ -49,7 +49,7 @@ locked on the buyer's account first, then charged or released later:
|
|
|
49
49
|
└── PayU returns WAITING_FOR_CONFIRMATION status
|
|
50
50
|
|
|
51
51
|
2. PayU callback handle_callback()
|
|
52
|
-
└── WAITING_FOR_CONFIRMATION →
|
|
52
|
+
└── WAITING_FOR_CONFIRMATION → locked
|
|
53
53
|
|
|
54
54
|
3a. Capture (charge) PayUProcessor.charge()
|
|
55
55
|
└── PayUClient.capture()
|
|
@@ -73,9 +73,9 @@ Refunds can be full or partial:
|
|
|
73
73
|
|
|
74
74
|
3. PayU callback handle_callback()
|
|
75
75
|
└── refund.status == FINALIZED
|
|
76
|
-
→
|
|
76
|
+
→ refund_confirmed
|
|
77
77
|
└── refund.status == CANCELED
|
|
78
|
-
→
|
|
78
|
+
→ refund_cancelled
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
## OAuth2 Authentication
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = 'python-getpaid-payu'
|
|
3
|
-
|
|
3
|
+
dynamic = ["version"]
|
|
4
4
|
description = 'PayU 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,12 @@ Repository = 'https://github.com/django-getpaid/python-getpaid-payu'
|
|
|
45
51
|
Documentation = 'https://getpaid-payu.readthedocs.io/'
|
|
46
52
|
Changelog = 'https://github.com/django-getpaid/python-getpaid-payu/releases'
|
|
47
53
|
|
|
54
|
+
[project.entry-points."getpaid.backends"]
|
|
55
|
+
payu = 'getpaid_payu.processor:PayUProcessor'
|
|
56
|
+
|
|
57
|
+
[project.entry-points."getpaid.simulator.providers"]
|
|
58
|
+
payu = 'getpaid_payu.simulator:get_plugin'
|
|
59
|
+
|
|
48
60
|
[build-system]
|
|
49
61
|
requires = ['hatchling']
|
|
50
62
|
build-backend = 'hatchling.build'
|
|
@@ -52,6 +64,9 @@ build-backend = 'hatchling.build'
|
|
|
52
64
|
[tool.hatch.build.targets.wheel]
|
|
53
65
|
packages = ['src/getpaid_payu']
|
|
54
66
|
|
|
67
|
+
[tool.hatch.version]
|
|
68
|
+
path = "src/getpaid_payu/__init__.py"
|
|
69
|
+
|
|
55
70
|
[tool.pytest.ini_options]
|
|
56
71
|
testpaths = ['tests']
|
|
57
72
|
asyncio_mode = 'auto'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
*** PLN Sandbox Keys ***
|
|
2
|
+
POS ID (pos_id): 300746
|
|
3
|
+
Second key (MD5): b6ca15b0d1020e8094d9b5f8d163db54
|
|
4
|
+
OAuth protocol - client_id: 300746
|
|
5
|
+
OAuth protocol - client_secret: 2ee86a66e5d97e3fadc400c9f19b065d
|
|
6
|
+
|
|
7
|
+
*** BGN Sandbox Keys ***
|
|
8
|
+
POS ID (pos_id): 404815
|
|
9
|
+
Second key (MD5): 87f410056e1ec5ff64f6bea777a0e694
|
|
10
|
+
OAuth protocol - client_id: 404815
|
|
11
|
+
OAuth protocol - client_secret: 89e263df5657cccfe7d1d2a0f50b6e41
|
|
12
|
+
|
|
13
|
+
*** RON Sandbox Keys ***
|
|
14
|
+
POS ID (pos_id): 491057
|
|
15
|
+
Second key (MD5): bac30a8686d9a31cbc9f3a25553e2f62
|
|
16
|
+
OAuth protocol - client_id: 491057
|
|
17
|
+
OAuth protocol - client_secret: d807005b11ca38eea8a3c1a794635b4f
|