Skip to content

Commit

Permalink
Copying the necessary parts from ex_pesa to ex_jenga!
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Ullrich authored and Peter Ullrich committed May 24, 2021
0 parents commit d6e7e87
Show file tree
Hide file tree
Showing 50 changed files with 2,440 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea for this project
title: 'Feature Request: '
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Work Involved**
What would would need to be done to deliver this?

**Definition of Done**
A clear and concise description of what done would look like for this issue

**Additional context**
Add any other context or screenshots about the feature request here.
34 changes: 34 additions & 0 deletions .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Elixir Coveralls

on:
push:
branches:
- develop
- main
pull_request:
branches:
- main
- develop

jobs:
coveralls-coverage:

runs-on: ubuntu-latest
env:
MIX_ENV: test
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- name: Create dev file
run: mv config/dev.sample.exs config/dev.exs
- name: Setup elixir
uses: actions/setup-elixir@v1
with:
elixir-version: '1.12.0'
otp-version: '24'
experimental-otp: true
- name: Install Dependencies
run: mix deps.get
- name: Coverals Coverage
run: mix coveralls.github
39 changes: 39 additions & 0 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Elixir CI

on:
push:
branches:
- develop
- main
pull_request:
branches:
- main
- develop

jobs:
check-lint-and-test:

runs-on: ubuntu-latest
strategy:
matrix:
otp: [24]
elixir: [1.11.2, 1.12.0]

steps:
- uses: actions/checkout@v2
- name: Create dev file
run: mv config/dev.sample.exs config/dev.exs
- name: Setup elixir
uses: actions/setup-elixir@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
experimental-otp: true
- name: Install Dependencies
run: mix deps.get
- name: Run Tests
run: mix test
- name: Check formatting
run: mix format --check-formatted
- name: Checking compile warnings
run: mix compile --warnings-as-errors --force
13 changes: 13 additions & 0 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Greetings

on: [pull_request_target, issues]

jobs:
greeting:
runs-on: ubuntu-latest
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Thank you @${{ github.actor }} for your issue! We are glad you contributed!"
pr-message: "Thank you @${{ github.actor }} for your first pull Request!"
16 changes: 16 additions & 0 deletions .github/workflows/hex-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on:
push:
tags:
- '*'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v2

- name: Publish to Hex.pm
uses: erlangpack/github-action@v1
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# The directory Mix will write compiled artifacts to.
/_build/

# If you run "mix test --cover", coverage assets end up here.
/cover/

# The directory Mix downloads your dependencies sources to.
/deps/

# Where third-party dependencies like ExDoc output generated docs.
/doc/

# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch

# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump

# Also ignore archive artifacts (built via "mix archive.build").
*.ez

# Ignore package tarball (built via "mix hex.build").
ex_jenga-*.tar

config/dev.exs
/.vscode
/.DS_Store
94 changes: 94 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<p align="left"><img src="assets/logo.png" width="140"></p>

