onepay 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.
Files changed (55) hide show
  1. onepay-0.1.0/.gitattributes +26 -0
  2. onepay-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
  3. onepay-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  4. onepay-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +26 -0
  5. onepay-0.1.0/.github/workflows/ci.yml +48 -0
  6. onepay-0.1.0/.gitignore +143 -0
  7. onepay-0.1.0/.pre-commit-config.yaml +35 -0
  8. onepay-0.1.0/CHANGELOG.md +28 -0
  9. onepay-0.1.0/CONTRIBUTING.md +47 -0
  10. onepay-0.1.0/LICENSE +21 -0
  11. onepay-0.1.0/PKG-INFO +310 -0
  12. onepay-0.1.0/README.md +272 -0
  13. onepay-0.1.0/docs/onepay.md +5167 -0
  14. onepay-0.1.0/pyproject.toml +73 -0
  15. onepay-0.1.0/src/onepay/__init__.py +88 -0
  16. onepay-0.1.0/src/onepay/_auth.py +59 -0
  17. onepay-0.1.0/src/onepay/_config.py +123 -0
  18. onepay-0.1.0/src/onepay/_http.py +326 -0
  19. onepay-0.1.0/src/onepay/_version.py +1 -0
  20. onepay-0.1.0/src/onepay/client.py +182 -0
  21. onepay-0.1.0/src/onepay/exceptions.py +138 -0
  22. onepay-0.1.0/src/onepay/models/__init__.py +128 -0
  23. onepay-0.1.0/src/onepay/models/card.py +67 -0
  24. onepay-0.1.0/src/onepay/models/checkout.py +69 -0
  25. onepay-0.1.0/src/onepay/models/customer.py +90 -0
  26. onepay-0.1.0/src/onepay/models/enums.py +46 -0
  27. onepay-0.1.0/src/onepay/models/item.py +92 -0
  28. onepay-0.1.0/src/onepay/models/payment_link.py +80 -0
  29. onepay-0.1.0/src/onepay/models/payout.py +45 -0
  30. onepay-0.1.0/src/onepay/models/refund.py +58 -0
  31. onepay-0.1.0/src/onepay/models/transaction.py +37 -0
  32. onepay-0.1.0/src/onepay/py.typed +1 -0
  33. onepay-0.1.0/src/onepay/resources/__init__.py +43 -0
  34. onepay-0.1.0/src/onepay/resources/cards.py +201 -0
  35. onepay-0.1.0/src/onepay/resources/checkout.py +146 -0
  36. onepay-0.1.0/src/onepay/resources/customers.py +229 -0
  37. onepay-0.1.0/src/onepay/resources/items.py +229 -0
  38. onepay-0.1.0/src/onepay/resources/payment_links.py +262 -0
  39. onepay-0.1.0/src/onepay/resources/payouts.py +174 -0
  40. onepay-0.1.0/src/onepay/resources/refunds.py +109 -0
  41. onepay-0.1.0/src/onepay/resources/subscriptions.py +154 -0
  42. onepay-0.1.0/src/onepay/resources/transactions.py +74 -0
  43. onepay-0.1.0/src/onepay/webhook.py +80 -0
  44. onepay-0.1.0/tests/conftest.py +144 -0
  45. onepay-0.1.0/tests/test_auth.py +66 -0
  46. onepay-0.1.0/tests/test_cards.py +109 -0
  47. onepay-0.1.0/tests/test_checkout.py +103 -0
  48. onepay-0.1.0/tests/test_customers.py +147 -0
  49. onepay-0.1.0/tests/test_http_client.py +86 -0
  50. onepay-0.1.0/tests/test_items.py +66 -0
  51. onepay-0.1.0/tests/test_payment_links.py +113 -0
  52. onepay-0.1.0/tests/test_payouts.py +84 -0
  53. onepay-0.1.0/tests/test_refunds.py +70 -0
  54. onepay-0.1.0/tests/test_transactions.py +49 -0
  55. onepay-0.1.0/tests/test_webhooks.py +54 -0
