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: remove pm_modular feature flag (#11868)
Kashif8510de7bdc92
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.tomlindex 92e08f8f3c..5bac2d6b94 100644--- a/crates/router/Cargo.toml+++ b/crates/router/Cargo.toml@@ -36,8 +36,6 @@ v1 = ["common_default", "api_models/v1", "diesel_models/v1", "hyperswitch_domaindynamic_routing = ["external_services/dynamic_routing", "storage_impl/dynamic_routing", "api_models/dynamic_routing"]revenue_recovery = ["api_models/revenue_recovery", "hyperswitch_interfaces/revenue_recovery", "hyperswitch_domain_models/revenue_recovery", "hyperswitch_connectors/revenue_recovery", "external_services/revenue_recovery", "dep:prost-types"]tokenization_v2 = ["api_models/tokenization_v2", "diesel_models/tokenization_v2", "hyperswitch_domain_models/tokenization_v2", "storage_impl/tokenization_v2"]-pm_modular = []-# Partial Auth# The feature reduces the overhead of the router authenticating the merchant for every request, and trusts on `x-merchant-id` header to be present in the request.# This is named as partial-auth because the router will still try to authenticate if the `x-merchant-id` header is not present.diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rsindex b94df8588e..2d64bad735 100644--- a/crates/router/src/core/payments.rs+++ b/crates/router/src/core/payments.rs@@ -116,7 +116,7 @@ use crate::core::card_testing_guard::utils as card_testing_guard_utils;use crate::core::debit_routing;#[cfg(feature = "frm")]use crate::core::fraud_check as frm_core;-#[cfg(any(feature = "v2", all(feature = "v1", feature = "pm_modular")))]+#[cfg(any(feature = "v2", feature = "v1"))]use crate::core::payment_methods::vault;#[cfg(feature = "v2")]use crate::core::revenue_recovery::map_to_recovery_payment_item;@@ -670,10 +670,8 @@ where.to_validate_request()?.validate_request(&req, platform.get_processor())?;- #[cfg(feature = "pm_modular")]let feature_config = core_utils::get_feature_config(state, platform, dimensions).await;- #[cfg(feature = "pm_modular")]let payment_method_info = operation.to_domain()?.fetch_payment_method(state, &req, platform, &feature_config)@@ -697,7 +695,6 @@ whereplatform,auth_flow,&header_payload,- #[cfg(feature = "pm_modular")]payment_method_info,dimensions,)@@ -714,7 +711,6 @@ where&payment_data.get_payment_intent().clone(),)?;- #[cfg(feature = "pm_modular")]operation.to_domain()?.create_payment_method(@@ -768,7 +764,6 @@ where&req,platform.get_processor(),&business_profile,- #[cfg(feature = "pm_modular")]&feature_config,&mut payment_data,eligible_connectors,@@ -808,7 +803,6 @@ where&validate_result,platform,&business_profile,- #[cfg(feature = "pm_modular")]&feature_config,).await?;@@ -995,7 +989,6 @@ where&business_profile,false,None,- #[cfg(feature = "pm_modular")]&feature_config,).await?;@@ -1064,7 +1057,6 @@ where//add connector http status code metricsadd_connector_http_status_code_metrics(connector_http_status_code);- #[cfg(feature = "pm_modular")]handle_pm_and_mandate_post_update(state,operation.as_ref(),@@ -1077,18 +1069,6 @@ where).await?;- #[cfg(not(feature = "pm_modular"))]- operation- .to_post_update_tracker()?- .save_pm_and_mandate(- state,- &router_data,- platform,- &mut payment_data,- &business_profile,- )- .await?;-let router_data_for_pm_mandate = router_data.clone();let mut payment_data = operation.to_post_update_tracker()?@@ -1113,7 +1093,6 @@ whereplatform.get_initiator(),&payment_data,&router_data_for_pm_mandate,- #[cfg(feature = "pm_modular")]&feature_config,).await?;@@ -1184,7 +1163,6 @@ where&business_profile,false,routing_decision,- #[cfg(feature = "pm_modular")]&feature_config,).await?;@@ -1275,7 +1253,6 @@ where#[cfg(not(feature = "frm"))]None,&business_profile,- #[cfg(feature = "pm_modular")]&feature_config,&dimensions,)@@ -1292,7 +1269,6 @@ where//add connector http status code metricsadd_connector_http_status_code_metrics(connector_http_status_code);- #[cfg(feature = "pm_modular")]handle_pm_and_mandate_post_update(state,operation.as_ref(),@@ -1305,18 +1281,6 @@ where).await?;- #[cfg(not(feature = "pm_modular"))]- operation- .to_post_update_tracker()?- .save_pm_and_mandate(- state,- &router_data,- platform,- &mut payment_data,- &business_profile,- )- .await?;-let router_data_for_pm_mandate = router_data.clone();let mut payment_data = operation.to_post_update_tracker()?@@ -1341,7 +1305,6 @@ whereplatform.get_initiator(),&payment_data,&router_data_for_pm_mandate,- #[cfg(feature = "pm_modular")]&feature_config,).await?;@@ -1565,7 +1528,6 @@ wheretracing::Span::current().record("payment_id", format!("{}", validate_result.payment_id));- #[cfg(feature = "pm_modular")]let feature_config = core_utils::get_feature_config(state, &platform, dimensions).await;let operations::GetTrackerResponse {@@ -1583,7 +1545,6 @@ where&platform,auth_flow,&header_payload,- #[cfg(feature = "pm_modular")]None,dimensions,)@@ -1716,7 +1677,6 @@ whereplatform.get_initiator(),&payment_data,&router_data_for_pm_mandate,- #[cfg(feature = "pm_modular")]&feature_config,).await?;@@ -2509,7 +2469,7 @@ pub async fn call_surcharge_decision_management_for_session_flow(}}-#[cfg(all(feature = "v1", feature = "pm_modular"))]+#[cfg(feature = "v1")]#[allow(clippy::too_many_arguments)]async fn handle_pm_and_mandate_post_update<F, R, Op, D>(state: &SessionState,@@ -4941,7 +4901,7 @@ pub async fn call_connector_service_prerequisites<F, RouterDReq, ApiRequest, D>(business_profile: &domain::Profile,should_retry_with_pan: bool,routing_decision: Option<routing_helpers::RoutingDecisionData>,- #[cfg(feature = "pm_modular")] feature_config: &core_utils::FeatureConfig,+ feature_config: &core_utils::FeatureConfig,) -> RouterResult<(helpers::MerchantConnectorAccountType,RouterData<F, RouterDReq, router_types::PaymentsResponseData>,@@ -5045,7 +5005,6 @@ whereplatform,business_profile,should_retry_with_pan,- #[cfg(feature = "pm_modular")]feature_config,).await?;@@ -8332,7 +8291,7 @@ pub async fn get_connector_tokenization_action_when_confirm_true<F, Req, D>(platform: &domain::Platform,business_profile: &domain::Profile,should_retry_with_pan: bool,- #[cfg(feature = "pm_modular")] feature_config: &core_utils::FeatureConfig,+ feature_config: &core_utils::FeatureConfig,) -> RouterResult<(D, TokenizationAction)>whereF: Send + Clone,@@ -8354,7 +8313,6 @@ wherelet payment_data_and_tokenization_action = match connector {Some(_) if is_mandate => {- #[cfg(feature = "pm_modular")]if feature_config.is_payment_method_modular_allowed {payment_data.set_payment_method_data(None);}@@ -8397,23 +8355,6 @@ wherelet connector_tokenization_action = match payment_method_action {TokenizationAction::TokenizeInRouter => {- #[cfg(not(feature = "pm_modular"))]- {- let (_operation, payment_method_data, pm_id) = operation- .to_domain()?- .make_pm_data(- state,- payment_data,- validate_result.storage_scheme,- platform,- business_profile,- should_retry_with_pan,- )- .await?;- payment_data.set_payment_method_data(payment_method_data);- payment_data.set_payment_method_id_in_attempt(pm_id);- }- #[cfg(feature = "pm_modular")]if !feature_config.is_payment_method_modular_allowed {let (_operation, payment_method_data, pm_id) = operation.to_domain()?@@ -8462,24 +8403,6 @@ where}TokenizationAction::TokenizeInConnector => TokenizationAction::TokenizeInConnector,TokenizationAction::TokenizeInConnectorAndRouter => {- #[cfg(not(feature = "pm_modular"))]- {- let (_operation, payment_method_data, pm_id) = operation- .to_domain()?- .make_pm_data(- state,- payment_data,- validate_result.storage_scheme,- platform,- business_profile,- should_retry_with_pan,- )- .await?;-- payment_data.set_payment_method_data(payment_method_data);- payment_data.set_payment_method_id_in_attempt(pm_id);- }- #[cfg(feature = "pm_modular")]if !feature_config.is_payment_method_modular_allowed {let (_operation, payment_method_data, pm_id) = operation.to_domain()?@@ -8570,7 +8493,7 @@ pub async fn tokenize_in_router_when_confirm_false_or_external_authentication<F,validate_result: &operations::ValidateResult,platform: &domain::Platform,business_profile: &domain::Profile,- #[cfg(feature = "pm_modular")] feature_config: &core_utils::FeatureConfig,+ feature_config: &core_utils::FeatureConfig,) -> RouterResult<D>whereF: Send + Clone,@@ -8582,25 +8505,6 @@ where.request_external_three_ds_authentication;let payment_data =if !is_operation_confirm(operation) || is_external_authentication_requested == Some(true) {- #[cfg(not(feature = "pm_modular"))]- {- let (_operation, payment_method_data, pm_id) = operation- .to_domain()?- .make_pm_data(- state,- payment_data,- validate_result.storage_scheme,- platform,- business_profile,- false,- )- .await?;- payment_data.set_payment_method_data(payment_method_data);- if let Some(payment_method_id) = pm_id {- payment_data.set_payment_method_id_in_attempt(Some(payment_method_id));- }- }- #[cfg(feature = "pm_modular")]if !feature_config.is_payment_method_modular_allowed {let (_operation, payment_method_data, pm_id) = operation.to_domain()?@@ -8632,7 +8536,7 @@ whereOk(payment_data.to_owned())}-#[cfg(all(feature = "v1", feature = "pm_modular"))]+#[cfg(feature = "v1")]async fn set_payment_method_from_token_for_modular_payment_method_flow<F, D>(state: &SessionState,payment_data: &mut D,@@ -9685,7 +9589,7 @@ pub async fn choose_connector<F, Req, D>(req: &Req,processor: &domain::Processor,business_profile: &domain::Profile,- #[cfg(feature = "pm_modular")] feature_config: &core_utils::FeatureConfig,+ feature_config: &core_utils::FeatureConfig,payment_data: &mut D,eligible_connectors: Option<Vec<enums::RoutableConnectors>>,mandate_type: Option<api::MandateTransactionType>,@@ -9755,7 +9659,6 @@ wherestate,processor,business_profile,- #[cfg(feature = "pm_modular")]feature_config,payment_data,Some(straight_through),@@ -9773,7 +9676,6 @@ wherestate,processor,business_profile,- #[cfg(feature = "pm_modular")]feature_config,payment_data,None,@@ -9968,7 +9870,7 @@ pub async fn perform_routing_for_connector_selection<F, D>(state: &SessionState,processor: &domain::Processor,business_profile: &domain::Profile,- #[cfg(feature = "pm_modular")] feature_config: &core_utils::FeatureConfig,+ feature_config: &core_utils::FeatureConfig,payment_data: &mut D,request_straight_through: Option<serde_json::Value>,eligible_connectors: Option<Vec<enums::RoutableConnectors>>,@@ -10023,10 +9925,7 @@ wheredimensions,fallback_config,backend_input,- #[cfg(feature = "pm_modular")]feature_config.is_payment_method_modular_allowed,- #[cfg(not(feature = "pm_modular"))]- false,).await?;diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rsindex c6d7825055..291e76ac5f 100644--- a/crates/router/src/core/payments/helpers.rs+++ b/crates/router/src/core/payments/helpers.rs@@ -468,10 +468,6 @@ pub async fn get_token_pm_type_mandate_details(dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<MandateGenericData> {let mandate_data = request.mandate_data.clone().map(MandateData::foreign_from);- // Should be removed, if we use dimensions in this method for any other purpose, but currently we are only using it for PM modular feature which is gated behind `pm_modular` feature flag- #[cfg(not(feature = "pm_modular"))]- let _ = dimensions;- #[cfg(feature = "pm_modular")]let is_payment_method_modular_allowed =core_utils::get_feature_config(state, platform, dimensions).await@@ -758,7 +754,6 @@ pub async fn get_token_pm_type_mandate_details(}}None => {- #[cfg(feature = "pm_modular")]let payment_method_info = if is_payment_method_modular_allowed {pm_info} else {@@ -777,21 +772,6 @@ pub async fn get_token_pm_type_mandate_details(.await.transpose()?};- #[cfg(not(feature = "pm_modular"))]- let payment_method_info = payment_method_id- .async_map(|payment_method_id| async move {- state- .store- .find_payment_method(- platform.get_provider().get_key_store(),- &payment_method_id,- platform.get_provider().get_account().storage_scheme,- )- .await- .to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)- })- .await- .transpose()?;let resolved_payment_method = request.payment_method.or_else(|| {payment_method_info.as_ref()diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rsindex 1125bba8f9..f5519bddd3 100644--- a/crates/router/src/core/payments/operations.rs+++ b/crates/router/src/core/payments/operations.rs@@ -99,16 +99,15 @@ pub use self::{payment_session_intent::PaymentSessionIntent,};use super::{helpers, CustomerDetails, OperationSessionGetters, OperationSessionSetters};-#[cfg(all(feature = "v1", feature = "pm_modular"))]+#[cfg(feature = "v1")]use crate::core::payment_methods::transformers::PaymentMethodWithRawData;#[cfg(feature = "v2")]use crate::core::payments;-#[cfg(feature = "pm_modular")]-use crate::core::utils as core_utils;use crate::{core::{configs::dimension_state,errors::{self, CustomResult, RouterResult},+ utils as core_utils,},routes::{app::ReqState, SessionState},services,@@ -222,9 +221,7 @@ pub trait GetTracker<F: Clone, D, R>: Send {platform: &domain::Platform,auth_flow: services::AuthFlow,header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] payment_method_with_raw_data: Option<- PaymentMethodWithRawData,- >,+ payment_method_with_raw_data: Option<PaymentMethodWithRawData>,dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<GetTrackerResponse<'a, F, R, D>>;@@ -317,7 +314,7 @@ pub trait Domain<F: Clone, R, D>: Send + Sync {) -> CustomResult<(), errors::ApiErrorResponse> {Ok(())}- #[cfg(all(feature = "v1", feature = "pm_modular"))]+ #[cfg(feature = "v1")]async fn create_payment_method(&self,_state: &SessionState,@@ -330,7 +327,7 @@ pub trait Domain<F: Clone, R, D>: Send + Sync {Ok(())}- #[cfg(all(feature = "v1", feature = "pm_modular"))]+ #[cfg(feature = "v1")]async fn fetch_payment_method(&self,_state: &SessionState,@@ -630,7 +627,7 @@ pub trait PostUpdateTracker<F, D, R: Send>: Send {_initiator: Option<&domain::Initiator>,_payment_data: &D,_router_data: &types::RouterData<F, R, PaymentsResponseData>,- #[cfg(feature = "pm_modular")] _feature_set: &core_utils::FeatureConfig,+ _feature_config: &core_utils::FeatureConfig,) -> RouterResult<()>whereF: 'b + Clone + Send + Sync,@@ -638,7 +635,7 @@ pub trait PostUpdateTracker<F, D, R: Send>: Send {Ok(())}- #[cfg(all(feature = "v1", feature = "pm_modular"))]+ #[cfg(feature = "v1")]async fn update_modular_pm_and_mandate<'b>(&self,_state: &SessionState,diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rsindex a0b57d78d0..6f5078ff2c 100644--- a/crates/router/src/core/payments/operations/payment_approve.rs+++ b/crates/router/src/core/payments/operations/payment_approve.rs@@ -43,9 +43,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCaptureRplatform: &domain::Platform,_auth_flow: services::AuthFlow,_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<- operations::PaymentMethodWithRawData,- >,+ _payment_method_wrapper: Option<operations::PaymentMethodWithRawData>,_dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsCaptureRequest, PaymentData<F>>,diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rsindex 4e39d5b4cc..879fabffa8 100644--- a/crates/router/src/core/payments/operations/payment_cancel.rs+++ b/crates/router/src/core/payments/operations/payment_cancel.rs@@ -45,9 +45,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelReplatform: &domain::Platform,_auth_flow: services::AuthFlow,_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<- operations::PaymentMethodWithRawData,- >,+ _payment_method_wrapper: Option<operations::PaymentMethodWithRawData>,_dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsCancelRequest, PaymentData<F>>,diff --git a/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs b/crates/router/src/core/payments/operations/payment_cancel_post_capture.rsindex 194ab7e03d..5a1cf67260 100644--- a/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs+++ b/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs@@ -43,9 +43,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelPoplatform: &domain::Platform,_auth_flow: services::AuthFlow,_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<- operations::PaymentMethodWithRawData,- >,+ _payment_method_wrapper: Option<operations::PaymentMethodWithRawData>,_dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rsindex 4fdf75f9f0..d10a7ac7c4 100644--- a/crates/router/src/core/payments/operations/payment_capture.rs+++ b/crates/router/src/core/payments/operations/payment_capture.rs@@ -45,9 +45,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymenplatform: &domain::Platform,_auth_flow: services::AuthFlow,_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<- operations::PaymentMethodWithRawData,- >,+ _payment_method_wrapper: Option<operations::PaymentMethodWithRawData>,_dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rsindex c2587be411..ded10d393d 100644--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs@@ -49,9 +49,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>platform: &domain::Platform,_auth_flow: services::AuthFlow,_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<- operations::PaymentMethodWithRawData,- >,+ _payment_method_wrapper: Option<operations::PaymentMethodWithRawData>,dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsRequest, PaymentData<F>>>{diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rsindex a289baa5af..f22bb6f7c6 100644--- a/crates/router/src/core/payments/operations/payment_confirm.rs+++ b/crates/router/src/core/payments/operations/payment_confirm.rs@@ -15,14 +15,9 @@ use common_utils::ext_traits::{AsyncExt, Encode, StringExt, ValueExt};use diesel_models::payment_attempt::ConnectorMandateReferenceId as DieselConnectorMandateReferenceId;use error_stack::{report, ResultExt};use futures::FutureExt;-#[cfg(all(feature = "v1", not(feature = "pm_modular")))]-use hyperswitch_domain_models::payments::payment_intent::PaymentIntentUpdateFields;-#[cfg(all(feature = "v1", feature = "pm_modular"))]-use hyperswitch_domain_models::payments::{- self as domain_payments, payment_intent::PaymentIntentUpdateFields,-};use hyperswitch_domain_models::{payment_method_data::RecurringDetails as domain_recurring_details,+ payments::{self as domain_payments, payment_intent::PaymentIntentUpdateFields},router_request_types::unified_authentication_service,};use hyperswitch_masking::{ExposeInterface, PeekInterface};@@ -31,8 +26,6 @@ use router_env::{instrument, logger, tracing};use tracing_futures::Instrument;use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};-#[cfg(feature = "pm_modular")]-use crate::core::payment_methods::{transformers as pm_transformers, utils as pm_utils};#[cfg(feature = "v1")]use crate::{consts,@@ -48,6 +41,7 @@ use crate::{errors::{self, CustomResult, RouterResult, StorageErrorExt},mandate::helpers as m_helpers,metrics,+ payment_methods::{transformers as pm_transformers, utils as pm_utils},payments::{self, helpers, operations,operations::payment_confirm::unified_authentication_service::ThreeDsMetaData,@@ -92,9 +86,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>platform: &domain::Platform,auth_flow: services::AuthFlow,header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] payment_method_with_raw_data: Option<- pm_transformers::PaymentMethodWithRawData,- >,+ payment_method_with_raw_data: Option<pm_transformers::PaymentMethodWithRawData>,dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsRequest, PaymentData<F>>>{@@ -554,7 +546,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>let n_payment_method_billing_address_id =payment_attempt.payment_method_billing_address_id.clone();- #[cfg(feature = "pm_modular")]let n_request_payment_method_billing_address = request.payment_method_data.as_ref()@@ -571,11 +562,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>.ok()})}));- #[cfg(not(feature = "pm_modular"))]- let n_request_payment_method_billing_address = request- .payment_method_data- .as_ref()- .and_then(|pmd| pmd.billing.clone());let m_payment_intent_customer_id = payment_intent.customer_id.clone();let m_payment_intent_payment_id = payment_intent.payment_id.clone();let m_key_store = platform.get_processor().get_key_store().clone();@@ -620,12 +606,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>let m_request = request.clone();let payment_intent_customer_id = payment_intent.customer_id.clone();- #[cfg(feature = "pm_modular")]let payment_method_info_from_modular = payment_method_with_raw_data.clone().map(|pm| pm.payment_method.0);- #[cfg(not(feature = "pm_modular"))]- let payment_method_info_from_modular = None;let m_pm_dimensions = dimensions.clone();let mandate_details_fut = tokio::spawn(@@ -678,7 +661,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>&request.ctp_service_details,)?;- #[cfg(feature = "pm_modular")]let pm_modular_dimensions = dimensions.with_organization_id(platform@@ -692,7 +674,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>//fetch for repeat cit using payment token- #[cfg(feature = "pm_modular")]let is_modular_payment_method_flow =pm_utils::get_organization_eligibility_config_for_pm_modular_service(state,@@ -700,7 +681,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>).await;- #[cfg(feature = "pm_modular")]let (token_data, payment_method_info) = if is_modular_payment_method_flow {(None,@@ -727,26 +707,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>} else {(None, payment_method_info)};- #[cfg(not(feature = "pm_modular"))]- let (token_data, payment_method_info) = if let Some(token) = token.clone() {- let token_data = helpers::retrieve_payment_token_data(- state,- token,- payment_method.or(payment_attempt.payment_method),- )- .await?;-- let payment_method_info = helpers::retrieve_payment_method_from_db_with_token_data(- state,- platform.get_provider().get_key_store(),- &token_data,- storage_scheme,- )- .await?;- (Some(token_data), payment_method_info)- } else {- (None, payment_method_info)- };let additional_pm_data_from_locker = if let Some(ref pm) = payment_method_info {let card_detail_from_locker: Option<api::CardDetailFromLocker> = pm.payment_method_data@@ -823,7 +783,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>request_payment_method_data.payment_method_data.clone()});- #[cfg(feature = "pm_modular")]let payment_method_data = payment_method_with_raw_data.clone().and_then(|pm| pm.raw_payment_method_data)@@ -836,17 +795,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>payment_method_data}});- #[cfg(not(feature = "pm_modular"))]- let payment_method_data = payment_method_data_from_request- .map(Into::into)- .or(payment_method_recurring_details.clone())- .map(|payment_method_data| {- if let Some(additional_pm_data) = additional_pm_data {- payment_method_data.apply_additional_payment_data(additional_pm_data)- } else {- payment_method_data- }- });payment_attempt.payment_method_billing_address_id = payment_method_billing.as_ref()@@ -867,7 +815,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>payment_method_data_billing.get_billing_address()}).map(From::from);- #[cfg(feature = "pm_modular")]let pm_pmd_billing = payment_method_with_raw_data.as_ref().and_then(|pm| {pm.payment_method.0@@ -884,10 +831,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>});// billing address from request body has the highest priority followed by billing address from raw pm data and then billing address from payment_attempt- #[cfg(feature = "pm_modular")]let pmd_address = payment_method_data_billing.or(pm_pmd_billing);- #[cfg(not(feature = "pm_modular"))]- let pmd_address = payment_method_data_billing;let unified_address = address.unify_with_payment_method_data_billing(pmd_address);@@ -960,7 +904,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>);//setting vault operation to existing vault data if raw payment method data is present in pm_info- #[cfg(feature = "pm_modular")]let vault_operation =payment_method_with_raw_data.and_then(|pm| match pm.raw_payment_method_data {Some(domain::PaymentMethodData::Card(card)) => {@@ -970,8 +913,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>}_ => None,});- #[cfg(not(feature = "pm_modular"))]- let vault_operation = None;payment_attempt.installment_data = request.installment_data.clone().map(Into::into);@@ -1183,7 +1124,6 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> forOk(())}- #[cfg(feature = "pm_modular")]#[instrument(skip_all)]async fn create_payment_method(&self,@@ -1296,7 +1236,6 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for}}- #[cfg(feature = "pm_modular")]#[instrument(skip_all)]async fn fetch_payment_method(&self,diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rsindex 7c31d2a802..6bffc61c2e 100644--- a/crates/router/src/core/payments/operations/payment_create.rs+++ b/crates/router/src/core/payments/operations/payment_create.rs@@ -30,8 +30,6 @@ use storage_impl::platform_wrapper;use time::PrimitiveDateTime;use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};-#[cfg(feature = "pm_modular")]-use crate::core::payment_methods::transformers as pm_transformers;use crate::{consts,core::{@@ -39,6 +37,7 @@ use crate::{errors::{self, CustomResult, RouterResult, StorageErrorExt},mandate::helpers as m_helpers,payment_link,+ payment_methods::transformers as pm_transformers,payments::{self, client_session::ClientSessionManager, helpers, operations, CustomerDetails,OperationSessionGetters, OperationSessionSetters, PaymentAddress, PaymentData,@@ -81,9 +80,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>platform: &domain::Platform,_auth_flow: services::AuthFlow,header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] payment_method_with_raw_data: Option<- pm_transformers::PaymentMethodWithRawData,- >,+ payment_method_with_raw_data: Option<pm_transformers::PaymentMethodWithRawData>,dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsRequest, PaymentData<F>>>{@@ -159,12 +156,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>reason: "Expected one out of recurring_details and mandate_data but got both".into(),})?;- #[cfg(feature = "pm_modular")]let payment_method_info_from_modular = payment_method_with_raw_data.clone().map(|pm| pm.payment_method.0);- #[cfg(not(feature = "pm_modular"))]- let payment_method_info_from_modular = None;let m_helpers::MandateGenericData {token,@@ -224,7 +218,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>).await?;- #[cfg(feature = "pm_modular")]let payment_method_data_billing = request.payment_method_data.as_ref()@@ -242,12 +235,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>})}));- #[cfg(not(feature = "pm_modular"))]- let payment_method_data_billing = request- .payment_method_data- .as_ref()- .and_then(|pmd| pmd.billing.clone());-let payment_method_billing_address =helpers::create_or_find_address_for_payment_by_request(state,@@ -557,7 +544,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>request_payment_method_data.payment_method_data.clone()});- #[cfg(feature = "pm_modular")]let payment_method_data = payment_method_with_raw_data.clone().and_then(|pm| pm.raw_payment_method_data)@@ -571,18 +557,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>}});- #[cfg(not(feature = "pm_modular"))]- let payment_method_data = payment_method_data_from_request- .map(Into::into)- .or(payment_method_recurring_details.clone())- .map(|payment_method_data| {- if let Some(additional_pm_data) = additional_payment_data {- payment_method_data.apply_additional_payment_data(additional_pm_data)- } else {- payment_method_data- }- });-let additional_pm_data_from_locker = if let Some(ref pm) = payment_method_info {let card_detail_from_locker: Option<api::CardDetailFromLocker> = pm.payment_method_data@@ -649,7 +623,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>payment_method_data_billing.get_billing_address()}).map(From::from);- #[cfg(feature = "pm_modular")]let pm_pmd_billing = payment_method_with_raw_data.as_ref().and_then(|pm| {pm.payment_method.0@@ -665,10 +638,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>})});- #[cfg(feature = "pm_modular")]let add = payment_method_data_billing.or(pm_pmd_billing);- #[cfg(not(feature = "pm_modular"))]- let add = payment_method_data_billing;let unified_address = address.unify_with_payment_method_data_billing(add);@@ -933,7 +903,6 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for}}- #[cfg(feature = "pm_modular")]#[instrument(skip_all)]async fn fetch_payment_method(&self,@@ -1324,7 +1293,6 @@ impl<F: Send + Clone + Sync> ValidateRequest<F, api::PaymentsRequest, PaymentDatimpl PaymentCreate {/// Determines the payment method reference for modular payment flows.- #[cfg(feature = "pm_modular")]fn get_payment_method_reference(self, req: &api::PaymentsRequest) -> Option<&String> {match (req.off_session, req.recurring_details.as_ref()) {// Payment using off_session MITs using PM IDdiff --git a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs b/crates/router/src/core/payments/operations/payment_post_session_tokens.rsindex b517eafe65..a985f707e2 100644--- a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs+++ b/crates/router/src/core/payments/operations/payment_post_session_tokens.rs@@ -44,9 +44,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsPostSessplatform: &domain::Platform,_auth_flow: services::AuthFlow,_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<- operations::PaymentMethodWithRawData,- >,+ _payment_method_wrapper: Option<operations::PaymentMethodWithRawData>,_dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<diff --git a/crates/router/src/core/payments/operations/payment_recurrence.rs b/crates/router/src/core/payments/operations/payment_recurrence.rsindex 610f508867..ebeccc92bc 100644--- a/crates/router/src/core/payments/operations/payment_recurrence.rs+++ b/crates/router/src/core/payments/operations/payment_recurrence.rs@@ -51,17 +51,10 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>platform: &domain::Platform,_auth_flow: services::AuthFlow,_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] payment_method_with_raw_data: Option<- pm_transformers::PaymentMethodWithRawData,- >,+ payment_method_with_raw_data: Option<pm_transformers::PaymentMethodWithRawData>,dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsRequest, PaymentData<F>>>{- #[cfg(not(feature = "pm_modular"))]- let payment_method_with_raw_data: Option<- pm_transformers::PaymentMethodWithRawData,- > = None;-let processor_merchant_id = platform.get_processor().get_account().get_id();let storage_scheme = platform.get_processor().get_account().storage_scheme;let (currency, amount);diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rsindex 07e9c79536..d359b2fad8 100644--- a/crates/router/src/core/payments/operations/payment_reject.rs+++ b/crates/router/src/core/payments/operations/payment_reject.rs@@ -42,9 +42,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsCancelRequestplatform: &domain::Platform,_auth_flow: services::AuthFlow,_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<- operations::PaymentMethodWithRawData,- >,+ _payment_method_wrapper: Option<operations::PaymentMethodWithRawData>,_dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a, F, PaymentsCancelRequest, PaymentData<F>>>{diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rsindex 94dccd5429..f5cefe7d06 100644--- a/crates/router/src/core/payments/operations/payment_response.rs+++ b/crates/router/src/core/payments/operations/payment_response.rs@@ -1,6 +1,6 @@use std::{collections::HashMap, ops::Deref};-#[cfg(all(feature = "v1", feature = "pm_modular"))]+#[cfg(feature = "v1")]use ::payment_methods::client::{BankDebitDetailUpdate, CardDetailUpdate, PaymentMethodUpdateData, UpdatePaymentMethodV1Payload,};@@ -8,9 +8,7 @@ use api_models::payments::{ConnectorMandateReferenceId, MandateReferenceId};#[cfg(feature = "dynamic_routing")]use api_models::routing::RoutableConnectorChoice;use async_trait::async_trait;-use common_enums::AuthorizationStatus;-#[cfg(all(feature = "v1", feature = "pm_modular"))]-use common_enums::{ConnectorTokenStatus, TokenizationType};+use common_enums::{AuthorizationStatus, ConnectorTokenStatus, TokenizationType};#[cfg(all(feature = "v1", feature = "dynamic_routing"))]use common_utils::ext_traits::ValueExt;use common_utils::{@@ -32,7 +30,7 @@ use router_env::{instrument, logger, tracing};use tracing_futures::Instrument;use super::{Operation, OperationSessionSetters, PostUpdateTracker};-#[cfg(all(feature = "v1", feature = "pm_modular"))]+#[cfg(feature = "v1")]use crate::core::payment_methods::transformers::call_modular_payment_method_update;#[cfg(all(feature = "v1", feature = "dynamic_routing"))]use crate::core::routing::helpers as routing_helpers;@@ -69,7 +67,7 @@ use crate::{/// This implementation executes the flow only when/// 1. Payment was created with supported payment methods/// 2. Payment attempt's status was not a terminal failure-#[cfg(all(feature = "v1", feature = "pm_modular"))]+#[cfg(feature = "v1")]async fn update_modular_pm_and_mandate_impl<F, T>(state: &SessionState,resp: &types::RouterData<F, T, types::PaymentsResponseData>,@@ -743,39 +741,25 @@ impl<F: Send + Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsAuthortypes::PaymentsAuthorizeData,types::PaymentsResponseData,>,- #[cfg(feature = "pm_modular")] feature_set: &core_utils::FeatureConfig,+ feature_config: &core_utils::FeatureConfig,) -> RouterResult<()>whereF: 'b + Clone + Send + Sync,{- #[cfg(feature = "pm_modular")]- {- if !feature_set.is_payment_method_modular_allowed {- return update_pm_connector_mandate_details(- state,- provider,- initiator,- payment_data,- router_data,- )- .await;- }- Ok(())- }- #[cfg(not(feature = "pm_modular"))]- {- update_pm_connector_mandate_details(+ if !feature_config.is_payment_method_modular_allowed {+ let _ = update_pm_connector_mandate_details(state,provider,initiator,payment_data,router_data,)- .await+ .await;}+ Ok(())}- #[cfg(all(feature = "v1", feature = "pm_modular"))]+ #[cfg(feature = "v1")]async fn update_modular_pm_and_mandate<'b>(&self,state: &SessionState,@@ -1057,39 +1041,25 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsSyncData> forinitiator: Option<&domain::Initiator>,payment_data: &PaymentData<F>,router_data: &types::RouterData<F, types::PaymentsSyncData, types::PaymentsResponseData>,- #[cfg(feature = "pm_modular")] feature_set: &core_utils::FeatureConfig,+ feature_config: &core_utils::FeatureConfig,) -> RouterResult<()>whereF: 'b + Clone + Send + Sync,{- #[cfg(feature = "pm_modular")]- {- if !feature_set.is_payment_method_modular_allowed {- return update_pm_connector_mandate_details(- state,- provider,- initiator,- payment_data,- router_data,- )- .await;- }- Ok(())- }- #[cfg(not(feature = "pm_modular"))]- {- update_pm_connector_mandate_details(+ if !feature_config.is_payment_method_modular_allowed {+ let _ = update_pm_connector_mandate_details(state,provider,initiator,payment_data,router_data,)- .await+ .await;}+ Ok(())}- #[cfg(all(feature = "v1", feature = "pm_modular"))]+ #[cfg(feature = "v1")]async fn update_modular_pm_and_mandate<'b>(&self,state: &SessionState,@@ -1819,15 +1789,24 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::SetupMandateRequestDatypes::SetupMandateRequestData,types::PaymentsResponseData,>,- #[cfg(feature = "pm_modular")] _feature_set: &core_utils::FeatureConfig,+ feature_config: &core_utils::FeatureConfig,) -> RouterResult<()>whereF: 'b + Clone + Send + Sync,{- update_pm_connector_mandate_details(state, provider, initiator, payment_data, router_data)- .await+ if !feature_config.is_payment_method_modular_allowed {+ let _ = update_pm_connector_mandate_details(+ state,+ provider,+ initiator,+ payment_data,+ router_data,+ )+ .await;+ }+ Ok(())}- #[cfg(all(feature = "v1", feature = "pm_modular"))]+ #[cfg(feature = "v1")]async fn update_modular_pm_and_mandate<'b>(&self,state: &SessionState,@@ -1945,39 +1924,25 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::CompleteAuthorizeDatatypes::CompleteAuthorizeData,types::PaymentsResponseData,>,- #[cfg(feature = "pm_modular")] feature_set: &core_utils::FeatureConfig,+ feature_config: &core_utils::FeatureConfig,) -> RouterResult<()>whereF: 'b + Clone + Send + Sync,{- #[cfg(feature = "pm_modular")]- {- if !feature_set.is_payment_method_modular_allowed {- return update_pm_connector_mandate_details(- state,- provider,- initiator,- payment_data,- router_data,- )- .await;- }- Ok(())- }- #[cfg(not(feature = "pm_modular"))]- {- update_pm_connector_mandate_details(+ if !feature_config.is_payment_method_modular_allowed {+ let _ = update_pm_connector_mandate_details(state,provider,initiator,payment_data,router_data,)- .await+ .await;}+ Ok(())}- #[cfg(all(feature = "v1", feature = "pm_modular"))]+ #[cfg(feature = "v1")]async fn update_modular_pm_and_mandate<'b>(&self,state: &SessionState,diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rsindex cbcad58707..d184c78133 100644--- a/crates/router/src/core/payments/operations/payment_session.rs+++ b/crates/router/src/core/payments/operations/payment_session.rs@@ -46,9 +46,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsSessionRplatform: &domain::Platform,_auth_flow: services::AuthFlow,_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<- operations::PaymentMethodWithRawData,- >,+ _payment_method_wrapper: Option<operations::PaymentMethodWithRawData>,_dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsSessionRequest, PaymentData<F>>,diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rsindex 4ac583b6e3..3cc426633a 100644--- a/crates/router/src/core/payments/operations/payment_start.rs+++ b/crates/router/src/core/payments/operations/payment_start.rs@@ -7,13 +7,12 @@ use router_derive::PaymentOperation;use router_env::{instrument, logger, tracing};use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};-#[cfg(feature = "pm_modular")]-use crate::core::utils;use crate::{core::{configs::dimension_state,errors::{self, CustomResult, RouterResult, StorageErrorExt},payments::{helpers, operations, CustomerDetails, PaymentAddress, PaymentData},+ utils,},routes::{app::ReqState, SessionState},services,@@ -45,16 +44,11 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsStartReqplatform: &domain::Platform,_auth_flow: services::AuthFlow,_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<- operations::PaymentMethodWithRawData,- >,+ _payment_method_wrapper: Option<operations::PaymentMethodWithRawData>,dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsStartRequest, PaymentData<F>>,> {- // Should be removed, if we use dimensions in this method for any other purpose, but currently we are only using it for PM modular feature which is gated behind `pm_modular` feature flag- #[cfg(not(feature = "pm_modular"))]- let _ = dimensions;let (mut payment_intent, payment_attempt, currency, amount);let db = &*state.store;@@ -136,7 +130,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsStartReq// In case of modular payment method flow payment token in the request will belong to payment method modular service// hence populating token data is not required- #[cfg(feature = "pm_modular")]let token_data = {let is_payment_method_modular_allowed =utils::get_feature_config(state, platform, dimensions)@@ -160,17 +153,6 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsStartReq}}};- #[cfg(not(feature = "pm_modular"))]- let token_data = match payment_attempt.payment_token.clone() {- Some(token) => Some(- helpers::retrieve_payment_token_data(state, token, payment_attempt.payment_method)- .await?,- ),- None => {- logger::debug!("skipping token data retrieval in payment start");- None- }- };payment_intent.shipping_address_id = shipping_address.clone().map(|i| i.address_id);payment_intent.billing_address_id = billing_address.clone().map(|i| i.address_id);diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rsindex 9d7b6c2aae..c76fa78d04 100644--- a/crates/router/src/core/payments/operations/payment_status.rs+++ b/crates/router/src/core/payments/operations/payment_status.rs@@ -8,16 +8,16 @@ use router_derive::PaymentOperation;use router_env::{instrument, logger, tracing};use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};-#[cfg(feature = "pm_modular")]-use crate::core::{payment_methods::transformers as pm_transformers, utils as core_utils};use crate::{core::{configs::dimension_state,errors::{self, CustomResult, RouterResult, StorageErrorExt},+ payment_methods::transformers as pm_transformers,payments::{helpers, operations, types as payment_types, CustomerDetails, PaymentAddress,PaymentData,},+ utils as core_utils,},events::audit_events::{AuditEvent, AuditEventType},routes::{app::ReqState, SessionState},@@ -233,9 +233,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRetrieveplatform: &domain::Platform,_auth_flow: services::AuthFlow,_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<- operations::PaymentMethodWithRawData,- >,+ _payment_method_wrapper: Option<operations::PaymentMethodWithRawData>,_dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsRetrieveRequest, PaymentData<F>>,@@ -286,7 +284,6 @@ async fn get_tracker_for_sync<{let (payment_intent, mut payment_attempt, currency, amount);- #[cfg(feature = "pm_modular")]let dimensions = dimension_state::Dimensions::new().with_processor_merchant_id(platform.get_processor().get_processor_merchant_id()).with_provider_merchant_id(platform.get_provider().get_provider_merchant_id());@@ -456,7 +453,6 @@ async fn get_tracker_for_sync<let payment_method_info = if let Some(ref payment_method_id) =payment_attempt.payment_method_id.clone(){- #[cfg(feature = "pm_modular")]if core_utils::get_feature_config(state, platform, &dimensions).await.is_payment_method_modular_allowed@@ -493,30 +489,6 @@ async fn get_tracker_for_sync<}}}-- #[cfg(not(feature = "pm_modular"))]- {- match db- .find_payment_method(- platform.get_provider().get_key_store(),- payment_method_id,- storage_scheme,- )- .await- {- Ok(payment_method) => Some(payment_method),- Err(error) => {- if error.current_context().is_db_not_found() {- logger::info!("Payment Method not found in db {:?}", error);- None- } else {- Err(error)- .change_context(errors::ApiErrorResponse::InternalServerError)- .attach_printable("Error retrieving payment method from db")?- }- }- }- }} else {None};diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rsindex f971858b49..a430f91c55 100644--- a/crates/router/src/core/payments/operations/payment_update.rs+++ b/crates/router/src/core/payments/operations/payment_update.rs@@ -60,9 +60,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>platform: &domain::Platform,auth_flow: services::AuthFlow,_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<- operations::PaymentMethodWithRawData,- >,+ _payment_method_wrapper: Option<operations::PaymentMethodWithRawData>,dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsRequest, PaymentData<F>>>{diff --git a/crates/router/src/core/payments/operations/payment_update_metadata.rs b/crates/router/src/core/payments/operations/payment_update_metadata.rsindex 6a707ddb46..3c054bc5de 100644--- a/crates/router/src/core/payments/operations/payment_update_metadata.rs+++ b/crates/router/src/core/payments/operations/payment_update_metadata.rs@@ -45,9 +45,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsUpdateMeplatform: &domain::Platform,_auth_flow: services::AuthFlow,_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<- operations::PaymentMethodWithRawData,- >,+ _payment_method_wrapper: Option<operations::PaymentMethodWithRawData>,_dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsUpdateMetadataRequest, PaymentData<F>>,diff --git a/crates/router/src/core/payments/operations/payments_extend_authorization.rs b/crates/router/src/core/payments/operations/payments_extend_authorization.rsindex 06ac4001b7..8f56450c3b 100644--- a/crates/router/src/core/payments/operations/payments_extend_authorization.rs+++ b/crates/router/src/core/payments/operations/payments_extend_authorization.rs@@ -43,9 +43,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsExtendAuplatform: &domain::Platform,_auth_flow: services::AuthFlow,_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<- operations::PaymentMethodWithRawData,- >,+ _payment_method_wrapper: Option<operations::PaymentMethodWithRawData>,_dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rsindex f3abe6b0af..816103e78f 100644--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs@@ -51,9 +51,7 @@ impl<F: Send + Clone + Sync>platform: &domain::Platform,_auth_flow: services::AuthFlow,_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<- operations::PaymentMethodWithRawData,- >,+ _payment_method_wrapper: Option<operations::PaymentMethodWithRawData>,_dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<diff --git a/crates/router/src/core/payments/operations/tax_calculation.rs b/crates/router/src/core/payments/operations/tax_calculation.rsindex d9841e7f8f..52fb351a1a 100644--- a/crates/router/src/core/payments/operations/tax_calculation.rs+++ b/crates/router/src/core/payments/operations/tax_calculation.rs@@ -49,9 +49,7 @@ impl<F: Send + Clone + Sync>platform: &domain::Platform,_auth_flow: services::AuthFlow,_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,- #[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<- operations::PaymentMethodWithRawData,- >,+ _payment_method_wrapper: Option<operations::PaymentMethodWithRawData>,_dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rsindex 93b923dc7f..5dcd99b5bd 100644--- a/crates/router/src/core/payments/retry.rs+++ b/crates/router/src/core/payments/retry.rs@@ -9,8 +9,6 @@ use router_env::{tracing::{self, instrument},};-#[cfg(feature = "pm_modular")]-use crate::core::utils as core_utils;use crate::{consts,core::{@@ -22,6 +20,7 @@ use crate::{helpers as payments_helpers, operations,},routing::helpers as routing_helpers,+ utils as core_utils,},db::StorageInterface,routes::{@@ -50,7 +49,7 @@ pub async fn do_gsm_actions<'a, F, ApiRequest, FData, D>(schedule_time: Option<time::PrimitiveDateTime>,frm_suggestion: Option<storage_enums::FrmSuggestion>,business_profile: &domain::Profile,- #[cfg(feature = "pm_modular")] feature_config: &core_utils::FeatureConfig,+ feature_config: &core_utils::FeatureConfig,_dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantIdAndProfileId,) -> RouterResult<types::RouterData<F, FData, types::PaymentsResponseData>>where@@ -121,7 +120,6 @@ wherefalse, //should_retry_with_pan is not applicable for step-upNone,initial_gsm.clone(),- #[cfg(feature = "pm_modular")]feature_config,)).await?;@@ -229,7 +227,6 @@ whereshould_retry_with_pan,routing_decision,gsm.clone(),- #[cfg(feature = "pm_modular")]feature_config,)).await?;@@ -379,7 +376,7 @@ pub async fn do_retry<'a, F, ApiRequest, FData, D>(should_retry_with_pan: bool,routing_decision: Option<routing_helpers::RoutingDecisionData>,initial_gsm: Option<hyperswitch_domain_models::gsm::GatewayStatusMap>,- #[cfg(feature = "pm_modular")] feature_config: &core_utils::FeatureConfig,+ feature_config: &core_utils::FeatureConfig,) -> RouterResult<types::RouterData<F, FData, types::PaymentsResponseData>>whereF: Clone + Send + Sync + std::fmt::Debug + 'static,@@ -423,7 +420,6 @@ wherebusiness_profile,should_retry_with_pan,routing_decision,- #[cfg(feature = "pm_modular")]feature_config,).await?;diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rsindex 849fdab132..13bbc79a8d 100644--- a/crates/router/src/core/utils.rs+++ b/crates/router/src/core/utils.rs@@ -68,13 +68,11 @@ use crate::{utils::{generate_id, OptionExt, ValueExt},};-#[cfg(all(feature = "v1", feature = "pm_modular"))]#[derive(Debug, Clone, Default)]pub struct FeatureConfig {pub is_payment_method_modular_allowed: bool,}-#[cfg(all(feature = "v1", feature = "pm_modular"))]pub async fn get_feature_config(state: &SessionState,platform: &domain::Platform,@@ -113,19 +111,14 @@ where.with_processor_merchant_id(platform.get_processor().get_processor_merchant_id()).with_provider_merchant_id(platform.get_provider().get_provider_merchant_id());- #[cfg(feature = "pm_modular")]- {- let feature_config = get_feature_config(state, platform, &dimensions).await;- common_utils::fp_utils::when(feature_config.is_payment_method_modular_allowed, || {- Err(error_stack::report!(E::from(- errors::ApiErrorResponse::AccessForbidden {- resource: "Deprecated route".to_string(),- },- )))- })?;- }- #[cfg(not(feature = "pm_modular"))]- let _ = (state, platform, dimensions);+ let feature_config = get_feature_config(state, platform, &dimensions).await;+ common_utils::fp_utils::when(feature_config.is_payment_method_modular_allowed, || {+ Err(error_stack::report!(E::from(+ errors::ApiErrorResponse::AccessForbidden {+ resource: "Deprecated route".to_string(),+ },+ )))+ })?;Ok(())}