mpesakit 0.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.
- mpesakit-0.1.2/.gitignore +207 -0
- mpesakit-0.1.2/LICENSE +73 -0
- mpesakit-0.1.2/PKG-INFO +226 -0
- mpesakit-0.1.2/README.md +180 -0
- mpesakit-0.1.2/mpesakit/B2B_express_checkout/B2B_express_checkout.py +51 -0
- mpesakit-0.1.2/mpesakit/B2B_express_checkout/__init__.py +16 -0
- mpesakit-0.1.2/mpesakit/B2B_express_checkout/schemas.py +127 -0
- mpesakit-0.1.2/mpesakit/B2C/B2C.py +47 -0
- mpesakit-0.1.2/mpesakit/B2C/__init__.py +23 -0
- mpesakit-0.1.2/mpesakit/B2C/schemas.py +339 -0
- mpesakit-0.1.2/mpesakit/B2C_account_top_up/B2C_account_top_up.py +49 -0
- mpesakit-0.1.2/mpesakit/B2C_account_top_up/__init__.py +19 -0
- mpesakit-0.1.2/mpesakit/B2C_account_top_up/schemas.py +316 -0
- mpesakit-0.1.2/mpesakit/C2B/C2B.py +56 -0
- mpesakit-0.1.2/mpesakit/C2B/__init__.py +21 -0
- mpesakit-0.1.2/mpesakit/C2B/schemas.py +234 -0
- mpesakit-0.1.2/mpesakit/__init__.py +0 -0
- mpesakit-0.1.2/mpesakit/account_balance/__init__.py +21 -0
- mpesakit-0.1.2/mpesakit/account_balance/account_balance.py +47 -0
- mpesakit-0.1.2/mpesakit/account_balance/schemas.py +298 -0
- mpesakit-0.1.2/mpesakit/auth/__init__.py +4 -0
- mpesakit-0.1.2/mpesakit/auth/access_token.py +22 -0
- mpesakit-0.1.2/mpesakit/auth/token_manager.py +86 -0
- mpesakit-0.1.2/mpesakit/bill_manager/__init__.py +40 -0
- mpesakit-0.1.2/mpesakit/bill_manager/bill_manager.py +133 -0
- mpesakit-0.1.2/mpesakit/bill_manager/schemas.py +467 -0
- mpesakit-0.1.2/mpesakit/business_buy_goods/__init__.py +19 -0
- mpesakit-0.1.2/mpesakit/business_buy_goods/business_buy_goods.py +47 -0
- mpesakit-0.1.2/mpesakit/business_buy_goods/schemas.py +302 -0
- mpesakit-0.1.2/mpesakit/business_paybill/__init__.py +19 -0
- mpesakit-0.1.2/mpesakit/business_paybill/business_paybill.py +47 -0
- mpesakit-0.1.2/mpesakit/business_paybill/schemas.py +284 -0
- mpesakit-0.1.2/mpesakit/dynamic_qr_code/__init__.py +13 -0
- mpesakit-0.1.2/mpesakit/dynamic_qr_code/dynamic_qr_code.py +49 -0
- mpesakit-0.1.2/mpesakit/dynamic_qr_code/schemas.py +172 -0
- mpesakit-0.1.2/mpesakit/errors.py +49 -0
- mpesakit-0.1.2/mpesakit/http_client/__init__.py +4 -0
- mpesakit-0.1.2/mpesakit/http_client/http_client.py +28 -0
- mpesakit-0.1.2/mpesakit/http_client/mpesa_http_client.py +173 -0
- mpesakit-0.1.2/mpesakit/mpesa_client.py +85 -0
- mpesakit-0.1.2/mpesakit/mpesa_express/__init__.py +28 -0
- mpesakit-0.1.2/mpesakit/mpesa_express/schemas.py +610 -0
- mpesakit-0.1.2/mpesakit/mpesa_express/stk_push.py +64 -0
- mpesakit-0.1.2/mpesakit/mpesa_ratiba/__init__.py +21 -0
- mpesakit-0.1.2/mpesakit/mpesa_ratiba/mpesa_ratiba.py +51 -0
- mpesakit-0.1.2/mpesakit/mpesa_ratiba/schemas.py +320 -0
- mpesakit-0.1.2/mpesakit/reversal/__init__.py +19 -0
- mpesakit-0.1.2/mpesakit/reversal/reversal.py +48 -0
- mpesakit-0.1.2/mpesakit/reversal/schemas.py +295 -0
- mpesakit-0.1.2/mpesakit/services/__init__.py +25 -0
- mpesakit-0.1.2/mpesakit/services/b2b.py +188 -0
- mpesakit-0.1.2/mpesakit/services/b2c.py +124 -0
- mpesakit-0.1.2/mpesakit/services/balance.py +67 -0
- mpesakit-0.1.2/mpesakit/services/bill.py +135 -0
- mpesakit-0.1.2/mpesakit/services/c2b.py +56 -0
- mpesakit-0.1.2/mpesakit/services/dynamic_qr.py +61 -0
- mpesakit-0.1.2/mpesakit/services/express.py +105 -0
- mpesakit-0.1.2/mpesakit/services/ratiba.py +82 -0
- mpesakit-0.1.2/mpesakit/services/reversal.py +67 -0
- mpesakit-0.1.2/mpesakit/services/tax.py +65 -0
- mpesakit-0.1.2/mpesakit/services/transaction.py +78 -0
- mpesakit-0.1.2/mpesakit/tax_remittance/__init__.py +19 -0
- mpesakit-0.1.2/mpesakit/tax_remittance/schemas.py +257 -0
- mpesakit-0.1.2/mpesakit/tax_remittance/tax_remittance.py +47 -0
- mpesakit-0.1.2/mpesakit/transaction_status/__init__.py +25 -0
- mpesakit-0.1.2/mpesakit/transaction_status/schemas.py +325 -0
- mpesakit-0.1.2/mpesakit/transaction_status/transaction_status.py +47 -0
- mpesakit-0.1.2/mpesakit/utils/ip_whitelist.py +56 -0
- mpesakit-0.1.2/mpesakit/utils/phone.py +38 -0
- mpesakit-0.1.2/pyproject.toml +127 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# ===== python.gitignore =====
|
|
2
|
+
# Byte-compiled / optimized / DLL files
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[codz]
|
|
5
|
+
*$py.class
|
|
6
|
+
|
|
7
|
+
# C extensions
|
|
8
|
+
*.so
|
|
9
|
+
|
|
10
|
+
# Distribution / packaging
|
|
11
|
+
.Python
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py.cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# UV
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
#uv.lock
|
|
103
|
+
|
|
104
|
+
# poetry
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
106
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
107
|
+
# commonly ignored for libraries.
|
|
108
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
109
|
+
#poetry.lock
|
|
110
|
+
#poetry.toml
|
|
111
|
+
|
|
112
|
+
# pdm
|
|
113
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
114
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
115
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
116
|
+
#pdm.lock
|
|
117
|
+
#pdm.toml
|
|
118
|
+
.pdm-python
|
|
119
|
+
.pdm-build/
|
|
120
|
+
|
|
121
|
+
# pixi
|
|
122
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
123
|
+
#pixi.lock
|
|
124
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
125
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
126
|
+
.pixi
|
|
127
|
+
|
|
128
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
129
|
+
__pypackages__/
|
|
130
|
+
|
|
131
|
+
# Celery stuff
|
|
132
|
+
celerybeat-schedule
|
|
133
|
+
celerybeat.pid
|
|
134
|
+
|
|
135
|
+
# SageMath parsed files
|
|
136
|
+
*.sage.py
|
|
137
|
+
|
|
138
|
+
# Environments
|
|
139
|
+
.env
|
|
140
|
+
.envrc
|
|
141
|
+
.venv
|
|
142
|
+
env/
|
|
143
|
+
venv/
|
|
144
|
+
ENV/
|
|
145
|
+
env.bak/
|
|
146
|
+
venv.bak/
|
|
147
|
+
|
|
148
|
+
# Spyder project settings
|
|
149
|
+
.spyderproject
|
|
150
|
+
.spyproject
|
|
151
|
+
|
|
152
|
+
# Rope project settings
|
|
153
|
+
.ropeproject
|
|
154
|
+
|
|
155
|
+
# mkdocs documentation
|
|
156
|
+
/site
|
|
157
|
+
|
|
158
|
+
# mypy
|
|
159
|
+
.mypy_cache/
|
|
160
|
+
.dmypy.json
|
|
161
|
+
dmypy.json
|
|
162
|
+
|
|
163
|
+
# Pyre type checker
|
|
164
|
+
.pyre/
|
|
165
|
+
|
|
166
|
+
# pytype static type analyzer
|
|
167
|
+
.pytype/
|
|
168
|
+
|
|
169
|
+
# Cython debug symbols
|
|
170
|
+
cython_debug/
|
|
171
|
+
|
|
172
|
+
# PyCharm
|
|
173
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
174
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
175
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
176
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
177
|
+
#.idea/
|
|
178
|
+
|
|
179
|
+
# Abstra
|
|
180
|
+
# Abstra is an AI-powered process automation framework.
|
|
181
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
182
|
+
# Learn more at https://abstra.io/docs
|
|
183
|
+
.abstra/
|
|
184
|
+
|
|
185
|
+
# Visual Studio Code
|
|
186
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
187
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
188
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
189
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
190
|
+
# .vscode/
|
|
191
|
+
|
|
192
|
+
# Ruff stuff:
|
|
193
|
+
.ruff_cache/
|
|
194
|
+
|
|
195
|
+
# PyPI configuration file
|
|
196
|
+
.pypirc
|
|
197
|
+
|
|
198
|
+
# Marimo
|
|
199
|
+
marimo/_static/
|
|
200
|
+
marimo/_lsp/
|
|
201
|
+
__marimo__/
|
|
202
|
+
|
|
203
|
+
# Streamlit
|
|
204
|
+
.streamlit/secrets.toml
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
uv.lock
|
mpesakit-0.1.2/LICENSE
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
10
|
+
|
|
11
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
12
|
+
|
|
13
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
14
|
+
|
|
15
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
16
|
+
|
|
17
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
18
|
+
|
|
19
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
20
|
+
|
|
21
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
22
|
+
|
|
23
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
24
|
+
|
|
25
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
26
|
+
|
|
27
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
28
|
+
|
|
29
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
30
|
+
|
|
31
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
32
|
+
|
|
33
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
34
|
+
|
|
35
|
+
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
36
|
+
|
|
37
|
+
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
38
|
+
|
|
39
|
+
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
40
|
+
|
|
41
|
+
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
42
|
+
|
|
43
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
44
|
+
|
|
45
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
46
|
+
|
|
47
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
48
|
+
|
|
49
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
50
|
+
|
|
51
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
52
|
+
|
|
53
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
54
|
+
|
|
55
|
+
END OF TERMS AND CONDITIONS
|
|
56
|
+
|
|
57
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
58
|
+
|
|
59
|
+
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
|
60
|
+
|
|
61
|
+
Copyright 2025 John Kagunda
|
|
62
|
+
|
|
63
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
64
|
+
you may not use this file except in compliance with the License.
|
|
65
|
+
You may obtain a copy of the License at
|
|
66
|
+
|
|
67
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
68
|
+
|
|
69
|
+
Unless required by applicable law or agreed to in writing, software
|
|
70
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
71
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
72
|
+
See the License for the specific language governing permissions and
|
|
73
|
+
limitations under the License.
|
mpesakit-0.1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mpesakit
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: A Python SDK for integrating with M-Pesa APIs
|
|
5
|
+
Project-URL: Homepage, https://github.com/rafaeljohn9/mpesakit
|
|
6
|
+
Project-URL: Repository, https://github.com/rafaeljohn9/mpesakit
|
|
7
|
+
Project-URL: Issues, https://github.com/rafaeljohn9/mpesakit/issues
|
|
8
|
+
Author-email: John Kagunda <johnmkagunda@gmail.com>
|
|
9
|
+
Maintainer-email: John Kagunda <johnmkagunda@gmail.com>
|
|
10
|
+
License: APACHE-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: africa,api,django,fastapi,flask,mobile money,mpesa,payment,payments,rest,sdk
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Python: >=3.12
|
|
22
|
+
Requires-Dist: pydantic<3.0.0,>=2.10.6
|
|
23
|
+
Requires-Dist: pydantic[email]<3.0.0,>=2.10.6
|
|
24
|
+
Requires-Dist: requests<3.0.0,>=2.32.3
|
|
25
|
+
Requires-Dist: typing-extensions<5.0.0,>=4.12.2
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: bandit; extra == 'dev'
|
|
28
|
+
Requires-Dist: build; extra == 'dev'
|
|
29
|
+
Requires-Dist: coverage; extra == 'dev'
|
|
30
|
+
Requires-Dist: hatch; extra == 'dev'
|
|
31
|
+
Requires-Dist: hatch-vcs; extra == 'dev'
|
|
32
|
+
Requires-Dist: hatchling; extra == 'dev'
|
|
33
|
+
Requires-Dist: mypy; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
36
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
37
|
+
Requires-Dist: types-requests; extra == 'dev'
|
|
38
|
+
Provides-Extra: test
|
|
39
|
+
Requires-Dist: bandit; extra == 'test'
|
|
40
|
+
Requires-Dist: mypy; extra == 'test'
|
|
41
|
+
Requires-Dist: pyngrok; extra == 'test'
|
|
42
|
+
Requires-Dist: pytest; extra == 'test'
|
|
43
|
+
Requires-Dist: pytest-cov; extra == 'test'
|
|
44
|
+
Requires-Dist: types-requests; extra == 'test'
|
|
45
|
+
Description-Content-Type: text/markdown
|
|
46
|
+
|
|
47
|
+
# mpesa-daraja-sdk
|
|
48
|
+
|
|
49
|
+
> ⚡ **Effortless M-Pesa integration** using Safaricom's Daraja API — built for developers, by developers.
|
|
50
|
+
|
|
51
|
+
[](https://www.python.org/downloads/)
|
|
52
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
53
|
+
<!-- []() -->
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## The Problem
|
|
58
|
+
|
|
59
|
+
Integrating Safaricom's **M-Pesa Daraja API** directly is **notoriously complex**:
|
|
60
|
+
|
|
61
|
+
- Confusing and inconsistent documentation
|
|
62
|
+
- Manual handling of OAuth2 tokens and security credentials
|
|
63
|
+
- Complex encryption and certificate management
|
|
64
|
+
- Different endpoints for sandbox vs production environments
|
|
65
|
+
- STK Push, C2B, B2C, balance — all feel like separate APIs
|
|
66
|
+
- Time-consuming setup that delays your time-to-market
|
|
67
|
+
|
|
68
|
+
For many developers and startups, this becomes a **huge barrier** to adopting M-Pesa payments in Kenya and beyond.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## The Solution
|
|
73
|
+
|
|
74
|
+
**`mpesa-daraja-sdk`** eliminates the complexity with a **clean, developer-friendly Python SDK** that:
|
|
75
|
+
|
|
76
|
+
- **Zero-config setup** — just add your credentials and go
|
|
77
|
+
- **Handles authentication automatically** — OAuth2, tokens, and security
|
|
78
|
+
- **Seamless environment switching** — sandbox ↔ production with one parameter
|
|
79
|
+
- **Pythonic interface** — clean methods that feel natural to Python developers
|
|
80
|
+
- **Batteries included** — everything you need for M-Pesa integration
|
|
81
|
+
- **Production-ready** — end goal is to be used by startups and enterprises across Kenya
|
|
82
|
+
|
|
83
|
+
### Supported Features
|
|
84
|
+
|
|
85
|
+
| Feature | Status | Description |
|
|
86
|
+
|---------|--------|-------------|
|
|
87
|
+
| **STK Push** | Ready | Lipa na M-Pesa Online payments |
|
|
88
|
+
| **C2B Payments** | Ready | Customer to Business transactions |
|
|
89
|
+
| **B2C Payments** | Ready | Business to Customer payouts |
|
|
90
|
+
| **Token Management** | Ready | Automatic OAuth2 handling |
|
|
91
|
+
| **Account Balance** | Coming Soon | Check account balances |
|
|
92
|
+
| **Transaction Reversal** | Coming Soon | Reverse transactions |
|
|
93
|
+
| 🎣 **Webhook Validation** | Coming Soon | Secure callback handling |
|
|
94
|
+
|
|
95
|
+
> Built on top of [Arlus/mpesa-py](https://github.com/Arlus/mpesa-py) with ❤️ — modernized, cleaned up, and restructured for today's developer needs.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Quick Start
|
|
100
|
+
|
|
101
|
+
### Installation (coming soon)
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
pip install mpesa-daraja-sdk
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 📖 Complete Setup Guide
|
|
110
|
+
|
|
111
|
+
### 1. Get Safaricom Developer Account
|
|
112
|
+
|
|
113
|
+
1. Visit [developer.safaricom.co.ke](https://developer.safaricom.co.ke)
|
|
114
|
+
2. **Create account** and verify your email
|
|
115
|
+
3. **Create a new app** to get your credentials:
|
|
116
|
+
- Consumer Key
|
|
117
|
+
- Consumer Secret
|
|
118
|
+
|
|
119
|
+
### 2. Obtain Test Credentials (Sandbox)
|
|
120
|
+
|
|
121
|
+
1. Navigate to [Test Credentials Page](https://developer.safaricom.co.ke/test_credentials)
|
|
122
|
+
2. Copy the following credentials:
|
|
123
|
+
- **Shortcode** (Business number)
|
|
124
|
+
- **Initiator Name** (API operator username)
|
|
125
|
+
- **Initiator Password** (API operator password)
|
|
126
|
+
- **Security Credential** (Encrypted password)
|
|
127
|
+
|
|
128
|
+
### 3. Production Setup
|
|
129
|
+
|
|
130
|
+
For production deployment:
|
|
131
|
+
|
|
132
|
+
1. **Get Paybill/Till Number** from Safaricom
|
|
133
|
+
2. **Generate Security Credential** using Safaricom's public certificate
|
|
134
|
+
3. **Switch environment** to `"production"` in your client initialization
|
|
135
|
+
4. **Update callback URLs** to your production domain
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
### Security Best Practices
|
|
140
|
+
|
|
141
|
+
1. **Never commit credentials** to version control
|
|
142
|
+
2. **Use environment variables** for sensitive data
|
|
143
|
+
3. **Implement webhook validation** for callbacks
|
|
144
|
+
4. **Log transactions** for audit trails
|
|
145
|
+
5. **Monitor rate limits** and implement backoff strategies
|
|
146
|
+
6. **Use HTTPS** for all callback URLs
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 🤝 Contributing
|
|
151
|
+
|
|
152
|
+
We welcome contributions from the community! Here's how you can help:
|
|
153
|
+
|
|
154
|
+
### Ways to Contribute
|
|
155
|
+
|
|
156
|
+
- 🐛 **Report bugs** via GitHub Issues
|
|
157
|
+
- 💡 **Suggest features** for the roadmap
|
|
158
|
+
- 📖 **Improve documentation** and examples
|
|
159
|
+
- 🔧 **Submit pull requests** with fixes/features
|
|
160
|
+
- ⭐ **Star the repo** to show support
|
|
161
|
+
|
|
162
|
+
### Development Setup
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# Clone the repository
|
|
166
|
+
git clone https://github.com/rafaeljohn9/mpesa-daraja-sdk.git
|
|
167
|
+
cd mpesa-daraja-sdk
|
|
168
|
+
|
|
169
|
+
# Create virtual environment
|
|
170
|
+
python -m venv venv
|
|
171
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
172
|
+
|
|
173
|
+
# Install in development mode
|
|
174
|
+
pip install -e ".[dev]"
|
|
175
|
+
|
|
176
|
+
# Run tests
|
|
177
|
+
pytest tests/
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Code Standards
|
|
181
|
+
|
|
182
|
+
- Follow PEP 8 style guidelines
|
|
183
|
+
- Include type hints where appropriate
|
|
184
|
+
- Write comprehensive tests for new features
|
|
185
|
+
- Update documentation for any API changes
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## 📞 Support & Community
|
|
190
|
+
|
|
191
|
+
- 📖 **Documentation**: [Full API docs coming soon]
|
|
192
|
+
- 🐛 **Issues**: [GitHub Issues](https://github.com/rafaeljohn9/mpesa-daraja-sdk/issues)
|
|
193
|
+
- 💬 **Discussions**: [GitHub Discussions](https://github.com/rafaeljohn9/mpesa-daraja-sdk/discussions)
|
|
194
|
+
- 📧 **Email**: <johnmkagunda@gmail.com>
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## 🙏 Attribution & Thanks
|
|
199
|
+
|
|
200
|
+
This project began as a fork of the fantastic [`Arlus/mpesa-py`](https://github.com/Arlus/mpesa-py) by [@Arlus](https://github.com/Arlus).
|
|
201
|
+
|
|
202
|
+
**What we've added:**
|
|
203
|
+
|
|
204
|
+
- 🏗️ **Modular architecture** for better maintainability
|
|
205
|
+
- 🎯 **Developer-first design** with intuitive APIs
|
|
206
|
+
- 🧪 **Comprehensive testing** suite
|
|
207
|
+
- 📚 **Better documentation** and examples
|
|
208
|
+
- 🚀 **Production-ready** features and error handling
|
|
209
|
+
|
|
210
|
+
Special thanks to the original contributors and the broader Python community in Kenya.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## 📄 License
|
|
215
|
+
|
|
216
|
+
Licensed under the [Apache 2.0 License](LICENSE) — free for commercial and private use.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
<div align="center">
|
|
221
|
+
|
|
222
|
+
**Made with ❤️ for the Kenyan developer community**
|
|
223
|
+
|
|
224
|
+
[⭐ Star this repo](https://github.com/rafaeljohn9/mpesa-daraja-sdk) | [🐛 Report Issue](https://github.com/rafaeljohn9/mpesa-daraja-sdk/issues) | [💡 Request Feature](https://github.com/rafaeljohn9/mpesa-daraja-sdk/issues/new)
|
|
225
|
+
|
|
226
|
+
</div>
|
mpesakit-0.1.2/README.md
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# mpesa-daraja-sdk
|
|
2
|
+
|
|
3
|
+
> ⚡ **Effortless M-Pesa integration** using Safaricom's Daraja API — built for developers, by developers.
|
|
4
|
+
|
|
5
|
+
[](https://www.python.org/downloads/)
|
|
6
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
7
|
+
<!-- []() -->
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## The Problem
|
|
12
|
+
|
|
13
|
+
Integrating Safaricom's **M-Pesa Daraja API** directly is **notoriously complex**:
|
|
14
|
+
|
|
15
|
+
- Confusing and inconsistent documentation
|
|
16
|
+
- Manual handling of OAuth2 tokens and security credentials
|
|
17
|
+
- Complex encryption and certificate management
|
|
18
|
+
- Different endpoints for sandbox vs production environments
|
|
19
|
+
- STK Push, C2B, B2C, balance — all feel like separate APIs
|
|
20
|
+
- Time-consuming setup that delays your time-to-market
|
|
21
|
+
|
|
22
|
+
For many developers and startups, this becomes a **huge barrier** to adopting M-Pesa payments in Kenya and beyond.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## The Solution
|
|
27
|
+
|
|
28
|
+
**`mpesa-daraja-sdk`** eliminates the complexity with a **clean, developer-friendly Python SDK** that:
|
|
29
|
+
|
|
30
|
+
- **Zero-config setup** — just add your credentials and go
|
|
31
|
+
- **Handles authentication automatically** — OAuth2, tokens, and security
|
|
32
|
+
- **Seamless environment switching** — sandbox ↔ production with one parameter
|
|
33
|
+
- **Pythonic interface** — clean methods that feel natural to Python developers
|
|
34
|
+
- **Batteries included** — everything you need for M-Pesa integration
|
|
35
|
+
- **Production-ready** — end goal is to be used by startups and enterprises across Kenya
|
|
36
|
+
|
|
37
|
+
### Supported Features
|
|
38
|
+
|
|
39
|
+
| Feature | Status | Description |
|
|
40
|
+
|---------|--------|-------------|
|
|
41
|
+
| **STK Push** | Ready | Lipa na M-Pesa Online payments |
|
|
42
|
+
| **C2B Payments** | Ready | Customer to Business transactions |
|
|
43
|
+
| **B2C Payments** | Ready | Business to Customer payouts |
|
|
44
|
+
| **Token Management** | Ready | Automatic OAuth2 handling |
|
|
45
|
+
| **Account Balance** | Coming Soon | Check account balances |
|
|
46
|
+
| **Transaction Reversal** | Coming Soon | Reverse transactions |
|
|
47
|
+
| 🎣 **Webhook Validation** | Coming Soon | Secure callback handling |
|
|
48
|
+
|
|
49
|
+
> Built on top of [Arlus/mpesa-py](https://github.com/Arlus/mpesa-py) with ❤️ — modernized, cleaned up, and restructured for today's developer needs.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Quick Start
|
|
54
|
+
|
|
55
|
+
### Installation (coming soon)
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install mpesa-daraja-sdk
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 📖 Complete Setup Guide
|
|
64
|
+
|
|
65
|
+
### 1. Get Safaricom Developer Account
|
|
66
|
+
|
|
67
|
+
1. Visit [developer.safaricom.co.ke](https://developer.safaricom.co.ke)
|
|
68
|
+
2. **Create account** and verify your email
|
|
69
|
+
3. **Create a new app** to get your credentials:
|
|
70
|
+
- Consumer Key
|
|
71
|
+
- Consumer Secret
|
|
72
|
+
|
|
73
|
+
### 2. Obtain Test Credentials (Sandbox)
|
|
74
|
+
|
|
75
|
+
1. Navigate to [Test Credentials Page](https://developer.safaricom.co.ke/test_credentials)
|
|
76
|
+
2. Copy the following credentials:
|
|
77
|
+
- **Shortcode** (Business number)
|
|
78
|
+
- **Initiator Name** (API operator username)
|
|
79
|
+
- **Initiator Password** (API operator password)
|
|
80
|
+
- **Security Credential** (Encrypted password)
|
|
81
|
+
|
|
82
|
+
### 3. Production Setup
|
|
83
|
+
|
|
84
|
+
For production deployment:
|
|
85
|
+
|
|
86
|
+
1. **Get Paybill/Till Number** from Safaricom
|
|
87
|
+
2. **Generate Security Credential** using Safaricom's public certificate
|
|
88
|
+
3. **Switch environment** to `"production"` in your client initialization
|
|
89
|
+
4. **Update callback URLs** to your production domain
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
### Security Best Practices
|
|
94
|
+
|
|
95
|
+
1. **Never commit credentials** to version control
|
|
96
|
+
2. **Use environment variables** for sensitive data
|
|
97
|
+
3. **Implement webhook validation** for callbacks
|
|
98
|
+
4. **Log transactions** for audit trails
|
|
99
|
+
5. **Monitor rate limits** and implement backoff strategies
|
|
100
|
+
6. **Use HTTPS** for all callback URLs
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## 🤝 Contributing
|
|
105
|
+
|
|
106
|
+
We welcome contributions from the community! Here's how you can help:
|
|
107
|
+
|
|
108
|
+
### Ways to Contribute
|
|
109
|
+
|
|
110
|
+
- 🐛 **Report bugs** via GitHub Issues
|
|
111
|
+
- 💡 **Suggest features** for the roadmap
|
|
112
|
+
- 📖 **Improve documentation** and examples
|
|
113
|
+
- 🔧 **Submit pull requests** with fixes/features
|
|
114
|
+
- ⭐ **Star the repo** to show support
|
|
115
|
+
|
|
116
|
+
### Development Setup
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Clone the repository
|
|
120
|
+
git clone https://github.com/rafaeljohn9/mpesa-daraja-sdk.git
|
|
121
|
+
cd mpesa-daraja-sdk
|
|
122
|
+
|
|
123
|
+
# Create virtual environment
|
|
124
|
+
python -m venv venv
|
|
125
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
126
|
+
|
|
127
|
+
# Install in development mode
|
|
128
|
+
pip install -e ".[dev]"
|
|
129
|
+
|
|
130
|
+
# Run tests
|
|
131
|
+
pytest tests/
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Code Standards
|
|
135
|
+
|
|
136
|
+
- Follow PEP 8 style guidelines
|
|
137
|
+
- Include type hints where appropriate
|
|
138
|
+
- Write comprehensive tests for new features
|
|
139
|
+
- Update documentation for any API changes
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## 📞 Support & Community
|
|
144
|
+
|
|
145
|
+
- 📖 **Documentation**: [Full API docs coming soon]
|
|
146
|
+
- 🐛 **Issues**: [GitHub Issues](https://github.com/rafaeljohn9/mpesa-daraja-sdk/issues)
|
|
147
|
+
- 💬 **Discussions**: [GitHub Discussions](https://github.com/rafaeljohn9/mpesa-daraja-sdk/discussions)
|
|
148
|
+
- 📧 **Email**: <johnmkagunda@gmail.com>
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 🙏 Attribution & Thanks
|
|
153
|
+
|
|
154
|
+
This project began as a fork of the fantastic [`Arlus/mpesa-py`](https://github.com/Arlus/mpesa-py) by [@Arlus](https://github.com/Arlus).
|
|
155
|
+
|
|
156
|
+
**What we've added:**
|
|
157
|
+
|
|
158
|
+
- 🏗️ **Modular architecture** for better maintainability
|
|
159
|
+
- 🎯 **Developer-first design** with intuitive APIs
|
|
160
|
+
- 🧪 **Comprehensive testing** suite
|
|
161
|
+
- 📚 **Better documentation** and examples
|
|
162
|
+
- 🚀 **Production-ready** features and error handling
|
|
163
|
+
|
|
164
|
+
Special thanks to the original contributors and the broader Python community in Kenya.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## 📄 License
|
|
169
|
+
|
|
170
|
+
Licensed under the [Apache 2.0 License](LICENSE) — free for commercial and private use.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
<div align="center">
|
|
175
|
+
|
|
176
|
+
**Made with ❤️ for the Kenyan developer community**
|
|
177
|
+
|
|
178
|
+
[⭐ Star this repo](https://github.com/rafaeljohn9/mpesa-daraja-sdk) | [🐛 Report Issue](https://github.com/rafaeljohn9/mpesa-daraja-sdk/issues) | [💡 Request Feature](https://github.com/rafaeljohn9/mpesa-daraja-sdk/issues/new)
|
|
179
|
+
|
|
180
|
+
</div>
|