paystack-django 1.0.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 (81) hide show
  1. paystack_django-1.0.0/CHANGELOG.md +91 -0
  2. paystack_django-1.0.0/CONTRIBUTING.md +275 -0
  3. paystack_django-1.0.0/LICENSE +21 -0
  4. paystack_django-1.0.0/MANIFEST.in +16 -0
  5. paystack_django-1.0.0/PKG-INFO +576 -0
  6. paystack_django-1.0.0/README.md +513 -0
  7. paystack_django-1.0.0/djpaystack/__init__.py +28 -0
  8. paystack_django-1.0.0/djpaystack/admin.py +69 -0
  9. paystack_django-1.0.0/djpaystack/api/__init__.py +56 -0
  10. paystack_django-1.0.0/djpaystack/api/apple_pay.py +22 -0
  11. paystack_django-1.0.0/djpaystack/api/base.py +93 -0
  12. paystack_django-1.0.0/djpaystack/api/bulk_charges.py +39 -0
  13. paystack_django-1.0.0/djpaystack/api/charge.py +51 -0
  14. paystack_django-1.0.0/djpaystack/api/customers.py +195 -0
  15. paystack_django-1.0.0/djpaystack/api/dedicated_accounts.py +54 -0
  16. paystack_django-1.0.0/djpaystack/api/direct_debit.py +22 -0
  17. paystack_django-1.0.0/djpaystack/api/disputes.py +64 -0
  18. paystack_django-1.0.0/djpaystack/api/integration.py +15 -0
  19. paystack_django-1.0.0/djpaystack/api/miscellaneous.py +34 -0
  20. paystack_django-1.0.0/djpaystack/api/pages.py +42 -0
  21. paystack_django-1.0.0/djpaystack/api/payment_requests.py +68 -0
  22. paystack_django-1.0.0/djpaystack/api/plans.py +42 -0
  23. paystack_django-1.0.0/djpaystack/api/products.py +35 -0
  24. paystack_django-1.0.0/djpaystack/api/refunds.py +29 -0
  25. paystack_django-1.0.0/djpaystack/api/settlements.py +20 -0
  26. paystack_django-1.0.0/djpaystack/api/splits.py +58 -0
  27. paystack_django-1.0.0/djpaystack/api/subaccounts.py +46 -0
  28. paystack_django-1.0.0/djpaystack/api/subscriptions.py +42 -0
  29. paystack_django-1.0.0/djpaystack/api/terminal.py +42 -0
  30. paystack_django-1.0.0/djpaystack/api/transactions.py +325 -0
  31. paystack_django-1.0.0/djpaystack/api/transfer_control.py +32 -0
  32. paystack_django-1.0.0/djpaystack/api/transfer_recipients.py +41 -0
  33. paystack_django-1.0.0/djpaystack/api/transfers.py +42 -0
  34. paystack_django-1.0.0/djpaystack/api/verification.py +26 -0
  35. paystack_django-1.0.0/djpaystack/api/virtual_terminal.py +11 -0
  36. paystack_django-1.0.0/djpaystack/apps.py +14 -0
  37. paystack_django-1.0.0/djpaystack/client.py +217 -0
  38. paystack_django-1.0.0/djpaystack/decorators.py +25 -0
  39. paystack_django-1.0.0/djpaystack/dev/__init__.py +13 -0
  40. paystack_django-1.0.0/djpaystack/dev/ngrok_tunnel.py +164 -0
  41. paystack_django-1.0.0/djpaystack/dev/webhook_tester.py +215 -0
  42. paystack_django-1.0.0/djpaystack/exceptions.py +45 -0
  43. paystack_django-1.0.0/djpaystack/management/__init__.py +0 -0
  44. paystack_django-1.0.0/djpaystack/management/commands/__init__.py +0 -0
  45. paystack_django-1.0.0/djpaystack/management/commands/cleanup_paystack_logs.py +97 -0
  46. paystack_django-1.0.0/djpaystack/management/commands/list_webhook_events.py +68 -0
  47. paystack_django-1.0.0/djpaystack/management/commands/start_webhook_tunnel.py +86 -0
  48. paystack_django-1.0.0/djpaystack/management/commands/sync_paystack_data.py +80 -0
  49. paystack_django-1.0.0/djpaystack/management/commands/test_webhook.py +113 -0
  50. paystack_django-1.0.0/djpaystack/management/commands/verify_paystack_config.py +35 -0
  51. paystack_django-1.0.0/djpaystack/middleware.py +20 -0
  52. paystack_django-1.0.0/djpaystack/migrations/0001_initial.py +144 -0
  53. paystack_django-1.0.0/djpaystack/migrations/__init__.py +0 -0
  54. paystack_django-1.0.0/djpaystack/models.py +211 -0
  55. paystack_django-1.0.0/djpaystack/py.typed +0 -0
  56. paystack_django-1.0.0/djpaystack/settings.py +68 -0
  57. paystack_django-1.0.0/djpaystack/signals.py +20 -0
  58. paystack_django-1.0.0/djpaystack/tests/__init__.py +0 -0
  59. paystack_django-1.0.0/djpaystack/tests/conftest.py +68 -0
  60. paystack_django-1.0.0/djpaystack/tests/settings.py +25 -0
  61. paystack_django-1.0.0/djpaystack/tests/test_client.py +127 -0
  62. paystack_django-1.0.0/djpaystack/tests/test_customers.py +59 -0
  63. paystack_django-1.0.0/djpaystack/tests/test_models.py +49 -0
  64. paystack_django-1.0.0/djpaystack/tests/test_transactions.py +113 -0
  65. paystack_django-1.0.0/djpaystack/tests/test_utils.py +39 -0
  66. paystack_django-1.0.0/djpaystack/tests/test_webhooks.py +124 -0
  67. paystack_django-1.0.0/djpaystack/utils.py +88 -0
  68. paystack_django-1.0.0/djpaystack/views.py +3 -0
  69. paystack_django-1.0.0/djpaystack/webhooks/__init__.py +0 -0
  70. paystack_django-1.0.0/djpaystack/webhooks/events.py +134 -0
  71. paystack_django-1.0.0/djpaystack/webhooks/handlers.py +436 -0
  72. paystack_django-1.0.0/djpaystack/webhooks/urls.py +8 -0
  73. paystack_django-1.0.0/djpaystack/webhooks/views.py +91 -0
  74. paystack_django-1.0.0/paystack_django.egg-info/PKG-INFO +576 -0
  75. paystack_django-1.0.0/paystack_django.egg-info/SOURCES.txt +80 -0
  76. paystack_django-1.0.0/paystack_django.egg-info/dependency_links.txt +1 -0
  77. paystack_django-1.0.0/paystack_django.egg-info/requires.txt +20 -0
  78. paystack_django-1.0.0/paystack_django.egg-info/top_level.txt +1 -0
  79. paystack_django-1.0.0/pyproject.toml +132 -0
  80. paystack_django-1.0.0/setup.cfg +85 -0
  81. paystack_django-1.0.0/setup.py +73 -0
