From d1fc87b8dba5789d5811f69d71a7331cbdf23fa5 Mon Sep 17 00:00:00 2001 From: Ray Besiga Date: Thu, 28 Mar 2019 12:19:57 +0300 Subject: [PATCH 01/14] Move testing documentation to contributing guide --- README.md | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/README.md b/README.md index 4ce45fc..2db2bc6 100644 --- a/README.md +++ b/README.md @@ -164,25 +164,4 @@ client.transfer(amount="600", mobile="256772123456", external_id="123456789", pa ``` -# Unit Tests - -This library has a comprehensive test suite, which can be run using the `tox` command: - -## to view all test environments - -```bash -$ tox -l -``` -## to run the tests for Python 2.7 - -```bash -$ tox -e py27-cover -``` - -## to run the tests for Python 3.4 - -```bash -$ tox -e py34-cover -``` - Thank you. From 9a933f79ff8da8cd8f2b4fc908de4d9145a5f7d0 Mon Sep 17 00:00:00 2001 From: Ray Besiga Date: Thu, 28 Mar 2019 12:20:17 +0300 Subject: [PATCH 02/14] Add me to authors --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index 71ef76b..0da110b 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -3,3 +3,4 @@ Authors ======= * Moses Mugisha - http://sparkpl.ug +* Ray Besiga \ No newline at end of file From f22242ac96dd4b3d99f1b65d3272a5980568dfbd Mon Sep 17 00:00:00 2001 From: Ray Besiga Date: Thu, 28 Mar 2019 12:20:43 +0300 Subject: [PATCH 03/14] Add resources file for future articles and links --- RESOURCES.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 RESOURCES.md diff --git a/RESOURCES.md b/RESOURCES.md new file mode 100644 index 0000000..e2899d7 --- /dev/null +++ b/RESOURCES.md @@ -0,0 +1,11 @@ +# Resources + +Here, we keep a list of resources for use of the library + +## Official Docs + +* [Developer Portal](https://momodeveloper.mtn.com/api-documentation) + +## Articles + + From c10d1af23869d774ec6a79541aaf818eab53f3b1 Mon Sep 17 00:00:00 2001 From: Ray Besiga Date: Thu, 28 Mar 2019 12:21:35 +0300 Subject: [PATCH 04/14] Update contributing guide --- CONTRIBUTING.md | 154 ++++++++++++++++++++++++++++++------------------ 1 file changed, 97 insertions(+), 57 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 28de1ce..35792d5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,90 +1,130 @@ -============ -Contributing -============ +# Contributing -Contributions are welcome, and they are greatly appreciated! Every -little bit helps, and credit will always be given. +First off, thank you for considering contributing to this Python MTN MoMo Library. It's people like you that make it such a great tool. Contributions are welcome, and they are greatly appreciated! -Bug reports -=========== +## Where do I go from here? -When `reporting a bug `_ please include: +If you've noticed a bug or have a question that doesn't belong on the +[Spectrum](https://spectrum.chat/momo-api-developers/) or [Stack Overflow](https://stackoverflow.com/), [search the issue tracker](https://github.com/sparkplug/momoapi-python/issues) to see if +someone else in the community has already created a ticket. If not, go ahead and +[make one](https://github.com/sparkplug/momoapi-python/issues/new/choose)! - * Your operating system name and version. - * Any details about your local setup that might be helpful in troubleshooting. - * Detailed steps to reproduce the bug. -Documentation improvements -========================== -momoapi-python could always use more documentation, whether as part of the -official momoapi-python docs, in docstrings, or even on the web in blog posts, -articles, and such. +## Fork & create a branch -Feature requests and feedback -============================= +If there is something you think you can fix, then fork the [repo](https://github.com/sparkplug/momoapi-python) and create a branch with a descriptive name. -The best way to send feedback is to file an issue at https://github.com/mossplix/python-momoapi/issues. +A good branch name would be (where issue #32 is the ticket you're working on): -If you are proposing a feature: +```sh +git checkout -b 32-add-swahili-translations +``` -* Explain in detail how it would work. -* Keep the scope as narrow as possible, to make it easier to implement. -* Remember that this is a volunteer-driven project, and that code contributions are welcome :) +## Get the test suite running -Development -=========== +This library has a comprehensive test suite, which can be run using the `tox` command: -To set up `python-momoapi` for local development: +To view all test environments -1. Fork `python-momoapi `_ - (look for the "Fork" button). -2. Clone your fork locally:: +```sh +$ tox -l +``` +To run the tests for Python 2.7 - git clone git@github.com:your_name_here/python-momoapi.git +```sh +$ tox -e py27-cover +``` -3. Create a branch for local development:: +To run the tests for Python 3.4 - git checkout -b name-of-your-bugfix-or-feature +```sh +$ tox -e py34-cover +``` - Now you can make your changes locally. +To run a subset of tests:: -4. When you're done making changes, run all the checks, doc builder and spell checker with `tox `_ one command:: +```sh +tox -e envname -- pytest -k test_myfeature +``` - tox +To run all the test environments in *parallel*, you need to `pip install detox`: -5. Commit your changes and push your branch to GitHub:: +```sh +detox +``` - git add . - git commit -m "Your detailed description of your changes." - git push origin name-of-your-bugfix-or-feature +### Did you find a bug? -6. Submit a pull request through the GitHub website. +* **Ensure the bug was not already reported** by [searching all issues](https://github.com/sparkplug/momoapi-python/issues). -Pull Request Guidelines ------------------------ +* If you're unable to find an open issue addressing the problem, + [open a new one](https://github.com/sparkplug/momoapi-python/issues/new/choose). Be sure to include a **title and clear + description**, as much relevant information as possible, and a **code sample** + or an **executable test case** demonstrating the expected behavior that is not + occurring. -If you need some code review or feedback while you're developing the code just make the pull request. +* If possible, use the relevant bug report templates to create the issue. + Make the necessary changes to demonstrate the issue, and **paste the content into the + issue description** -For merging, you should: +### Implement your fix or feature -1. Include passing tests (run ``tox``) [1]_. -2. Update documentation when there's new API, functionality etc. -3. Add a note to ``CHANGELOG.rst`` about the changes. -4. Add yourself to ``AUTHORS.rst``. +At this point, you're ready to make your changes! Feel free to ask for help; +everyone is a beginner at first :smile_cat: -.. [1] If you don't have all the necessary python versions available locally you can rely on Travis - it will - `run the tests `_ for each change you add in the pull request. +If you are proposing a feature: - It will be slower though ... +* Explain in detail how it would work. +* Keep the scope as narrow as possible, to make it easier to implement. +* Remember that this is a volunteer-driven project, and that code contributions are welcome :) -Tips ----- +If you would like to send us feedback, simply [file an issue](https://github.com/sparkplug/momoapi-python/issues/new/choose). -To run a subset of tests:: +## Local Development + +To set up `python-momoapi` for local development: + +1. Fork the repo. Look for the "Fork" button in the Github UI. +2. Clone your fork locally: + +```sh +git clone https://github.com/your_name_here/momoapi-python.git +``` + +3. Create a branch for local development: +```sh +git checkout -b name-of-your-bugfix-or-feature +``` + +Now you can make your changes locally. + +4. When you're done making changes, run all the checks, doc builder and spell checker with `tox`. +```sh +tox +``` +Make sure Tox is installed by following the instructions [here](http://tox.readthedocs.io/en/latest/install.html) + +5. Commit your changes and push your branch to GitHub:: + +```sh +git add . +git commit -m "Your detailed description of your changes." +git push origin name-of-your-bugfix-or-feature +``` + +6. Submit a pull request through the GitHub website. + +## Pull Request Guidelines + +Before you make a Pull Request, make sure of the following: + +1. Make sure your tests pass. Run `tox` beforehand. +2. Update documentation where necessary. +3. Note changes to `CHANGELOG.md`. +4. Add yourself to `AUTHORS.md`. - tox -e envname -- pytest -k test_myfeature +## Improvements -To run all the test environments in *parallel* (you need to ``pip install detox``):: +This library could always use more documentation, whether as part of the official docs, in docstrings, or even in blog posts and articles. We look forward to add them to our RESOURCES file. - detox From 8ed6eae218f2883e151d9e796d10261134a4049f Mon Sep 17 00:00:00 2001 From: Ray Besiga Date: Thu, 28 Mar 2019 12:23:52 +0300 Subject: [PATCH 05/14] Add bugs and fixes header --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 35792d5..f3a5c55 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -54,6 +54,8 @@ To run all the test environments in *parallel*, you need to `pip install detox`: detox ``` +## Bugs and Fixes + ### Did you find a bug? * **Ensure the bug was not already reported** by [searching all issues](https://github.com/sparkplug/momoapi-python/issues). From db36b67d7c683471cc23c0e5d2a7456408d8d631 Mon Sep 17 00:00:00 2001 From: Ray Besiga Date: Thu, 28 Mar 2019 12:40:20 +0300 Subject: [PATCH 06/14] Update guide for PR and maintainers --- CONTRIBUTING.md | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f3a5c55..be573c9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -119,6 +119,74 @@ git push origin name-of-your-bugfix-or-feature ## Pull Request Guidelines +### Make a Pull Request + +At this point, you should switch back to your master branch and make sure it's +up to date with `momoapi-python`'s master branch: + +```sh +git remote add upstream https://github.com/sparkplug/momoapi-python.git +git checkout master +git pull upstream master +``` + +Then update your feature branch from your local copy of master, and push it! + +```sh +git checkout 32-add-swahili-translations +git rebase master +git push --set-upstream origin 32-add-swahili-translations +``` + +Finally, go to GitHub and make a Pull Request :D + +TravisCI will run our test suite against all supported Python versions. We care +about quality, so your PR won't be merged until all tests pass. It's unlikely, +but it's possible that your changes pass tests in one Python version but fail in +another. In that case, you'll have to setup your development environment to use your Python version, and investigate what's going on! + +### Keeping your Pull Request updated + +If a maintainer asks you to "rebase" your PR, they're saying that a lot of code has changed, and that you need to update your branch so it's easier to merge. + +To learn more about rebasing in Git, there are a lot of [good](https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase) [resources](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) but here's the suggested workflow: + +```sh +git checkout 32-add-swahili-translations +git pull --rebase upstream master +git push --force-with-lease 32-add-swahili-translations +``` + +### Merging a PR (maintainers only) + +A PR can only be merged into master by a maintainer if: + +* It is passing CI. +* It has been approved by at least one maintainers. If it was a maintainer who opened the PR, only one extra approval is needed. +* It has no requested changes. +* It is up to date with current master. + +Any maintainer is allowed to merge a PR if all of these conditions are met. + +### Shipping a release (maintainers only) + +Maintainers need to do the following to push out a release: + +* Make sure all pull requests are in and that changelog is current +* Update version and changelog with new version number using semver +* If it's not a patch level release, create a stable branch for that release, + otherwise switch to the stable branch corresponding to the patch release you + want to ship: + + ```sh + git checkout master + git fetch momoapi-python + git rebase momoapi-python/master + # If the release is 2.1.x then this should be: 2-1-stable + git checkout -b N-N-stable + git push momoapi-python N-N-stable:N-N-stable + ``` + Before you make a Pull Request, make sure of the following: 1. Make sure your tests pass. Run `tox` beforehand. From 439c65aa6bf538fd006424c91ccb4fbac64d49df Mon Sep 17 00:00:00 2001 From: Ray Besiga Date: Tue, 7 May 2019 12:44:03 +0300 Subject: [PATCH 07/14] Update README --- README.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2db2bc6..3394eb1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,15 @@ -# MTN Mobile Money API Client +# MTN MoMo API Python Client + +Power your apps with our MTN MoMo API + +
+ Join our active, engaged community:
+ Website + | + Spectrum +

+
-MTN MoMo API Client for Python. [![Build Status](https://travis-ci.com/sparkplug/momoapi-python.svg?branch=master)](https://travis-ci.com/sparkplug/momoapi-node) [![Latest Version](https://img.shields.io/pypi/v/tox-travis.svg)](https://badge.fury.io/js/mtn-momo) @@ -8,7 +17,9 @@ MTN MoMo API Client for Python. [![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/momo-api-developers/) -# Installing +# Usage + +## Installation Add the latest version of the library to your project using pip: From 8b93092f03594dfa3012e9d7c73cf7f15e075122 Mon Sep 17 00:00:00 2001 From: Ray Besiga Date: Tue, 7 May 2019 13:07:12 +0300 Subject: [PATCH 08/14] Update Authors --- AUTHORS.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index 0da110b..0343a4e 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -2,5 +2,7 @@ Authors ======= -* Moses Mugisha - http://sparkpl.ug -* Ray Besiga \ No newline at end of file +* Moses Mugisha +* Ray Besiga + +For [Sparkplug](http://sparkpl.ug) \ No newline at end of file From a5fa464e36ff5c34e163722e57ffa1de53acfaac Mon Sep 17 00:00:00 2001 From: Phillip Ahereza Date: Sat, 22 Jun 2019 08:32:06 +0300 Subject: [PATCH 09/14] fixed typo in config.py --- src/mtnmomo/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mtnmomo/config.py b/src/mtnmomo/config.py index 7376814..60c6912 100644 --- a/src/mtnmomo/config.py +++ b/src/mtnmomo/config.py @@ -18,7 +18,7 @@ def __init__(self, conf): REMITTANCE_USER_ID: os.environ.get("REMITTANCE_USER_ID"), REMITTANCE_API_SECRET: os.environ.get("REMITTANCE_API_SECRET"), - REMITTANCE_PRIMARY_KEY: os.envieon.get("REMITTANCE_PRIMARY_KEY") + REMITTANCE_PRIMARY_KEY: os.environ.get("REMITTANCE_PRIMARY_KEY") DISBURSEMENT_USER_ID: os.environ.get("DISBURSEMENT_USER_ID"), DISBURSEMENT_API_SECRET: os.environ.get("DISBURSEMENTS_API_SECRET"), From 9728556bd6beb55b407d4c694dc048bec33ff72c Mon Sep 17 00:00:00 2001 From: okellogabrielinnocent Date: Tue, 10 Sep 2019 13:57:51 +0300 Subject: [PATCH 10/14] update README.md to match implemented function - change getTransaction to getTransactionStatus on readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3394eb1..fc92547 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ client = Collection({ 1. `requestToPay`: This operation is used to request a payment from a consumer (Payer). The payer will be asked to authorize the payment. The transaction is executed once the payer has authorized the payment. The transaction will be in status PENDING until it is authorized or declined by the payer or it is timed out by the system. Status of the transaction can be validated by using `getTransactionStatus`. -2. `getTransaction`: Retrieve transaction information using the `transactionId` returned by `requestToPay`. You can invoke it at intervals until the transaction fails or succeeds. If the transaction has failed, it will throw an appropriate error. +2. `getTransactionStatus`: Retrieve transaction information using the `transactionId` returned by `requestToPay`. You can invoke it at intervals until the transaction fails or succeeds. If the transaction has failed, it will throw an appropriate error. 3. `getBalance`: Get the balance of the account. From 70100d9e280291e98f3d084e1ebf12f9ac4e446c Mon Sep 17 00:00:00 2001 From: arthurarty Date: Tue, 14 Jan 2020 12:09:45 +0300 Subject: [PATCH 11/14] ch(README) - Correct importation in sample code. - Change import for Disbursement class in sample code. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3394eb1..8e192a6 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,7 @@ You can create a disbursements client with the following ```python import os -from mtnmomo.collection import Disbursement +from mtnmomo.disbursement import Disbursement client = Disbursement({ "DISBURSEMENT_USER_ID": os.environ.get("DISBURSEMENT_USER_ID"), @@ -163,7 +163,7 @@ client = Disbursement({ ```python import os -from mtnmomo.collection import Disbursement +from mtnmomo.disbursement import Disbursement client = Disbursement({ "DISBURSEMENT_USER_ID": os.environ.get("DISBURSEMENT_USER_ID"), From c978d594131fb770905d972d97113282d9510c76 Mon Sep 17 00:00:00 2001 From: Kenneth Date: Wed, 27 May 2020 13:28:42 +0300 Subject: [PATCH 12/14] remove print statements --- src/mtnmomo/client.py | 3 --- src/mtnmomo/disbursement.py | 1 - 2 files changed, 4 deletions(-) diff --git a/src/mtnmomo/client.py b/src/mtnmomo/client.py index fdeee8f..2740009 100644 --- a/src/mtnmomo/client.py +++ b/src/mtnmomo/client.py @@ -99,7 +99,6 @@ def request(self, method, url, headers, post_data=None): def interpret_response(self, resp): rcode = resp.status_code rheaders = resp.headers - print(resp) try: rbody = resp.json() @@ -163,7 +162,6 @@ def getTransactionStatus( "Ocp-Apim-Subscription-Key": subscription_key } _url = self.config.baseUrl + url + transaction_id - print(_url) res = self.request("GET", _url, headers) return res.json() @@ -192,5 +190,4 @@ def generateToken( def close(self): if self._session is not None: - print("closing!") self._session.close() diff --git a/src/mtnmomo/disbursement.py b/src/mtnmomo/disbursement.py index 6d71deb..4472b95 100644 --- a/src/mtnmomo/disbursement.py +++ b/src/mtnmomo/disbursement.py @@ -58,6 +58,5 @@ def transfer( if kwargs.get("callback_url"): headers["X-Callback-Url"] = kwargs.get("callback_url") url = super(Disbursement, self).config.baseUrl + "/disbursement/v1_0/transfer" - print(url) self.request("POST", url, headers, data) return {"transaction_ref": ref} From 06e2abd2ef5c4e8377c0337182ea93a3254781dc Mon Sep 17 00:00:00 2001 From: Peter Thaleikis Date: Wed, 25 Nov 2020 16:50:35 +0400 Subject: [PATCH 13/14] Typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 36deeef..1a89e95 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ These are the credentials we shall use for the sandbox environment. In productio Before we can fully utilize the library, we need to specify global configurations. The global configuration must contain the following: * `BASE_URL`: An optional base url to the MTN Momo API. By default the staging base url will be used -* `ENVIRONMENT`: Optional enviroment, either "sandbox" or "production". Default is 'sandbox' +* `ENVIRONMENT`: Optional environment, either "sandbox" or "production". Default is 'sandbox' * `CALLBACK_HOST`: The domain where you webhooks urls are hosted. This is mandatory. Once you have specified the global variables, you can now provide the product-specific variables. Each MoMo API product requires its own authentication details i.e its own `Subscription Key`, `User ID` and `User Secret`, also sometimes refered to as the `API Secret`. As such, we have to configure subscription keys for each product you will be using. From 5914667d6e393d2879315190a1862fa715e9567f Mon Sep 17 00:00:00 2001 From: Ray Besiga Date: Mon, 14 Jul 2025 14:34:56 +0300 Subject: [PATCH 14/14] Update README.md --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1a89e95..5e46eed 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,21 @@ # MTN MoMo API Python Client -Power your apps with our MTN MoMo API + +**🛑 This repository is no longer actively maintained.** + +As of July 14, 2025, this project is no longer under active development. This means: +* No new features will be added. +* Bugs will not be fixed. +* Pull requests will not be reviewed or merged. +* Issues will not be addressed. + +We appreciate your interest and contributions. +**Thank you.** + +
+ +Power your apps with our MTN MoMo API
Join our active, engaged community:
Website