Skip to content

Commit

Permalink
chore: Update express_request getters to return string slices
Browse files Browse the repository at this point in the history
  • Loading branch information
c12i committed Apr 6, 2021
1 parent ae97107 commit 8a39a23
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mpesa"
version = "0.3.3"
version = "0.3.4"
authors = ["Collins Muriuki <[email protected]>"]
edition = "2018"
description = "A wrapper around the M-PESA API in Rust."
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ An unofficial Rust wrapper around the [Safaricom API](https://developer.safarico

```md
[dependencies]
mpesa = "0.3.3"
mpesa = "0.3.4"
```

In your lib or binary crate:
Expand All @@ -45,7 +45,7 @@ read the docs [here](https://developer.safaricom.co.ke/docs?javascript#going-liv

_NOTE_:

- Only calling `unwrap` for demonstration purposes. Errors are handled appropriately in the lib via the `MpesaError` enum.
- Only calling `unwrap` for demonstration purposes. Errors are handled appropriately in the lib via the `MpesaError` enum.

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

Expand Down Expand Up @@ -99,7 +99,7 @@ assert!(client.is_connected())

The following services are currently available from the `Mpesa` client as methods that return builders:

- B2C
- B2C

```rust
let response = client
Expand All @@ -113,7 +113,7 @@ let response = client
assert!(response.is_ok())
```

- B2B
- B2B

```rust
let response = client
Expand All @@ -128,7 +128,7 @@ let response = client
assert!(response.is_ok())
```

- C2B Register
- C2B Register

```rust
let response = client
Expand All @@ -140,7 +140,7 @@ let response = client
assert!(response.is_ok())
```

- C2B Simulate
- C2B Simulate

```rust

Expand All @@ -153,7 +153,7 @@ let response = client
assert!(response.is_ok())
```

- Account Balance
- Account Balance

```rust
let response = client
Expand All @@ -165,7 +165,7 @@ let response = client
assert!(response.is_ok())
```

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

```rust
let response = client
Expand All @@ -185,8 +185,8 @@ More will be added progressively, pull requests welcome

**Collins Muriuki**

- Twitter: [@collinsmuriuki\_](https://twitter.com/collinsmuriuki_)
- Not affiliated with Safaricom.
- Twitter: [@collinsmuriuki\_](https://twitter.com/collinsmuriuki_)
- Not affiliated with Safaricom.

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//!
//! ```md
//! [dependencies]
//! mpesa = "0.3.0"
//! mpesa = "0.3.4"
//! ```
//!
//! In your lib or binary crate:
Expand Down
8 changes: 4 additions & 4 deletions src/services/express_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ pub struct MpesaExpressRequestResponse {

#[allow(dead_code)]
impl<'a> MpesaExpressRequestResponse {
pub fn checkout_request_id(&'a self) -> &'a String {
pub fn checkout_request_id(&'a self) -> &'a str {
&self.CheckoutRequestID
}

pub fn customer_message(&'a self) -> &'a String {
pub fn customer_message(&'a self) -> &'a str {
&self.CustomerMessage
}

pub fn merchant_request_id(&'a self) -> &'a String {
pub fn merchant_request_id(&'a self) -> &'a str {
&self.MerchantRequestID
}

pub fn response_code(&'a self) -> &'a String {
pub fn response_code(&'a self) -> &'a str {
&self.ResponseDescription
}
}
Expand Down

0 comments on commit 8a39a23

Please sign in to comment.