Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
chore: address Rust 1.80 clippy lints (#5447)
Chethan Rao074e90c9f9fb
diff --git a/crates/api_models/src/events.rs b/crates/api_models/src/events.rsindex 8289a320d0..a0808c0c24 100644--- a/crates/api_models/src/events.rs+++ b/crates/api_models/src/events.rs@@ -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)diff --git a/crates/external_services/src/file_storage/file_system.rs b/crates/external_services/src/file_storage/file_system.rsindex 2c1ec287f5..e3986abf0f 100644--- a/crates/external_services/src/file_storage/file_system.rs+++ b/crates/external_services/src/file_storage/file_system.rs@@ -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");diff --git a/crates/router/src/compatibility/stripe/payment_intents.rs b/crates/router/src/compatibility/stripe/payment_intents.rsindex 79b6b0fc00..fa6b02e499 100644--- a/crates/router/src/compatibility/stripe/payment_intents.rs+++ b/crates/router/src/compatibility/stripe/payment_intents.rs@@ -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);diff --git a/crates/router/src/compatibility/stripe/refunds.rs b/crates/router/src/compatibility/stripe/refunds.rsindex da68e79e42..52d5230cfc 100644--- a/crates/router/src/compatibility/stripe/refunds.rs+++ b/crates/router/src/compatibility/stripe/refunds.rs@@ -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::<_,diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rsindex 8ccc97c73f..2fe484b8fb 100644--- a/crates/router/src/configs/settings.rs+++ b/crates/router/src/configs/settings.rs@@ -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)]diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rsindex 27189aab99..b1f14e8305 100644--- a/crates/router/src/connector/adyen/transformers.rs+++ b/crates/router/src/connector/adyen/transformers.rs@@ -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")]diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rsindex 2f4670ccdc..dc67c1961b 100644--- a/crates/router/src/connector/bluesnap/transformers.rs+++ b/crates/router/src/connector/bluesnap/transformers.rs@@ -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 {diff --git a/crates/router/src/connector/boku/transformers.rs b/crates/router/src/connector/boku/transformers.rsindex a8b4d8c0ec..e6c6e3b823 100644--- a/crates/router/src/connector/boku/transformers.rs+++ b/crates/router/src/connector/boku/transformers.rs@@ -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()diff --git a/crates/router/src/connector/globalpay/response.rs b/crates/router/src/connector/globalpay/response.rsindex 228562a1bc..a5f905d0e7 100644--- a/crates/router/src/connector/globalpay/response.rs+++ b/crates/router/src/connector/globalpay/response.rs@@ -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 bediff --git a/crates/router/src/connector/mollie/transformers.rs b/crates/router/src/connector/mollie/transformers.rsindex 9320aee8d7..f755ca6029 100644--- a/crates/router/src/connector/mollie/transformers.rs+++ b/crates/router/src/connector/mollie/transformers.rs@@ -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>>,diff --git a/crates/router/src/connector/netcetera/netcetera_types.rs b/crates/router/src/connector/netcetera/netcetera_types.rsindex 2a7758fe55..2718fb3b23 100644--- a/crates/router/src/connector/netcetera/netcetera_types.rs+++ b/crates/router/src/connector/netcetera/netcetera_types.rs@@ -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)]diff --git a/crates/router/src/connector/powertranz/transformers.rs b/crates/router/src/connector/powertranz/transformers.rsindex 40fe823595..fedaabb5e7 100644--- a/crates/router/src/connector/powertranz/transformers.rs+++ b/crates/router/src/connector/powertranz/transformers.rs@@ -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")]diff --git a/crates/router/src/db/user_role.rs b/crates/router/src/db/user_role.rsindex cc3e246096..8689dfc653 100644--- a/crates/router/src/db/user_role.rs+++ b/crates/router/src/db/user_role.rs@@ -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- }-}diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rsindex 2bac740d37..956909f9e5 100644--- a/crates/router/src/routes/payments.rs+++ b/crates/router/src/routes/payments.rs@@ -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());diff --git a/crates/router/src/routes/refunds.rs b/crates/router/src/routes/refunds.rsindex 6c7af7496e..46ff0dce2a 100644--- a/crates/router/src/routes/refunds.rs+++ b/crates/router/src/routes/refunds.rs@@ -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,diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rsindex bee82d8935..795d6dd9ef 100644--- a/crates/router/src/services/api.rs+++ b/crates/router/src/services/api.rs@@ -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 {diff --git a/crates/router_derive/src/lib.rs b/crates/router_derive/src/lib.rsindex ff407deb09..31e28a2aaa 100644--- a/crates/router_derive/src/lib.rs+++ b/crates/router_derive/src/lib.rs@@ -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;