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
feat(superposition): Migrate additional boolean configs to superposition (#11507)
Aniket Burman20956f555369
diff --git a/config/superposition_seed.toml b/config/superposition_seed.tomlindex f262346110..acb4dd4311 100644--- a/config/superposition_seed.toml+++ b/config/superposition_seed.toml@@ -109,3 +109,27 @@ schema = { type = "integer", minimum = 0, maximum = 4294967295 }description = "Maximum auto payout retries, differentiated by payout_retry_type dimension (single_connector or multi_connector)"change_reason = "Initial setup"+[default-configs.gsm_payout_call]+value = false+schema = { type = "boolean" }+description = "Whether to call GSM for payout retries"+change_reason = "Initial setup"++[default-configs.should_disable_vault_tokenization]+value = false+schema = { type = "boolean" }+description = "Whether to disable vault tokenization for a merchant"+change_reason = "Initial setup"++[default-configs.should_call_pm_modular_service]+value = false+schema = { type = "boolean" }+description = "Whether to call the PM modular service for an organization"+change_reason = "Initial setup"++[default-configs.should_return_raw_payment_method_details]+value = false+schema = { type = "boolean" }+description = "Whether to return raw payment method details (v2 only)"+change_reason = "Initial setup"+diff --git a/crates/common_utils/src/id_type/global_id/customer.rs b/crates/common_utils/src/id_type/global_id/customer.rsindex 5f2e51dd4f..82e328fa5c 100644--- a/crates/common_utils/src/id_type/global_id/customer.rs+++ b/crates/common_utils/src/id_type/global_id/customer.rs@@ -69,6 +69,12 @@ impl TryFrom<GlobalCustomerId> for crate::id_type::CustomerId {}}+impl crate::id_type::TargetingKey for GlobalCustomerId {+ fn targeting_key_value(&self) -> &str {+ self.get_string_repr()+ }+}+impl crate::events::ApiEventMetric for GlobalCustomerId {fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> {Some(crate::events::ApiEventsType::Customer {diff --git a/crates/router/src/consts.rs b/crates/router/src/consts.rsindex e018653317..71feae848d 100644--- a/crates/router/src/consts.rs+++ b/crates/router/src/consts.rs@@ -357,12 +357,6 @@ pub mod superposition {pub const REQUIRES_CVV: &str = "requires_cvv";/// implicit customer update configuration keypub const IMPLICIT_CUSTOMER_UPDATE: &str = "implicit_customer_update";- /// dynamic fields configuration key for sdk config- pub const DYNAMIC_FIELDS: &str = "dynamic_fields";- /// payout sync tracker configuration key- pub const PAYOUT_TRACKER_MAPPING: &str = "payout_tracker_mapping";- /// client session validation enabled configuration key- pub const CLIENT_SESSION_VALIDATION_ENABLED: &str = "client_session_validation_enabled";/// GSM (Global Status Map) call configuration keypub const SHOULD_CALL_GSM: &str = "should_call_gsm";/// Eligibility check configuration key@@ -377,6 +371,21 @@ pub mod superposition {pub const ENABLE_EXTENDED_CARD_BIN: &str = "enable_extended_card_bin";/// Max auto payout retries configuration keypub const MAX_AUTO_PAYOUT_RETRIES: &str = "max_auto_payout_retries";+ /// GSM payout call configuration key (scoped by merchant, profile, and payout retry type)+ pub const GSM_PAYOUT_CALL: &str = "gsm_payout_call";+ /// Disable vault tokenization configuration key+ pub const SHOULD_DISABLE_VAULT_TOKENIZATION: &str = "should_disable_vault_tokenization";+ /// Return raw payment method details configuration key+ pub const SHOULD_RETURN_RAW_PAYMENT_METHOD_DETAILS: &str =+ "should_return_raw_payment_method_details";+ /// Call PM modular service configuration key+ pub const SHOULD_CALL_PM_MODULAR_SERVICE: &str = "should_call_pm_modular_service";+ /// dynamic fields configuration key for sdk config+ pub const DYNAMIC_FIELDS: &str = "dynamic_fields";+ /// payout sync tracker configuration key+ pub const PAYOUT_TRACKER_MAPPING: &str = "payout_tracker_mapping";+ /// client session validation enabled configuration key+ pub const CLIENT_SESSION_VALIDATION_ENABLED: &str = "client_session_validation_enabled";}#[cfg(test)]diff --git a/crates/router/src/core/configs/dimension_config.rs b/crates/router/src/core/configs/dimension_config.rsindex 1ada27a17b..7bc8383346 100644--- a/crates/router/src/core/configs/dimension_config.rs+++ b/crates/router/src/core/configs/dimension_config.rs@@ -1,3 +1,4 @@+use common_enums;use external_services::superposition;use scheduler::consumer::types::process_data::RetryMapping;@@ -168,7 +169,7 @@ config! {superposition_key = SHOULD_PERFORM_ELIGIBILITY,output = bool,default = false,- requires = dimension_state::DimensionsWithProcessorAndProviderMerchantId,+ requires = dimension_state::DimensionsWithProcessorAndProviderMerchantIdAndProfileId,targeting_key = id_type::CustomerId}@@ -239,6 +240,93 @@ impl DatabaseBackedConfig for EnableExtendedCardBin {}}+config! {+ superposition_key = GSM_PAYOUT_CALL,+ output = bool,+ default = false,+ requires = dimension_state::DimensionsWithProcessorAndProviderMerchantIdAndPayoutRetryType,+ targeting_key = id_type::CustomerId+}++impl DatabaseBackedConfig for GsmPayoutCall {+ const KEY: &'static str = "gsm_payout_call";++ fn db_key(dimensions: &impl dimension_state::DimensionsBase) -> Option<String> {+ dimensions+ .get_processor_merchant_id()+ .and_then(|merchant_id| {+ dimensions+ .get_payout_retry_type()+ .map(|retry_type| match retry_type {+ common_enums::PayoutRetryType::SingleConnector => format!(+ "should_call_gsm_single_connector_payout_{}",+ merchant_id.get_string_repr()+ ),+ common_enums::PayoutRetryType::MultiConnector => format!(+ "should_call_gsm_multiple_connector_payout_{}",+ merchant_id.get_string_repr()+ ),+ })+ })+ }+}++config! {+ superposition_key = SHOULD_DISABLE_VAULT_TOKENIZATION,+ output = bool,+ default = false,+ requires = dimension_state::DimensionsWithProcessorAndProviderMerchantIdAndProfileId,+ targeting_key = id_type::CustomerId+}++impl DatabaseBackedConfig for ShouldDisableVaultTokenization {+ const KEY: &'static str = "should_disable_vault_tokenization";++ fn db_key(dimensions: &impl dimension_state::DimensionsBase) -> Option<String> {+ dimensions+ .get_processor_merchant_id()+ .map(|id| format!("{}_{}", Self::KEY, id.get_string_repr()))+ }+}++#[cfg(feature = "v2")]+config! {+ superposition_key = SHOULD_RETURN_RAW_PAYMENT_METHOD_DETAILS,+ output = bool,+ default = false,+ requires = dimension_state::DimensionsWithProviderMerchantId,+ targeting_key = id_type::GlobalCustomerId+}++#[cfg(feature = "v2")]+impl DatabaseBackedConfig for ShouldReturnRawPaymentMethodDetails {+ const KEY: &'static str = "should_return_raw_payment_method_details";++ fn db_key(dimensions: &impl dimension_state::DimensionsBase) -> Option<String> {+ dimensions+ .get_provider_merchant_id()+ .map(|id| format!("{}_{}", Self::KEY, id.get_string_repr()))+ }+}++config! {+ superposition_key = SHOULD_CALL_PM_MODULAR_SERVICE,+ output = bool,+ default = false,+ requires = dimension_state::DimensionsWithOrgId,+ targeting_key = id_type::CustomerId+}++impl DatabaseBackedConfig for ShouldCallPmModularService {+ const KEY: &'static str = "should_call_pm_modular_service";++ fn db_key(dimensions: &impl dimension_state::DimensionsBase) -> Option<String> {+ dimensions+ .get_organization_id()+ .map(|id| format!("{}_{}", Self::KEY, id.get_string_repr()))+ }+}+config! {superposition_key = PAYOUT_TRACKER_MAPPING,output = RetryMapping,diff --git a/crates/router/src/core/configs/dimension_state.rs b/crates/router/src/core/configs/dimension_state.rsindex 38c367256e..0750cc942f 100644--- a/crates/router/src/core/configs/dimension_state.rs+++ b/crates/router/src/core/configs/dimension_state.rs@@ -476,6 +476,16 @@ impl<Pm, M, O, P, Cn, PRT> DimensionsBase for Dimensions<Pm, M, O, P, Cn, PRT> {}}+// Type aliases+pub type DimensionsWithProviderMerchantId = Dimensions<+ HasProviderMerchantId,+ NoProcessorMerchantId,+ NoOrgId,+ NoProfileId,+ NoConnector,+ NoPayoutRetryType,+>;+// Type aliases - both provider and processor merchant IDs presentpub type DimensionsWithProcessorAndProviderMerchantId = Dimensions<HasProviderMerchantId,@@ -493,6 +503,14 @@ pub type DimensionsWithProcessorAndProviderMerchantIdAndProfileId = Dimensions<NoConnector,NoPayoutRetryType,>;+pub type DimensionsWithOrgId = Dimensions<+ NoProviderMerchantId,+ NoProcessorMerchantId,+ HasOrgId,+ NoProfileId,+ NoConnector,+ NoPayoutRetryType,+>;pub type DimensionsWithProcessorAndProviderMerchantIdAndConnector = Dimensions<HasProviderMerchantId,HasProcessorMerchantId,diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rsindex 849aeab519..18f9b26db0 100644--- a/crates/router/src/core/payment_methods.rs+++ b/crates/router/src/core/payment_methods.rs@@ -70,7 +70,10 @@ use super::{#[cfg(feature = "v2")]use crate::{configs::settings,- core::{payment_methods::transformers as pm_transforms, tokenization as tokenization_core},+ core::{+ configs::dimension_state, payment_methods::transformers as pm_transforms,+ tokenization as tokenization_core,+ },headers,routes::{self, payment_methods as pm_routes},services::encryption,@@ -4107,6 +4110,9 @@ pub async fn retrieve_payment_method() -> RouterResponse<api::PaymentMethodResponse> {let db = state.store.as_ref();+ let dimensions = dimension_state::Dimensions::new()+ .with_provider_merchant_id(platform.get_provider().get_provider_merchant_id());+// 1. Resolve parent token (if any) -> storage type & optional token datalet (storage_type, pm_token_data_opt) =resolve_storage_type_from_token(&state, &pm.payment_method_id).await?;@@ -4131,10 +4137,11 @@ pub async fn retrieve_payment_method()?;let raw_payment_method_fetch_access = get_raw_payment_method_data_fetch_access(- db,- platform.get_provider().get_account().get_id(),+ &state,+ &dimensions,api_key_type,fetch_raw_detail_query_param,+ payment_method.customer_id.as_ref(),).await.attach_printable("Failed to get raw payment method fetch access")?;@@ -4530,11 +4537,13 @@ impl RawPaymentMethodFetchAccess {}}+#[cfg(feature = "v2")]pub async fn get_raw_payment_method_data_fetch_access(- db: &dyn StorageInterface,- merchant_id: &id_type::MerchantId,+ state: &SessionState,+ dimensions: &dimension_state::DimensionsWithProviderMerchantId,api_key_type: enums::ApiKeyType,fetch_raw_detail_query_param: bool,+ customer_id: Option<&id_type::GlobalCustomerId>,) -> RouterResult<RawPaymentMethodFetchAccess> {// If query param not set, never allowed to fetch raw payment method detailslet fetch_access = match fetch_raw_detail_query_param {@@ -4549,23 +4558,17 @@ pub async fn get_raw_payment_method_data_fetch_access(// External API keys allowed only via org-level config// This supports cases where a PCI-compliant entity needs to retrieve raw payment method details.enums::ApiKeyType::External => {- let config = db- .find_config_by_key_unwrap_or(- &merchant_id.should_return_raw_payment_method_details_key(),- Some("false".to_string()),+ let allowed = dimensions+ .get_should_return_raw_payment_method_details(+ state.store.as_ref(),+ state.superposition_service.as_ref(),+ customer_id,).await;- match config {- Ok(conf) if conf.config.eq_ignore_ascii_case("true") => Ok(fetch_access),- Ok(_) => Ok(RawPaymentMethodFetchAccess::Denied),- Err(error) => {- router_env::logger::error!(- ?error,- "Failed to fetch raw payment method details config"- );- Ok(RawPaymentMethodFetchAccess::Denied)- }+ match allowed {+ true => Ok(fetch_access),+ false => Ok(RawPaymentMethodFetchAccess::Denied),}}}diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rsindex 68860dbee6..f469a44df6 100644--- a/crates/router/src/core/payment_methods/cards.rs+++ b/crates/router/src/core/payment_methods/cards.rs@@ -3076,9 +3076,6 @@ pub async fn list_payment_methods() -> errors::RouterResponse<api::PaymentMethodListResponse> {let db = &*state.store;let pm_config_mapping = &state.conf.pm_filters;- 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());let payment_intent = if let Some(cs) = &req.client_secret {if cs.starts_with("pm_") {validate_payment_method_and_client_secret(cs, db, &platform).await?;@@ -3218,6 +3215,11 @@ pub async fn list_payment_methods(}};+ 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())+ .with_profile_id(profile_id.clone());+// filter out payment connectors based on profile_idlet filtered_mcas = all_mcas.clone()diff --git a/crates/router/src/core/payment_methods/utils.rs b/crates/router/src/core/payment_methods/utils.rsindex 06c5f73519..4b5813f2b6 100644--- a/crates/router/src/core/payment_methods/utils.rs+++ b/crates/router/src/core/payment_methods/utils.rs@@ -14,13 +14,9 @@ use euclid::frontend::dir;use hyperswitch_constraint_graph as cgraph;use hyperswitch_masking::ExposeInterface;use kgraph_utils::{error::KgraphError, transformers::IntoDirValue};-#[cfg(feature = "v1")]-use router_env::logger;use storage_impl::redis::cache::{CacheKey, PM_FILTERS_CGRAPH_CACHE};-use crate::{- configs::settings, core::configs::dimension_state, db::StorageInterface, routes::SessionState,-};+use crate::{configs::settings, core::configs::dimension_state, routes::SessionState};#[cfg(feature = "v2")]use crate::{db::{@@ -817,27 +813,21 @@ fn compile_accepted_currency_for_mca(}pub async fn get_organization_eligibility_config_for_pm_modular_service(- db: &dyn StorageInterface,- organization_id: &common_utils::id_type::OrganizationId,+ state: &SessionState,+ dimensions: &dimension_state::DimensionsWithOrgId,) -> bool {- let config = db- .find_config_by_key_unwrap_or(- &organization_id.get_should_call_pm_modular_service_key(),- Some("false".to_string()),+ dimensions+ .get_should_call_pm_modular_service(+ state.store.as_ref(),+ state.superposition_service.as_ref(),+ None,)- .await;- match config {- Ok(conf) => conf.config == "true",- Err(error) => {- logger::error!(?error);- false- }- }+ .await}pub async fn get_sdk_next_action_for_payment_method_list(state: &SessionState,- dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,+ dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantIdAndProfileId,customer_id: Option<&common_utils::id_type::CustomerId>,) -> api_models::payments::SdkNextAction {let should_perform_eligibility_check = dimensionsdiff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rsindex 3d8ef993e0..e46f315f67 100644--- a/crates/router/src/core/payments.rs+++ b/crates/router/src/core/payments.rs@@ -672,7 +672,7 @@ where.validate_request(&req, platform.get_processor())?;#[cfg(feature = "pm_modular")]- let feature_config = core_utils::get_feature_config(state, platform).await;+ let feature_config = core_utils::get_feature_config(state, platform, dimensions).await;#[cfg(feature = "pm_modular")]let payment_method_info = operation@@ -700,6 +700,7 @@ where&header_payload,#[cfg(feature = "pm_modular")]payment_method_info,+ dimensions,).await?;let dimensions = dimensions.with_profile_id(business_profile.get_id().clone());@@ -1553,7 +1554,7 @@ 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).await;+ let feature_config = core_utils::get_feature_config(state, &platform, dimensions).await;let operations::GetTrackerResponse {operation,@@ -1572,6 +1573,7 @@ where&header_payload,#[cfg(feature = "pm_modular")]None,+ dimensions,).await?;let dimensions = dimensions.with_profile_id(business_profile.get_id().clone());@@ -2032,6 +2034,7 @@ where.to_not_found_response(errors::ApiErrorResponse::CustomerNotFound).attach_printable("Failed while fetching/creating customer")?;+ let dimensions = dimensions.with_profile_id(profile.get_id().clone());let (_operation, payment_data) = operation.to_update_tracker()?.update_trackers(@@ -2041,7 +2044,7 @@ wherepayment_data,None,header_payload,- &dimensions,+ &dimensions.without_profile_id(),).await?;@@ -2068,9 +2071,6 @@ whereD: OperationSessionGetters<F> + Send + Sync + Clone,{let operation: BoxedOperation<'_, F, Req, D> = Box::new(operation);- 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());tracing::Span::current().record("merchant_id",@@ -2081,6 +2081,11 @@ where.get_string_repr(),);+ let dimensions = dimension_state::Dimensions::new()+ .with_provider_merchant_id(platform.get_provider().get_provider_merchant_id())+ .with_processor_merchant_id(platform.get_processor().get_processor_merchant_id())+ .with_profile_id(profile.get_id().clone());+let _validate_result = operation.to_validate_request()?.validate_request(&req, &platform)?;@@ -2120,7 +2125,7 @@ wherepayment_data,None,header_payload,- &dimensions,+ &dimensions.without_profile_id(),).await?;@@ -5756,6 +5761,10 @@ whereNone => true,};+ let dimensions = dimension_state::Dimensions::new()+ .with_provider_merchant_id(platform.get_provider().get_provider_merchant_id())+ .with_processor_merchant_id(platform.get_processor().get_processor_merchant_id())+ .with_profile_id(business_profile.get_id().clone());(_, *payment_data) = operation.to_update_tracker()?.update_trackers(@@ -5765,7 +5774,7 @@ wherepayment_data.clone(),None, // frm_suggestion is not used in internal flowsheader_payload.clone(),- &dimensions,+ &dimensions.without_profile_id(),).await?;@@ -5997,10 +6006,6 @@ wheredyn api::Connector:services::api::ConnectorIntegration<F, RouterDReq, router_types::PaymentsResponseData>,{- 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());-let stime_connector = Instant::now();let merchant_connector_account = construct_profile_id_and_get_mca(@@ -6128,7 +6133,9 @@ where}let frm_suggestion = None;-+ let dimensions = dimension_state::Dimensions::new()+ .with_provider_merchant_id(platform.get_provider().get_provider_merchant_id())+ .with_processor_merchant_id(platform.get_processor().get_processor_merchant_id());(_, *payment_data) = operation.to_update_tracker()?.update_trackers(@@ -10391,6 +10398,7 @@ whereis_payment_method_modular_allowed,business_profile.is_connector_agnostic_mit_enabled,business_profile.is_network_tokenization_enabled,+ dimensions,).await}@@ -10406,6 +10414,7 @@ pub async fn plan_payment_execution_after_routing<F: Clone, D>(is_payment_method_modular_allowed: bool,is_connector_agnostic_mit_enabled: Option<bool>,is_network_tokenization_enabled: bool,+ _dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantIdAndProfileId,) -> RouterResult<ConnectorCallType>whereD: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,@@ -10536,7 +10545,8 @@ where}}_ => {- helpers::override_setup_future_usage_to_on_session(&*state.store, payment_data).await?;+ helpers::override_setup_future_usage_to_on_session(state.store.as_ref(), payment_data)+ .await?;let first_choice = connectors.first()diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rsindex c7ae65a460..c6d7825055 100644--- a/crates/router/src/core/payments/helpers.rs+++ b/crates/router/src/core/payments/helpers.rs@@ -456,6 +456,7 @@ pub async fn get_address_by_id(}#[cfg(feature = "v1")]+#[allow(clippy::too_many_arguments)]pub async fn get_token_pm_type_mandate_details(state: &SessionState,request: &api::PaymentsRequest,@@ -464,12 +465,17 @@ pub async fn get_token_pm_type_mandate_details(payment_method_id: Option<String>,payment_intent_customer_id: Option<&id_type::CustomerId>,pm_info: Option<domain::PaymentMethod>,+ 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)- .await- .is_payment_method_modular_allowed;+ let is_payment_method_modular_allowed =+ core_utils::get_feature_config(state, platform, dimensions)+ .await+ .is_payment_method_modular_allowed;let (payment_token,payment_method,@@ -808,6 +814,7 @@ pub async fn get_token_pm_type_mandate_details()}};+Ok(MandateGenericData {token: payment_token,payment_method,diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rsindex 86067b44f3..1125bba8f9 100644--- a/crates/router/src/core/payments/operations.rs+++ b/crates/router/src/core/payments/operations.rs@@ -225,6 +225,7 @@ pub trait GetTracker<F: Clone, D, R>: Send {#[cfg(feature = "pm_modular")] payment_method_with_raw_data: Option<PaymentMethodWithRawData,>,+ dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<GetTrackerResponse<'a, F, R, D>>;#[cfg(feature = "v2")]diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rsindex c461e5a739..f4bb339ab5 100644--- a/crates/router/src/core/payments/operations/payment_approve.rs+++ b/crates/router/src/core/payments/operations/payment_approve.rs@@ -46,6 +46,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCaptureR#[cfg(feature = "pm_modular")] _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 428349403d..71f200133e 100644--- a/crates/router/src/core/payments/operations/payment_cancel.rs+++ b/crates/router/src/core/payments/operations/payment_cancel.rs@@ -48,6 +48,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelRe#[cfg(feature = "pm_modular")] _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 1b30f72b83..53f2037ee7 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@@ -46,6 +46,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelPo#[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<operations::PaymentMethodWithRawData,>,+ _dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a,diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rsindex f0f5bf6e17..aef129c6a7 100644--- a/crates/router/src/core/payments/operations/payment_capture.rs+++ b/crates/router/src/core/payments/operations/payment_capture.rs@@ -48,6 +48,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen#[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<operations::PaymentMethodWithRawData,>,+ _dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a,diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rsindex 04399638d7..6887c3f9ce 100644--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs@@ -52,6 +52,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>#[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<operations::PaymentMethodWithRawData,>,+ dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsRequest, PaymentData<F>>>{let db = &*state.store;@@ -142,6 +143,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>payment_attempt.payment_method_id.clone(),payment_intent.customer_id.as_ref(),None,+ dimensions,)).await?;let customer_acceptance: Option<CustomerAcceptance> =diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rsindex 0eecd26fb5..a6703cf1cd 100644--- a/crates/router/src/core/payments/operations/payment_confirm.rs+++ b/crates/router/src/core/payments/operations/payment_confirm.rs@@ -95,6 +95,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>#[cfg(feature = "pm_modular")] payment_method_with_raw_data: Option<pm_transformers::PaymentMethodWithRawData,>,+ dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsRequest, PaymentData<F>>>{let processor_merchant_id = platform.get_processor().get_account().get_id();@@ -529,10 +530,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>.change_context(errors::ApiErrorResponse::InternalServerError).attach_printable("'profile_id' not set in payment intent")?;let customer_id = payment_intent.customer_id.clone();- 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())- .with_profile_id(profile_id.clone());+ let additional_pm_data_dimensions = dimensions.with_profile_id(profile_id.clone());let additional_pm_data_fut = tokio::spawn(async move {@@ -542,7 +540,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>&payment_method_data,store.as_ref(),superposition_service.as_ref(),- &dimensions,+ &additional_pm_data_dimensions,customer_id.as_ref(),None,)@@ -629,6 +627,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>#[cfg(not(feature = "pm_modular"))]let payment_method_info_from_modular = None;+ let m_pm_dimensions = dimensions.clone();let mandate_details_fut = tokio::spawn(async move {Box::pin(helpers::get_token_pm_type_mandate_details(@@ -639,6 +638,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>None,payment_intent_customer_id.as_ref(),payment_method_info_from_modular,+ &m_pm_dimensions,)).await}@@ -678,13 +678,25 @@ 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+ .get_processor()+ .get_account()+ .organization_id+ .clone(),+ )+ .without_provider_merchant_id()+ .without_processor_merchant_id();+//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.store,- &platform.get_processor().get_account().organization_id,+ state,+ &pm_modular_dimensions,).await;@@ -2321,7 +2333,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for_customer: Option<domain::Customer>,_frm_suggestion: Option<FrmSuggestion>,_header_payload: hyperswitch_domain_models::payments::HeaderPayload,- _dimensions: &dimension_state::Dimensions,+ _dimensions: &dimension_state::DimensionWithProcessorAndProviderMerchaantId,) -> RouterResult<(BoxedOperation<'b, F, api::PaymentsRequest, PaymentData<F>>,PaymentData<F>,diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rsindex 8ea5d0f002..c177c72db1 100644--- a/crates/router/src/core/payments/operations/payment_create.rs+++ b/crates/router/src/core/payments/operations/payment_create.rs@@ -84,6 +84,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>#[cfg(feature = "pm_modular")] payment_method_with_raw_data: Option<pm_transformers::PaymentMethodWithRawData,>,+ dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsRequest, PaymentData<F>>>{let db = &*state.store;@@ -181,6 +182,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>None,None,payment_method_info_from_modular,+ dimensions,).await?;@@ -371,6 +373,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>&customer_acceptance,payment_method_recurring_details.clone(),customer_details.customer_id.as_ref(),+ dimensions,).await?;@@ -1376,10 +1379,12 @@ impl PaymentCreate {customer_acceptance: &Option<common_payments_types::CustomerAcceptance>,payment_method_recurring_details: Option<domain::PaymentMethodData>,customer_id: Option<&common_utils::id_type::CustomerId>,+ dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<(PaymentAttempt,Option<api_models::payments::AdditionalPaymentData>,)> {+ let dimensions = dimensions.with_profile_id(profile_id.clone());let payment_method_data =request.payment_method_data@@ -1388,10 +1393,6 @@ impl PaymentCreate {payment_method_data_request.payment_method_data.as_ref()});- 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());-let created_at @ modified_at @ last_synced = common_utils::date_time::now();let status = helpers::payment_attempt_status_fsm(payment_method_data, request.confirm);let (amount, currency) = (money.0, Some(money.1));@@ -1405,8 +1406,7 @@ impl PaymentCreate {.map(domain::PaymentMethodData::from).or(payment_method_recurring_details).zip(Some(profile_id.clone())) // since data is consumed by async move, profile_id needs to be send separately- .async_map(|(payment_method_data, profile_id)| async move {- let dimensions = dimensions.with_profile_id(profile_id);+ .async_map(|(payment_method_data, _)| async move {helpers::get_additional_payment_data(&payment_method_data,&*state.store,diff --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 f425156e6f..dfafa1cfd5 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@@ -47,6 +47,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsPostSess#[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<operations::PaymentMethodWithRawData,>,+ _dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a,diff --git a/crates/router/src/core/payments/operations/payment_recurrence.rs b/crates/router/src/core/payments/operations/payment_recurrence.rsindex cc431a1cb3..5baf7359ab 100644--- a/crates/router/src/core/payments/operations/payment_recurrence.rs+++ b/crates/router/src/core/payments/operations/payment_recurrence.rs@@ -54,6 +54,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>#[cfg(feature = "pm_modular")] 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"))]@@ -160,10 +161,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>.get_required_value("profile_id").change_context(errors::ApiErrorResponse::InternalServerError).attach_printable("'profile_id' not set in payment intent")?;- 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())- .with_profile_id(profile_id.clone());+ let mandate_dimensions = dimensions.with_profile_id(profile_id.clone());let additional_pm_data_fut = tokio::spawn(async move {@@ -173,7 +171,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>&payment_method_data,store.as_ref(),superposition_service.as_ref(),- &dimensions,+ &mandate_dimensions,None,None,)@@ -204,6 +202,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>let payment_intent_customer_id = payment_intent.customer_id.clone();let m_pm_wrapper = payment_method_with_raw_data.clone();+ let mandate_dimensions = dimensions.clone();let mandate_details_fut = tokio::spawn(async move {Box::pin(helpers::get_token_pm_type_mandate_details(@@ -214,6 +213,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>None,payment_intent_customer_id.as_ref(),m_pm_wrapper.map(|pm| pm.payment_method.0),+ &mandate_dimensions,)).await}diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rsindex 99fb2910ac..90dc4f33f9 100644--- a/crates/router/src/core/payments/operations/payment_reject.rs+++ b/crates/router/src/core/payments/operations/payment_reject.rs@@ -45,6 +45,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsCancelRequest#[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<operations::PaymentMethodWithRawData,>,+ _dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a, F, PaymentsCancelRequest, PaymentData<F>>>{let db = &*state.store;diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rsindex 527ed2674d..bba2fd27d8 100644--- a/crates/router/src/core/payments/operations/payment_session.rs+++ b/crates/router/src/core/payments/operations/payment_session.rs@@ -49,6 +49,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsSessionR#[cfg(feature = "pm_modular")] _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 2de495c46d..fd58d9be0d 100644--- a/crates/router/src/core/payments/operations/payment_start.rs+++ b/crates/router/src/core/payments/operations/payment_start.rs@@ -48,9 +48,13 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsStartReq#[cfg(feature = "pm_modular")] _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;@@ -134,9 +138,10 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsStartReq// 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)- .await- .is_payment_method_modular_allowed;+ let is_payment_method_modular_allowed =+ utils::get_feature_config(state, platform, dimensions)+ .await+ .is_payment_method_modular_allowed;match (payment_attempt.payment_token.clone(),is_payment_method_modular_allowed,diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rsindex e8bd751ce9..e4ade6ad73 100644--- a/crates/router/src/core/payments/operations/payment_status.rs+++ b/crates/router/src/core/payments/operations/payment_status.rs@@ -236,6 +236,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRetrieve#[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<operations::PaymentMethodWithRawData,>,+ _dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsRetrieveRequest, PaymentData<F>>,> {@@ -285,6 +286,11 @@ 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());+(payment_intent, payment_attempt) = get_payment_intent_payment_attempt(state,payment_id,@@ -451,7 +457,7 @@ async fn get_tracker_for_sync<payment_attempt.payment_method_id.clone(){#[cfg(feature = "pm_modular")]- if core_utils::get_feature_config(state, platform)+ if core_utils::get_feature_config(state, platform, &dimensions).await.is_payment_method_modular_allowed{diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rsindex 987086e2ba..e0ddaff090 100644--- a/crates/router/src/core/payments/operations/payment_update.rs+++ b/crates/router/src/core/payments/operations/payment_update.rs@@ -63,6 +63,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>#[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<operations::PaymentMethodWithRawData,>,+ dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsRequest, PaymentData<F>>>{let (mut payment_intent, mut payment_attempt, currency): (_, _, storage_enums::Currency);@@ -171,6 +172,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>None,payment_intent.customer_id.as_ref(),None,+ dimensions,)).await?;helpers::validate_amount_to_capture_and_capture_method(Some(&payment_attempt), request)?;diff --git a/crates/router/src/core/payments/operations/payment_update_metadata.rs b/crates/router/src/core/payments/operations/payment_update_metadata.rsindex 337f4dcba7..9dc1d06806 100644--- a/crates/router/src/core/payments/operations/payment_update_metadata.rs+++ b/crates/router/src/core/payments/operations/payment_update_metadata.rs@@ -48,6 +48,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsUpdateMe#[cfg(feature = "pm_modular")] _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 9aea560916..4961f61ca4 100644--- a/crates/router/src/core/payments/operations/payments_extend_authorization.rs+++ b/crates/router/src/core/payments/operations/payments_extend_authorization.rs@@ -46,6 +46,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsExtendAu#[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<operations::PaymentMethodWithRawData,>,+ _dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a,diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rsindex c87b853a5a..1f7153a918 100644--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs@@ -54,6 +54,7 @@ impl<F: Send + Clone + Sync>#[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<operations::PaymentMethodWithRawData,>,+ _dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a,diff --git a/crates/router/src/core/payments/operations/tax_calculation.rs b/crates/router/src/core/payments/operations/tax_calculation.rsindex 7cea90e989..3cd9e00514 100644--- a/crates/router/src/core/payments/operations/tax_calculation.rs+++ b/crates/router/src/core/payments/operations/tax_calculation.rs@@ -52,6 +52,7 @@ impl<F: Send + Clone + Sync>#[cfg(feature = "pm_modular")] _payment_method_wrapper: Option<operations::PaymentMethodWithRawData,>,+ _dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> RouterResult<operations::GetTrackerResponse<'a,diff --git a/crates/router/src/core/payments/session_operation.rs b/crates/router/src/core/payments/session_operation.rsindex 80b3a42fa3..8b8948b9c5 100644--- a/crates/router/src/core/payments/session_operation.rs+++ b/crates/router/src/core/payments/session_operation.rs@@ -74,6 +74,11 @@ wheredyn api::Connector:services::api::ConnectorIntegration<F, FData, router_types::PaymentsResponseData>,{+ let dimensions = dimension_state::Dimensions::new()+ .with_provider_merchant_id(platform.get_provider().get_provider_merchant_id())+ .with_processor_merchant_id(platform.get_processor().get_processor_merchant_id())+ .with_profile_id(profile.get_id().clone());+let (payment_data, _req, customer, connector_http_status_code, external_latency) =payments_session_operation_core::<_, _, _, _, _>(&state,@@ -85,6 +90,7 @@ wherepayment_id,call_connector_action,header_payload.clone(),+ &dimensions,).await?;@@ -113,6 +119,7 @@ pub async fn payments_session_operation_core<F, Req, Op, FData, D>(payment_id: id_type::GlobalPaymentId,_call_connector_action: CallConnectorAction,header_payload: HeaderPayload,+ dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantIdAndProfileId,) -> RouterResult<(D, Req, Option<domain::Customer>, Option<u16>, Option<u128>)>whereF: Send + Clone + Sync,@@ -131,10 +138,6 @@ where{let operation: BoxedOperation<'_, F, Req, D> = Box::new(operation);- 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());-let _validate_result = operation.to_validate_request()?.validate_request(&req, &platform)?;@@ -196,7 +199,7 @@ wherepayment_data.clone(),None,header_payload.clone(),- &dimensions,+ &dimensions.without_profile_id(),).await?;// todo: call surcharge manager for session token call.diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rsindex d97c5374ef..7b58ffc026 100644--- a/crates/router/src/core/payouts.rs+++ b/crates/router/src/core/payouts.rs@@ -202,9 +202,10 @@ pub async fn make_connector_decision(#[cfg(feature = "payout_retry")]{let config_bool = retry::config_should_call_gsm_payout(- &*state.store,- platform.get_processor().get_account().get_id(),+ state,+ dimensions,PayoutRetryType::SingleConnector,+ payout_data.payouts.customer_id.as_ref(),).await;@@ -241,9 +242,10 @@ pub async fn make_connector_decision(#[cfg(feature = "payout_retry")]{let config_multiple_connector_bool = retry::config_should_call_gsm_payout(- &*state.store,- platform.get_processor().get_account().get_id(),+ state,+ dimensions,PayoutRetryType::MultiConnector,+ payout_data.payouts.customer_id.as_ref(),).await;@@ -261,9 +263,10 @@ pub async fn make_connector_decision(}let config_single_connector_bool = retry::config_should_call_gsm_payout(- &*state.store,- platform.get_processor().get_account().get_id(),+ state,+ dimensions,PayoutRetryType::SingleConnector,+ payout_data.payouts.customer_id.as_ref(),).await;diff --git a/crates/router/src/core/payouts/retry.rs b/crates/router/src/core/payouts/retry.rsindex 2f393dd854..27241bd25c 100644--- a/crates/router/src/core/payouts/retry.rs+++ b/crates/router/src/core/payouts/retry.rs@@ -16,7 +16,6 @@ use crate::{errors::{self, RouterResult, StorageErrorExt},payouts,},- db::StorageInterface,routes::{self, app, metrics},types::{api, domain, storage},utils,@@ -312,21 +311,19 @@ pub async fn modify_trackers(}pub async fn config_should_call_gsm_payout(- db: &dyn StorageInterface,- merchant_id: &common_utils::id_type::MerchantId,+ state: &app::SessionState,+ dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,retry_type: PayoutRetryType,+ customer_id: Option<&common_utils::id_type::CustomerId>,) -> bool {- let key = merchant_id.get_should_call_gsm_payout_key(retry_type);- let config = db- .find_config_by_key_unwrap_or(key.as_str(), Some("false".to_string()))- .await;- match config {- Ok(conf) => conf.config == "true",- Err(error) => {- logger::error!(?error);- false- }- }+ let dimensions = dimensions.with_payout_retry_type(retry_type);+ dimensions+ .get_gsm_payout_call(+ state.store.as_ref(),+ state.superposition_service.as_ref(),+ customer_id,+ )+ .await}pub trait GsmValidation {diff --git a/crates/router/src/core/unified_authentication_service.rs b/crates/router/src/core/unified_authentication_service.rsindex 50880baf4b..4b1ed6df7b 100644--- a/crates/router/src/core/unified_authentication_service.rs+++ b/crates/router/src/core/unified_authentication_service.rs@@ -2015,6 +2015,11 @@ pub async fn authentication_sync_core(id: profile_id.get_string_repr().to_owned(),})?;+ let dimensions = dimension_state::Dimensions::new()+ .with_provider_merchant_id(platform.get_provider().get_provider_merchant_id())+ .with_processor_merchant_id(platform.get_processor().get_processor_merchant_id())+ .with_profile_id(profile_id.clone());+let (authentication_connector, three_ds_connector_account) =auth_utils::get_authentication_connector_data(&state,@@ -2108,8 +2113,13 @@ pub async fn authentication_sync_core(}// Determine whether to tokenise or not- let should_disable_vault_tokenization =- utils::should_disable_vault_tokenization(&state, &authentication.merchant_id).await;+ let should_disable_vault_tokenization = dimensions+ .get_should_disable_vault_tokenization(+ state.store.as_ref(),+ state.superposition_service.as_ref(),+ None,+ )+ .await;// Determine the authentication sync strategy based on current statelet strategy = determine_auth_sync_strategy(diff --git a/crates/router/src/core/unified_authentication_service/utils.rs b/crates/router/src/core/unified_authentication_service/utils.rsindex 5b62a57af8..824b890059 100644--- a/crates/router/src/core/unified_authentication_service/utils.rs+++ b/crates/router/src/core/unified_authentication_service/utils.rs@@ -732,32 +732,3 @@ async fn fetch_region(state: &SessionState, key: &str) -> Option<RoutingRegion>.ok().map(|conf| RoutingRegion::from_str(&conf.config).unwrap_or(RoutingRegion::Region1))}--pub async fn get_bool_config(state: &SessionState, key: &str, default_value: bool) -> bool {- let default_str = if default_value { "true" } else { "false" };-- let config = state- .store- .find_config_by_key_unwrap_or(key, Some(default_str.to_string()))- .await;-- match config {- Ok(conf) => conf.config == "true",- Err(error) => {- router_env::logger::error!(?error);- default_value- }- }-}--pub async fn should_disable_vault_tokenization(- state: &SessionState,- merchant_id: &common_utils::id_type::MerchantId,-) -> bool {- get_bool_config(- state,- &merchant_id.get_should_disable_vault_tokenization(),- false,- )- .await-}diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rsindex cae91b1200..849fdab132 100644--- a/crates/router/src/core/utils.rs+++ b/crates/router/src/core/utils.rs@@ -54,6 +54,7 @@ use crate::{configs::Settings,consts,core::{+ configs::dimension_state,errors::{self, RouterResult, StorageErrorExt},payments::PaymentData,},@@ -77,10 +78,22 @@ pub struct FeatureConfig {pub async fn get_feature_config(state: &SessionState,platform: &domain::Platform,+ dimensions: &dimension_state::DimensionsWithProcessorAndProviderMerchantId,) -> FeatureConfig {+ let dimensions = dimensions+ .with_organization_id(+ platform+ .get_processor()+ .get_account()+ .organization_id+ .clone(),+ )+ .without_provider_merchant_id()+ .without_processor_merchant_id();+let is_payment_method_modular_allowed = crate::core::payment_methods::utils::get_organization_eligibility_config_for_pm_modular_service(- state.store.as_ref(),- &platform.get_processor().get_account().organization_id,+ state,+ &dimensions,).await;FeatureConfig {@@ -96,9 +109,13 @@ pub async fn validate_legacy_endpoint_access<E>(whereE: From<errors::ApiErrorResponse> + error_stack::Context,{+ 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());+#[cfg(feature = "pm_modular")]{- let feature_config = get_feature_config(state, platform).await;+ 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 {@@ -108,7 +125,7 @@ where})?;}#[cfg(not(feature = "pm_modular"))]- let _ = (state, platform);+ let _ = (state, platform, dimensions);Ok(())}