Skip to content

Commit

Permalink
refactor: resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kashif-m committed Nov 22, 2024
1 parent 98221a3 commit 2adabf2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
10 changes: 4 additions & 6 deletions crates/router/src/core/recon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use masking::{ExposeInterface, PeekInterface, Secret};
#[cfg(feature = "email")]
use crate::{consts, services::email::types as email_types, types::domain};
use crate::{
core::errors::{self, RouterResponse, UserErrors, UserResponse},
core::errors::{self, RouterResponse, UserResponse},
services::{api as service_api, authentication},
types::{
api::{self as api_types, enums},
Expand Down Expand Up @@ -50,7 +50,6 @@ pub async fn send_recon_request(
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to convert recipient's email to UserEmail")?,
settings: state.conf.clone(),
subject: format!(
"{} {}",
consts::EMAIL_SUBJECT_DASHBOARD_FEATURE_REQUEST,
Expand Down Expand Up @@ -164,7 +163,6 @@ pub async fn recon_merchant_account_update(
user_name: domain::UserName::new(Secret::new("HyperSwitch User".to_string()))
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to form username")?,
settings: state.conf.clone(),
subject: consts::EMAIL_SUBJECT_APPROVAL_RECON_REQUEST,
};
if req.recon_status == enums::ReconStatus::Active {
Expand All @@ -176,8 +174,7 @@ pub async fn recon_merchant_account_update(
)
.await
.change_context(UserErrors::InternalServerError)
.attach_printable("Failed to compose and send email for ReconActivation")
.is_ok();
.attach_printable("Failed to compose and send email for ReconActivation");
}
}

Expand Down Expand Up @@ -206,7 +203,8 @@ pub async fn verify_recon_token(

let acl = user_with_role.role_info.get_recon_acl();
let optional_acl_str = serde_json::to_string(&acl)
.map_err(|_| UserErrors::InternalServerError)
.inspect_err(|err| router_env::logger::error!("Failed to serialize acl to string: {}", err))
.change_context(errors::UserErrors::InternalServerError)
.attach_printable("Failed to serialize acl to string. Using empty ACL")
.ok();

Expand Down
3 changes: 2 additions & 1 deletion crates/router/src/services/authentication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3295,7 +3295,8 @@ impl ReconToken {
let exp = jwt::generate_exp(exp_duration)?.as_secs();
let acl = role_info.get_recon_acl();
let optional_acl_str = serde_json::to_string(&acl)
.map_err(|_| errors::UserErrors::InternalServerError)
.inspect_err(|err| logger::error!("Failed to serialize acl to string: {}", err))
.change_context(errors::UserErrors::InternalServerError)
.attach_printable("Failed to serialize acl to string. Using empty ACL")
.ok();
let token_payload = Self {
Expand Down
2 changes: 0 additions & 2 deletions crates/router/src/services/email/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ impl EmailData for InviteUser {
pub struct ReconActivation {
pub recipient_email: domain::UserEmail,
pub user_name: domain::UserName,
pub settings: std::sync::Arc<configs::Settings>,
pub subject: &'static str,
}

Expand Down Expand Up @@ -455,7 +454,6 @@ pub struct ProFeatureRequest {
pub merchant_id: common_utils::id_type::MerchantId,
pub user_name: domain::UserName,
pub user_email: domain::UserEmail,
pub settings: std::sync::Arc<configs::Settings>,
pub subject: String,
}

Expand Down

0 comments on commit 2adabf2

Please sign in to comment.