Skip to content

Commit 5ac17da

Browse files
committed
Keep readme and rust docs in sync
1 parent fe2af48 commit 5ac17da

File tree

3 files changed

+21
-372
lines changed

3 files changed

+21
-372
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
# TODO
1+
# How to Contribute
22

3-
- [x] Unify `mpesa_derive` and `mpesa_core`
4-
- [ ] Add missing services: `transaction_status`, `bill_manager`, `dynamic_qr_code`, `c2b_simulate_v2`
5-
- [x] Clean up `Cargo.toml`: Correctly use Cargo features and declare optional and dev dependencies
6-
- [x] Convert library to async and update tests
7-
- [x] Migrate to `thiserror` and remove `failure`
8-
- [ ] Refine tests: test more edge cases
3+
- Create an issue or pick an already existing issue. Please avoid creating duplicate issues
4+
- Fork the repo, add your changes and make a pull request
5+
- Request for review from either me or other contributors

README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ mpesa = { git = "https://github.com/collinsmuriuki/mpesa-rust", default_features
3737

3838
In your lib or binary crate:
3939

40-
```rs
40+
```rust,no_run
4141
use mpesa::Mpesa;
4242
```
4343

@@ -52,7 +52,7 @@ read the docs [here](https://developer.safaricom.co.ke/docs?javascript#going-liv
5252

5353
These are the following ways you can instantiate `Mpesa`:
5454

55-
```rust
55+
```rust,no_run
5656
use mpesa::{Mpesa, Environment};
5757
5858
let client = Mpesa::new(
@@ -67,7 +67,7 @@ assert!(client.is_connected().await)
6767
Since the `Environment` enum implements `FromStr` and `TryFrom` for `String` and `&str` types, you can call `Environment::from_str` or `Environment::try_from` to create an `Environment` type. This is ideal if the environment values are
6868
stored in a `.env` or any other configuration file:
6969

70-
```rust
70+
```rust,no_run
7171
use mpesa::{Mpesa, Environment};
7272
use std::str::FromStr;
7373
use std::convert::TryFrom;
@@ -77,13 +77,13 @@ let client0 = Mpesa::new(
7777
env!("CLIENT_SECRET"),
7878
Environment::from_str("sandbox")? // "Sandbox" and "SANDBOX" also valid
7979
);
80+
assert!(client0.is_connected().await)
8081
8182
let client1 = Mpesa::new(
8283
env!("CLIENT_KEY"),
8384
env!("CLIENT_SECRET"),
8485
Environment::try_from("production")? // "Production" and "PRODUCTION" also valid
8586
);
86-
assert!(client0.is_connected().await)
8787
assert!(client1.is_connected().await)
8888
```
8989

@@ -101,7 +101,7 @@ This trait allows you to create your own type to pass to the `environment` param
101101

102102
See the example below (and [here](./src/environment.rs) so see how the trait is implemented for the `Environment` enum):
103103

104-
```rust
104+
```rust,no_run
105105
use mpesa::{Mpesa, ApiEnvironment};
106106
use std::str::FromStr;
107107
use std::convert::TryFrom;
@@ -132,7 +132,7 @@ let client: Mpesa<MyCustomEnvironment> = Mpesa::new(
132132
If you intend to use in production, you will need to call a the `set_initiator_password` method from `Mpesa` after initially
133133
creating the client. Here you provide your initiator password, which overrides the default password used in sandbox `"Safcom496!"`:
134134

135-
```rust
135+
```rust,no_run
136136
use mpesa::Mpesa;
137137
138138
let client = Mpesa::new(
@@ -152,7 +152,7 @@ The following services are currently available from the `Mpesa` client as method
152152

153153
- B2C
154154

155-
```rust
155+
```rust,no_run
156156
let response = client
157157
.b2c("testapi496")
158158
.party_a("600496")
@@ -167,7 +167,7 @@ assert!(response.is_ok())
167167

168168
- B2B
169169

170-
```rust
170+
```rust,no_run
171171
let response = client
172172
.b2b("testapi496")
173173
.party_a("600496")
@@ -183,7 +183,7 @@ assert!(response.is_ok())
183183

184184
- C2B Register
185185

186-
```rust
186+
```rust,no_run
187187
let response = client
188188
.c2b_register()
189189
.short_code("600496")
@@ -196,8 +196,7 @@ assert!(response.is_ok())
196196

197197
- C2B Simulate
198198

199-
```rust
200-
199+
```rust,no_run
201200
let response = client
202201
.c2b_simulate()
203202
.short_code("600496")
@@ -210,7 +209,7 @@ assert!(response.is_ok())
210209

211210
- Account Balance
212211

213-
```rust
212+
```rust,no_run
214213
let response = client
215214
.account_balance("testapi496")
216215
.result_url("https://testdomain.com/ok")
@@ -223,7 +222,7 @@ assert!(response.is_ok())
223222

224223
- Mpesa Express Request / STK push / Lipa na M-PESA online
225224

226-
```rust
225+
```rust,no_run
227226
let response = client
228227
.express_request("174379")
229228
.phone_number("254708374149")
@@ -236,7 +235,7 @@ assert!(response.is_ok())
236235

237236
- Transaction Reversal:
238237

239-
```rust
238+
```rust,no_run
240239
let response = client
241240
.transaction_reversal("testapi496")
242241
.result_url("https://testdomain.com/ok")
@@ -252,7 +251,7 @@ assert!(response.is_ok())
252251

253252
- Transaction Status
254253

255-
```rust
254+
```rust,no_run
256255
let response = client
257256
.transaction_status("testapi496")
258257
.result_url("https://testdomain.com/ok")
@@ -278,7 +277,7 @@ More will be added progressively, pull requests welcome
278277

279278
## Contributing
280279

281-
Contributions, issues and feature requests are welcome!<br />Feel free to check [issues page](https://github.com/collinsmuriuki/mpesa-rust/issues). You can also take a look at the [contributing guide](CONTRIBUTING.md).
280+
Contributions, issues and feature requests are welcome!<br />Feel free to check [issues page](https://github.com/collinsmuriuki/mpesa-rust/issues). You can also take a look at the [contributing guide](https://raw.githubusercontent.com/collinsmuriuki/mpesa-rust/master/CONTRIBUTING.md).
282281

283282
Copyright © 2023 [Collins Muriuki](https://github.com/collinsmuriuki).<br />
284-
This project is [MIT](LICENSE) licensed.
283+
This project is [MIT](https://raw.githubusercontent.com/collinsmuriuki/mpesa-rust/master/LICENSE) licensed.

0 commit comments

Comments
 (0)