pywayforpay 0.2.0__py3-none-any.whl

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.
@@ -0,0 +1,194 @@
1
+ Metadata-Version: 2.5
2
+ Name: pywayforpay
3
+ Version: 0.2.0
4
+ Summary: Strongly typed WayForPay PSP API SDK (msgspec-based, sync + async)
5
+ Project-URL: Documentation, https://wiki.wayforpay.com/en/
6
+ Project-URL: Repository, https://github.com/HermanPlay/pywayforpay
7
+ Author: Filip Shramko
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Keywords: api,msgspec,payment-gateway,payments,psp,sdk,wayforpay
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Internet :: WWW/HTTP
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.11
22
+ Requires-Dist: httpx>=0.27
23
+ Requires-Dist: msgspec>=0.18
24
+ Description-Content-Type: text/markdown
25
+
26
+ # pywayforpay
27
+
28
+ [![CI](https://img.shields.io/github/actions/workflow/status/HermanPlay/pywayforpay/ci.yml?branch=master&label=CI)](https://github.com/HermanPlay/pywayforpay/actions/workflows/ci.yml)
29
+ [![codecov](https://codecov.io/gh/HermanPlay/pywayforpay/graph/badge.svg?token=8V2RQUJEMM)](https://codecov.io/gh/HermanPlay/pywayforpay)
30
+ [![Python](https://img.shields.io/pypi/pyversions/pywayforpay)](https://pypi.org/project/pywayforpay/)
31
+ [![Docs](https://img.shields.io/badge/docs-mkdocs-blue)](https://HermanPlay.github.io/pywayforpay/)
32
+
33
+ Strongly typed [WayForPay](https://wiki.wayforpay.com/en/) PSP API SDK for Python (3.11+),
34
+ built on [msgspec](https://msgspec.dev/) with explicit structs, HMAC-MD5 signature handling,
35
+ and sync + async [httpx](https://www.python-httpx.org/) clients.
36
+
37
+ ## Features
38
+
39
+ - **Payments** — purchase (redirect form, widget, offline link), verify, charge (host-to-host),
40
+ 3-DS completion, settle, refund, invoices, QR, P2P transfers, currency rates.
41
+ - **Recurring payments** — status, suspend, resume, remove, change.
42
+ - **Reporting** — check status, transaction list.
43
+ - **Merchant management (MMS)** — merchants, partners, balances.
44
+ - **Antifraud** — validate and check status.
45
+ - **Webhooks** — verify callbacks and acks, build acks.
46
+ - Fully typed (`py.typed`), documented, sync + async APIs in lockstep.
47
+
48
+ ## Installation
49
+
50
+ ```bash
51
+ pip install pywayforpay
52
+ ```
53
+
54
+ Requires Python 3.11+.
55
+
56
+ ## Quickstart
57
+
58
+ ```python
59
+ from wayforpay import Client, Credentials, money
60
+ from wayforpay.models import PurchaseRequest, Product, Currency
61
+
62
+ creds = Credentials(
63
+ merchant_account="test_merch_n1",
64
+ merchant_secret_key="flk3409refn54t54t*FNJRET",
65
+ merchant_domain_name="www.market.ua",
66
+ )
67
+
68
+ product = Product(name="Dell XPS", price=money("1547.36"), count=1)
69
+ request = PurchaseRequest.from_products(
70
+ order_reference="DH783023",
71
+ order_date=1415379863,
72
+ amount=money("1547.36"),
73
+ currency=Currency.UAH,
74
+ products=[product],
75
+ )
76
+
77
+ with Client(creds) as client:
78
+ url = client.purchase_url() # https://secure.wayforpay.com/pay
79
+ form = client.purchase_form(request) # signed POST payload for the payment page
80
+ ```
81
+
82
+ Render `form` as hidden fields inside `<form action="{url}" method="POST">`.
83
+
84
+ Async mirrors sync:
85
+
86
+ ```python
87
+ import asyncio
88
+ from wayforpay import AsyncClient, Credentials
89
+
90
+ async def main() -> None:
91
+ async with AsyncClient(creds) as client:
92
+ result = await client.check_status(CheckStatusRequest(order_reference="DH783023"))
93
+
94
+ asyncio.run(main())
95
+ ```
96
+
97
+ ## Examples
98
+
99
+ Runnable examples live in [`examples/`](examples/):
100
+
101
+ ```bash
102
+ uv run python examples/purchase_form.py # signed purchase form + HTML snippet
103
+ uv run python examples/widget.py # payment-widget config
104
+ uv run python examples/webhooks.py # callback verification + ack
105
+ uv run python examples/verify_form.py # card verification form
106
+ uv run python examples/async_api.py # async client (dry-run; add --live)
107
+ uv run python examples/charge.py # host-to-host charge (dry-run; add --live)
108
+ ```
109
+
110
+ ## Documentation
111
+
112
+ Full documentation is available at <https://HermanPlay.github.io/pywayforpay/>.
113
+
114
+ - [Quickstart](https://HermanPlay.github.io/pywayforpay/quickstart/)
115
+ - [Payments](https://HermanPlay.github.io/pywayforpay/payment-flows/)
116
+ - [Payment widget](https://HermanPlay.github.io/pywayforpay/widget/)
117
+ - [Webhooks](https://HermanPlay.github.io/pywayforpay/webhooks/)
118
+ - [Recurring payments](https://HermanPlay.github.io/pywayforpay/recurring/)
119
+ - [Merchant management (MMS)](https://HermanPlay.github.io/pywayforpay/mms/)
120
+ - [Antifraud](https://HermanPlay.github.io/pywayforpay/antifraud/)
121
+ - [Errors & reason codes](https://HermanPlay.github.io/pywayforpay/errors/)
122
+ - [PCI DSS](https://HermanPlay.github.io/pywayforpay/pci-dss/)
123
+ - [API reference](https://HermanPlay.github.io/pywayforpay/api/clients/)
124
+
125
+ WayForPay API docs: <https://wiki.wayforpay.com/en/>
126
+
127
+ ## PCI DSS
128
+
129
+ This library exposes host-to-host card operations (`ChargeRequest`, `CardData`).
130
+ Handling raw card data carries PCI DSS obligations; the merchant/integrator remains
131
+ responsible for compliance. Prefer the hosted payment widget or redirect form to avoid
132
+ touching card data. See the [PCI DSS guide](https://HermanPlay.github.io/pywayforpay/pci-dss/).
133
+
134
+ ## Development
135
+
136
+ Install dev deps: `uv sync`.
137
+
138
+ ### Conventional commits
139
+
140
+ Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/)
141
+ (`feat:`, `fix:`, `docs:`, `refactor:`, `ci:`, ...). The `commit-lint` CI job checks
142
+ every commit in a PR (and the PR title) with commitizen and fails on violations.
143
+
144
+ The `master` branch is protected by a GitHub ruleset (`scripts/apply-protection.sh`):
145
+
146
+ - direct pushes and force-pushes to `master` are rejected — all changes go through PRs;
147
+ - a PR needs one approving review and a green `commit-lint` check before merge.
148
+
149
+ So the remote rejects non-conventional commits even if a contributor skips local hooks.
150
+ The pre-commit hook is convenience only:
151
+
152
+ ```bash
153
+ uv run pre-commit install --hook-type commit-msg # one-time local setup
154
+ ```
155
+
156
+ ### Releases
157
+
158
+ Publishing creates a version tag, a GitHub release with a changelog generated from
159
+ the commit log, and a PyPI package published via trusted publishing (OIDC).
160
+
161
+ 1. Bump the version and tag it:
162
+
163
+ ```bash
164
+ uv run cz bump
165
+ ```
166
+
167
+ Bumps `pyproject.toml`, `__init__.py` and `uv.lock`, updates `CHANGELOG.md`, and
168
+ creates a `vX.Y.Z` tag. Add `--yes --increment patch|minor|major` to skip the
169
+ interactive prompt (e.g. in scripts/CI).
170
+
171
+ 2. Push the tag:
172
+
173
+ ```bash
174
+ git push origin master --tags
175
+ ```
176
+
177
+ The `release` workflow builds the changelog for the tag and creates a GitHub
178
+ release. The `publish` workflow then publishes the package to PyPI.
179
+
180
+ #### One-time PyPI setup (trusted publishing)
181
+
182
+ The `publish` workflow uses PyPI trusted publishing (OIDC) — no API tokens stored.
183
+
184
+ - Enable 2FA on your PyPI and TestPyPI accounts (PyPI policy requirement).
185
+ - Register the project `pywayforpay` on PyPI (and TestPyPI).
186
+ - Add a trusted publisher on each: owner `HermanPlay`, repository `pywayforpay`,
187
+ workflow file `publish.yml`, environment `release`.
188
+
189
+ To validate a release against TestPyPI first, trigger the `publish` workflow manually
190
+ with repository `testpypi` (Actions tab → Publish to PyPI → Run workflow).
191
+
192
+ ## License
193
+
194
+ [MIT](LICENSE)
@@ -0,0 +1,22 @@
1
+ wayforpay/__init__.py,sha256=HUp-m0FXiM7aKPVRXZcmrP6gr869T-3yNQ2q9JLp2-4,811
2
+ wayforpay/_async_client.py,sha256=KQ24Af5nousL7MNqZxtEW9SbvehDShB4pmf3O6CyZo4,16607
3
+ wayforpay/_constants.py,sha256=cgCGt_JJPV6Wak7UqmG2EzOjdM3CLVbMcfepvxLzH58,937
4
+ wayforpay/_encoding.py,sha256=irBfM4XFPkwBPUUnLDl11wqGBFTdMJ_-mk8kKDGTZsQ,1599
5
+ wayforpay/_errors.py,sha256=-yrbBO4aT2s5d8ZBrKpSckHlnLboKjvDGjSvr6xl1xo,421
6
+ wayforpay/_money.py,sha256=Fe4rRR4_70HZLZwya-KRqma0XxGw1JIdp4ndVsE76vo,175
7
+ wayforpay/_signature.py,sha256=V4Q0AluSN-ZbSjXW_DhsA_56KiPhdqWqda6_i_FHUNY,1271
8
+ wayforpay/_transports.py,sha256=O0dv0JTbvN3k8_7DyqsHnpCZz7bvyLyshoZjN5U03wU,2515
9
+ wayforpay/client.py,sha256=f8tqVZpXVxIJCHRgOhUhjxmUruNiU8WrJA_Kuh3aiJI,17675
10
+ wayforpay/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ wayforpay/webhooks.py,sha256=SCQhJkk6FwhTtTQiNDkLX8JNr3c2dig5CNX8vgSHJK4,3228
12
+ wayforpay/models/__init__.py,sha256=h7BdMQFX8iqdjNGlyb3pA_PxhxSH0EuCJX92kl2-PIQ,4177
13
+ wayforpay/models/_base.py,sha256=mSN7D601wlEowlf24uoSRbxJOl5KCJ_iOYuZRBShJGI,474
14
+ wayforpay/models/antifraud.py,sha256=NtkNuzLr9CkGH1UU7NW0nFrfHsfeo_PKWWK9nrqt27s,4684
15
+ wayforpay/models/data.py,sha256=nBI9ImVTqpKshQMsKLbHMA5NgH6ed5_InQ-k143sQXs,5126
16
+ wayforpay/models/enums.py,sha256=jaAnX7d9yynBXTzbin6TF3TrUSGABj2zgpU1Y02FO6I,9020
17
+ wayforpay/models/requests.py,sha256=PTWhhx86vmZ02taMFwybomicUyw50CkrdqUyTl8y5io,33275
18
+ wayforpay/models/responses.py,sha256=jowpHxaBqlE6_MIC5qpKW9VfQOIdIaiZilL1YP-I42Q,10096
19
+ pywayforpay-0.2.0.dist-info/METADATA,sha256=2VCO0IQm1v6kL2hT_32dIhmJi0ZoSh03pd8AdVXdCQY,7353
20
+ pywayforpay-0.2.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
21
+ pywayforpay-0.2.0.dist-info/licenses/LICENSE,sha256=Z3cEFyA6FM79V0wo8cCnrmeQoKlIo8QlZidy-wdAgr0,1069
22
+ pywayforpay-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Filip Shramko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
wayforpay/__init__.py ADDED
@@ -0,0 +1,31 @@
1
+ from __future__ import annotations
2
+
3
+ from ._async_client import AsyncAntifraudClient, AsyncClient, AsyncMMSClient
4
+ from ._errors import CredentialsError, ResponseError, SignatureError, WayForPayError
5
+ from ._money import money
6
+ from ._transports import Credentials
7
+ from .client import AntifraudClient, Client, MMSClient
8
+ from .models import * # noqa: F403
9
+ from .webhooks import CallbackAck, ack_dict, build_ack, verify_ack, verify_callback
10
+
11
+ __version__ = "0.2.0"
12
+
13
+ __all__ = [
14
+ "AntifraudClient",
15
+ "AsyncAntifraudClient",
16
+ "AsyncClient",
17
+ "AsyncMMSClient",
18
+ "CallbackAck",
19
+ "Client",
20
+ "Credentials",
21
+ "CredentialsError",
22
+ "MMSClient",
23
+ "ResponseError",
24
+ "SignatureError",
25
+ "WayForPayError",
26
+ "ack_dict",
27
+ "build_ack",
28
+ "money",
29
+ "verify_ack",
30
+ "verify_callback",
31
+ ]