mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
chore: address Rust 1.80 clippy lints (#5447)
This commit is contained in:
@ -145,20 +145,6 @@ impl_api_event_type!(
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
#[cfg(feature = "stripe")]
|
|
||||||
impl_api_event_type!(
|
|
||||||
Miscellaneous,
|
|
||||||
(
|
|
||||||
StripeSetupIntentResponse,
|
|
||||||
StripeRefundResponse,
|
|
||||||
StripePaymentIntentListResponse,
|
|
||||||
StripePaymentIntentResponse,
|
|
||||||
CustomerDeleteResponse,
|
|
||||||
CustomerPaymentMethodListResponse,
|
|
||||||
CreateCustomerResponse
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
impl<T> ApiEventMetric for MetricsResponse<T> {
|
impl<T> ApiEventMetric for MetricsResponse<T> {
|
||||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||||
Some(ApiEventsType::Miscellaneous)
|
Some(ApiEventsType::Miscellaneous)
|
||||||
|
|||||||
@ -17,9 +17,6 @@ use crate::file_storage::{FileStorageError, FileStorageInterface};
|
|||||||
/// The file path is generated based on the workspace path and the provided file key.
|
/// The file path is generated based on the workspace path and the provided file key.
|
||||||
fn get_file_path(file_key: impl AsRef<str>) -> PathBuf {
|
fn get_file_path(file_key: impl AsRef<str>) -> PathBuf {
|
||||||
let mut file_path = PathBuf::new();
|
let mut file_path = PathBuf::new();
|
||||||
#[cfg(feature = "logs")]
|
|
||||||
file_path.push(router_env::env::workspace_path());
|
|
||||||
#[cfg(not(feature = "logs"))]
|
|
||||||
file_path.push(std::env::current_dir().unwrap_or(".".into()));
|
file_path.push(std::env::current_dir().unwrap_or(".".into()));
|
||||||
|
|
||||||
file_path.push("files");
|
file_path.push("files");
|
||||||
|
|||||||
@ -28,7 +28,7 @@ pub async fn payment_intents_create(
|
|||||||
Err(err) => return api::log_and_return_error_response(err),
|
Err(err) => return api::log_and_return_error_response(err),
|
||||||
};
|
};
|
||||||
|
|
||||||
tracing::Span::current().record("payment_id", &payload.id.clone().unwrap_or_default());
|
tracing::Span::current().record("payment_id", payload.id.clone().unwrap_or_default());
|
||||||
|
|
||||||
logger::info!(tag = ?Tag::CompatibilityLayerRequest, payload = ?payload);
|
logger::info!(tag = ?Tag::CompatibilityLayerRequest, payload = ?payload);
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ pub async fn payment_intents_retrieve_with_gateway_creds(
|
|||||||
_ => Flow::PaymentsRetrieve,
|
_ => Flow::PaymentsRetrieve,
|
||||||
};
|
};
|
||||||
|
|
||||||
tracing::Span::current().record("flow", &flow.to_string());
|
tracing::Span::current().record("flow", flow.to_string());
|
||||||
|
|
||||||
let locking_action = payload.get_locking_input(flow.clone());
|
let locking_action = payload.get_locking_input(flow.clone());
|
||||||
Box::pin(wrap::compatibility_api_wrap::<
|
Box::pin(wrap::compatibility_api_wrap::<
|
||||||
@ -361,7 +361,7 @@ pub async fn payment_intents_capture(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
tracing::Span::current().record("payment_id", &stripe_payload.payment_id.clone());
|
tracing::Span::current().record("payment_id", stripe_payload.payment_id.clone());
|
||||||
|
|
||||||
logger::info!(tag = ?Tag::CompatibilityLayerRequest, payload = ?stripe_payload);
|
logger::info!(tag = ?Tag::CompatibilityLayerRequest, payload = ?stripe_payload);
|
||||||
|
|
||||||
@ -423,7 +423,7 @@ pub async fn payment_intents_cancel(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
tracing::Span::current().record("payment_id", &payment_id.clone());
|
tracing::Span::current().record("payment_id", payment_id.clone());
|
||||||
|
|
||||||
logger::info!(tag = ?Tag::CompatibilityLayerRequest, payload = ?stripe_payload);
|
logger::info!(tag = ?Tag::CompatibilityLayerRequest, payload = ?stripe_payload);
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ pub async fn refund_create(
|
|||||||
Err(err) => return api::log_and_return_error_response(err),
|
Err(err) => return api::log_and_return_error_response(err),
|
||||||
};
|
};
|
||||||
|
|
||||||
tracing::Span::current().record("payment_id", &payload.payment_intent.clone());
|
tracing::Span::current().record("payment_id", payload.payment_intent.clone());
|
||||||
|
|
||||||
logger::info!(tag = ?Tag::CompatibilityLayerRequest, payload = ?payload);
|
logger::info!(tag = ?Tag::CompatibilityLayerRequest, payload = ?payload);
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ pub async fn refund_retrieve_with_gateway_creds(
|
|||||||
_ => Flow::RefundsRetrieve,
|
_ => Flow::RefundsRetrieve,
|
||||||
};
|
};
|
||||||
|
|
||||||
tracing::Span::current().record("flow", &flow.to_string());
|
tracing::Span::current().record("flow", flow.to_string());
|
||||||
|
|
||||||
Box::pin(wrap::compatibility_api_wrap::<
|
Box::pin(wrap::compatibility_api_wrap::<
|
||||||
_,
|
_,
|
||||||
|
|||||||
@ -45,16 +45,6 @@ pub struct CmdLineConf {
|
|||||||
/// Application will look for "config/config.toml" if this option isn't specified.
|
/// Application will look for "config/config.toml" if this option isn't specified.
|
||||||
#[arg(short = 'f', long, value_name = "FILE")]
|
#[arg(short = 'f', long, value_name = "FILE")]
|
||||||
pub config_path: Option<PathBuf>,
|
pub config_path: Option<PathBuf>,
|
||||||
|
|
||||||
#[command(subcommand)]
|
|
||||||
pub subcommand: Option<Subcommand>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(clap::Parser)]
|
|
||||||
pub enum Subcommand {
|
|
||||||
#[cfg(feature = "openapi")]
|
|
||||||
/// Generate the OpenAPI specification file from code.
|
|
||||||
GenerateOpenapiSpec,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, Default)]
|
#[derive(Debug, Deserialize, Clone, Default)]
|
||||||
|
|||||||
@ -688,12 +688,6 @@ pub struct MbwayData {
|
|||||||
telephone_number: Secret<String>,
|
telephone_number: Secret<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
|
||||||
pub struct WalleyData {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
payment_type: PaymentType,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
pub struct SamsungPayPmData {
|
pub struct SamsungPayPmData {
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
@ -702,12 +696,6 @@ pub struct SamsungPayPmData {
|
|||||||
samsung_pay_token: Secret<String>,
|
samsung_pay_token: Secret<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
|
||||||
pub struct PayBrightData {
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
payment_type: PaymentType,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
pub struct OnlineBankingCzechRepublicData {
|
pub struct OnlineBankingCzechRepublicData {
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
|
|||||||
@ -133,12 +133,6 @@ pub struct BluesnapGooglePayObject {
|
|||||||
payment_method_data: utils::GooglePayWalletData,
|
payment_method_data: utils::GooglePayWalletData,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct BluesnapApplePayObject {
|
|
||||||
token: payments::ApplePayWalletData,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||||
pub enum BluesnapWalletTypes {
|
pub enum BluesnapWalletTypes {
|
||||||
|
|||||||
@ -459,11 +459,6 @@ pub struct BokuErrorResponse {
|
|||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
|
||||||
pub struct BokuConnMetaData {
|
|
||||||
country: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_hosted_data(item: &types::PaymentsAuthorizeRouterData) -> Option<BokuHostedData> {
|
fn get_hosted_data(item: &types::PaymentsAuthorizeRouterData) -> Option<BokuHostedData> {
|
||||||
item.return_url
|
item.return_url
|
||||||
.clone()
|
.clone()
|
||||||
|
|||||||
@ -462,12 +462,6 @@ pub struct CardDetails {
|
|||||||
pub card_cvv: Secret<String>,
|
pub card_cvv: Secret<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Eq, PartialEq)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct BankDetails {
|
|
||||||
billing_email: Email,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct MollieAuthType {
|
pub struct MollieAuthType {
|
||||||
pub(super) api_key: Secret<String>,
|
pub(super) api_key: Secret<String>,
|
||||||
pub(super) profile_token: Option<Secret<String>>,
|
pub(super) profile_token: Option<Secret<String>>,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
use common_utils::pii::{Email, IpAddress};
|
use common_utils::pii::IpAddress;
|
||||||
use diesel_models::enums::RefundStatus;
|
use diesel_models::enums::RefundStatus;
|
||||||
use masking::{ExposeInterface, Secret};
|
use masking::{ExposeInterface, Secret};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -74,20 +74,20 @@ pub struct PowertranzCard {
|
|||||||
card_cvv: Secret<String>,
|
card_cvv: Secret<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
// #[derive(Debug, Serialize)]
|
||||||
#[serde(rename_all = "PascalCase")]
|
// #[serde(rename_all = "PascalCase")]
|
||||||
pub struct PowertranzAddressDetails {
|
// pub struct PowertranzAddressDetails {
|
||||||
first_name: Option<Secret<String>>,
|
// first_name: Option<Secret<String>>,
|
||||||
last_name: Option<Secret<String>>,
|
// last_name: Option<Secret<String>>,
|
||||||
line1: Option<Secret<String>>,
|
// line1: Option<Secret<String>>,
|
||||||
line2: Option<Secret<String>>,
|
// line2: Option<Secret<String>>,
|
||||||
city: Option<String>,
|
// city: Option<String>,
|
||||||
country: Option<enums::CountryAlpha2>,
|
// country: Option<enums::CountryAlpha2>,
|
||||||
state: Option<Secret<String>>,
|
// state: Option<Secret<String>>,
|
||||||
postal_code: Option<Secret<String>>,
|
// postal_code: Option<Secret<String>>,
|
||||||
email_address: Option<Email>,
|
// email_address: Option<Email>,
|
||||||
phone_number: Option<Secret<String>>,
|
// phone_number: Option<Secret<String>>,
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
#[serde(rename_all = "PascalCase")]
|
#[serde(rename_all = "PascalCase")]
|
||||||
|
|||||||
@ -634,56 +634,3 @@ impl UserRoleInterface for MockDb {
|
|||||||
Ok(filtered_roles)
|
Ok(filtered_roles)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "kafka_events")]
|
|
||||||
#[async_trait::async_trait]
|
|
||||||
impl UserRoleInterface for super::KafkaStore {
|
|
||||||
async fn insert_user_role(
|
|
||||||
&self,
|
|
||||||
user_role: storage::UserRoleNew,
|
|
||||||
) -> CustomResult<storage::UserRole, errors::StorageError> {
|
|
||||||
self.diesel_store.insert_user_role(user_role).await
|
|
||||||
}
|
|
||||||
async fn update_user_role_by_user_id_merchant_id(
|
|
||||||
&self,
|
|
||||||
user_id: &str,
|
|
||||||
merchant_id: &common_utils::id_type::MerchantId,
|
|
||||||
update: storage::UserRoleUpdate,
|
|
||||||
) -> CustomResult<storage::UserRole, errors::StorageError> {
|
|
||||||
self.diesel_store
|
|
||||||
.update_user_role_by_user_id_merchant_id(user_id, merchant_id, update)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
async fn find_user_role_by_user_id(
|
|
||||||
&self,
|
|
||||||
user_id: &str,
|
|
||||||
version: enums::UserRoleVersion,
|
|
||||||
) -> CustomResult<storage::UserRole, errors::StorageError> {
|
|
||||||
self.diesel_store
|
|
||||||
.find_user_role_by_user_id(user_id, version)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
async fn delete_user_role_by_user_id_merchant_id(
|
|
||||||
&self,
|
|
||||||
user_id: &str,
|
|
||||||
merchant_id: &common_utils::id_type::MerchantId,
|
|
||||||
) -> CustomResult<storage::UserRole, errors::StorageError> {
|
|
||||||
self.diesel_store
|
|
||||||
.delete_user_role_by_user_id_merchant_id(user_id, merchant_id)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
async fn list_user_roles_by_user_id(
|
|
||||||
&self,
|
|
||||||
user_id: &str,
|
|
||||||
) -> CustomResult<Vec<storage::UserRole>, errors::StorageError> {
|
|
||||||
self.diesel_store.list_user_roles_by_user_id(user_id).await
|
|
||||||
}
|
|
||||||
async fn list_user_roles_by_merchant_id(
|
|
||||||
&self,
|
|
||||||
merchant_id: &common_utils::id_type::MerchantId,
|
|
||||||
) -> CustomResult<Vec<storage::UserRole>, errors::StorageError> {
|
|
||||||
self.diesel_store
|
|
||||||
.list_user_roles_by_merchant_id(merchant_id)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -108,7 +108,7 @@ pub async fn payments_create(
|
|||||||
|
|
||||||
tracing::Span::current().record(
|
tracing::Span::current().record(
|
||||||
"payment_id",
|
"payment_id",
|
||||||
&payload
|
payload
|
||||||
.payment_id
|
.payment_id
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|payment_id_type| payment_id_type.get_payment_intent_id())
|
.map(|payment_id_type| payment_id_type.get_payment_intent_id())
|
||||||
@ -254,8 +254,8 @@ pub async fn payments_retrieve(
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
tracing::Span::current().record("payment_id", &path.to_string());
|
tracing::Span::current().record("payment_id", path.to_string());
|
||||||
tracing::Span::current().record("flow", &flow.to_string());
|
tracing::Span::current().record("flow", flow.to_string());
|
||||||
|
|
||||||
let (auth_type, auth_flow) =
|
let (auth_type, auth_flow) =
|
||||||
match auth::check_client_secret_and_get_auth(req.headers(), &payload) {
|
match auth::check_client_secret_and_get_auth(req.headers(), &payload) {
|
||||||
@ -334,7 +334,7 @@ pub async fn payments_retrieve_with_gateway_creds(
|
|||||||
};
|
};
|
||||||
|
|
||||||
tracing::Span::current().record("payment_id", &json_payload.payment_id);
|
tracing::Span::current().record("payment_id", &json_payload.payment_id);
|
||||||
tracing::Span::current().record("flow", &flow.to_string());
|
tracing::Span::current().record("flow", flow.to_string());
|
||||||
|
|
||||||
let locking_action = payload.get_locking_input(flow.clone());
|
let locking_action = payload.get_locking_input(flow.clone());
|
||||||
|
|
||||||
|
|||||||
@ -81,7 +81,7 @@ pub async fn refunds_retrieve(
|
|||||||
_ => Flow::RefundsRetrieve,
|
_ => Flow::RefundsRetrieve,
|
||||||
};
|
};
|
||||||
|
|
||||||
tracing::Span::current().record("flow", &flow.to_string());
|
tracing::Span::current().record("flow", flow.to_string());
|
||||||
|
|
||||||
Box::pin(api::server_wrap(
|
Box::pin(api::server_wrap(
|
||||||
flow,
|
flow,
|
||||||
@ -132,7 +132,7 @@ pub async fn refunds_retrieve_with_body(
|
|||||||
_ => Flow::RefundsRetrieve,
|
_ => Flow::RefundsRetrieve,
|
||||||
};
|
};
|
||||||
|
|
||||||
tracing::Span::current().record("flow", &flow.to_string());
|
tracing::Span::current().record("flow", flow.to_string());
|
||||||
|
|
||||||
Box::pin(api::server_wrap(
|
Box::pin(api::server_wrap(
|
||||||
flow,
|
flow,
|
||||||
|
|||||||
@ -126,7 +126,7 @@ where
|
|||||||
// If needed add an error stack as follows
|
// If needed add an error stack as follows
|
||||||
// connector_integration.build_request(req).attach_printable("Failed to build request");
|
// connector_integration.build_request(req).attach_printable("Failed to build request");
|
||||||
tracing::Span::current().record("connector_name", &req.connector);
|
tracing::Span::current().record("connector_name", &req.connector);
|
||||||
tracing::Span::current().record("payment_method", &req.payment_method.to_string());
|
tracing::Span::current().record("payment_method", req.payment_method.to_string());
|
||||||
logger::debug!(connector_request=?connector_request);
|
logger::debug!(connector_request=?connector_request);
|
||||||
let mut router_data = req.clone();
|
let mut router_data = req.clone();
|
||||||
match call_connector_action {
|
match call_connector_action {
|
||||||
|
|||||||
Reference in New Issue
Block a user