Skip to content

Commit b744706

Browse files
committed
feat - fix conflicting feature docs and add new feature flags
1 parent 96805df commit b744706

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ An unofficial Rust wrapper around the [Safaricom API](https://developer.safarico
2525

2626
```toml
2727
[dependencies]
28-
mpesa = "0.3.6"
28+
mpesa = "0.3.7"
2929
```
3030

31-
Optionally, you can disable default-features, which is basically the entire suite of MPESA APIs to conditionally select from either `["b2b", "b2c", "account_balance"]` services, which make use of `openssl` and `base64` dependencies that can be opted out of compilation if not required.
31+
Optionally, you can disable default-features, which is basically the entire suite of MPESA APIs to conditionally select from either `["b2b", "b2c" ,"account_balance", "c2b_register", "c2b_simulate", "express_request"]` services.
32+
Example:
3233

3334
```toml
3435
[dependencies]
35-
mpesa = { version = "0.3.6", default_features = false, features = ["b2b"] }
36+
mpesa = { version = "0.3.7", default_features = false, features = ["b2b", "express_request"] }
3637
```
3738

3839
In your lib or binary crate:

mpesa_core/Cargo.toml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mpesa"
3-
version = "0.3.6"
3+
version = "0.3.7"
44
authors = ["Collins Muriuki <[email protected]>"]
55
edition = "2018"
66
description = "A wrapper around the M-PESA API in Rust."
@@ -13,6 +13,8 @@ license = "MIT"
1313
serde_json = "1.0"
1414
dotenv = "0.15.0"
1515
mpesa_derive = "0.2.1"
16+
openssl = "0.10.30"
17+
base64 = "0.12.3"
1618
failure = "0.1.5"
1719
failure_derive = "0.1.5"
1820
chrono = "0.4"
@@ -25,16 +27,11 @@ features = ["blocking", "json"]
2527
version = "1.0.114"
2628
features = ["derive"]
2729

28-
[dependencies.openssl]
29-
version = "0.10.30"
30-
optional = true
31-
32-
[dependencies.base64]
33-
version = "0.12.3"
34-
optional = true
35-
3630
[features]
37-
default = ["b2b", "b2c" ,"account_balance"]
38-
account_balance = ["openssl", "base64"]
39-
b2c = ["openssl", "base64"]
40-
b2b = ["openssl", "base64"]
31+
default = ["b2b", "b2c" ,"account_balance", "c2b_register", "c2b_simulate", "express_request"]
32+
b2b = []
33+
b2c = []
34+
account_balance = []
35+
c2b_register = []
36+
c2b_simulate = []
37+
express_request = []

mpesa_core/src/client.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ impl<'a> Mpesa {
182182
/// .response_type(mpesa::ResponseTypes::Complete) // optional, defaults to `ResponseTypes::Complete`
183183
/// .send();
184184
/// ```
185+
#[cfg(feature = "c2b_register")]
185186
pub fn c2b_register(&'a self) -> C2bRegisterBuilder<'a> {
186187
C2bRegisterBuilder::new(&self)
187188
}
@@ -202,6 +203,7 @@ impl<'a> Mpesa {
202203
/// .bill_ref_number("Your_BillRefNumber>") // optional, defaults to "None"
203204
/// .send();
204205
/// ```
206+
#[cfg(feature = "c2b_simulate")]
205207
pub fn c2b_simulate(&'a self) -> C2bSimulateBuilder<'a> {
206208
C2bSimulateBuilder::new(&self)
207209
}
@@ -250,6 +252,7 @@ impl<'a> Mpesa {
250252
/// .transaction_desc("Description") // Optional, defaults to "None"
251253
/// .send();
252254
/// ```
255+
#[cfg(feature = "express_request")]
253256
pub fn express_request(
254257
&'a self,
255258
business_short_code: &'a str,

mpesa_core/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
//!
88
//! ```toml
99
//! [dependencies]
10-
//! mpesa = "0.3.6"
10+
//! mpesa = "0.3.7"
1111
//! ```
12-
//! Optionally, you can disable default-features, which is basically the entire suite of MPESA APIs to conditionally select from either `["b2b", "b2c", "account_balance"]` services, which make use of `openssl` and `base64` dependencies that can be opted out of compilation if not required.
12+
//! Optionally, you can disable default-features, which is basically the entire suite of MPESA APIs to conditionally select from either `["b2b", "b2c" ,"account_balance", "c2b_register", "c2b_simulate", "express_request"]` services.
13+
//! Example:
1314
//!
1415
//! ```toml
1516
//! [dependencies]
16-
//! mpesa = { version = "0.3.6", default_features = false, features = ["b2b"] }
17+
//! mpesa = { version = "0.3.7", default_features = false, features = ["b2b", "express_request"] }
1718
//! ```
1819
//!
1920
//! In your lib or binary crate:

0 commit comments

Comments
 (0)