@@ -0,0 +1,26 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto eol=lf
3
+
4
+ # Explicitly declare text files you want to always be normalized and converted
5
+ # to native line endings on checkout.
6
+ *.py text diff=python
7
+ *.md text
8
+ *.txt text
9
+ *.toml text
10
+ *.yaml text
11
+ *.yml text
12
+ *.json text
13
+
14
+ # Exclude generated and minified files from GitHub language statistics
15
+ docs/site/* linguist-generated=true
16
+ tests/data/* linguist-generated=true
17
+
18
+ # Keep bash scripts as LF
19
+ *.sh text eol=lf
20
+
21
+ # Image files are binary
22
+ *.png binary
23
+ *.jpg binary
24
+ *.jpeg binary
25
+ *.gif binary
26
+ *.ico binary
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve the SDK
4
+ title: "[BUG] "
5
+ labels: bug
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Initialize client with '...'
16
+ 2. Call method '...'
17
+ 3. See error '...'
18
+
19
+ **Expected behavior**
20
+ A clear and concise description of what you expected to happen.
21
+
22
+ **Environment (please complete the following information):**
23
+ - OS: [e.g. Ubuntu 20.04, macOS 13]
24
+ - Python Version: [e.g. 3.9.12]
25
+ - SDK Version: [e.g. 0.1.0]
26
+
27
+ **Additional context**
28
+ Add any other context about the problem here, such as stack traces.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: "[FEATURE] "
5
+ labels: enhancement
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,26 @@
1
+ ## Description
2
+ <!-- Please include a summary of the change and which issue is fixed. -->
3
+ <!-- Please also include relevant motivation and context. -->
4
+
5
+ Fixes # (issue number if applicable)
6
+
7
+ ## Type of change
8
+ <!-- Please delete options that are not relevant. -->
9
+ - [ ] Bug fix (non-breaking change which fixes an issue)
10
+ - [ ] New feature (non-breaking change which adds functionality)
11
+ - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
12
+ - [ ] Documentation update
13
+
14
+ ## How Has This Been Tested?
15
+ <!-- Please describe the tests that you ran to verify your changes. -->
16
+ - [ ] Added/Updated Unit Tests
17
+ - [ ] Tested manually against the API
18
+
19
+ ## Checklist:
20
+ - [ ] My code follows the style guidelines of this project (checked by `ruff`)
21
+ - [ ] I have performed a self-review of my own code
22
+ - [ ] I have commented my code, particularly in hard-to-understand areas
23
+ - [ ] I have made corresponding changes to the documentation
24
+ - [ ] My changes generate no new warnings or type errors (checked by `mypy`)
25
+ - [ ] I have added tests that prove my fix is effective or that my feature works
26
+ - [ ] New and existing unit tests pass locally with my changes
@@ -0,0 +1,48 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ pull_request:
7
+ branches: [ "main" ]
8
+
9
+ jobs:
10
+ build-and-test:
11
+ runs-on: ${{ matrix.os }}
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
15
+ os: [ubuntu-latest, macos-latest, windows-latest]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+ cache: 'pip'
25
+
26
+ - name: Install dependencies
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ pip install -e ".[dev]"
30
+
31
+ - name: Check code formatting (Ruff)
32
+ run: ruff format --check .
33
+
34
+ - name: Lint code (Ruff)
35
+ run: ruff check .
36
+
37
+ - name: Type check (MyPy)
38
+ run: mypy src tests
39
+
40
+ - name: Run tests (Pytest)
41
+ run: pytest --cov=src/onepay --cov-report=xml
42
+
43
+ - name: Upload coverage reports to Codecov
44
+ uses: codecov/codecov-action@v4
45
+ with:
46
+ token: ${{ secrets.CODECOV_TOKEN }}
47
+ file: ./coverage.xml
48
+ fail_ci_if_error: false
@@ -0,0 +1,143 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
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
+ docs/site/
74
+ site/
75
+
76
+ # PyBuilder
77
+ .pybuilder/
78
+ target/
79
+
80
+ # Jupyter Notebook
81
+ .ipynb_checkpoints
82
+
83
+ # IPython
84
+ profile_default/
85
+ ipython_config.py
86
+
87
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
88
+ __pypackages__/
89
+
90
+ # Celery stuff
91
+ celerybeat-schedule
92
+ celerybeat.pid
93
+
94
+ # SageMath parsed files
95
+ *.sage.py
96
+
97
+ # Environments
98
+ .env
99
+ .venv
100
+ env/
101
+ venv/
102
+ ENV/
103
+ env.bak/
104
+ venv.bak/
105
+
106
+ # Spyder project settings
107
+ .spyderproject
108
+ .spyproject
109
+
110
+ # Rope project settings
111
+ .ropeproject
112
+
113
+ # mkdocs documentation
114
+ /site
115
+
116
+ # mypy
117
+ .mypy_cache/
118
+ .dmypy.json
119
+ dmypy.json
120
+
121
+ # Pyre type checker
122
+ .pyre/
123
+
124
+ # pytype static type analyzer
125
+ .pytype/
126
+
127
+ # Cython debug symbols
128
+ cython_debug/
129
+
130
+ # OS generated files
131
+ .DS_Store
132
+ .DS_Store?
133
+ ._*
134
+ .Spotlight-V100
135
+ .Trashes
136
+ ehthumbs.db
137
+ Thumbs.db
138
+
139
+ # IDEs
140
+ .idea/
141
+ .vscode/
142
+ *.swp
143
+ *.swo
@@ -0,0 +1,35 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.5.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-toml
9
+ - id: check-added-large-files
10
+ - id: check-merge-conflict
11
+ - id: detect-private-key
12
+
13
+ - repo: https://github.com/astral-sh/ruff-pre-commit
14
+ rev: v0.1.6 # Use an older standard compatible with python 3.9 if needed, but ruff is self-contained.
15
+ # Will use latest widely supported:
16
+ # Actually wait, let's use the one configured in pyproject.toml if possible, but v0.1.14 is a safe bet.
17
+ # v0.2.0 or v0.3.0 is newer, I'll use a reasonably recent version v0.3.4
18
+ # Wait, pyproject.toml specifies ruff>=0.1
19
+ # We will use v0.3.4
20
+ hooks:
21
+ # Run the linter
22
+ - id: ruff
23
+ args: [ --fix ]
24
+ # Run the formatter
25
+ - id: ruff-format
26
+
27
+ - repo: https://github.com/pre-commit/mirrors-mypy
28
+ rev: v1.9.0
29
+ hooks:
30
+ - id: mypy
31
+ additional_dependencies:
32
+ - httpx>=0.27
33
+ - pydantic>=2.0
34
+ - pytest>=7.0
35
+ args: [--strict, --ignore-missing-imports]
@@ -0,0 +1,28 @@
1
+ # Changelog
2
+
3
+ All notable changes to the OnePay Python SDK will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/).
7
+
8
+ ## [0.1.0] - 2026-08-30
9
+
10
+ ### Added
11
+ - Initial release of the OnePay Python SDK
12
+ - **Checkout** — `client.checkout.create()` for payment session creation with automatic SHA-256 hash generation
13
+ - **Transaction Status** — `client.transactions.get_status()` for payment verification
14
+ - **Items** — Full CRUD via `client.items.create/list/update/delete()`
15
+ - **Payment Links** — Full CRUD via `client.payment_links.create/get/update/delete()`
16
+ - **Customers** — `client.customers.create/list/get/request_token/list_transactions()`
17
+ - **Cards** — `client.cards.list/get/delete/charge()`
18
+ - **Refunds** — `client.refunds.create()` with full and partial refund support
19
+ - **Payouts** — `client.payouts.get_transaction()` and auto-paginating `list_transactions()`
20
+ - **Subscriptions** — Experimental `client.subscriptions.create()`
21
+ - **Webhooks** — `Webhook.parse()` for framework-agnostic callback handling
22
+ - Sync (`OnePay`) and async (`AsyncOnePay`) clients
23
+ - Full type annotations with PEP 561 `py.typed` marker
24
+ - Pydantic v2 models for all request/response types
25
+ - Exception hierarchy: `OnePayError`, `AuthenticationError`, `InvalidRequestError`, `RateLimitError`, `NetworkError`
26
+ - Automatic retry with exponential backoff for 429 and 5xx errors
27
+ - Environment variable fallback for all credentials
28
+ - Context manager support (`with OnePay(...) as client:`)
@@ -0,0 +1,47 @@
1
+ # Contributing to OnePay Python SDK
2
+
3
+ First off, thank you for considering contributing to OnePay! It's people like you that make this SDK a great tool for the community.
4
+
5
+ ## Development Environment Setup
6
+
7
+ 1. Fork the repository and clone it locally.
8
+ 2. Ensure you have Python 3.9+ installed.
9
+ 3. Create a virtual environment and activate it:
10
+ ```bash
11
+ python -m venv .venv
12
+ source .venv/bin/activate # On Windows use: .venv\Scripts\activate
13
+ ```
14
+ 4. Install the package in editable mode with development dependencies:
15
+ ```bash
16
+ pip install -e ".[dev]"
17
+ ```
18
+ 5. Install `pre-commit` to ensure code quality before pushing:
19
+ ```bash
20
+ pip install pre-commit
21
+ pre-commit install
22
+ ```
23
+
24
+ ## Development Workflow
25
+
26
+ - **Code Style**: This project uses `ruff` for both linting and formatting. The pre-commit hooks will automatically format your code.
27
+ - **Type Checking**: We use `mypy` for static type checking. Ensure you add type hints to all new functions.
28
+ - **Testing**: We use `pytest`. All new features should have accompanying tests.
29
+ ```bash
30
+ pytest
31
+ ```
32
+ To check coverage:
33
+ ```bash
34
+ pytest --cov=src/onepay
35
+ ```
36
+
37
+ ## Pull Request Process
38
+
39
+ 1. Create a new branch from `main` (e.g., `feature/add-new-endpoint` or `fix/handle-timeout`).
40
+ 2. Make your changes and commit them with clear, descriptive messages.
41
+ 3. Push your branch and open a Pull Request against the `main` branch.
42
+ 4. Ensure all CI checks pass (linting, type checking, tests).
43
+ 5. A maintainer will review your PR and provide feedback.
44
+
45
+ ## Reporting Issues
46
+
47
+ If you find a bug or have a feature request, please use the issue templates provided in the `.github/ISSUE_TEMPLATE` directory.
onepay-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 OnePay Team
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.