@@ -0,0 +1,91 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2024-02-13
9
+
10
+ ### Added
11
+
12
+ - ✨ Complete Paystack API integration with all endpoints
13
+ - ✨ Django models for transactions, customers, plans, products, and more
14
+ - ✨ Webhook support with automatic verification and signal dispatch
15
+ - ✨ Comprehensive configuration system with environment variable support
16
+ - ✨ Signal support for payment events (success, failed, verified, etc.)
17
+ - ✨ Type hints throughout the codebase for better IDE support
18
+ - ✨ Extensive error handling with custom exception classes
19
+ - ✨ Automatic retry mechanism with exponential backoff
20
+ - ✨ Request/response logging for debugging
21
+ - ✨ Pagination support for list endpoints
22
+ - ✨ Caching support for frequently accessed data
23
+ - ✨ Async-ready design for future async support
24
+ - ✨ Comprehensive test suite with high coverage
25
+ - ✨ Full API documentation with examples
26
+ - ✨ Support for Django 3.2 through Django 5.0
27
+ - ✨ Support for Python 3.8 through Python 3.12
28
+
29
+ ### Supported Services
30
+
31
+ - Transactions - Create, verify, and manage transactions
32
+ - Customers - Create and manage customer records
33
+ - Plans - Create and manage subscription plans
34
+ - Subscriptions - Manage customer subscriptions
35
+ - Transfers - Handle fund transfers to bank accounts
36
+ - Refunds - Process and manage refunds
37
+ - Disputes - Manage transaction disputes
38
+ - Settlements - Track settlement information
39
+ - Splits - Configure payment splits between accounts
40
+ - Subaccounts - Manage subaccounts
41
+ - Products - Create and manage products
42
+ - Payment Requests - Generate payment request links
43
+ - Verification - Bank and account verification
44
+ - Direct Debit - Direct debit authorization
45
+ - Terminal - Terminal operations
46
+ - Apple Pay - Apple Pay integration
47
+ - Virtual Terminal - Virtual terminal operations
48
+ - Pages - Create and manage pages
49
+ - Bulk Charges - Batch charge operations
50
+ - Integration - Integration-related operations
51
+ - Miscellaneous - Other utility endpoints
52
+
53
+ ### Features
54
+
55
+ - 🔐 Secure webhook signature verification
56
+ - 🔄 Automatic transaction verification
57
+ - 📊 Comprehensive transaction tracking
58
+ - 🏪 Multi-merchant support via subaccounts
59
+ - 💳 Multiple payment methods support
60
+ - 📱 Apple Pay integration
61
+ - 💰 Payment splits and routing
62
+ - 🔗 Linked bank accounts for payouts
63
+ - 📧 Email-based customer identification
64
+ - 🏦 Bank account verification
65
+ - 📱 Phone number verification
66
+ - 🗂️ Flexible metadata storage
67
+ - 🔍 Advanced filtering and pagination
68
+ - 📝 Comprehensive logging
69
+
70
+ ### Documentation
71
+
72
+ - 📚 Full API documentation
73
+ - 🎓 Quick start guide
74
+ - 📖 Configuration guide
75
+ - 🔧 Integration examples
76
+ - 🧪 Testing guide
77
+ - 🔐 Security best practices
78
+
79
+ ---
80
+
81
+ ---
82
+
83
+ ## Support
84
+
85
+ For issues or feature requests, please visit [GitHub Issues](https://github.com/HummingByteDev/paystack-django/issues).
86
+
87
+ ---
88
+
89
+ ## License
90
+
91
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,275 @@
1
+ # Contributing to paystack-django
2
+
3
+ Thank you for your interest in contributing to paystack-django! We welcome contributions from anyone and are grateful for even the smallest of fixes!
4
+
5
+ ## Code of Conduct
6
+
7
+ This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code.
8
+
9
+ ## How Can I Contribute?
10
+
11
+ ### Reporting Bugs
12
+
13
+ Before creating bug reports, search the issue list to see if the problem has already been reported. If you find your bug is not listed, create a new issue with:
14
+
15
+ - **Use a clear and descriptive title**
16
+ - **Describe the exact steps which reproduce the problem** in as many details as possible
17
+ - **Provide specific examples** to demonstrate the steps
18
+ - **Describe the behavior you observed** after following the steps
19
+ - **Explain which behavior you expected to see** instead and why
20
+ - **Include screenshots and animated GIFs** if possible
21
+ - **Include your environment details**:
22
+ - Python version
23
+ - Django version
24
+ - paystack-django version
25
+ - Operating System
26
+
27
+ ### Suggesting Enhancements
28
+
29
+ Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, provide:
30
+
31
+ - **Use a clear and descriptive title**
32
+ - **Provide a step-by-step description** of the suggested enhancement
33
+ - **Provide specific examples** to demonstrate the steps
34
+ - **Describe the current behavior** and **the expected behavior**
35
+ - **Explain why this enhancement would be useful**
36
+
37
+ ### Pull Requests
38
+
39
+ Pull requests are the best way to propose changes. We actively welcome them.
40
+
41
+ - Fill in the provided pull request template
42
+ - Follow the Python/Django styleguides
43
+ - Document new code with docstrings
44
+ - End all files with a newline
45
+ - Avoid platform-dependent code
46
+ - Add tests for any new functionality
47
+
48
+ ## Development Setup
49
+
50
+ ### 1. Fork and Clone the Repository
51
+
52
+ ```bash
53
+ git clone https://github.com/YOUR-USERNAME/django-paystack.git
54
+ cd django-paystack
55
+ ```
56
+
57
+ ### 2. Create a Virtual Environment
58
+
59
+ ```bash
60
+ python -m venv venv
61
+ source venv/bin/activate # On Windows: venv\Scripts\activate
62
+ ```
63
+
64
+ ### 3. Install Development Dependencies
65
+
66
+ ```bash
67
+ pip install -e ".[dev]"
68
+ ```
69
+
70
+ ### 4. Create a New Branch
71
+
72
+ ```bash
73
+ git checkout -b feature/your-feature-name
74
+ # or
75
+ git checkout -b fix/your-bug-fix
76
+ ```
77
+
78
+ ## Development Workflow
79
+
80
+ ### Running Tests
81
+
82
+ ```bash
83
+ # Run all tests
84
+ pytest
85
+
86
+ # Run with coverage
87
+ pytest --cov=djpaystack --cov-report=html
88
+
89
+ # Run specific test file
90
+ pytest djpaystack/tests/test_client.py
91
+
92
+ # Run specific test
93
+ pytest djpaystack/tests/test_client.py::TestPaystackClient::test_initialization
94
+ ```
95
+
96
+ ### Running Tests Across Python Versions
97
+
98
+ ```bash
99
+ tox
100
+ ```
101
+
102
+ ### Code Style
103
+
104
+ We use several tools to maintain code quality:
105
+
106
+ ```bash
107
+ # Format code with black
108
+ black djpaystack
109
+
110
+ # Sort imports with isort
111
+ isort djpaystack
112
+
113
+ # Check for style issues
114
+ flake8 djpaystack
115
+
116
+ # Run type checks
117
+ mypy djpaystack
118
+ ```
119
+
120
+ ### Automated Code Quality
121
+
122
+ Before submitting a pull request, run all checks:
123
+
124
+ ```bash
125
+ # Format and check
126
+ black djpaystack
127
+ isort djpaystack
128
+ flake8 djpaystack
129
+ mypy djpaystack --ignore-missing-imports
130
+ pytest --cov=djpaystack
131
+ ```
132
+
133
+ ## Styleguides
134
+
135
+ ### Git Commit Messages
136
+
137
+ - Use the present tense ("Add feature" not "Added feature")
138
+ - Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
139
+ - Limit the first line to 72 characters or less
140
+ - Reference issues and pull requests liberally after the first line
141
+ - Consider starting the commit message with an applicable emoji:
142
+ - 🎨 `:art:` when improving the format/structure of the code
143
+ - 🐛 `:bug:` when fixing a bug
144
+ - ✅ `:white_check_mark:` when adding tests
145
+ - 📚 `:books:` when writing docs
146
+ - 🎉 `:tada:` when releasing a new version
147
+ - ⚡ `:zap:` when improving performance
148
+ - 🔒 `:lock:` when dealing with security
149
+ - ⬆️ `:arrow_up:` when upgrading dependencies
150
+
151
+ Example:
152
+
153
+ ```
154
+ 🎨 Reformat payment response handling
155
+
156
+ - Improved clarity of response parsing
157
+ - Added inline documentation
158
+ - Fixes #123
159
+ ```
160
+
161
+ ### Python Styleguide
162
+
163
+ We follow PEP 8 with the following additions:
164
+
165
+ - Use type hints for function parameters and return values
166
+ - Maximum line length is 100 characters (not 79)
167
+ - Use docstrings for all public modules, functions, classes, and methods
168
+ - Use Google-style docstrings
169
+
170
+ Example:
171
+
172
+ ```python
173
+ def initialize_transaction(
174
+ email: str,
175
+ amount: int,
176
+ reference: str,
177
+ **kwargs
178
+ ) -> Dict[str, Any]:
179
+ """
180
+ Initialize a new transaction on Paystack.
181
+
182
+ Args:
183
+ email: Customer email address
184
+ amount: Amount in kobo (e.g., 50000 = 500 NGN)
185
+ reference: Unique transaction reference
186
+
187
+ Returns:
188
+ API response containing authorization URL and access code
189
+
190
+ Raises:
191
+ PaystackValidationError: If validation fails
192
+ PaystackAPIError: If API returns an error
193
+ """
194
+ ```
195
+
196
+ ### Documentation Styleguide
197
+
198
+ - Use Markdown for documentation
199
+ - Use clear, concise language
200
+ - Include code examples where helpful
201
+ - Update relevant documentation when making changes
202
+
203
+ ## Pull Request Process
204
+
205
+ 1. **Create a fork** of the repository
206
+ 2. **Create a feature branch** from `main`
207
+ 3. **Make your changes** with clear, descriptive commits
208
+ 4. **Add tests** for new functionality
209
+ 5. **Update documentation** as needed
210
+ 6. **Run tests** and ensure they pass
211
+ 7. **Push to your fork** and create a Pull Request
212
+ 8. **Write a clear PR description** explaining your changes
213
+ 9. **Link any related issues** using keywords like `Closes #123`
214
+
215
+ ## What to Include in a Pull Request
216
+
217
+ - **Clear description** of the changes made
218
+ - **Link to related issues** (if applicable)
219
+ - **Testing information**: What tests did you run? How did you verify?
220
+ - **Screenshots or examples** (if visual changes)
221
+ - **Backward compatibility** notes (if applicable)
222
+ - **Performance impact** (if applicable)
223
+
224
+ ## Review Process
225
+
226
+ - At least one maintainer review is required before merging
227
+ - Automated tests must pass
228
+ - Code quality checks must pass
229
+ - Documentation must be updated
230
+
231
+ ## Release Process
232
+
233
+ 1. Update `__version__` in `djpaystack/__init__.py`
234
+ 2. Update `pyproject.toml` version
235
+ 3. Update `CHANGELOG.md` with release notes
236
+ 4. Create a new Git tag: `git tag v1.x.x`
237
+ 5. Push to repository
238
+ 6. Build and upload to PyPI:
239
+ ```bash
240
+ python -m build
241
+ python -m twine upload dist/*
242
+ ```
243
+
244
+ ## Dependencies
245
+
246
+ When adding new dependencies:
247
+
248
+ 1. Consider the impact on package size and installation time
249
+ 2. Use well-maintained, popular packages
250
+ 3. Add to appropriate section in `pyproject.toml`
251
+ 4. Update documentation with new dependency information
252
+ 5. Explain why the dependency is needed in the PR
253
+
254
+ ## Questions?
255
+
256
+ Feel free to ask questions by:
257
+
258
+ - Opening an issue with the `question` label
259
+ - Starting a discussion on GitHub Discussions
260
+ - Emailing the maintainers
261
+
262
+ ## Additional Notes
263
+
264
+ - This is a volunteer-driven project
265
+ - We appreciate your patience as maintainers may need time to review
266
+ - Be respectful to other contributors
267
+ - Help others when you can
268
+
269
+ ## License
270
+
271
+ By contributing, you agree that your contributions will be licensed under its MIT License.
272
+
273
+ ---
274
+
275
+ **Thank you for contributing to paystack-django!** 🎉
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Humming Byte
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.
@@ -0,0 +1,16 @@
1
+ include README.md
2
+ include LICENSE
3
+ include CHANGELOG.md
4
+ include CONTRIBUTING.md
5
+ recursive-include djpaystack *.py
6
+ recursive-include djpaystack *.html
7
+ recursive-include djpaystack *.txt
8
+ recursive-include djpaystack *.yml
9
+ recursive-include djpaystack *.yaml
10
+ recursive-include djpaystack *.json
11
+ exclude djpaystack/__pycache__
12
+ exclude djpaystack/*/__pycache__
13
+ exclude djpaystack/*/*/__pycache__
14
+ recursive-exclude * __pycache__
15
+ recursive-exclude * *.py[cod]
16
+ recursive-exclude * *.so