-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add main function to bill manager docs code snippets
- Loading branch information
Showing
6 changed files
with
174 additions
and
89 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
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 |
---|---|---|
|
@@ -4,14 +4,29 @@ Safaricom API docs [reference](https://developer.safaricom.co.ke/APIs/BillManage | |
|
||
# Example | ||
```rust,ignore | ||
let response = client | ||
.onboard() | ||
.callback_url("https://testdomain.com/true") | ||
.email("[email protected]") | ||
.logo("https://file.domain/file.png") | ||
.official_contact("0712345678") | ||
.send_reminders(SendRemindersTypes::Enable) | ||
.short_code("600496") | ||
.send() | ||
.await; | ||
use mpesa::{Mpesa, Environment, SendRemindersTypes}; | ||
#[tokio::main] | ||
async fn main() { | ||
dotenv::dotenv().ok(); | ||
let client = Mpesa::new( | ||
env!("CLIENT_KEY"), | ||
env!("CLIENT_SECRET"), | ||
Environment::Sandbox, | ||
); | ||
let response = client | ||
.onboard() | ||
.callback_url("https://testdomain.com/true") | ||
.email("[email protected]") | ||
.logo("https://file.domain/file.png") | ||
.official_contact("0712345678") | ||
.send_reminders(SendRemindersTypes::Enable) | ||
.short_code("718003") | ||
.send() | ||
.await; | ||
assert!(response.is_ok()); | ||
} | ||
``` |
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 |
---|---|---|
|
@@ -4,14 +4,29 @@ Safaricom API docs [reference](https://developer.safaricom.co.ke/APIs/BillManage | |
|
||
# Example | ||
```rust,ignore | ||
let response = client | ||
.onboard_modify() | ||
.callback_url("https://testdomain.com/true") | ||
.email("[email protected]") | ||
.logo("https://file.domain/file.png") | ||
.official_contact("0712345678") | ||
.send_reminders(SendRemindersTypes::Enable) | ||
.short_code("600496") | ||
.send() | ||
.await; | ||
use mpesa::{Mpesa, Environment, SendRemindersTypes}; | ||
#[tokio::main] | ||
async fn main() { | ||
dotenv::dotenv().ok(); | ||
let client = Mpesa::new( | ||
env!("CLIENT_KEY"), | ||
env!("CLIENT_SECRET"), | ||
Environment::Sandbox, | ||
); | ||
let response = client | ||
.onboard_modify() | ||
.callback_url("https://testdomain.com/true") | ||
.email("[email protected]") | ||
.logo("https://file.domain/file.png") | ||
.official_contact("0712345678") | ||
.send_reminders(SendRemindersTypes::Enable) | ||
.short_code("600496") | ||
.send() | ||
.await; | ||
assert!(response.is_ok()); | ||
} | ||
``` |
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