[![Actions Status](https://github.com/beamkenya/ex_jenga/workflows/Elixir%20CI/badge.svg)](https://github.com/beamkenya/ex_jenga/actions) ![Hex.pm](https://img.shields.io/hexpm/v/ex_jenga) ![Hex.pm](https://img.shields.io/hexpm/dt/ex_jenga) [![Coverage Status](https://coveralls.io/repos/github/beamkenya/ex_jenga/badge.svg?branch=develop)](https://coveralls.io/github/beamkenya/ex_jenga?branch=develop)

# ExJenga :dollar: :pound: :yen: :euro:

> Payment Library for Equity Bank's Jenga API in Kenya. Let us get this :moneybag:
## Table of contents

- [Features](#features)
- [Installation](#installation)
- [Configuration](#configuration)
- [Documentation](#documentation)
- [Contribution](#contribution)
- [Contributors](#contributors)
- [Licence](#licence)

## Features

- [x] Jenga(Equity)
- [ ] Send Money
- [ ] Send Money Queries
- [ ] Receive Money
- [ ] Receive Money Queries
- [ ] Buy Goods, Pay Bills, Get Airtime
- [ ] Airtime
- [ ] Reg Tech: KYC, AML, & CDD API
- [ ] Account Services
- [ ] Forex Rates

## Installation

If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `ex_jenga` to your list of dependencies in `mix.exs`:

```elixir
def deps do
[
{:ex_jenga, "~> 0.1.0"}
]
end
```

## Configuration

Create a copy of `config/dev.exs` or `config/prod.exs` from `config/dev.sample.exs`
Use the `sandbox` key to `true` when you are using sandbox credentials, chnage to `false` when going to `:prod`

### Jenga API (Equity)

Jenga API link: https://developer.jengaapi.io

Add below config to dev.exs / prod.exs files. <br>
This asumes you have a clear understanding of how [Jenga API works](https://developer.jengaapi.io/reference). <br>

Read more about how the token is generted here: https://developer.jengaapi.io/docs/developer-quickstart . <br>
The `private_key` is used to generate the `signature`. READ More: https://developer.jengaapi.io/docs/generating-signatures .

```elixir
config :ex_jenga,
jenga: [
api_key: "=======API KEY HERE ========",
username: "=====USERNAME HERE=====",
password: "=======PASSWORD HERE =======",
private_key: "=======PRIVATE KEY HERE ======="
]
```

## Documentation

The docs can be found at [https://hexdocs.pm/ex_jenga](https://hexdocs.pm/ex_jenga).

## Contribution

If you'd like to contribute, start by searching through the [issues](https://github.com/beamkenya/ex_jenga/issues) and [pull requests](https://github.com/beamkenya/ex_jenga/pulls) to see whether someone else has raised a similar idea or question.
If you don't see your idea listed, [Open an issue](https://github.com/beamkenya/ex_jenga/issues).

Check the [Contribution guide](contributing.md) on how to contribute.

## Contributors

Auto-populated from:
[contributors-img](https://contributors-img.firebaseapp.com/image?repo=beamkenya/ex_jenga)

<a href="https://github.com/beamkenya/ex_jenga/graphs/contributors">
<img src="https://contributors-img.firebaseapp.com/image?repo=beamkenya/ex_jenga" />
</a>

## Licence

ExJenga is released under [MIT License](https://github.com/appcues/exsentry/blob/master/LICENSE.txt)

[![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=for-the-badge)](#)
5 changes: 5 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config

import_config "#{Mix.env()}.exs"
12 changes: 12 additions & 0 deletions config/dev.sample.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use Mix.Config
config :tesla, adapter: Tesla.Adapter.Hackney

config :ex_jenga,
# When changed to "false" one will use the live endpoint url
sandbox: true,
jenga: [
api_key: "=======API KEY HERE ========",
username: "=====USERNAME HERE=====",
password: "=======PASSWORD HERE =======",
private_key: "=======PRIVATE KEY HERE ======="
]
46 changes: 46 additions & 0 deletions config/test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
use Mix.Config
config :tesla, adapter: Tesla.Mock

config :ex_jenga,
sandbox: true,
jenga: [
api_key: "N2RJd0FvTjB3TWVSR0ZUQUdHQkRVNG1sRHF4b1g2OWU6ejNUYzRoZmdhOEFmZ2hh",
username: "00860091",
password: "cE70aUkn6fzwhBLWpZXcuWa2tSjHq",
private_key: "-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAoOFMXt5HYwoEzj8YURznYrKDoLSDGsp6kd9UmBOsg84UKt/z
BJUvlg/Y7v86l0bd9TMjPiVoQE7DoIJpG8xgX8BX837/cgpt3o7UGqOXNu9plEoo
bSc+SACMtLu6+9tve7aTigaO8bSs6EplBYI6Ol0JFoeKlE8CEZ02J0XafumpObiE
03kCqrEwxeb2QWybfKh0evAweqUi1vlMncDE0X2dqOsQY/zQEWJRxGR8WW9ziudT
w01x434EWHirTju/GPKdT/aLa6Ki5dXGHZLojiF+qbUfKg1Og8fw25yU8hKJSxR+
039mD15vQKIrG8TXMK+t5/f9hbXaPwey5NXrEwIDAQABAoIBAHLyJmfN90FrAh3+
dLhXp3ccRvHGp7m3m7Wn1MBHpkYSMtSjZ/YJRZO5RO0WDN3TM3kjDXY0sfTokduX
8dN7xgwD2JNQVOE9VFzkveU+pycIDe52wcWjeVtmkSH8089pbJD+1RGUOAO4bKYX
qXAzKLlUic7ADyKCBN9i7TNINKHh3Ne7v+Y7pmF+uWzn2zS3r3zAm5Z6hO7K7bSP
CwlB0KlFK2tZU8r53kWjopwAFXmTB8BvsoqA0htoDLEB3M+5+1Rn0bA1QR7TSub4
kKqHROgbWg1ijYGG85ZV8t7spisBDOA+rZzpmW5bE6yn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MjPiVoQE7DoIJpG8xg
X8BX837/cgpt3o7UGqOXNu9plEoobSc+SACMtLu6+9tve7aTigaO8bSs6EplBYI6
Ol0JFoeKlE8CEZ02J0XafumpObiE03kCqrEwxeb2QWybfKh0evAweqUi1vlMncDE
0X2dqOsQY/zQEWJRxGR8WW9ziudTw01x434EWHirTju/GPKdT/aLa6Ki5dXGHZLo
jiF+qbUfKg1Og8fw25yU8hKJSxR+039mD15vQKIrG8TXMK+t5/f9hbXaPwey5NXr
EwIDAQAB
-----END PUBLIC KEY-----"
]
26 changes: 26 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Guide

If you don't see your idea listed, and you think it fits into the goals of this library, do the following:

0. Find an issue that you are interested in addressing or a feature that you would like to add.
1. Fork the repository associated with the issue to your local GitHub organization. This means that you will have a copy of the repository under `your-GitHub-username/repository-name`.
2. Clone the repository to your local machine using `git clone https://github.com/beamkenya/ex_jenga.git`
3. Create a new branch for your fix using `git checkout -b your-branch-name-here`.
4. Make the appropriate changes for the issue you are trying to address or the feature that you want to add.
5. Use `git add insert-paths-of-changed-files-here` to add the file contents of the changed files to the "snapshot" git uses to manage the state of the project, also known as the index.
6. Use `git commit -m "Insert a short message of the changes made here"` to store the contents of the index with a descriptive message.
7. Push the changes to the remote repository using `git push origin your-branch-name-here`.
8. Submit a pull request to the upstream repository.
9. Title the pull request with a short description of the changes made and the issue or bug number associated with your change. For example, you can title an issue like so "Added more log outputting to resolve #4352".
10. In the description of the pull request, explain the changes that you made, any issues you think exist with the pull request you made, and any questions you have for the maintainers. It's OK if your pull request is not perfect (no pull request is), the reviewer will be able to help you fix any problems and improve it!
11. Wait for the pull request to be reviewed by a maintainer.
12. Make changes to the pull request if the reviewing maintainer recommends them.
13. Celebrate your success after your pull request is merged!

## Testing

Make sure you write tests to any `module` or `function` you add. Also add `doctests`

## Style guide

Ensure you run `mix format` to format the code to the best standards and limit failure when the CI runs.
Empty file added lib/ex_jenga.ex
Empty file.
Loading

0 comments on commit d6e7e87

Please sign in to comment.