Skip to content

Commit

Permalink
Merge branch 'master' of github.com:sparkplug/momoapi-java
Browse files Browse the repository at this point in the history
  • Loading branch information
mossplix committed May 7, 2019
2 parents 162ac69 + f0a0398 commit 8358a30
Show file tree
Hide file tree
Showing 4 changed files with 208 additions and 20 deletions.
7 changes: 7 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Authors
=======

* Moses Mugisha
* Ray Besiga

For [Sparkplug](http://sparkpl.ug)
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

Changelog
=========

0.1.0 (2018-10-29)
------------------

* First release on Maven
177 changes: 177 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
# Contributing

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!

## Where do I go from here?

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-java/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-java/issues/new/choose)!



## Fork & create a branch

If there is something you think you can fix, then fork the [repo](https://github.com/sparkplug/momoapi-java) and create a branch with a descriptive name.

A good branch name would be (where issue #32 is the ticket you're working on):

```sh
git checkout -b 32-add-swahili-translations
```

## Get the test suite running

This library has a comprehensive test suite, which can be run using the `tox` command:

To view all test environments

```sh
$ ./gradlew test
```

## Bugs and Fixes

### Did you find a bug?

* **Ensure the bug was not already reported** by [searching all issues](https://github.com/sparkplug/momoapi-java/issues).

* If you're unable to find an open issue addressing the problem,
[open a new one](https://github.com/sparkplug/momoapi-java/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 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**

### Implement your fix or feature

At this point, you're ready to make your changes! Feel free to ask for help;
everyone is a beginner at first :smile_cat:

If you are proposing a feature:

* 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 :)

If you would like to send us feedback, simply [file an issue](https://github.com/sparkplug/momoapi-python/issues/new/choose).

## Local Development

To set up `momoapi-java` 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-java.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

### 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-java`'s master branch:

```sh
git remote add upstream https://github.com/sparkplug/momoapi-java.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-java
git rebase momoapi-java/master
# If the release is 2.1.x then this should be: 2-1-stable
git checkout -b N-N-stable
git push momoapi-java 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.
2. Update documentation where necessary.
3. Note changes to `CHANGELOG.md`.
4. Add yourself to `AUTHORS.md`.

## Improvements

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.

36 changes: 16 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# MomoAPI Java Bindings
# MTN MoMo API Java Client</h1>

<strong>Power your apps with our MTN MoMo API</strong>

<div>
Join our active, engaged community: <br>
<a href="https://momodeveloper.mtn.com/">Website</a>
<span> | </span>
<a href="https://spectrum.chat/momo-api-developers/">Spectrum</a>
<br><br>
</div>

You can sign up for a MOMOAPI account at https://https://momodeveloper.mtn.com

[![Build Status](https://travis-ci.com/sparkplug/momoapi-java.svg?branch=master)](https://travis-ci.com/sparkplug/momoapi-java)
[![Coverage Status](https://coveralls.io/repos/github/sparkplug/momoapi-java/badge.svg?branch=master)](https://coveralls.io/github/sparkplug/momoapi-java?branch=master)
Expand Down Expand Up @@ -73,19 +82,10 @@ but can be overidden using the RequestOpts builder

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.



The full list of configuration options can be seen in the example below:


You will only need to configure the variables for the product(s) you will be using.


### Per-request Configuration




``` java

RequestOptions opts = RequestOptions.builder()
Expand All @@ -99,12 +99,10 @@ You will only need to configure the variables for the product(s) you will be usi

```

## Usage


## Collections

The collections client can be created with the following paramaters. Note that the `COLLECTION_USER_ID` and `COLLECTION_API_SECRET` for production are provided on the MTN OVA dashboard;
The collections client can be created with the following paramaters. Note that the `COLLECTION_USER_ID` and `COLLECTION_API_SECRET` for production are provided on the MTN OVA dashboard.

* `COLLECTION_PRIMARY_KEY`: Primary Key for the `Collection` product on the developer portal.
* `COLLECTION_USER_ID`: For sandbox, use the one generated with the `mtnmomo` command.
Expand Down Expand Up @@ -150,7 +148,6 @@ public class MomoCollectionsExample {
}
```


### Methods

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`.
Expand Down Expand Up @@ -224,18 +221,17 @@ public class MomoDisbursementsExample {



## Development
## Development

You must have Gradle installed. To run the tests:

```bash
./gradlew test

```

The library uses [Project Lombok][lombok]. While it is not a requirement, you might want to install a [plugin][lombok-plugins] for your favorite IDE to facilitate development.

[lombok]: https://projectlombok.org
[lombok-plugins]: https://projectlombok.org/setup/overview

<!--
# vim: set tw=79:
-->
# Thank you.

0 comments on commit 8358a30

Please sign in to comment.