epay 0.1.0__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.
- epay-0.1.0/.github/workflows/ci.yml +120 -0
- epay-0.1.0/.github/workflows/release.yml +87 -0
- epay-0.1.0/.gitignore +33 -0
- epay-0.1.0/LICENSE +21 -0
- epay-0.1.0/PKG-INFO +473 -0
- epay-0.1.0/README.md +441 -0
- epay-0.1.0/pyproject.toml +78 -0
- epay-0.1.0/src/epay/__init__.py +146 -0
- epay-0.1.0/src/epay/_config.py +106 -0
- epay-0.1.0/src/epay/_specs.py +197 -0
- epay-0.1.0/src/epay/_transport.py +228 -0
- epay-0.1.0/src/epay/_types.py +194 -0
- epay-0.1.0/src/epay/_version.py +3 -0
- epay-0.1.0/src/epay/async_client.py +275 -0
- epay-0.1.0/src/epay/client.py +362 -0
- epay-0.1.0/src/epay/errors.py +224 -0
- epay-0.1.0/src/epay/helpers.py +167 -0
- epay-0.1.0/src/epay/integrations/__init__.py +19 -0
- epay-0.1.0/src/epay/integrations/asgi.py +66 -0
- epay-0.1.0/src/epay/integrations/django.py +83 -0
- epay-0.1.0/src/epay/integrations/flask.py +87 -0
- epay-0.1.0/src/epay/pagination.py +142 -0
- epay-0.1.0/src/epay/py.typed +0 -0
- epay-0.1.0/src/epay/webhooks.py +163 -0
- epay-0.1.0/tests/conftest.py +124 -0
- epay-0.1.0/tests/test_async_client.py +254 -0
- epay-0.1.0/tests/test_client.py +537 -0
- epay-0.1.0/tests/test_config.py +78 -0
- epay-0.1.0/tests/test_errors.py +102 -0
- epay-0.1.0/tests/test_helpers.py +122 -0
- epay-0.1.0/tests/test_integrations.py +199 -0
- epay-0.1.0/tests/test_webhooks.py +139 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: ci-${{ github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
test:
|
|
15
|
+
name: Python ${{ matrix.python }}
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
strategy:
|
|
18
|
+
fail-fast: false
|
|
19
|
+
matrix:
|
|
20
|
+
# 3.9 is the declared floor in pyproject.toml; keep it here so a
|
|
21
|
+
# 3.10-only syntax slip cannot reach a release.
|
|
22
|
+
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
23
|
+
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
|
|
27
|
+
- uses: actions/setup-python@v5
|
|
28
|
+
with:
|
|
29
|
+
python-version: ${{ matrix.python }}
|
|
30
|
+
cache: pip
|
|
31
|
+
|
|
32
|
+
- name: Install
|
|
33
|
+
run: pip install -e ".[dev]"
|
|
34
|
+
|
|
35
|
+
- name: Test
|
|
36
|
+
run: pytest -q
|
|
37
|
+
|
|
38
|
+
quality:
|
|
39
|
+
name: Types and lint
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
steps:
|
|
42
|
+
- uses: actions/checkout@v4
|
|
43
|
+
|
|
44
|
+
- uses: actions/setup-python@v5
|
|
45
|
+
with:
|
|
46
|
+
python-version: "3.12"
|
|
47
|
+
cache: pip
|
|
48
|
+
|
|
49
|
+
- run: pip install -e ".[dev]"
|
|
50
|
+
|
|
51
|
+
- name: mypy (strict)
|
|
52
|
+
run: mypy
|
|
53
|
+
|
|
54
|
+
- name: ruff lint
|
|
55
|
+
run: ruff check .
|
|
56
|
+
|
|
57
|
+
- name: ruff format
|
|
58
|
+
run: ruff format --check .
|
|
59
|
+
|
|
60
|
+
# __version__ rides in the User-Agent, so it must not drift from pyproject.
|
|
61
|
+
versions:
|
|
62
|
+
name: Version consistency
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
steps:
|
|
65
|
+
- uses: actions/checkout@v4
|
|
66
|
+
- uses: actions/setup-python@v5
|
|
67
|
+
with:
|
|
68
|
+
python-version: "3.12"
|
|
69
|
+
- name: pyproject.toml matches _version.py
|
|
70
|
+
run: |
|
|
71
|
+
python - <<'EOF'
|
|
72
|
+
import pathlib, re, sys, tomllib
|
|
73
|
+
|
|
74
|
+
manifest = tomllib.loads(pathlib.Path("pyproject.toml").read_text())["project"]["version"]
|
|
75
|
+
constant = re.search(
|
|
76
|
+
r'__version__ = "([^"]+)"',
|
|
77
|
+
pathlib.Path("src/epay/_version.py").read_text(),
|
|
78
|
+
).group(1)
|
|
79
|
+
|
|
80
|
+
print(f"manifest={manifest} constant={constant}")
|
|
81
|
+
if manifest != constant:
|
|
82
|
+
print(f"::error::_version.py says {constant} but pyproject.toml says {manifest}")
|
|
83
|
+
sys.exit(1)
|
|
84
|
+
EOF
|
|
85
|
+
|
|
86
|
+
package:
|
|
87
|
+
name: Package smoke test
|
|
88
|
+
runs-on: ubuntu-latest
|
|
89
|
+
steps:
|
|
90
|
+
- uses: actions/checkout@v4
|
|
91
|
+
|
|
92
|
+
- uses: actions/setup-python@v5
|
|
93
|
+
with:
|
|
94
|
+
python-version: "3.12"
|
|
95
|
+
|
|
96
|
+
- run: pip install build twine
|
|
97
|
+
|
|
98
|
+
- name: Build wheel and sdist
|
|
99
|
+
run: python -m build
|
|
100
|
+
|
|
101
|
+
# Catches broken metadata before it reaches PyPI, where a filename can
|
|
102
|
+
# never be reused.
|
|
103
|
+
- name: Validate metadata
|
|
104
|
+
run: twine check --strict dist/*
|
|
105
|
+
|
|
106
|
+
- name: Install the wheel into a clean venv and import it
|
|
107
|
+
run: |
|
|
108
|
+
python -m venv "$RUNNER_TEMP/consumer"
|
|
109
|
+
"$RUNNER_TEMP/consumer/bin/pip" install --quiet dist/*.whl
|
|
110
|
+
"$RUNNER_TEMP/consumer/bin/python" -c "
|
|
111
|
+
import epay
|
|
112
|
+
from epay.integrations import asgi, django, flask
|
|
113
|
+
assert epay.Epay('sk_test_0123456789abcdef').is_sandbox
|
|
114
|
+
print('import ok:', epay.__version__)
|
|
115
|
+
"
|
|
116
|
+
|
|
117
|
+
- uses: actions/upload-artifact@v4
|
|
118
|
+
with:
|
|
119
|
+
name: dist
|
|
120
|
+
path: dist/
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
target:
|
|
9
|
+
description: "Where to publish"
|
|
10
|
+
type: choice
|
|
11
|
+
options: [testpypi, pypi]
|
|
12
|
+
default: testpypi
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
name: Build distributions
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: "3.12"
|
|
27
|
+
|
|
28
|
+
- run: pip install build twine
|
|
29
|
+
|
|
30
|
+
# A tag that disagrees with pyproject.toml would publish the wrong
|
|
31
|
+
# version; PyPI never lets a filename be reused, so catch it here.
|
|
32
|
+
- name: Verify the tag matches the package version
|
|
33
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
34
|
+
run: |
|
|
35
|
+
TAG="${GITHUB_REF_NAME#v}"
|
|
36
|
+
VERSION=$(python -c "
|
|
37
|
+
import tomllib, pathlib
|
|
38
|
+
print(tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']['version'])
|
|
39
|
+
")
|
|
40
|
+
if [ "$VERSION" != "$TAG" ]; then
|
|
41
|
+
echo "::error::pyproject.toml is $VERSION but the tag is $TAG"
|
|
42
|
+
exit 1
|
|
43
|
+
fi
|
|
44
|
+
echo "Version matches: $TAG"
|
|
45
|
+
|
|
46
|
+
- run: python -m build
|
|
47
|
+
- run: twine check --strict dist/*
|
|
48
|
+
|
|
49
|
+
- uses: actions/upload-artifact@v4
|
|
50
|
+
with:
|
|
51
|
+
name: dist
|
|
52
|
+
path: dist/
|
|
53
|
+
|
|
54
|
+
testpypi:
|
|
55
|
+
name: Publish to TestPyPI
|
|
56
|
+
needs: build
|
|
57
|
+
if: github.event_name == 'workflow_dispatch' && inputs.target == 'testpypi'
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
environment: testpypi
|
|
60
|
+
permissions:
|
|
61
|
+
# Trusted Publishing: no API token is stored anywhere. Register this
|
|
62
|
+
# workflow at test.pypi.org -> Account -> Publishing first.
|
|
63
|
+
id-token: write
|
|
64
|
+
steps:
|
|
65
|
+
- uses: actions/download-artifact@v4
|
|
66
|
+
with:
|
|
67
|
+
name: dist
|
|
68
|
+
path: dist/
|
|
69
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
70
|
+
with:
|
|
71
|
+
repository-url: https://test.pypi.org/legacy/
|
|
72
|
+
|
|
73
|
+
pypi:
|
|
74
|
+
name: Publish to PyPI
|
|
75
|
+
needs: build
|
|
76
|
+
if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && inputs.target == 'pypi')
|
|
77
|
+
runs-on: ubuntu-latest
|
|
78
|
+
environment: pypi
|
|
79
|
+
permissions:
|
|
80
|
+
# Register this workflow at pypi.org -> Account -> Publishing first.
|
|
81
|
+
id-token: write
|
|
82
|
+
steps:
|
|
83
|
+
- uses: actions/download-artifact@v4
|
|
84
|
+
with:
|
|
85
|
+
name: dist
|
|
86
|
+
path: dist/
|
|
87
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
epay-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Byte-compiled and caches
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# Packaging
|
|
7
|
+
build/
|
|
8
|
+
dist/
|
|
9
|
+
*.egg-info/
|
|
10
|
+
.eggs/
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
.venv/
|
|
14
|
+
venv/
|
|
15
|
+
env/
|
|
16
|
+
|
|
17
|
+
# Tooling caches
|
|
18
|
+
.pytest_cache/
|
|
19
|
+
.mypy_cache/
|
|
20
|
+
.ruff_cache/
|
|
21
|
+
.tox/
|
|
22
|
+
.coverage
|
|
23
|
+
.coverage.*
|
|
24
|
+
htmlcov/
|
|
25
|
+
|
|
26
|
+
# Local env files
|
|
27
|
+
.env
|
|
28
|
+
.env.local
|
|
29
|
+
|
|
30
|
+
# Editor / OS
|
|
31
|
+
.DS_Store
|
|
32
|
+
.vscode/
|
|
33
|
+
.idea/
|
epay-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ePay
|
|
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.
|