yookassax 1.2__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.
- yookassax-1.2/.github/workflows/release.yml +75 -0
- yookassax-1.2/.gitignore +218 -0
- yookassax-1.2/AGENTS.md +123 -0
- yookassax-1.2/LICENSE +21 -0
- yookassax-1.2/PKG-INFO +336 -0
- yookassax-1.2/README.en.md +274 -0
- yookassax-1.2/README.md +271 -0
- yookassax-1.2/docs/examples/en/01-configuration.md +160 -0
- yookassax-1.2/docs/examples/en/02-payments.md +307 -0
- yookassax-1.2/docs/examples/en/03-refunds.md +142 -0
- yookassax-1.2/docs/examples/en/04-receipts.md +141 -0
- yookassax-1.2/docs/examples/en/05-deals.md +172 -0
- yookassax-1.2/docs/examples/en/06-payouts.md +163 -0
- yookassax-1.2/docs/examples/en/07-self-employed.md +79 -0
- yookassax-1.2/docs/examples/en/08-personal-data.md +65 -0
- yookassax-1.2/docs/examples/en/09-sbp-banks.md +47 -0
- yookassax-1.2/docs/examples/en/10-invoices.md +129 -0
- yookassax-1.2/docs/examples/en/11-payment-methods.md +118 -0
- yookassax-1.2/docs/examples/en/12-pos-links.md +90 -0
- yookassax-1.2/docs/examples/en/13-webhooks.md +170 -0
- yookassax-1.2/docs/examples/en/14-errors.md +216 -0
- yookassax-1.2/docs/examples/en/README.md +57 -0
- yookassax-1.2/docs/examples/ru/01-configuration.md +159 -0
- yookassax-1.2/docs/examples/ru/02-payments.md +303 -0
- yookassax-1.2/docs/examples/ru/03-refunds.md +142 -0
- yookassax-1.2/docs/examples/ru/04-receipts.md +141 -0
- yookassax-1.2/docs/examples/ru/05-deals.md +171 -0
- yookassax-1.2/docs/examples/ru/06-payouts.md +164 -0
- yookassax-1.2/docs/examples/ru/07-self-employed.md +79 -0
- yookassax-1.2/docs/examples/ru/08-personal-data.md +65 -0
- yookassax-1.2/docs/examples/ru/09-sbp-banks.md +47 -0
- yookassax-1.2/docs/examples/ru/10-invoices.md +129 -0
- yookassax-1.2/docs/examples/ru/11-payment-methods.md +118 -0
- yookassax-1.2/docs/examples/ru/12-pos-links.md +89 -0
- yookassax-1.2/docs/examples/ru/13-webhooks.md +169 -0
- yookassax-1.2/docs/examples/ru/14-errors.md +207 -0
- yookassax-1.2/docs/examples/ru/README.md +55 -0
- yookassax-1.2/docs/llms.en.txt +316 -0
- yookassax-1.2/docs/llms.txt +313 -0
- yookassax-1.2/docs/yookassa-openapi.yaml +5895 -0
- yookassax-1.2/pyproject.toml +87 -0
- yookassax-1.2/src/yookassax/__init__.py +142 -0
- yookassax-1.2/src/yookassax/_version.py +3 -0
- yookassax-1.2/src/yookassax/clients/__init__.py +11 -0
- yookassax-1.2/src/yookassax/clients/asynchronous.py +112 -0
- yookassax-1.2/src/yookassax/clients/base.py +50 -0
- yookassax-1.2/src/yookassax/clients/response.py +23 -0
- yookassax-1.2/src/yookassax/clients/sync.py +111 -0
- yookassax-1.2/src/yookassax/credentials.py +60 -0
- yookassax-1.2/src/yookassax/errors.py +171 -0
- yookassax-1.2/src/yookassax/models/__init__.py +51 -0
- yookassax-1.2/src/yookassax/models/base.py +125 -0
- yookassax-1.2/src/yookassax/models/common.py +99 -0
- yookassax-1.2/src/yookassax/models/deal.py +35 -0
- yookassax-1.2/src/yookassax/models/misc.py +91 -0
- yookassax-1.2/src/yookassax/models/page.py +62 -0
- yookassax-1.2/src/yookassax/models/payment.py +127 -0
- yookassax-1.2/src/yookassax/models/payout.py +44 -0
- yookassax-1.2/src/yookassax/models/receipt.py +67 -0
- yookassax-1.2/src/yookassax/models/refund.py +49 -0
- yookassax-1.2/src/yookassax/models/shop.py +46 -0
- yookassax-1.2/src/yookassax/operation.py +41 -0
- yookassax-1.2/src/yookassax/operations/__init__.py +31 -0
- yookassax-1.2/src/yookassax/operations/deals.py +48 -0
- yookassax-1.2/src/yookassax/operations/parties.py +98 -0
- yookassax-1.2/src/yookassax/operations/payment_methods.py +38 -0
- yookassax-1.2/src/yookassax/operations/payments.py +81 -0
- yookassax-1.2/src/yookassax/operations/payouts.py +63 -0
- yookassax-1.2/src/yookassax/operations/pos.py +105 -0
- yookassax-1.2/src/yookassax/operations/receipts.py +48 -0
- yookassax-1.2/src/yookassax/operations/refunds.py +48 -0
- yookassax-1.2/src/yookassax/operations/shop.py +61 -0
- yookassax-1.2/src/yookassax/py.typed +0 -0
- yookassax-1.2/src/yookassax/resources/__init__.py +54 -0
- yookassax-1.2/src/yookassax/resources/base.py +58 -0
- yookassax-1.2/src/yookassax/resources/deals.py +64 -0
- yookassax-1.2/src/yookassax/resources/parties.py +144 -0
- yookassax-1.2/src/yookassax/resources/payment_methods.py +52 -0
- yookassax-1.2/src/yookassax/resources/payments.py +132 -0
- yookassax-1.2/src/yookassax/resources/payouts.py +75 -0
- yookassax-1.2/src/yookassax/resources/pos.py +138 -0
- yookassax-1.2/src/yookassax/resources/receipts.py +64 -0
- yookassax-1.2/src/yookassax/resources/refunds.py +68 -0
- yookassax-1.2/src/yookassax/resources/shop.py +95 -0
- yookassax-1.2/src/yookassax/retry.py +53 -0
- yookassax-1.2/src/yookassax/transport.py +79 -0
- yookassax-1.2/src/yookassax/unknown_fields.py +99 -0
- yookassax-1.2/src/yookassax/webhooks/__init__.py +45 -0
- yookassax-1.2/src/yookassax/webhooks/notification.py +87 -0
- yookassax-1.2/src/yookassax/webhooks/sources.py +46 -0
- yookassax-1.2/tests/__init__.py +0 -0
- yookassax-1.2/tests/conftest.py +66 -0
- yookassax-1.2/tests/test_client_async.py +100 -0
- yookassax-1.2/tests/test_client_sync.py +178 -0
- yookassax-1.2/tests/test_credentials.py +42 -0
- yookassax-1.2/tests/test_models.py +87 -0
- yookassax-1.2/tests/test_retry_policy.py +47 -0
- yookassax-1.2/tests/test_spec_coverage.py +118 -0
- yookassax-1.2/tests/test_unknown_fields.py +120 -0
- yookassax-1.2/tests/test_webhooks.py +78 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Публикация на PyPI по тегу вида v1.2.
|
|
2
|
+
#
|
|
3
|
+
# Токен нигде не хранится: PyPI доверяет этому workflow по OIDC (доверенная
|
|
4
|
+
# публикация). Настраивается один раз на pypi.org, в разделе Publishing:
|
|
5
|
+
# владелец Sepera-okeq, репозиторий yookassax, файл release.yml, окружение pypi.
|
|
6
|
+
name: release
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
tags:
|
|
11
|
+
- "v*"
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.12"
|
|
22
|
+
|
|
23
|
+
- name: Установить зависимости
|
|
24
|
+
run: |
|
|
25
|
+
python -m pip install --upgrade pip
|
|
26
|
+
pip install -e ".[dev]" build
|
|
27
|
+
|
|
28
|
+
# Версию нельзя перезалить, поэтому расхождение тега и пакета ловим до
|
|
29
|
+
# сборки: иначе тег v1.2 опубликует что-нибудь другое, и это навсегда.
|
|
30
|
+
- name: Сверить тег с версией пакета
|
|
31
|
+
run: |
|
|
32
|
+
tag="${GITHUB_REF_NAME#v}"
|
|
33
|
+
version=$(python -c "import yookassax; print(yookassax.__version__)")
|
|
34
|
+
if [ "$tag" != "$version" ]; then
|
|
35
|
+
echo "тег $tag, а версия пакета $version"
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
- name: Тесты
|
|
40
|
+
run: pytest -q
|
|
41
|
+
|
|
42
|
+
- name: Проверки
|
|
43
|
+
run: |
|
|
44
|
+
ruff check .
|
|
45
|
+
mypy src
|
|
46
|
+
|
|
47
|
+
- name: Собрать пакет
|
|
48
|
+
run: python -m build
|
|
49
|
+
|
|
50
|
+
# twine check смотрит, отрендерится ли README на странице пакета.
|
|
51
|
+
- name: Проверить пакет
|
|
52
|
+
run: |
|
|
53
|
+
pip install twine
|
|
54
|
+
twine check dist/*
|
|
55
|
+
|
|
56
|
+
- uses: actions/upload-artifact@v4
|
|
57
|
+
with:
|
|
58
|
+
name: dist
|
|
59
|
+
path: dist/
|
|
60
|
+
|
|
61
|
+
publish:
|
|
62
|
+
needs: build
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
environment: pypi
|
|
65
|
+
permissions:
|
|
66
|
+
# Право выпустить OIDC-токен, которым PyPI опознаёт этот workflow.
|
|
67
|
+
# Без него доверенная публикация не работает.
|
|
68
|
+
id-token: write
|
|
69
|
+
steps:
|
|
70
|
+
- uses: actions/download-artifact@v4
|
|
71
|
+
with:
|
|
72
|
+
name: dist
|
|
73
|
+
path: dist/
|
|
74
|
+
|
|
75
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
yookassax-1.2/.gitignore
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
# Temporary file for partial code execution
|
|
204
|
+
tempCodeRunnerFile.py
|
|
205
|
+
|
|
206
|
+
# Ruff stuff:
|
|
207
|
+
.ruff_cache/
|
|
208
|
+
|
|
209
|
+
# PyPI configuration file
|
|
210
|
+
.pypirc
|
|
211
|
+
|
|
212
|
+
# Marimo
|
|
213
|
+
marimo/_static/
|
|
214
|
+
marimo/_lsp/
|
|
215
|
+
__marimo__/
|
|
216
|
+
|
|
217
|
+
# Streamlit
|
|
218
|
+
.streamlit/secrets.toml
|
yookassax-1.2/AGENTS.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Правила работы в этом репозитории
|
|
2
|
+
|
|
3
|
+
Гайд для того, кто правит `yookassax`, включая ИИ-ассистентов. Библиотека
|
|
4
|
+
неофициальная: с ЮKassa и ЮMoney не связана, ими не поддерживается. В
|
|
5
|
+
документации и в описании пакета это должно быть сказано прямо, иначе
|
|
6
|
+
пользователь решит, что перед ним продукт ЮKassa. Справочник по
|
|
7
|
+
самой библиотеке лежит отдельно: [`docs/llms.txt`](docs/llms.txt).
|
|
8
|
+
|
|
9
|
+
## Устройство
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
src/yookassax/
|
|
13
|
+
errors.py иерархия исключений
|
|
14
|
+
credentials.py ключи доступа
|
|
15
|
+
retry.py политика повторов
|
|
16
|
+
operation.py описание одного вызова API
|
|
17
|
+
transport.py сборка запроса и разбор ответа
|
|
18
|
+
unknown_fields.py предупреждение о полях, которых нет в моделях
|
|
19
|
+
models/ типизированные модели, по файлу на домен
|
|
20
|
+
operations/ каталог операций, по файлу на ресурс
|
|
21
|
+
resources/ фасады ресурсов, оба режима рядом
|
|
22
|
+
clients/ синхронный и асинхронный клиенты
|
|
23
|
+
webhooks/ разбор уведомлений и проверка источника
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Ключевая идея: **операция описывается один раз**. Клиенты не содержат своей
|
|
27
|
+
логики, они только исполняют описание. Поэтому синхронный и асинхронный режимы
|
|
28
|
+
не могут разойтись в поведении.
|
|
29
|
+
|
|
30
|
+
## Как добавить эндпоинт
|
|
31
|
+
|
|
32
|
+
1. Функция-построитель в `operations/<ресурс>.py`, возвращает `Operation`.
|
|
33
|
+
2. По методу в синхронный и асинхронный класс в `resources/<ресурс>.py`.
|
|
34
|
+
Тело метода одна строка: вызов `self._client.send(...)`.
|
|
35
|
+
3. Если появился новый тип объекта, модель в `models/`.
|
|
36
|
+
4. Тест.
|
|
37
|
+
|
|
38
|
+
Новое поле в ответе описывается в модели, а не оставляется на `extra()`. Тест
|
|
39
|
+
`test_models_cover_documented_fields` сверяет модели со спецификацией: пока
|
|
40
|
+
поле не описано, разбор ответа выдаёт `UnknownFieldWarning`, и предупреждение,
|
|
41
|
+
которое срабатывает на давно документированном поле, начинают глушить фильтром
|
|
42
|
+
вместе с настоящими новыми полями.
|
|
43
|
+
|
|
44
|
+
Сверьтесь со спецификацией: `docs/yookassa-openapi.yaml`. Тест
|
|
45
|
+
`test_spec_coverage.py` проверяет, что реализованы все её маршруты и что в
|
|
46
|
+
библиотеке нет путей, которых в спецификации нет. Именно он поймал опечатку в
|
|
47
|
+
кассовых ссылках: метод называется `change_recipient`, а путь в API просто
|
|
48
|
+
`/recipient`.
|
|
49
|
+
|
|
50
|
+
## Стиль
|
|
51
|
+
|
|
52
|
+
PEP 8, длина строки 88. Проверяется `ruff check .`.
|
|
53
|
+
|
|
54
|
+
Комментарии и docstring-и на русском. Комментарий объясняет **почему**, а не
|
|
55
|
+
пересказывает код. Неочевидное решение и грабли комментируем, очевидное нет.
|
|
56
|
+
|
|
57
|
+
Не украшаем текст символами псевдографики и стрелками: обычные дефисы, обычные
|
|
58
|
+
слова.
|
|
59
|
+
|
|
60
|
+
Идентификаторы только латиницей, включая имена тестов. Docstring теста может
|
|
61
|
+
быть на русском и должен объяснять, что именно и зачем проверяется.
|
|
62
|
+
|
|
63
|
+
## Что нельзя менять, не подумав
|
|
64
|
+
|
|
65
|
+
**Ключи живут в экземпляре клиента.** Не переносите их в глобальную
|
|
66
|
+
переменную или на класс. Именно из-за этого в официальном SDK возможна гонка:
|
|
67
|
+
при работе с несколькими магазинами два платежа переписывают токен друг другу,
|
|
68
|
+
и платёж уходит через чужой магазин.
|
|
69
|
+
|
|
70
|
+
**Ключ идемпотентности при повторе тот же.** Повтор с новым ключом создаст
|
|
71
|
+
второй платёж. Это правило проверяется тестом
|
|
72
|
+
`test_network_failure_retries_with_same_key`.
|
|
73
|
+
|
|
74
|
+
**Ошибки данных не повторяются.** Повторять 400 и 404 бессмысленно, а на
|
|
75
|
+
платёжных путях ещё и вредно: это лишняя нагрузка в момент, когда что-то уже
|
|
76
|
+
пошло не так.
|
|
77
|
+
|
|
78
|
+
**Модели терпимы к новым полям.** ЮKassa добавляет поля в ответы. Строгая
|
|
79
|
+
валидация превратила бы это в отказ обслуживать платежи. Неизвестное
|
|
80
|
+
складывается в `raw`.
|
|
81
|
+
|
|
82
|
+
**Суммы только `Decimal`.** Ни `float`, ни `Decimal(float)`: разбирайте через
|
|
83
|
+
строку, иначе `Decimal(0.1)` даст `0.1000000000000000055`.
|
|
84
|
+
|
|
85
|
+
**Предупреждение о неизвестном поле дедуплицируется.** Один раз на пару
|
|
86
|
+
"модель плюс поле" за жизнь процесса. Без этого страница из ста платежей даёт
|
|
87
|
+
сто одинаковых строк, а лог, в котором одно и то же повторяется сотнями,
|
|
88
|
+
читать перестают, и предупреждение теряет смысл.
|
|
89
|
+
|
|
90
|
+
**Поле `type` перекрывает встроенный `type`.** У части моделей есть поле с
|
|
91
|
+
таким именем, и внутри класса аннотация `dict[str, type]` начинает ссылаться на
|
|
92
|
+
поле, а не на класс. Для таких случаев в `models/base.py` объявлен псевдоним
|
|
93
|
+
`ModelClass`, используйте его.
|
|
94
|
+
|
|
95
|
+
## Документация
|
|
96
|
+
|
|
97
|
+
Вся документация парная: русская версия и английская. Русская основная,
|
|
98
|
+
английская её перевод.
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
README.md README.en.md
|
|
102
|
+
docs/llms.txt docs/llms.en.txt
|
|
103
|
+
docs/examples/ru/ docs/examples/en/
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Новый эндпоинт или изменившееся поведение правится сразу в обеих версиях.
|
|
107
|
+
Файл, у которого нет пары, хуже отсутствующего: читатель второй версии решит,
|
|
108
|
+
что описанного там просто нет в библиотеке.
|
|
109
|
+
|
|
110
|
+
Примеры показывают оба режима: сначала синхронный, следом тот же вызов с
|
|
111
|
+
`await`. Именно это различие и есть весь переход между режимами, показывать
|
|
112
|
+
его каждый раз дешевле, чем объяснять один раз в начале.
|
|
113
|
+
|
|
114
|
+
## Проверка перед сдачей
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pytest
|
|
118
|
+
ruff check .
|
|
119
|
+
mypy src
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Тесты не ходят в сеть: HTTP подменяется через `respx`. Если тесту нужен
|
|
123
|
+
реальный запрос, значит он проверяет не то.
|
yookassax-1.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 sepera_okeq
|
|
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.
|