forked from c12i/mpesa-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'collinsmuriuki:master' into master
- Loading branch information
Showing
72 changed files
with
5,993 additions
and
1,671 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
[build] | ||
rustdoc = "rustdoc" | ||
|
||
[profile.release] | ||
lto = "fat" | ||
debug = 1 | ||
codegen-units = 1 | ||
rustdoc = "rustdoc" | ||
|
||
[alias] | ||
t = ["test", "--all-features", "--no-fail-fast"] | ||
t = ["test", "--all-features", "--no-fail-fast"] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,3 +74,4 @@ jobs: | |
uses: actions-rs/[email protected] | ||
with: | ||
args: '--ignore-tests --no-fail-fast' | ||
version: '0.22.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,4 @@ | |
/.idea | ||
Cargo.lock | ||
.env | ||
.DS_Store | ||
main.rs | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
fail_fast: true | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.0.1 | ||
hooks: | ||
- id: check-toml | ||
|
||
- repo: local | ||
hooks: | ||
- id: run-cargo-fmt | ||
name: Cargo fmt | ||
entry: /bin/bash -c "cargo fmt --all -- --check" | ||
language: script | ||
files: ^.*\.rs$ | ||
always_run: true | ||
- id: run-cargo-clippy | ||
name: Cargo clippy | ||
entry: /bin/bash -c "cargo clippy -- -D warnings" | ||
language: script | ||
files: ^.*\.rs$ | ||
always_run: true | ||
- id: run-cargo-test | ||
name: Cargo test | ||
entry: /bin/bash -c "cargo test --no-fail-fast" | ||
language: script | ||
files: ^.*\.rs$ | ||
always_run: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"cSpell.words": [ | ||
"Mpesa" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,5 @@ | ||
# Contributing guide | ||
# How to Contribute | ||
|
||
> Instructions for local project setup and contribution. | ||
## Rust | ||
|
||
You will need Rust installed to run this project. You can find a guide to install on any os [here](https://www.rust-lang.org/tools/install) | ||
|
||
## Install | ||
|
||
```sh | ||
git clone https://github.com/collinsmuriuki/mpesa-rust.git | ||
cd mpesa-rust | ||
``` | ||
|
||
## App Keys | ||
Copy your safaricom credentials to an `.env` file in the root of the project, check `.env.example` for reference or simply run. | ||
|
||
See [here](https://developer.safaricom.co.ke/docs#developer-sign-up) if you need to acquire app keys. | ||
```sh | ||
echo CLIENT_KEY="<your_client_key>" >> .env | ||
echo CLIENT_SECRET="<your_client_secret>" >> .env | ||
``` | ||
|
||
## Test Credentials | ||
You can get test credentials [here](https://developer.safaricom.co.ke/test_credentials) | ||
|
||
## Run tests | ||
|
||
```sh | ||
cargo test | ||
``` | ||
|
||
## RoadMap | ||
|
||
- [x] Create Mpesa Client struct | ||
- [x] Implement Auth | ||
- [x] Error handling | ||
- [x] Generate security credentials | ||
- [x] Implement B2C payment | ||
- [x] Implement B2B payment | ||
- [x] Query transaction status | ||
- [x] Simulate C2B Payment | ||
- [ ] Query status of Lipa na M-Pesa | ||
- [x] Initiate Lipa na M-Pesa online w/ STK push | ||
- [x] Register C2B Confirmation and Validation URLs | ||
- [x] Integration tests | ||
- [ ] Rewrite in async | ||
- [x] Publish on https://crates.io | ||
- [x] Setup travis-ci | ||
- [ ] Improve documentation | ||
|
||
|
||
## Pull Requests | ||
|
||
Fork the repo and create a feature branch. Push your changes and make a PR. | ||
- Create an issue or pick an already existing issue. Please avoid creating duplicate issues | ||
- Fork the repo, add your changes and make a pull request | ||
- Request for review from either me or other contributors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,56 @@ | ||
[workspace] | ||
members = ["mpesa_derive", "mpesa_core"] | ||
[package] | ||
name = "mpesa" | ||
version = "1.1.0" | ||
authors = ["Collins Muriuki <[email protected]>"] | ||
edition = "2021" | ||
description = "A wrapper around the M-PESA API in Rust." | ||
keywords = ["api", "mpesa", "mobile"] | ||
repository = "https://github.com/collinsmuriuki/mpesa-rust" | ||
readme = "./README.md" | ||
license = "MIT" | ||
|
||
[dependencies] | ||
cached = { version = "0.46", features = ["wasm", "async", "proc_macro"] } | ||
chrono = { version = "0.4", optional = true, default-features = false, features = [ | ||
"clock", | ||
"serde", | ||
] } | ||
openssl = { version = "0.10", optional = true } | ||
reqwest = { version = "0.11", features = ["json"] } | ||
derive_builder = "0.12" | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_json = "1.0" | ||
serde_repr = "0.1" | ||
thiserror = "1.0.37" | ||
wiremock = "0.5" | ||
secrecy = "0.8.0" | ||
serde-aux = "4.2.0" | ||
|
||
[dev-dependencies] | ||
dotenv = "0.15" | ||
tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros"] } | ||
wiremock = "0.5" | ||
|
||
[features] | ||
default = [ | ||
"account_balance", | ||
"b2b", | ||
"b2c", | ||
"bill_manager", | ||
"c2b_register", | ||
"c2b_simulate", | ||
"express_request", | ||
"transaction_reversal", | ||
"transaction_status", | ||
"dynamic_qr" | ||
] | ||
dynamic_qr = [] | ||
account_balance = ["dep:openssl"] | ||
b2b = ["dep:openssl"] | ||
b2c = ["dep:openssl"] | ||
bill_manager = ["dep:chrono"] | ||
c2b_register = [] | ||
c2b_simulate = [] | ||
express_request = ["dep:chrono"] | ||
transaction_reversal = ["dep:openssl"] | ||
transaction_status = ["dep:openssl"] |
Oops, something went wrong.