From 10a2097e80e3902b9e19181ad8cc80e1d1b82bb6 Mon Sep 17 00:00:00 2001 From: Collins Muriuki Date: Mon, 29 Jan 2024 01:47:04 +0300 Subject: [PATCH] feat: expose `gen_security_credentials` to public api --- src/client.rs | 2 +- tests/mpesa-rust/account_balance_test.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client.rs b/src/client.rs index 9f8211c16..bcff05ba4 100644 --- a/src/client.rs +++ b/src/client.rs @@ -261,7 +261,7 @@ impl Mpesa { /// /// # Errors /// Returns `EncryptionError` variant of `MpesaError` - pub(crate) fn gen_security_credentials(&self) -> MpesaResult { + pub fn gen_security_credentials(&self) -> MpesaResult { let pem = self.certificate.as_bytes(); let cert = X509::from_pem(pem)?; // getting the public and rsa keys diff --git a/tests/mpesa-rust/account_balance_test.rs b/tests/mpesa-rust/account_balance_test.rs index 104ec73a4..8faa37be0 100644 --- a/tests/mpesa-rust/account_balance_test.rs +++ b/tests/mpesa-rust/account_balance_test.rs @@ -65,7 +65,7 @@ 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: "dummy".to_owned() + security_credential: client.gen_security_credentials().unwrap() }; let response = AccountBalance::from_request(&client, request).send().await.unwrap(); assert_eq!(response.originator_conversation_id, "29464-48063588-1");