diff --git a/Cargo.lock b/Cargo.lock index e34c80bd9278..2007f4f88a08 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9266,9 +9266,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ "cfg-if 1.0.0", "once_cell", @@ -9277,13 +9277,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", "syn 2.0.77", @@ -9304,9 +9303,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -9314,9 +9313,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", @@ -9327,9 +9326,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "web-sys" diff --git a/crates/diesel_models/src/query/address.rs b/crates/diesel_models/src/query/address.rs index 23c3711a8ac2..21304a6ab9af 100644 --- a/crates/diesel_models/src/query/address.rs +++ b/crates/diesel_models/src/query/address.rs @@ -15,10 +15,7 @@ impl AddressNew { } impl Address { - pub async fn find_by_address_id<'a>( - conn: &PgPooledConn, - address_id: &str, - ) -> StorageResult { + pub async fn find_by_address_id(conn: &PgPooledConn, address_id: &str) -> StorageResult { generics::generic_find_by_id::<::Table, _, _>(conn, address_id.to_owned()) .await } @@ -104,7 +101,7 @@ impl Address { .await } - pub async fn find_by_merchant_id_payment_id_address_id<'a>( + pub async fn find_by_merchant_id_payment_id_address_id( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, payment_id: &common_utils::id_type::PaymentId, @@ -133,7 +130,7 @@ impl Address { } } - pub async fn find_optional_by_address_id<'a>( + pub async fn find_optional_by_address_id( conn: &PgPooledConn, address_id: &str, ) -> StorageResult> { diff --git a/crates/euclid/src/backend/vir_interpreter/types.rs b/crates/euclid/src/backend/vir_interpreter/types.rs index d0eca5fec2ef..c97f60ee17e2 100644 --- a/crates/euclid/src/backend/vir_interpreter/types.rs +++ b/crates/euclid/src/backend/vir_interpreter/types.rs @@ -31,8 +31,7 @@ impl Context { .get(&key) .and_then(|value| value.get_num_value()); - value.get_num_value().zip(ctx_num_value).map_or( - false, + value.get_num_value().zip(ctx_num_value).is_some_and( |(program_value, ctx_value)| { let program_num = program_value.number; let ctx_num = ctx_value.number; diff --git a/crates/euclid/src/dssa/graph.rs b/crates/euclid/src/dssa/graph.rs index 7ef9bb244d98..c4c8c2608619 100644 --- a/crates/euclid/src/dssa/graph.rs +++ b/crates/euclid/src/dssa/graph.rs @@ -194,11 +194,11 @@ impl cgraph::CheckingContext for AnalysisContext { DataType::EnumVariant | DataType::StrValue | DataType::MetadataValue => { value_set.contains(val) } - DataType::Number => val.get_num_value().map_or(false, |num_val| { + DataType::Number => val.get_num_value().is_some_and(|num_val| { value_set.iter().any(|ctx_val| { ctx_val .get_num_value() - .map_or(false, |ctx_num_val| num_val.fits(&ctx_num_val)) + .is_some_and(|ctx_num_val| num_val.fits(&ctx_num_val)) }) }), } diff --git a/crates/euclid_wasm/Cargo.toml b/crates/euclid_wasm/Cargo.toml index 19c425e4c01d..4f967df34ada 100644 --- a/crates/euclid_wasm/Cargo.toml +++ b/crates/euclid_wasm/Cargo.toml @@ -35,7 +35,7 @@ ron-parser = "0.1.4" serde = { version = "1.0", features = [] } serde-wasm-bindgen = "0.6.5" strum = { version = "0.26", features = ["derive"] } -wasm-bindgen = { version = "0.2.92" } +wasm-bindgen = { version = "0.2.99" } [lints] workspace = true diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs index 169e5ae146e4..6b75a2148c55 100644 --- a/crates/hyperswitch_connectors/src/utils.rs +++ b/crates/hyperswitch_connectors/src/utils.rs @@ -1338,9 +1338,7 @@ impl PaymentsAuthorizeRequestData for PaymentsAuthorizeData { } fn is_mandate_payment(&self) -> bool { ((self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) - && self.setup_future_usage.map_or(false, |setup_future_usage| { - setup_future_usage == FutureUsage::OffSession - })) + && (self.setup_future_usage == Some(FutureUsage::OffSession))) || self .mandate_id .as_ref() @@ -1409,9 +1407,7 @@ impl PaymentsAuthorizeRequestData for PaymentsAuthorizeData { fn is_customer_initiated_mandate_payment(&self) -> bool { (self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) - && self.setup_future_usage.map_or(false, |setup_future_usage| { - setup_future_usage == FutureUsage::OffSession - }) + && self.setup_future_usage == Some(FutureUsage::OffSession) } fn get_metadata_as_object(&self) -> Option { @@ -1469,9 +1465,7 @@ impl PaymentsAuthorizeRequestData for PaymentsAuthorizeData { } fn is_cit_mandate_payment(&self) -> bool { (self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) - && self.setup_future_usage.map_or(false, |setup_future_usage| { - setup_future_usage == FutureUsage::OffSession - }) + && self.setup_future_usage == Some(FutureUsage::OffSession) } } @@ -1687,9 +1681,7 @@ impl PaymentsCompleteAuthorizeRequestData for CompleteAuthorizeData { } fn is_mandate_payment(&self) -> bool { ((self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) - && self.setup_future_usage.map_or(false, |setup_future_usage| { - setup_future_usage == FutureUsage::OffSession - })) + && self.setup_future_usage == Some(FutureUsage::OffSession)) || self .mandate_id .as_ref() @@ -1712,9 +1704,7 @@ impl PaymentsCompleteAuthorizeRequestData for CompleteAuthorizeData { } fn is_cit_mandate_payment(&self) -> bool { (self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) - && self.setup_future_usage.map_or(false, |setup_future_usage| { - setup_future_usage == FutureUsage::OffSession - }) + && self.setup_future_usage == Some(FutureUsage::OffSession) } } pub trait AddressData { diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs index 9698b4ac5d83..d2b212e3ea0e 100644 --- a/crates/router/src/connector/authorizedotnet/transformers.rs +++ b/crates/router/src/connector/authorizedotnet/transformers.rs @@ -702,39 +702,41 @@ impl &domain::Card, ), ) -> Result { - let (profile, customer) = if item - .router_data - .request - .setup_future_usage - .map_or(false, |future_usage| { - matches!(future_usage, common_enums::FutureUsage::OffSession) - }) - && (item.router_data.request.customer_acceptance.is_some() - || item - .router_data - .request - .setup_mandate_details - .clone() - .map_or(false, |mandate_details| { - mandate_details.customer_acceptance.is_some() - })) { - ( - Some(ProfileDetails::CreateProfileDetails(CreateProfileDetails { - create_profile: true, - })), - Some(CustomerDetails { - //The payment ID is included in the customer details because the connector requires unique customer information with a length of fewer than 20 characters when creating a mandate. - //If the length exceeds 20 characters, a random alphanumeric string is used instead. - id: if item.router_data.payment_id.len() <= 20 { - item.router_data.payment_id.clone() - } else { - Alphanumeric.sample_string(&mut rand::thread_rng(), 20) - }, - }), - ) - } else { - (None, None) - }; + let (profile, customer) = + if item + .router_data + .request + .setup_future_usage + .is_some_and(|future_usage| { + matches!(future_usage, common_enums::FutureUsage::OffSession) + }) + && (item.router_data.request.customer_acceptance.is_some() + || item + .router_data + .request + .setup_mandate_details + .clone() + .is_some_and(|mandate_details| { + mandate_details.customer_acceptance.is_some() + })) + { + ( + Some(ProfileDetails::CreateProfileDetails(CreateProfileDetails { + create_profile: true, + })), + Some(CustomerDetails { + //The payment ID is included in the customer details because the connector requires unique customer information with a length of fewer than 20 characters when creating a mandate. + //If the length exceeds 20 characters, a random alphanumeric string is used instead. + id: if item.router_data.payment_id.len() <= 20 { + item.router_data.payment_id.clone() + } else { + Alphanumeric.sample_string(&mut rand::thread_rng(), 20) + }, + }), + ) + } else { + (None, None) + }; Ok(Self { transaction_type: TransactionType::try_from(item.router_data.request.capture_method)?, amount: item.amount, diff --git a/crates/router/src/connector/bankofamerica/transformers.rs b/crates/router/src/connector/bankofamerica/transformers.rs index 71cc006700e4..48363481ad85 100644 --- a/crates/router/src/connector/bankofamerica/transformers.rs +++ b/crates/router/src/connector/bankofamerica/transformers.rs @@ -619,18 +619,15 @@ impl .router_data .request .setup_future_usage - .map_or(false, |future_usage| { - matches!(future_usage, common_enums::FutureUsage::OffSession) - }) + == Some(common_enums::FutureUsage::OffSession) && (item.router_data.request.customer_acceptance.is_some() || item .router_data .request .setup_mandate_details .clone() - .map_or(false, |mandate_details| { - mandate_details.customer_acceptance.is_some() - })) { + .is_some_and(|mandate_details| mandate_details.customer_acceptance.is_some())) + { get_boa_mandate_action_details() } else if item.router_data.request.connector_mandate_id().is_some() { let original_amount = item diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs index 7ce98d3d5a34..2aa24e5ffdf4 100644 --- a/crates/router/src/connector/cybersource/transformers.rs +++ b/crates/router/src/connector/cybersource/transformers.rs @@ -632,18 +632,15 @@ impl .router_data .request .setup_future_usage - .map_or(false, |future_usage| { - matches!(future_usage, FutureUsage::OffSession) - }) + == Some(FutureUsage::OffSession) && (item.router_data.request.customer_acceptance.is_some() || item .router_data .request .setup_mandate_details .clone() - .map_or(false, |mandate_details| { - mandate_details.customer_acceptance.is_some() - })) { + .is_some_and(|mandate_details| mandate_details.customer_acceptance.is_some())) + { ( Some(vec![CybersourceActionsList::TokenCreate]), Some(vec![ @@ -960,35 +957,30 @@ impl let connector_merchant_config = CybersourceConnectorMetadataObject::try_from(&item.router_data.connector_meta_data)?; - let (action_list, action_token_types, authorization_options) = if item - .router_data - .request - .setup_future_usage - .map_or(false, |future_usage| { - matches!(future_usage, FutureUsage::OffSession) - }) - //TODO check for customer acceptance also - { - ( - Some(vec![CybersourceActionsList::TokenCreate]), - Some(vec![ - CybersourceActionsTokenType::PaymentInstrument, - CybersourceActionsTokenType::Customer, - ]), - Some(CybersourceAuthorizationOptions { - initiator: Some(CybersourcePaymentInitiator { - initiator_type: Some(CybersourcePaymentInitiatorTypes::Customer), - credential_stored_on_file: Some(true), - stored_credential_used: None, + let (action_list, action_token_types, authorization_options) = + if item.router_data.request.setup_future_usage == Some(FutureUsage::OffSession) + //TODO check for customer acceptance also + { + ( + Some(vec![CybersourceActionsList::TokenCreate]), + Some(vec![ + CybersourceActionsTokenType::PaymentInstrument, + CybersourceActionsTokenType::Customer, + ]), + Some(CybersourceAuthorizationOptions { + initiator: Some(CybersourcePaymentInitiator { + initiator_type: Some(CybersourcePaymentInitiatorTypes::Customer), + credential_stored_on_file: Some(true), + stored_credential_used: None, + }), + merchant_intitiated_transaction: None, + ignore_avs_result: connector_merchant_config.disable_avs, + ignore_cv_result: connector_merchant_config.disable_cvn, }), - merchant_intitiated_transaction: None, - ignore_avs_result: connector_merchant_config.disable_avs, - ignore_cv_result: connector_merchant_config.disable_cvn, - }), - ) - } else { - (None, None, None) - }; + ) + } else { + (None, None, None) + }; Ok(Self { capture: Some(matches!( item.router_data.request.capture_method, diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rs index 3e75130f575d..b96283247b4c 100644 --- a/crates/router/src/connector/noon/transformers.rs +++ b/crates/router/src/connector/noon/transformers.rs @@ -879,7 +879,7 @@ impl TryFrom> transaction .transaction_reference .clone() - .map_or(false, |transaction_instance| { + .is_some_and(|transaction_instance| { transaction_instance == item.data.request.refund_id }) }) diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs index 85b1dd221f72..cbf1867b08ba 100644 --- a/crates/router/src/connector/utils.rs +++ b/crates/router/src/connector/utils.rs @@ -893,9 +893,7 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData { fn is_mandate_payment(&self) -> bool { ((self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) - && self.setup_future_usage.map_or(false, |setup_future_usage| { - setup_future_usage == storage_enums::FutureUsage::OffSession - })) + && self.setup_future_usage == Some(storage_enums::FutureUsage::OffSession)) || self .mandate_id .as_ref() @@ -904,9 +902,7 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData { } fn is_cit_mandate_payment(&self) -> bool { (self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) - && self.setup_future_usage.map_or(false, |setup_future_usage| { - setup_future_usage == storage_enums::FutureUsage::OffSession - }) + && self.setup_future_usage == Some(storage_enums::FutureUsage::OffSession) } fn get_webhook_url(&self) -> Result { self.webhook_url @@ -973,9 +969,7 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData { fn is_customer_initiated_mandate_payment(&self) -> bool { (self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) - && self.setup_future_usage.map_or(false, |setup_future_usage| { - setup_future_usage == storage_enums::FutureUsage::OffSession - }) + && self.setup_future_usage == Some(storage_enums::FutureUsage::OffSession) } fn get_metadata_as_object(&self) -> Option { @@ -1123,9 +1117,7 @@ impl PaymentsCompleteAuthorizeRequestData for types::CompleteAuthorizeData { } fn is_mandate_payment(&self) -> bool { ((self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) - && self.setup_future_usage.map_or(false, |setup_future_usage| { - setup_future_usage == storage_enums::FutureUsage::OffSession - })) + && self.setup_future_usage == Some(storage_enums::FutureUsage::OffSession)) || self .mandate_id .as_ref() @@ -1134,9 +1126,7 @@ impl PaymentsCompleteAuthorizeRequestData for types::CompleteAuthorizeData { } fn is_cit_mandate_payment(&self) -> bool { (self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) - && self.setup_future_usage.map_or(false, |setup_future_usage| { - setup_future_usage == storage_enums::FutureUsage::OffSession - }) + && self.setup_future_usage == Some(storage_enums::FutureUsage::OffSession) } /// Attempts to retrieve the connector mandate reference ID as a `Result`. fn get_connector_mandate_request_reference_id(&self) -> Result { diff --git a/crates/router/src/connector/wellsfargo/transformers.rs b/crates/router/src/connector/wellsfargo/transformers.rs index 937af33bd798..0500b098bb18 100644 --- a/crates/router/src/connector/wellsfargo/transformers.rs +++ b/crates/router/src/connector/wellsfargo/transformers.rs @@ -567,18 +567,15 @@ impl .router_data .request .setup_future_usage - .map_or(false, |future_usage| { - matches!(future_usage, FutureUsage::OffSession) - }) + == Some(FutureUsage::OffSession) && (item.router_data.request.customer_acceptance.is_some() || item .router_data .request .setup_mandate_details .clone() - .map_or(false, |mandate_details| { - mandate_details.customer_acceptance.is_some() - })) { + .is_some_and(|mandate_details| mandate_details.customer_acceptance.is_some())) + { ( Some(vec![WellsfargoActionsList::TokenCreate]), Some(vec![ diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index 35df1ca8df3e..a8db0e998e47 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -1748,7 +1748,7 @@ struct PMAuthConfigValidation<'a> { key_manager_state: &'a KeyManagerState, } -impl<'a> PMAuthConfigValidation<'a> { +impl PMAuthConfigValidation<'_> { async fn validate_pm_auth(&self, val: &pii::SecretSerdeValue) -> RouterResponse<()> { let config = serde_json::from_value::( val.clone().expose(), @@ -1865,7 +1865,7 @@ struct MerchantDefaultConfigUpdate<'a> { transaction_type: &'a api_enums::TransactionType, } #[cfg(feature = "v1")] -impl<'a> MerchantDefaultConfigUpdate<'a> { +impl MerchantDefaultConfigUpdate<'_> { async fn retrieve_and_update_default_fallback_routing_algorithm_if_routable_connector_exists( &self, ) -> RouterResult<()> { @@ -1938,11 +1938,7 @@ impl<'a> MerchantDefaultConfigUpdate<'a> { }; if default_routing_config.contains(&choice) { default_routing_config.retain(|mca| { - mca.merchant_connector_id - .as_ref() - .map_or(true, |merchant_connector_id| { - merchant_connector_id != self.merchant_connector_id - }) + mca.merchant_connector_id.as_ref() != Some(self.merchant_connector_id) }); routing::helpers::update_merchant_default_config( self.store, @@ -1954,11 +1950,7 @@ impl<'a> MerchantDefaultConfigUpdate<'a> { } if default_routing_config_for_profile.contains(&choice.clone()) { default_routing_config_for_profile.retain(|mca| { - mca.merchant_connector_id - .as_ref() - .map_or(true, |merchant_connector_id| { - merchant_connector_id != self.merchant_connector_id - }) + mca.merchant_connector_id.as_ref() != Some(self.merchant_connector_id) }); routing::helpers::update_merchant_default_config( self.store, @@ -1982,7 +1974,7 @@ struct DefaultFallbackRoutingConfigUpdate<'a> { key_manager_state: &'a KeyManagerState, } #[cfg(feature = "v2")] -impl<'a> DefaultFallbackRoutingConfigUpdate<'a> { +impl DefaultFallbackRoutingConfigUpdate<'_> { async fn retrieve_and_update_default_fallback_routing_algorithm_if_routable_connector_exists( &self, ) -> RouterResult<()> { @@ -2025,11 +2017,7 @@ impl<'a> DefaultFallbackRoutingConfigUpdate<'a> { }; if default_routing_config_for_profile.contains(&choice.clone()) { default_routing_config_for_profile.retain(|mca| { - mca.merchant_connector_id - .as_ref() - .map_or(true, |merchant_connector_id| { - merchant_connector_id != self.merchant_connector_id - }) + (mca.merchant_connector_id.as_ref() != Some(self.merchant_connector_id)) }); profile_wrapper diff --git a/crates/router/src/core/blocklist/transformers.rs b/crates/router/src/core/blocklist/transformers.rs index b5b3d6625e14..f1194d7d6809 100644 --- a/crates/router/src/core/blocklist/transformers.rs +++ b/crates/router/src/core/blocklist/transformers.rs @@ -32,7 +32,7 @@ impl ForeignFrom for blocklist::AddToBlocklistResponse { } } -async fn generate_fingerprint_request<'a>( +async fn generate_fingerprint_request( jwekey: &settings::Jwekey, locker: &settings::Locker, payload: &blocklist::GenerateFingerprintRequest, diff --git a/crates/router/src/core/customers.rs b/crates/router/src/core/customers.rs index 65bbf736f1a7..4f69cf41963d 100644 --- a/crates/router/src/core/customers.rs +++ b/crates/router/src/core/customers.rs @@ -314,7 +314,7 @@ struct AddressStructForDbEntry<'a> { } #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] -impl<'a> AddressStructForDbEntry<'a> { +impl AddressStructForDbEntry<'_> { async fn encrypt_customer_address_and_set_to_db( &self, db: &dyn StorageInterface, @@ -1029,7 +1029,7 @@ struct AddressStructForDbUpdate<'a> { } #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] -impl<'a> AddressStructForDbUpdate<'a> { +impl AddressStructForDbUpdate<'_> { async fn update_address_if_sent( &self, db: &dyn StorageInterface, @@ -1131,7 +1131,7 @@ struct VerifyIdForUpdateCustomer<'a> { } #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] -impl<'a> VerifyIdForUpdateCustomer<'a> { +impl VerifyIdForUpdateCustomer<'_> { async fn verify_id_and_get_customer_object( &self, db: &dyn StorageInterface, @@ -1152,7 +1152,7 @@ impl<'a> VerifyIdForUpdateCustomer<'a> { } #[cfg(all(feature = "v2", feature = "customer_v2"))] -impl<'a> VerifyIdForUpdateCustomer<'a> { +impl VerifyIdForUpdateCustomer<'_> { async fn verify_id_and_get_customer_object( &self, db: &dyn StorageInterface, diff --git a/crates/router/src/core/fraud_check.rs b/crates/router/src/core/fraud_check.rs index 99a60817303a..a2a9864aadc9 100644 --- a/crates/router/src/core/fraud_check.rs +++ b/crates/router/src/core/fraud_check.rs @@ -379,7 +379,7 @@ where #[cfg(feature = "v2")] #[allow(clippy::too_many_arguments)] -pub async fn make_frm_data_and_fraud_check_operation<'a, F, D>( +pub async fn make_frm_data_and_fraud_check_operation( _db: &dyn StorageInterface, state: &SessionState, merchant_account: &domain::MerchantAccount, @@ -402,7 +402,7 @@ where #[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] -pub async fn make_frm_data_and_fraud_check_operation<'a, F, D>( +pub async fn make_frm_data_and_fraud_check_operation( _db: &dyn StorageInterface, state: &SessionState, merchant_account: &domain::MerchantAccount, @@ -486,7 +486,7 @@ where } #[allow(clippy::too_many_arguments)] -pub async fn pre_payment_frm_core<'a, F, Req, D>( +pub async fn pre_payment_frm_core( state: &SessionState, merchant_account: &domain::MerchantAccount, payment_data: &mut D, @@ -578,7 +578,7 @@ where } #[allow(clippy::too_many_arguments)] -pub async fn post_payment_frm_core<'a, F, D>( +pub async fn post_payment_frm_core( state: &SessionState, req_state: ReqState, merchant_account: &domain::MerchantAccount, @@ -674,7 +674,7 @@ where } #[allow(clippy::too_many_arguments)] -pub async fn call_frm_before_connector_call<'a, F, Req, D>( +pub async fn call_frm_before_connector_call( operation: &BoxedOperation<'_, F, Req, D>, merchant_account: &domain::MerchantAccount, payment_data: &mut D, diff --git a/crates/router/src/core/fraud_check/flows/checkout_flow.rs b/crates/router/src/core/fraud_check/flows/checkout_flow.rs index e6ff3fdbfca3..6711b96b0665 100644 --- a/crates/router/src/core/fraud_check/flows/checkout_flow.rs +++ b/crates/router/src/core/fraud_check/flows/checkout_flow.rs @@ -200,9 +200,9 @@ impl FeatureFrm for FrmCheckoutRouter } } -pub async fn decide_frm_flow<'a, 'b>( - router_data: &'b mut FrmCheckoutRouterData, - state: &'a SessionState, +pub async fn decide_frm_flow( + router_data: &mut FrmCheckoutRouterData, + state: &SessionState, connector: &FraudCheckConnectorData, call_connector_action: payments::CallConnectorAction, _merchant_account: &domain::MerchantAccount, diff --git a/crates/router/src/core/fraud_check/flows/record_return.rs b/crates/router/src/core/fraud_check/flows/record_return.rs index 21c5de5ed3b6..d639345e227b 100644 --- a/crates/router/src/core/fraud_check/flows/record_return.rs +++ b/crates/router/src/core/fraud_check/flows/record_return.rs @@ -168,9 +168,9 @@ impl FeatureFrm for FrmRecordReturnRou } } -pub async fn decide_frm_flow<'a, 'b>( - router_data: &'b mut FrmRecordReturnRouterData, - state: &'a SessionState, +pub async fn decide_frm_flow( + router_data: &mut FrmRecordReturnRouterData, + state: &SessionState, connector: &FraudCheckConnectorData, call_connector_action: payments::CallConnectorAction, _merchant_account: &domain::MerchantAccount, diff --git a/crates/router/src/core/fraud_check/flows/sale_flow.rs b/crates/router/src/core/fraud_check/flows/sale_flow.rs index 189edb5bc080..34fbda2c685e 100644 --- a/crates/router/src/core/fraud_check/flows/sale_flow.rs +++ b/crates/router/src/core/fraud_check/flows/sale_flow.rs @@ -176,9 +176,9 @@ impl FeatureFrm for FrmSaleRouterData { } } -pub async fn decide_frm_flow<'a, 'b>( - router_data: &'b mut FrmSaleRouterData, - state: &'a SessionState, +pub async fn decide_frm_flow( + router_data: &mut FrmSaleRouterData, + state: &SessionState, connector: &FraudCheckConnectorData, call_connector_action: payments::CallConnectorAction, _merchant_account: &domain::MerchantAccount, diff --git a/crates/router/src/core/fraud_check/flows/transaction_flow.rs b/crates/router/src/core/fraud_check/flows/transaction_flow.rs index 7ddf41c509fc..1675fdfb383b 100644 --- a/crates/router/src/core/fraud_check/flows/transaction_flow.rs +++ b/crates/router/src/core/fraud_check/flows/transaction_flow.rs @@ -185,9 +185,9 @@ impl FeatureFrm for FrmTransact } } -pub async fn decide_frm_flow<'a, 'b>( - router_data: &'b mut FrmTransactionRouterData, - state: &'a SessionState, +pub async fn decide_frm_flow( + router_data: &mut FrmTransactionRouterData, + state: &SessionState, connector: &frm_api::FraudCheckConnectorData, call_connector_action: payments::CallConnectorAction, _merchant_account: &domain::MerchantAccount, diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs index 79cfb6950b3a..5bd2c07073ef 100644 --- a/crates/router/src/core/payment_methods/cards.rs +++ b/crates/router/src/core/payment_methods/cards.rs @@ -2303,40 +2303,38 @@ pub fn validate_payment_method_update( card_updation_obj .card_exp_month .map(|exp_month| exp_month.expose()) - .map_or(false, |new_exp_month| { + .is_some_and(|new_exp_month| { existing_card_data .expiry_month .map(|exp_month| exp_month.expose()) - .map_or(true, |old_exp_month| new_exp_month != old_exp_month) + != Some(new_exp_month) }) || card_updation_obj .card_exp_year .map(|exp_year| exp_year.expose()) - .map_or(false, |new_exp_year| { + .is_some_and(|new_exp_year| { existing_card_data .expiry_year .map(|exp_year| exp_year.expose()) - .map_or(true, |old_exp_year| new_exp_year != old_exp_year) + != Some(new_exp_year) }) || card_updation_obj .card_holder_name .map(|name| name.expose()) - .map_or(false, |new_card_holder_name| { + .is_some_and(|new_card_holder_name| { existing_card_data .card_holder_name .map(|name| name.expose()) - .map_or(true, |old_card_holder_name| { - new_card_holder_name != old_card_holder_name - }) + != Some(new_card_holder_name) }) || card_updation_obj .nick_name .map(|nick_name| nick_name.expose()) - .map_or(false, |new_nick_name| { + .is_some_and(|new_nick_name| { existing_card_data .nick_name .map(|nick_name| nick_name.expose()) - .map_or(true, |old_nick_name| new_nick_name != old_nick_name) + != Some(new_nick_name) }) } @@ -4212,9 +4210,9 @@ pub async fn list_payment_methods( } }); - let is_tax_connector_enabled = business_profile.as_ref().map_or(false, |business_profile| { - business_profile.get_is_tax_connector_enabled() - }); + let is_tax_connector_enabled = business_profile + .as_ref() + .is_some_and(|business_profile| business_profile.get_is_tax_connector_enabled()); Ok(services::ApplicationResponse::Json( api::PaymentMethodListResponse { diff --git a/crates/router/src/core/payment_methods/utils.rs b/crates/router/src/core/payment_methods/utils.rs index d7e83cb5bf22..5885b830e7ab 100644 --- a/crates/router/src/core/payment_methods/utils.rs +++ b/crates/router/src/core/payment_methods/utils.rs @@ -41,7 +41,7 @@ pub fn make_pm_graph( Ok(()) } -pub async fn get_merchant_pm_filter_graph<'a>( +pub async fn get_merchant_pm_filter_graph( state: &SessionState, key: &str, ) -> Option>> { diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs index b7b3420987d1..ed7b84e8329b 100644 --- a/crates/router/src/core/payments/operations/payment_create.rs +++ b/crates/router/src/core/payments/operations/payment_create.rs @@ -1193,7 +1193,7 @@ impl PaymentCreate { payment_id.get_attempt_id(1) }; - if request.mandate_data.as_ref().map_or(false, |mandate_data| { + if request.mandate_data.as_ref().is_some_and(|mandate_data| { mandate_data.update_mandate_id.is_some() && mandate_data.mandate_type.is_some() }) { Err(errors::ApiErrorResponse::InvalidRequestData {message:"Only one field out of 'mandate_type' and 'update_mandate_id' was expected, found both".to_string()})? diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs index 8f3f40edf066..45bd0a6a015b 100644 --- a/crates/router/src/core/payments/routing.rs +++ b/crates/router/src/core/payments/routing.rs @@ -554,7 +554,7 @@ pub fn perform_volume_split( } #[cfg(feature = "v1")] -pub async fn get_merchant_cgraph<'a>( +pub async fn get_merchant_cgraph( state: &SessionState, key_store: &domain::MerchantKeyStore, profile_id: &common_utils::id_type::ProfileId, @@ -601,7 +601,7 @@ pub async fn get_merchant_cgraph<'a>( } #[cfg(feature = "v1")] -pub async fn refresh_cgraph_cache<'a>( +pub async fn refresh_cgraph_cache( state: &SessionState, key_store: &domain::MerchantKeyStore, key: String, diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs index b07094c321cc..060fc64f8918 100644 --- a/crates/router/src/core/payouts/helpers.rs +++ b/crates/router/src/core/payouts/helpers.rs @@ -49,8 +49,8 @@ use crate::{ }; #[allow(clippy::too_many_arguments)] -pub async fn make_payout_method_data<'a>( - state: &'a SessionState, +pub async fn make_payout_method_data( + state: &SessionState, payout_method_data: Option<&api::PayoutMethodData>, payout_token: Option<&str>, customer_id: &id_type::CustomerId, diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs index e78c9471e61e..1e788b6acee4 100644 --- a/crates/router/src/core/refunds.rs +++ b/crates/router/src/core/refunds.rs @@ -426,7 +426,7 @@ where // ********************************************** REFUND SYNC ********************************************** -pub async fn refund_response_wrapper<'a, F, Fut, T, Req>( +pub async fn refund_response_wrapper( state: SessionState, merchant_account: domain::MerchantAccount, profile_id: Option, diff --git a/crates/router/src/core/relay/utils.rs b/crates/router/src/core/relay/utils.rs index 1c201fba56ff..78e42039e02f 100644 --- a/crates/router/src/core/relay/utils.rs +++ b/crates/router/src/core/relay/utils.rs @@ -17,8 +17,8 @@ const IRRELEVANT_PAYMENT_INTENT_ID: &str = "irrelevant_payment_intent_id"; const IRRELEVANT_PAYMENT_ATTEMPT_ID: &str = "irrelevant_payment_attempt_id"; -pub async fn construct_relay_refund_router_data<'a, F>( - state: &'a SessionState, +pub async fn construct_relay_refund_router_data( + state: &SessionState, merchant_id: &id_type::MerchantId, connector_account: &domain::MerchantConnectorAccount, relay_record: &hyperswitch_domain_models::relay::Relay, diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs index 6f739c48ae3f..1395563a30a5 100644 --- a/crates/router/src/core/routing/helpers.rs +++ b/crates/router/src/core/routing/helpers.rs @@ -575,7 +575,7 @@ pub fn get_default_config_key( /// Retrieves cached success_based routing configs specific to tenant and profile #[cfg(all(feature = "v1", feature = "dynamic_routing"))] -pub async fn get_cached_success_based_routing_config_for_profile<'a>( +pub async fn get_cached_success_based_routing_config_for_profile( state: &SessionState, key: &str, ) -> Option> { diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs index 5e126310fa6c..0f775eda8553 100644 --- a/crates/router/src/core/utils.rs +++ b/crates/router/src/core/utils.rs @@ -922,8 +922,8 @@ pub async fn construct_upload_file_router_data<'a>( } #[cfg(feature = "v2")] -pub async fn construct_payments_dynamic_tax_calculation_router_data<'a, F: Clone>( - state: &'a SessionState, +pub async fn construct_payments_dynamic_tax_calculation_router_data( + state: &SessionState, merchant_account: &domain::MerchantAccount, _key_store: &domain::MerchantKeyStore, payment_data: &mut PaymentData, @@ -933,8 +933,8 @@ pub async fn construct_payments_dynamic_tax_calculation_router_data<'a, F: Clone } #[cfg(feature = "v1")] -pub async fn construct_payments_dynamic_tax_calculation_router_data<'a, F: Clone>( - state: &'a SessionState, +pub async fn construct_payments_dynamic_tax_calculation_router_data( + state: &SessionState, merchant_account: &domain::MerchantAccount, _key_store: &domain::MerchantKeyStore, payment_data: &mut PaymentData, diff --git a/crates/router/src/core/webhooks/utils.rs b/crates/router/src/core/webhooks/utils.rs index 256fae78d4a8..569570428600 100644 --- a/crates/router/src/core/webhooks/utils.rs +++ b/crates/router/src/core/webhooks/utils.rs @@ -57,7 +57,7 @@ pub async fn is_webhook_event_disabled( } } -pub async fn construct_webhook_router_data<'a>( +pub async fn construct_webhook_router_data( state: &SessionState, connector_name: &str, merchant_connector_account: domain::MerchantConnectorAccount, diff --git a/crates/router/src/db/dashboard_metadata.rs b/crates/router/src/db/dashboard_metadata.rs index 742c03dde4a0..4f1624f34571 100644 --- a/crates/router/src/db/dashboard_metadata.rs +++ b/crates/router/src/db/dashboard_metadata.rs @@ -332,10 +332,7 @@ impl DashboardMetadataInterface for MockDb { let index_to_remove = dashboard_metadata .iter() .position(|metadata_inner| { - metadata_inner - .user_id - .as_deref() - .map_or(false, |user_id_inner| user_id_inner == user_id) + metadata_inner.user_id.as_deref() == Some(user_id) && metadata_inner.merchant_id == *merchant_id && metadata_inner.data_key == data_key }) diff --git a/crates/router/src/db/refund.rs b/crates/router/src/db/refund.rs index 88962f73233a..e07821cd9a80 100644 --- a/crates/router/src/db/refund.rs +++ b/crates/router/src/db/refund.rs @@ -1136,7 +1136,7 @@ impl RefundInterface for MockDb { || refund .merchant_connector_id .as_ref() - .map_or(false, |id| unique_merchant_connector_ids.contains(id)) + .is_some_and(|id| unique_merchant_connector_ids.contains(id)) }) .filter(|refund| { unique_currencies.is_empty() || unique_currencies.contains(&refund.currency) @@ -1342,7 +1342,7 @@ impl RefundInterface for MockDb { || refund .merchant_connector_id .as_ref() - .map_or(false, |id| unique_merchant_connector_ids.contains(id)) + .is_some_and(|id| unique_merchant_connector_ids.contains(id)) }) .filter(|refund| { unique_currencies.is_empty() || unique_currencies.contains(&refund.currency) diff --git a/crates/router/src/services/authentication/blacklist.rs b/crates/router/src/services/authentication/blacklist.rs index 0ac8c419ef69..da5f87a450e1 100644 --- a/crates/router/src/services/authentication/blacklist.rs +++ b/crates/router/src/services/authentication/blacklist.rs @@ -79,7 +79,7 @@ pub async fn check_user_in_blacklist( .get_key::>(token.as_str()) .await .change_context(ApiErrorResponse::InternalServerError) - .map(|timestamp| timestamp.map_or(false, |timestamp| timestamp > token_issued_at)) + .map(|timestamp| timestamp > Some(token_issued_at)) } pub async fn check_role_in_blacklist( @@ -94,7 +94,7 @@ pub async fn check_role_in_blacklist( .get_key::>(token.as_str()) .await .change_context(ApiErrorResponse::InternalServerError) - .map(|timestamp| timestamp.map_or(false, |timestamp| timestamp > token_issued_at)) + .map(|timestamp| timestamp > Some(token_issued_at)) } #[cfg(feature = "email")] diff --git a/crates/router/src/services/pm_auth.rs b/crates/router/src/services/pm_auth.rs index d63dadc8b157..2d8097037dc2 100644 --- a/crates/router/src/services/pm_auth.rs +++ b/crates/router/src/services/pm_auth.rs @@ -11,9 +11,9 @@ use crate::{ services::{self}, }; -pub async fn execute_connector_processing_step<'b, 'a, T, Req, Resp>( +pub async fn execute_connector_processing_step<'b, T, Req, Resp>( state: &'b SessionState, - connector_integration: BoxedConnectorIntegration<'a, T, Req, Resp>, + connector_integration: BoxedConnectorIntegration<'_, T, Req, Resp>, req: &'b PaymentAuthRouterData, connector: &pm_auth_types::PaymentMethodAuthConnectors, ) -> errors::CustomResult, ConnectorError> diff --git a/crates/router/src/utils/user/dashboard_metadata.rs b/crates/router/src/utils/user/dashboard_metadata.rs index 39a76844be1e..b5e16290fca5 100644 --- a/crates/router/src/utils/user/dashboard_metadata.rs +++ b/crates/router/src/utils/user/dashboard_metadata.rs @@ -281,7 +281,7 @@ pub fn parse_string_to_enums(query: String) -> UserResult, value_to_be_checked: &str) -> bool { value .as_ref() - .map_or(false, |mail| !mail.contains(value_to_be_checked)) + .is_some_and(|mail| !mail.contains(value_to_be_checked)) } pub fn is_prod_email_required(data: &ProdIntent, user_email: String) -> bool { diff --git a/crates/storage_impl/src/redis/kv_store.rs b/crates/storage_impl/src/redis/kv_store.rs index 9203a14ae21c..17974a3b9bc0 100644 --- a/crates/storage_impl/src/redis/kv_store.rs +++ b/crates/storage_impl/src/redis/kv_store.rs @@ -288,10 +288,10 @@ impl std::fmt::Display for Op<'_> { } } -pub async fn decide_storage_scheme<'a, T, D>( +pub async fn decide_storage_scheme( store: &KVRouterStore, storage_scheme: MerchantStorageScheme, - operation: Op<'a>, + operation: Op<'_>, ) -> MerchantStorageScheme where D: de::DeserializeOwned