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 some clippy lints arising from v2 code (#6015)
Sanchith Hegdedec0a57f7699
diff --git a/.github/workflows/CI-pr.yml b/.github/workflows/CI-pr.ymlindex e43af03ec6..220c4f2577 100644--- a/.github/workflows/CI-pr.yml+++ b/.github/workflows/CI-pr.yml@@ -307,6 +307,7 @@ jobs:uses: dtolnay/rust-toolchain@masterwith:toolchain: stable 2 weeks ago+ components: clippy- name: Install Protocuses: arduino/setup-protoc@v3@@ -322,14 +323,9 @@ jobs:tool: justchecksum: true- - name: Run cargo check with v2 features enabled+ - name: Run cargo clippy with v2 features enabledshell: bash- env:- RUSTFLAGS: "-A warnings"- # Not denying warnings for now.- # We only want to ensure successful compilation for now.- # RUSTFLAGS: "-D warnings -A clippy::todo"- run: just check_v2+ run: just clippy_v2 -- -D warnings -Aunused -Aclippy::todo -Aclippy::diverging_sub_expression- name: Run cargo check enabling only the release and v2 featuresshell: bashdiff --git a/crates/common_utils/src/id_type/global_id.rs b/crates/common_utils/src/id_type/global_id.rsindex c0b6384abc..0709ce84d5 100644--- a/crates/common_utils/src/id_type/global_id.rs+++ b/crates/common_utils/src/id_type/global_id.rs@@ -63,13 +63,24 @@ impl From<AlphaNumericIdError> for CellIdError {impl CellId {/// Create a new cell id from a string- pub fn from_str(cell_id_string: impl AsRef<str>) -> Result<Self, CellIdError> {+ fn from_str(cell_id_string: impl AsRef<str>) -> Result<Self, CellIdError> {let trimmed_input_string = cell_id_string.as_ref().trim().to_string();let alphanumeric_id = AlphaNumericId::from(trimmed_input_string.into())?;let length_id = LengthId::from_alphanumeric_id(alphanumeric_id)?;Ok(Self(length_id))}+ /// Create a new cell id from a string+ pub fn from_string(+ input_string: impl AsRef<str>,+ ) -> error_stack::Result<Self, errors::ValidationError> {+ Self::from_str(input_string).change_context(+ errors::ValidationError::IncorrectValueProvided {+ field_name: "cell_id",+ },+ )+ }+/// Get the string representation of the cell idfn get_string_repr(&self) -> &str {&self.0 .0 .0@@ -115,7 +126,7 @@ impl GlobalId {pub(crate) fn from_string(input_string: std::borrow::Cow<'static, str>,) -> Result<Self, GlobalIdError> {- let length_id = LengthId::from(input_string.into())?;+ let length_id = LengthId::from(input_string)?;let input_string = &length_id.0 .0;let (cell_id, remaining) = input_string.split_once("_")diff --git a/crates/common_utils/src/id_type/global_id/payment_methods.rs b/crates/common_utils/src/id_type/global_id/payment_methods.rsindex 3929efd09b..f6f394242c 100644--- a/crates/common_utils/src/id_type/global_id/payment_methods.rs+++ b/crates/common_utils/src/id_type/global_id/payment_methods.rs@@ -1,4 +1,3 @@-use diesel::{backend::Backend, deserialize::FromSql, serialize::ToSql, sql_types};use error_stack::ResultExt;use crate::{@@ -7,6 +6,7 @@ use crate::{id_type::global_id::{CellId, GlobalEntity, GlobalId, GlobalIdError},};+/// A global id that can be used to identify a payment method#[derive(Debug,Clone,@@ -27,7 +27,7 @@ pub enum GlobalPaymentMethodIdError {}impl GlobalPaymentMethodId {- /// Create a new GlobalPaymentMethodId from celll id information+ /// Create a new GlobalPaymentMethodId from cell id informationpub fn generate(cell_id: &str) -> error_stack::Result<Self, GlobalPaymentMethodIdError> {let cell_id = CellId::from_str(cell_id).change_context(GlobalPaymentMethodIdError::ConstructionError)@@ -36,10 +36,12 @@ impl GlobalPaymentMethodId {Ok(Self(global_id))}+ /// Get string representation of the idpub fn get_string_repr(&self) -> &str {self.0.get_string_repr()}+ /// Construct a new GlobalPaymentMethodId from a stringpub fn generate_from_string(value: String) -> CustomResult<Self, GlobalPaymentMethodIdError> {let id = GlobalId::from_string(value.into()).change_context(GlobalPaymentMethodIdError::ConstructionError)?;@@ -47,7 +49,7 @@ impl GlobalPaymentMethodId {}}-impl<DB> diesel::Queryable<sql_types::Text, DB> for GlobalPaymentMethodId+impl<DB> diesel::Queryable<diesel::sql_types::Text, DB> for GlobalPaymentMethodIdwhereDB: diesel::backend::Backend,Self: diesel::deserialize::FromSql<diesel::sql_types::Text, DB>,@@ -58,10 +60,10 @@ where}}-impl<DB> ToSql<sql_types::Text, DB> for GlobalPaymentMethodId+impl<DB> diesel::serialize::ToSql<diesel::sql_types::Text, DB> for GlobalPaymentMethodIdwhere- DB: Backend,- GlobalId: ToSql<sql_types::Text, DB>,+ DB: diesel::backend::Backend,+ GlobalId: diesel::serialize::ToSql<diesel::sql_types::Text, DB>,{fn to_sql<'b>(&'b self,@@ -71,10 +73,10 @@ where}}-impl<DB> FromSql<sql_types::Text, DB> for GlobalPaymentMethodId+impl<DB> diesel::deserialize::FromSql<diesel::sql_types::Text, DB> for GlobalPaymentMethodIdwhere- DB: Backend,- GlobalId: FromSql<sql_types::Text, DB>,+ DB: diesel::backend::Backend,+ GlobalId: diesel::deserialize::FromSql<diesel::sql_types::Text, DB>,{fn from_sql(value: DB::RawValue<'_>) -> diesel::deserialize::Result<Self> {let global_id = GlobalId::from_sql(value)?;diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rsindex da56a1dc30..c59fb9b12f 100644--- a/crates/hyperswitch_domain_models/src/payments.rs+++ b/crates/hyperswitch_domain_models/src/payments.rs@@ -109,8 +109,8 @@ pub enum SurchargeCalculationOverride {impl From<Option<bool>> for TaxCalculationOverride {fn from(value: Option<bool>) -> Self {match value {- Some(true) => TaxCalculationOverride::Calculate,- _ => TaxCalculationOverride::Skip,+ Some(true) => Self::Calculate,+ _ => Self::Skip,}}}@@ -119,8 +119,8 @@ impl From<Option<bool>> for TaxCalculationOverride {impl From<Option<bool>> for SurchargeCalculationOverride {fn from(value: Option<bool>) -> Self {match value {- Some(true) => SurchargeCalculationOverride::Calculate,- _ => SurchargeCalculationOverride::Skip,+ Some(true) => Self::Calculate,+ _ => Self::Skip,}}}@@ -235,7 +235,7 @@ pub struct PaymentIntent {/// The details of the customer in a denormalized form. Only a subset of fields are stored.pub customer_details: Option<Encryptable<Secret<serde_json::Value>>>,/// The reference id for the order in the merchant's system. This value can be passed by the merchant.- pub merchant_reference_id: Option<common_utils::id_type::PaymentId>,+ pub merchant_reference_id: Option<id_type::PaymentId>,/// The billing address for the order in a denormalized form.pub billing_address: Option<Encryptable<Secret<serde_json::Value>>>,/// The shipping address for the order in a denormalized form.diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rsindex eb207a1950..381a84ce82 100644--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs@@ -1481,7 +1481,7 @@ impl behaviour::Conversion for PaymentIntent {type NewDstType = DieselPaymentIntentNew;async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {- let PaymentIntent {+ let Self {merchant_id,amount_details,status,@@ -1585,7 +1585,7 @@ impl behaviour::Conversion for PaymentIntent {async fn convert_back(state: &KeyManagerState,storage_model: Self::DstType,- key: &masking::Secret<Vec<u8>>,+ key: &Secret<Vec<u8>>,key_manager_identifier: keymanager::Identifier,) -> CustomResult<Self, ValidationError>wherediff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rsindex 0a7defc406..e59dd73cd3 100644--- a/crates/router/src/configs/settings.rs+++ b/crates/router/src/configs/settings.rs@@ -958,7 +958,7 @@ impl Default for CellInformation {// around the time of deserializing application settings.// And a panic at application startup is considered acceptable.#[allow(clippy::expect_used)]- let cell_id = common_utils::id_type::CellId::from_str("defid")+ let cell_id = common_utils::id_type::CellId::from_string("defid").expect("Failed to create a default for Cell Id");Self { id: cell_id }}diff --git a/crates/router/src/configs/validations.rs b/crates/router/src/configs/validations.rsindex 7736d7b3f3..bfea4eee42 100644--- a/crates/router/src/configs/validations.rs+++ b/crates/router/src/configs/validations.rs@@ -198,7 +198,7 @@ impl super::settings::CellInformation {pub fn validate(&self) -> Result<(), ApplicationError> {use common_utils::{fp_utils::when, id_type};- when(self == &super::settings::CellInformation::default(), || {+ when(self == &Self::default(), || {Err(ApplicationError::InvalidConfigurationValueError("CellId cannot be set to a default".into(),))diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rsindex e51771a280..cb26494b70 100644--- a/crates/router/src/core/payment_methods.rs+++ b/crates/router/src/core/payment_methods.rs@@ -21,13 +21,13 @@ use api_models::payment_methods;pub use api_models::{enums::PayoutConnectors, payouts as payout_types};#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]use common_utils::ext_traits::Encode;-use common_utils::{consts::DEFAULT_LOCALE, id_type::CustomerId};+use common_utils::{consts::DEFAULT_LOCALE, id_type};#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]use common_utils::{crypto::{self, Encryptable},ext_traits::{AsyncExt, Encode, ValueExt},fp_utils::when,- generate_id, id_type,+ generate_id,request::RequestContent,types as util_types,};@@ -40,9 +40,7 @@ use hyperswitch_domain_models::api::{GenericLinks, GenericLinksData};use hyperswitch_domain_models::payments::{payment_attempt::PaymentAttempt, PaymentIntent};#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]use masking::ExposeInterface;-use masking::PeekInterface;-#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]-use masking::Secret;+use masking::{PeekInterface, Secret};use router_env::{instrument, tracing};use time::Duration;@@ -198,10 +196,10 @@ pub async fn initiate_pm_collect_link(req.return_url.clone(),).await?;- let customer_id = CustomerId::try_from(Cow::from(pm_collect_link.primary_reference))+ let customer_id = id_type::CustomerId::try_from(Cow::from(pm_collect_link.primary_reference)).change_context(errors::ApiErrorResponse::InvalidDataValue {- field_name: "customer_id",- })?;+ field_name: "customer_id",+ })?;// Return responselet url = pm_collect_link.url.peek();@@ -321,11 +319,12 @@ pub async fn render_pm_collect_link(// else, send back form link} else {- let customer_id =- CustomerId::try_from(Cow::from(pm_collect_link.primary_reference.clone()))- .change_context(errors::ApiErrorResponse::InvalidDataValue {- field_name: "customer_id",- })?;+ let customer_id = id_type::CustomerId::try_from(Cow::from(+ pm_collect_link.primary_reference.clone(),+ ))+ .change_context(errors::ApiErrorResponse::InvalidDataValue {+ field_name: "customer_id",+ })?;// Fetch customerlet customer = db@@ -349,7 +348,7 @@ pub async fn render_pm_collect_link())?;let js_data = payment_methods::PaymentMethodCollectLinkDetails {- publishable_key: masking::Secret::new(merchant_account.publishable_key),+ publishable_key: Secret::new(merchant_account.publishable_key),client_secret: link_data.client_secret.clone(),pm_collect_link_id: pm_collect_link.link_id,customer_id: customer.customer_id,@@ -448,7 +447,7 @@ pub async fn add_payment_method_status_update_task(payment_method: &domain::PaymentMethod,prev_status: enums::PaymentMethodStatus,curr_status: enums::PaymentMethodStatus,- merchant_id: &common_utils::id_type::MerchantId,+ merchant_id: &id_type::MerchantId,) -> Result<(), errors::ProcessTrackerError> {let created_at = payment_method.created_at;let schedule_time =@@ -496,6 +495,7 @@ pub async fn add_payment_method_status_update_task(}#[cfg(feature = "v2")]+#[allow(clippy::too_many_arguments)]#[instrument(skip_all)]pub async fn retrieve_payment_method_with_token(_state: &SessionState,@@ -671,8 +671,8 @@ pub(crate) async fn get_payment_method_create_request(payment_method_data: Option<&domain::PaymentMethodData>,payment_method: Option<storage_enums::PaymentMethod>,payment_method_type: Option<storage_enums::PaymentMethodType>,- customer_id: &Option<CustomerId>,- billing_name: Option<masking::Secret<String>>,+ customer_id: &Option<id_type::CustomerId>,+ billing_name: Option<Secret<String>>,) -> RouterResult<payment_methods::PaymentMethodCreate> {match payment_method_data {Some(pm_data) => match payment_method {@@ -748,8 +748,8 @@ pub(crate) async fn get_payment_method_create_request(payment_method_data: Option<&domain::PaymentMethodData>,payment_method: Option<storage_enums::PaymentMethod>,payment_method_type: Option<storage_enums::PaymentMethodType>,- customer_id: &Option<CustomerId>,- billing_name: Option<masking::Secret<String>>,+ customer_id: &Option<id_type::CustomerId>,+ billing_name: Option<Secret<String>>,) -> RouterResult<payment_methods::PaymentMethodCreate> {match payment_method_data {Some(pm_data) => match payment_method {@@ -833,7 +833,7 @@ pub async fn create_payment_method(req: api::PaymentMethodCreate,merchant_account: &domain::MerchantAccount,key_store: &domain::MerchantKeyStore,-) -> errors::RouterResponse<api::PaymentMethodResponse> {+) -> RouterResponse<api::PaymentMethodResponse> {req.validate()?;let db = &*state.store;@@ -844,7 +844,7 @@ pub async fn create_payment_method(&(state.into()),&customer_id,merchant_account.get_id(),- &key_store,+ key_store,merchant_account.storage_scheme,).await@@ -860,10 +860,9 @@ pub async fn create_payment_method(.attach_printable("Unable to encrypt Payment method billing address")?;// create pm- let payment_method_id =- common_utils::id_type::GlobalPaymentMethodId::generate("random_cell_id")- .change_context(errors::ApiErrorResponse::InternalServerError)- .attach_printable("Unable to generate GlobalPaymentMethodId")?;+ let payment_method_id = id_type::GlobalPaymentMethodId::generate("random_cell_id")+ .change_context(errors::ApiErrorResponse::InternalServerError)+ .attach_printable("Unable to generate GlobalPaymentMethodId")?;let payment_method = create_payment_method_for_intent(state,@@ -897,7 +896,7 @@ pub async fn create_payment_method(let payment_method = db.update_payment_method(&(state.into()),- &key_store,+ key_store,payment_method,pm_update,merchant_account.storage_scheme,@@ -917,7 +916,7 @@ pub async fn create_payment_method(db.update_payment_method(&(state.into()),- &key_store,+ key_store,payment_method,pm_update,merchant_account.storage_scheme,@@ -940,7 +939,7 @@ pub async fn payment_method_intent_create(req: api::PaymentMethodIntentCreate,merchant_account: &domain::MerchantAccount,key_store: &domain::MerchantKeyStore,-) -> errors::RouterResponse<api::PaymentMethodResponse> {+) -> RouterResponse<api::PaymentMethodResponse> {let db = &*state.store;let merchant_id = merchant_account.get_id();let customer_id = req.customer_id.to_owned();@@ -949,7 +948,7 @@ pub async fn payment_method_intent_create(&(state.into()),&customer_id,merchant_account.get_id(),- &key_store,+ key_store,merchant_account.storage_scheme,).await@@ -966,10 +965,9 @@ pub async fn payment_method_intent_create(// create pm entry- let payment_method_id =- common_utils::id_type::GlobalPaymentMethodId::generate("random_cell_id")- .change_context(errors::ApiErrorResponse::InternalServerError)- .attach_printable("Unable to generate GlobalPaymentMethodId")?;+ let payment_method_id = id_type::GlobalPaymentMethodId::generate("random_cell_id")+ .change_context(errors::ApiErrorResponse::InternalServerError)+ .attach_printable("Unable to generate GlobalPaymentMethodId")?;let payment_method = create_payment_method_for_intent(state,@@ -997,19 +995,19 @@ pub async fn payment_method_intent_confirm(merchant_account: &domain::MerchantAccount,key_store: &domain::MerchantKeyStore,pm_id: String,-) -> errors::RouterResponse<api::PaymentMethodResponse> {+) -> RouterResponse<api::PaymentMethodResponse> {req.validate()?;let db = &*state.store;let client_secret = req.client_secret.clone();- let pm_id = common_utils::id_type::GlobalPaymentMethodId::generate_from_string(pm_id)+ let pm_id = id_type::GlobalPaymentMethodId::generate_from_string(pm_id).change_context(errors::ApiErrorResponse::InternalServerError).attach_printable("Unable to generate GlobalPaymentMethodId")?;let payment_method = db.find_payment_method(&(state.into()),- &key_store,+ key_store,&pm_id,merchant_account.storage_scheme,)@@ -1037,7 +1035,7 @@ pub async fn payment_method_intent_confirm(&(state.into()),&customer_id,merchant_account.get_id(),- &key_store,+ key_store,merchant_account.storage_scheme,).await@@ -1062,7 +1060,7 @@ pub async fn payment_method_intent_confirm(let payment_method = db.update_payment_method(&(state.into()),- &key_store,+ key_store,payment_method,pm_update,merchant_account.storage_scheme,@@ -1082,7 +1080,7 @@ pub async fn payment_method_intent_confirm(db.update_payment_method(&(state.into()),- &key_store,+ key_store,payment_method,pm_update,merchant_account.storage_scheme,@@ -1228,7 +1226,7 @@ pub async fn create_pm_additional_data_update(vault_id: Option<String>,payment_method: Option<api_enums::PaymentMethod>,payment_method_type: Option<api_enums::PaymentMethodType>,-) -> errors::RouterResult<storage::PaymentMethodUpdate> {+) -> RouterResult<storage::PaymentMethodUpdate> {let card = match pmd.clone() {api::PaymentMethodCreateData::Card(card) => api::PaymentMethodsData::Card(card.into()),};@@ -1244,7 +1242,7 @@ pub async fn create_pm_additional_data_update(locker_id: vault_id,payment_method,payment_method_type,- payment_method_data: Some(pmd).map(Into::into),+ payment_method_data: Some(pmd.into()),network_token_requestor_reference_id: None,network_token_locker_id: None,network_token_payment_method_data: None,@@ -1260,7 +1258,7 @@ pub async fn vault_payment_method(pmd: &api::PaymentMethodCreateData,merchant_account: &domain::MerchantAccount,key_store: &domain::MerchantKeyStore,-) -> errors::RouterResult<pm_types::AddVaultResponse> {+) -> RouterResult<pm_types::AddVaultResponse> {let db = &*state.store;// get fingerprint_id from locker@@ -1377,7 +1375,7 @@ pub async fn list_customer_payment_method_util(req: Option<api::PaymentMethodListRequest>,customer_id: Option<id_type::CustomerId>,is_payment_associated: bool,-) -> errors::RouterResponse<api::CustomerPaymentMethodsListResponse> {+) -> RouterResponse<api::CustomerPaymentMethodsListResponse> {let limit = req.as_ref().and_then(|pml_req| pml_req.limit);let (customer_id, payment_intent) = if is_payment_associated {@@ -1431,11 +1429,11 @@ pub async fn list_customer_payment_method(state: &SessionState,merchant_account: domain::MerchantAccount,key_store: domain::MerchantKeyStore,- payment_intent: Option<storage::PaymentIntent>,+ payment_intent: Option<PaymentIntent>,customer_id: &id_type::CustomerId,limit: Option<i64>,is_payment_associated: bool,-) -> errors::RouterResponse<api::CustomerPaymentMethodsListResponse> {+) -> RouterResponse<api::CustomerPaymentMethodsListResponse> {let db = &*state.store;let key_manager_state = &(state).into();// let key = key_store.key.get_inner().peek();@@ -1661,12 +1659,12 @@ async fn generate_saved_pm_response(#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]impl pm_types::SavedPMLPaymentsInfo {pub async fn form_payments_info(- payment_intent: storage::PaymentIntent,+ payment_intent: PaymentIntent,merchant_account: &domain::MerchantAccount,db: &dyn StorageInterface,key_manager_state: &util_types::keymanager::KeyManagerState,key_store: &domain::MerchantKeyStore,- ) -> errors::RouterResult<Self> {+ ) -> RouterResult<Self> {let requires_cvv = db.find_config_by_key_unwrap_or(format!(@@ -1718,7 +1716,7 @@ impl pm_types::SavedPMLPaymentsInfo {parent_payment_method_token: Option<String>,pma: &api::CustomerPaymentMethod,pm_list_context: PaymentMethodListContext,- ) -> errors::RouterResult<()> {+ ) -> RouterResult<()> {let token = parent_payment_method_token.as_ref().get_required_value("parent_payment_method_token")?;diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rsindex 6e3d89195d..a7ae7f9ca5 100644--- a/crates/router/src/core/payment_methods/cards.rs+++ b/crates/router/src/core/payment_methods/cards.rs@@ -226,7 +226,7 @@ async fn create_vault_request<R: pm_types::VaultingInterface>(jwekey: &settings::Jwekey,locker: &settings::Locker,payload: Vec<u8>,-) -> errors::CustomResult<services::Request, errors::VaultError> {+) -> errors::CustomResult<Request, errors::VaultError> {let private_key = jwekey.vault_private_key.peek().as_bytes();let jws = services::encryption::jws_sign_payload(@@ -241,7 +241,7 @@ async fn create_vault_request<R: pm_types::VaultingInterface>(let mut url = locker.host.to_owned();url.push_str(R::get_vaulting_request_url());- let mut request = services::Request::new(services::Method::Post, &url);+ let mut request = Request::new(services::Method::Post, &url);request.add_header(headers::CONTENT_TYPE,router_consts::VAULT_HEADER_CONTENT_TYPE.into(),diff --git a/crates/router/src/core/payment_methods/transformers.rs b/crates/router/src/core/payment_methods/transformers.rsindex 6583d109d5..ab21add60a 100644--- a/crates/router/src/core/payment_methods/transformers.rs+++ b/crates/router/src/core/payment_methods/transformers.rs@@ -310,15 +310,11 @@ pub async fn create_jwe_body_for_vault(let public_key = jwekey.vault_encryption_key.peek().as_bytes();- let jwe_encrypted = encryption::encrypt_jwe(- &payload,- public_key,- encryption::EncryptionAlgorithm::A256GCM,- None,- )- .await- .change_context(errors::VaultError::SaveCardFailed)- .attach_printable("Error on jwe encrypt")?;+ let jwe_encrypted =+ encryption::encrypt_jwe(&payload, public_key, EncryptionAlgorithm::A256GCM, None)+ .await+ .change_context(errors::VaultError::SaveCardFailed)+ .attach_printable("Error on jwe encrypt")?;let jwe_payload: Vec<&str> = jwe_encrypted.split('.').collect();let generate_jwe_body = |payload: Vec<&str>| -> Option<encryption::JweBody> {diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rsindex ded12b781d..23ac67c910 100644--- a/crates/router/src/core/payments/helpers.rs+++ b/crates/router/src/core/payments/helpers.rs@@ -1788,7 +1788,7 @@ pub async fn retrieve_payment_method_with_temporary_token(pub async fn retrieve_card_with_permanent_token(state: &SessionState,locker_id: &str,- _payment_method_id: &common_utils::id_type::GlobalPaymentMethodId,+ _payment_method_id: &id_type::GlobalPaymentMethodId,payment_intent: &PaymentIntent,card_token_data: Option<&domain::CardToken>,_merchant_key_store: &domain::MerchantKeyStore,diff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rsindex b51e7afb34..be2c25d476 100644--- a/crates/router/src/db/merchant_connector_account.rs+++ b/crates/router/src/db/merchant_connector_account.rs@@ -785,7 +785,7 @@ impl MerchantConnectorAccountInterface for Store {format!("{}_{}", _profile_id.get_string_repr(), _connector_name).into(),),cache::CacheKind::Accounts(- format!("{}", _merchant_connector_id.get_string_repr()).into(),+ _merchant_connector_id.get_string_repr().to_string().into(),),cache::CacheKind::CGraph(format!(diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rsindex cb75fe6a9b..c7b76d1780 100644--- a/crates/router/src/types/api/admin.rs+++ b/crates/router/src/types/api/admin.rs@@ -173,7 +173,7 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {}#[cfg(feature = "v2")]-impl ForeignTryFrom<domain::Profile> for admin::ProfileResponse {+impl ForeignTryFrom<domain::Profile> for ProfileResponse {type Error = error_stack::Report<errors::ParsingError>;fn foreign_try_from(item: domain::Profile) -> Result<Self, Self::Error> {@@ -193,7 +193,7 @@ impl ForeignTryFrom<domain::Profile> for admin::ProfileResponse {let order_fulfillment_time = item.order_fulfillment_time- .map(api_models::admin::OrderFulfillmentTime::try_new)+ .map(admin::OrderFulfillmentTime::try_new).transpose().change_context(errors::ParsingError::IntegerOverflow)?;diff --git a/crates/router/src/types/api/payment_methods.rs b/crates/router/src/types/api/payment_methods.rsindex 65111815b5..28d387771b 100644--- a/crates/router/src/types/api/payment_methods.rs+++ b/crates/router/src/types/api/payment_methods.rs@@ -69,25 +69,25 @@ impl PaymentMethodCreateExt for PaymentMethodCreate {self.payment_method_type,),|| {- return Err(report!(errors::ApiErrorResponse::InvalidRequestData {+ Err(report!(errors::ApiErrorResponse::InvalidRequestData {message: "Invalid 'payment_method_type' provided".to_string()})- .attach_printable("Invalid payment method type"));+ .attach_printable("Invalid payment method type"))},- );+ )?;utils::when(- !PaymentMethodCreate::validate_payment_method_data_against_payment_method(+ !Self::validate_payment_method_data_against_payment_method(self.payment_method,self.payment_method_data.clone(),),|| {- return Err(report!(errors::ApiErrorResponse::InvalidRequestData {+ Err(report!(errors::ApiErrorResponse::InvalidRequestData {message: "Invalid 'payment_method_data' provided".to_string()})- .attach_printable("Invalid payment method data"));+ .attach_printable("Invalid payment method data"))},- );+ )?;Ok(())}}@@ -101,25 +101,25 @@ impl PaymentMethodCreateExt for PaymentMethodIntentConfirm {self.payment_method_type,),|| {- return Err(report!(errors::ApiErrorResponse::InvalidRequestData {+ Err(report!(errors::ApiErrorResponse::InvalidRequestData {message: "Invalid 'payment_method_type' provided".to_string()})- .attach_printable("Invalid payment method type"));+ .attach_printable("Invalid payment method type"))},- );+ )?;utils::when(- !PaymentMethodIntentConfirm::validate_payment_method_data_against_payment_method(+ !Self::validate_payment_method_data_against_payment_method(self.payment_method,self.payment_method_data.clone(),),|| {- return Err(report!(errors::ApiErrorResponse::InvalidRequestData {+ Err(report!(errors::ApiErrorResponse::InvalidRequestData {message: "Invalid 'payment_method_data' provided".to_string()})- .attach_printable("Invalid payment method data"));+ .attach_printable("Invalid payment method data"))},- );+ )?;Ok(())}}diff --git a/crates/router/src/types/payment_methods.rs b/crates/router/src/types/payment_methods.rsindex 9b8d17db42..e55516fc3a 100644--- a/crates/router/src/types/payment_methods.rs+++ b/crates/router/src/types/payment_methods.rs@@ -78,7 +78,7 @@ impl VaultingInterface for GetVaultFingerprint {impl VaultingDataInterface for api::PaymentMethodCreateData {fn get_vaulting_data_key(&self) -> String {match &self {- api::PaymentMethodCreateData::Card(card) => card.card_number.to_string(),+ Self::Card(card) => card.card_number.to_string(),}}}diff --git a/justfile b/justfileindex 4cbaf38efe..e1b9c25935 100644--- a/justfile+++ b/justfile@@ -19,7 +19,7 @@ clippy *FLAGS:#! /usr/bin/env bashset -euo pipefail- FEATURES="$(cargo metadata --all-features --format-version 1 | \+ FEATURES="$(cargo metadata --all-features --format-version 1 --no-deps | \jq -r '[ ( .workspace_members | sort ) as $package_ids # Store workspace crate package IDs in `package_ids` array| .packages[] | select( IN(.id; $package_ids[]) ) | .features | keys[] ] | unique # Select all unique features from all workspace crates@@ -35,7 +35,7 @@ clippy_v2 *FLAGS:#! /usr/bin/env bashset -euo pipefail- FEATURES="$(cargo metadata --all-features --format-version 1 | \+ FEATURES="$(cargo metadata --all-features --format-version 1 --no-deps | \jq -r '[ ( .workspace_members | sort ) as $package_ids # Store workspace crate package IDs in `package_ids` array| .packages[] | select( IN(.id; $package_ids[]) ) | .features | keys[] ] | unique # Select all unique features from all workspace crates@@ -44,14 +44,14 @@ clippy_v2 *FLAGS:')"set -x- cargo clippy {{ check_flags }} --no-default-features --features "${FEATURES}" {{ FLAGS }}+ cargo clippy {{ check_flags }} --no-default-features --features "${FEATURES}" {{ FLAGS }}set +xcheck_v2 *FLAGS:#! /usr/bin/env bashset -euo pipefail- FEATURES="$(cargo metadata --all-features --format-version 1 | \+ FEATURES="$(cargo metadata --all-features --format-version 1 --no-deps | \jq -r '[ ( .workspace_members | sort ) as $package_ids # Store workspace crate package IDs in `package_ids` array| .packages[] | select( IN(.id; $package_ids[]) ) | .features | keys[] ] | unique # Select all unique features from all workspace crates@@ -60,7 +60,7 @@ check_v2 *FLAGS:')"set -x- cargo check {{ check_flags }} --no-default-features --features "${FEATURES}" {{ FLAGS }}+ cargo check {{ check_flags }} --no-default-features --features "${FEATURES}" {{ FLAGS }}set +xrun_v2:@@ -82,7 +82,7 @@ check *FLAGS:#! /usr/bin/env bashset -euo pipefail- FEATURES="$(cargo metadata --all-features --format-version 1 | \+ FEATURES="$(cargo metadata --all-features --format-version 1 --no-deps | \jq -r '[ ( .workspace_members | sort ) as $package_ids # Store workspace crate package IDs in `package_ids` array| .packages[] | select( IN(.id; $package_ids[]) ) | .features | keys[] ] | unique # Select all unique features from all workspace crates@@ -91,7 +91,7 @@ check *FLAGS:')"set -x- cargo check {{ check_flags }} --features "${FEATURES}" {{ FLAGS }}+ cargo check {{ check_flags }} --features "${FEATURES}" {{ FLAGS }}set +xalias cl := clippy