mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 19:42:27 +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> {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
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.
|
||||
fn get_file_path(file_key: impl AsRef<str>) -> PathBuf {
|
||||
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("files");
|
||||
|
||||
@ -28,7 +28,7 @@ pub async fn payment_intents_create(
|
||||
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);
|
||||
|
||||
@ -170,7 +170,7 @@ pub async fn payment_intents_retrieve_with_gateway_creds(
|
||||
_ => 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());
|
||||
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);
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ pub async fn refund_create(
|
||||
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);
|
||||
|
||||
@ -76,7 +76,7 @@ pub async fn refund_retrieve_with_gateway_creds(
|
||||
_ => Flow::RefundsRetrieve,
|
||||
};
|
||||
|
||||
tracing::Span::current().record("flow", &flow.to_string());
|
||||
tracing::Span::current().record("flow", flow.to_string());
|
||||
|
||||
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.
|
||||
#[arg(short = 'f', long, value_name = "FILE")]
|
||||
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)]
|
||||
|
||||
@ -688,12 +688,6 @@ pub struct MbwayData {
|
||||
telephone_number: Secret<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct WalleyData {
|
||||
#[serde(rename = "type")]
|
||||
payment_type: PaymentType,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct SamsungPayPmData {
|
||||
#[serde(rename = "type")]
|
||||
@ -702,12 +696,6 @@ pub struct SamsungPayPmData {
|
||||
samsung_pay_token: Secret<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct PayBrightData {
|
||||
#[serde(rename = "type")]
|
||||
payment_type: PaymentType,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct OnlineBankingCzechRepublicData {
|
||||
#[serde(rename = "type")]
|
||||
|
||||
@ -133,12 +133,6 @@ pub struct BluesnapGooglePayObject {
|
||||
payment_method_data: utils::GooglePayWalletData,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct BluesnapApplePayObject {
|
||||
token: payments::ApplePayWalletData,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
pub enum BluesnapWalletTypes {
|
||||
|
||||
@ -459,11 +459,6 @@ pub struct BokuErrorResponse {
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct BokuConnMetaData {
|
||||
country: String,
|
||||
}
|
||||
|
||||
fn get_hosted_data(item: &types::PaymentsAuthorizeRouterData) -> Option<BokuHostedData> {
|
||||
item.return_url
|
||||
.clone()
|
||||
|
||||
@ -123,9 +123,9 @@ pub struct PaymentMethod {
|
||||
/// If enabled, this field indicates whether the payment method has been seen before or is
|
||||
/// new.
|
||||
/// * EXISTS - Indicates that the payment method was seen on the platform before by this
|
||||
/// merchant.
|
||||
/// merchant.
|
||||
/// * NEW - Indicates that the payment method was not seen on the platform before by this
|
||||
/// merchant.
|
||||
/// merchant.
|
||||
pub fingerprint_presence_indicator: Option<String>,
|
||||
/// Unique Global Payments generated id used to reference a stored payment method on the
|
||||
/// Global Payments system. Often referred to as the payment method token. This value can be
|
||||
|
||||
@ -462,12 +462,6 @@ pub struct CardDetails {
|
||||
pub card_cvv: Secret<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Eq, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct BankDetails {
|
||||
billing_email: Email,
|
||||
}
|
||||
|
||||
pub struct MollieAuthType {
|
||||
pub(super) api_key: Secret<String>,
|
||||
pub(super) profile_token: Option<Secret<String>>,
|
||||
|
||||
@ -91,7 +91,7 @@ pub struct ThreeDSRequestor {
|
||||
/// Format of this field was changed with EMV 3DS 2.3.1 version:
|
||||
/// In versions prior to 2.3.1, this field is a single object.
|
||||
/// Starting from EMVCo version 2.3.1, this field is now an array of objects. Accepted value length is 1-3 elements.
|
||||
///
|
||||
///
|
||||
/// This field is optional, but recommended to include.
|
||||
#[serde(rename = "threeDSRequestorAuthenticationInfo")]
|
||||
pub three_ds_requestor_authentication_info:
|
||||
@ -206,16 +206,16 @@ pub struct ThreeDSRequestorAuthenticationInformation {
|
||||
/// Indicates whether a challenge is requested for this transaction. For example: For 01-PA, a 3DS Requestor may have
|
||||
/// concerns about the transaction, and request a challenge. For 02-NPA, a challenge may be necessary when adding a new
|
||||
/// card to a wallet.
|
||||
///
|
||||
///
|
||||
/// This field is optional. The accepted values are:
|
||||
///
|
||||
/// - 01 -> No preference
|
||||
/// - 02 -> No challenge requested
|
||||
/// - 03 -> Challenge requested: 3DS Requestor Preference
|
||||
/// - 04 -> Challenge requested: Mandate.
|
||||
/// The next values are accepted as well if 3DS Server initiates authentication with EMV 3DS 2.2.0 version
|
||||
/// or greater (required protocol version can be set in
|
||||
/// ThreeDSServerAuthenticationRequest#preferredProtocolVersion field):
|
||||
/// The next values are accepted as well if 3DS Server initiates authentication with EMV 3DS 2.2.0 version
|
||||
/// or greater (required protocol version can be set in
|
||||
/// ThreeDSServerAuthenticationRequest#preferredProtocolVersion field):
|
||||
///
|
||||
/// - 05 -> No challenge requested (transactional risk analysis is already performed)
|
||||
/// - 06 -> No challenge requested (Data share only)
|
||||
@ -223,9 +223,9 @@ pub struct ThreeDSRequestorAuthenticationInformation {
|
||||
/// - 08 -> No challenge requested (utilise whitelist exemption if no challenge required)
|
||||
/// - 09 -> Challenge requested (whitelist prompt requested if challenge required).
|
||||
/// - Additionally, 80-99 can be used for PS-specific values, regardless of protocol version.
|
||||
///
|
||||
///
|
||||
/// If the element is not provided, the expected action is that the ACS would interpret as 01 -> No preference.
|
||||
///
|
||||
///
|
||||
/// Format of this field was changed with EMV 3DS 2.3.1 version:
|
||||
/// In versions prior to 2.3.1, this field is a String.
|
||||
/// Starting from EMVCo version 2.3.1, this field is now an array of objects. Accepted value length is 1-2 elements.
|
||||
@ -257,7 +257,7 @@ pub enum ThreeDSRequestorChallengeIndicator {
|
||||
/// Format of this field was changed with EMV 3DS 2.3.1 version:
|
||||
/// In versions prior to 2.3.1, this field is a single object.
|
||||
/// Starting from EMVCo version 2.3.1, this field is now an array of objects. Accepted value length is 1-3 elements.
|
||||
///
|
||||
///
|
||||
/// This field is optional, but recommended to include for versions prior to 2.3.1. From 2.3.1,
|
||||
/// it is required for 3RI in the case of Decoupled Authentication Fallback or for SPC.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use common_utils::pii::{Email, IpAddress};
|
||||
use common_utils::pii::IpAddress;
|
||||
use diesel_models::enums::RefundStatus;
|
||||
use masking::{ExposeInterface, Secret};
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -74,20 +74,20 @@ pub struct PowertranzCard {
|
||||
card_cvv: Secret<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct PowertranzAddressDetails {
|
||||
first_name: Option<Secret<String>>,
|
||||
last_name: Option<Secret<String>>,
|
||||
line1: Option<Secret<String>>,
|
||||
line2: Option<Secret<String>>,
|
||||
city: Option<String>,
|
||||
country: Option<enums::CountryAlpha2>,
|
||||
state: Option<Secret<String>>,
|
||||
postal_code: Option<Secret<String>>,
|
||||
email_address: Option<Email>,
|
||||
phone_number: Option<Secret<String>>,
|
||||
}
|
||||
// #[derive(Debug, Serialize)]
|
||||
// #[serde(rename_all = "PascalCase")]
|
||||
// pub struct PowertranzAddressDetails {
|
||||
// first_name: Option<Secret<String>>,
|
||||
// last_name: Option<Secret<String>>,
|
||||
// line1: Option<Secret<String>>,
|
||||
// line2: Option<Secret<String>>,
|
||||
// city: Option<String>,
|
||||
// country: Option<enums::CountryAlpha2>,
|
||||
// state: Option<Secret<String>>,
|
||||
// postal_code: Option<Secret<String>>,
|
||||
// email_address: Option<Email>,
|
||||
// phone_number: Option<Secret<String>>,
|
||||
// }
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
|
||||
@ -634,56 +634,3 @@ impl UserRoleInterface for MockDb {
|
||||
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(
|
||||
"payment_id",
|
||||
&payload
|
||||
payload
|
||||
.payment_id
|
||||
.as_ref()
|
||||
.map(|payment_id_type| payment_id_type.get_payment_intent_id())
|
||||
@ -254,8 +254,8 @@ pub async fn payments_retrieve(
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
tracing::Span::current().record("payment_id", &path.to_string());
|
||||
tracing::Span::current().record("flow", &flow.to_string());
|
||||
tracing::Span::current().record("payment_id", path.to_string());
|
||||
tracing::Span::current().record("flow", flow.to_string());
|
||||
|
||||
let (auth_type, auth_flow) =
|
||||
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("flow", &flow.to_string());
|
||||
tracing::Span::current().record("flow", flow.to_string());
|
||||
|
||||
let locking_action = payload.get_locking_input(flow.clone());
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ pub async fn refunds_retrieve(
|
||||
_ => Flow::RefundsRetrieve,
|
||||
};
|
||||
|
||||
tracing::Span::current().record("flow", &flow.to_string());
|
||||
tracing::Span::current().record("flow", flow.to_string());
|
||||
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
@ -132,7 +132,7 @@ pub async fn refunds_retrieve_with_body(
|
||||
_ => Flow::RefundsRetrieve,
|
||||
};
|
||||
|
||||
tracing::Span::current().record("flow", &flow.to_string());
|
||||
tracing::Span::current().record("flow", flow.to_string());
|
||||
|
||||
Box::pin(api::server_wrap(
|
||||
flow,
|
||||
|
||||
@ -126,7 +126,7 @@ where
|
||||
// If needed add an error stack as follows
|
||||
// connector_integration.build_request(req).attach_printable("Failed to build request");
|
||||
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);
|
||||
let mut router_data = req.clone();
|
||||
match call_connector_action {
|
||||
|
||||
@ -292,7 +292,7 @@ fn check_if_auth_based_attr_is_present(f: &syn::Field, ident: &str) -> bool {
|
||||
/// # The Generated `Serialize` Implementation
|
||||
///
|
||||
/// - For a simple enum variant with no fields, the generated [`Serialize`][Serialize]
|
||||
/// implementation has only three fields, `type`, `code` and `message`:
|
||||
/// implementation has only three fields, `type`, `code` and `message`:
|
||||
///
|
||||
/// ```
|
||||
/// # use router_derive::ApiError;
|
||||
@ -322,8 +322,8 @@ fn check_if_auth_based_attr_is_present(f: &syn::Field, ident: &str) -> bool {
|
||||
/// ```
|
||||
///
|
||||
/// - For an enum variant with named fields, the generated [`Serialize`][Serialize] implementation
|
||||
/// includes three mandatory fields, `type`, `code` and `message`, and any other fields not
|
||||
/// included in the message:
|
||||
/// includes three mandatory fields, `type`, `code` and `message`, and any other fields not
|
||||
/// included in the message:
|
||||
///
|
||||
/// ```
|
||||
/// # use router_derive::ApiError;
|
||||
|
||||
Reference in New Issue
Block a user