Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Migrate to derive builder #107

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: Fix clippy and rustfmt ci failures
  • Loading branch information
c12i committed Jan 28, 2024
commit 3c3b93bc115eca1057c93a26c98a646ac0060ab6
2 changes: 1 addition & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@

#[cfg(feature = "account_balance")]
#[doc = include_str!("../docs/client/account_balance.md")]
pub fn account_balance<'a>(&'a self) -> AccountBalanceBuilder {
pub fn account_balance(&self) -> AccountBalanceBuilder {
AccountBalance::builder(self)
}

Expand All @@ -251,9 +251,9 @@
#[cfg(feature = "dynamic_qr")]
#[doc = include_str!("../docs/client/dynamic_qr.md")]
pub fn dynamic_qr(&self) -> DynamicQRBuilder {
DynamicQR::builder(self)

Check failure on line 254 in src/client.rs

View workflow job for this annotation

GitHub Actions / Test

this method takes 0 arguments but 1 argument was supplied

Check failure on line 254 in src/client.rs

View workflow job for this annotation

GitHub Actions / Test

this method takes 0 arguments but 1 argument was supplied
}

Check failure on line 255 in src/client.rs

View workflow job for this annotation

GitHub Actions / Test

the trait bound `url::Url: From<&str>` is not satisfied

Check failure on line 255 in src/client.rs

View workflow job for this annotation

GitHub Actions / Test

the trait bound `url::Url: From<&str>` is not satisfied

Check failure on line 256 in src/client.rs

View workflow job for this annotation

GitHub Actions / Test

no method named `timeout_url` found for mutable reference `&mut AccountBalanceBuilder<'_>` in the current scope

Check failure on line 256 in src/client.rs

View workflow job for this annotation

GitHub Actions / Test

no method named `timeout_url` found for mutable reference `&mut AccountBalanceBuilder<'_>` in the current scope
/// Generates security credentials
/// M-Pesa Core authenticates a transaction by decrypting the security credentials.
/// Security credentials are generated by encrypting the base64 encoded initiator password with M-Pesa’s public key, a X509 certificate.
Expand Down
7 changes: 5 additions & 2 deletions tests/mpesa-rust/account_balance_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ async fn account_balance_using_struct_initialization() {
queue_time_out_url: "https://testdomain.com/err".try_into().unwrap(),
remarks: "None",
result_url: "https://testdomain.com/ok".try_into().unwrap(),
security_credential: client.gen_security_credentials().unwrap()
security_credential: client.gen_security_credentials().unwrap(),
};
let response = AccountBalance::from_request(&client, request).send().await.unwrap();
let response = AccountBalance::from_request(&client, request)
.send()
.await
.unwrap();
assert_eq!(response.originator_conversation_id, "29464-48063588-1");
assert_eq!(response.conversation_id, "AG_20230206_201056794190723278ff");
assert_eq!(
Expand Down
Loading