Skip to content

Commit

Permalink
Merge pull request #75 from Borwe/refactor
Browse files Browse the repository at this point in the history
cleanup
  • Loading branch information
c12i authored Oct 11, 2023
2 parents ad79f58 + d8d1818 commit abbfa0d
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ use serde_json::Value;
use std::cell::RefCell;

/// Source: [test credentials](https://developer.safaricom.co.ke/test_credentials)
static DEFAULT_INITIATOR_PASSWORD: &str = "Safcom496!";
const DEFAULT_INITIATOR_PASSWORD: &str = "Safcom496!";
/// Get current package version from metadata
static CARGO_PACKAGE_VERSION: &str = env!("CARGO_PKG_VERSION");
const CARGO_PACKAGE_VERSION: &str = env!("CARGO_PKG_VERSION");

/// `Result` enum type alias
pub type MpesaResult<T> = Result<T, MpesaError>;
Expand Down
5 changes: 0 additions & 5 deletions src/services/c2b_register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ struct C2bRegisterPayload<'mpesa> {

#[derive(Debug, Deserialize, Clone)]
pub struct C2bRegisterResponse {
#[serde(
rename(deserialize = "ConversationID"),
skip_serializing_if = "Option::is_none"
)]
pub conversation_id: Option<String>,
#[serde(rename(deserialize = "OriginatorConverstionID"))]
pub originator_conversation_id: String,
#[serde(rename(deserialize = "ResponseCode"))]
Expand Down
1 change: 0 additions & 1 deletion tests/mpesa-rust/c2b_register_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ async fn c2b_register_success() {
"Accept the service request successfully."
);
assert_eq!(response.response_code, "0");
assert_eq!(response.conversation_id, None);
}

#[tokio::test]
Expand Down
10 changes: 0 additions & 10 deletions tests/mpesa-rust/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,4 @@ mod tests {
);
assert!(!client.is_connected().await);
}

#[tokio::test]
async fn test_client_will_not_authenticate_with_sandbox_credentials_in_production() {
let client = get_mpesa_client!(
std::env::var("CLIENT_KEY").unwrap(),
std::env::var("CLIENT_SECRET").unwrap(),
Environment::from_str("production").unwrap()
);
assert!(!client.is_connected().await);
}
}

0 comments on commit abbfa0d

Please sign in to comment.