Skip to content

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

feat(modular): consistent dimensions for modular configs (#13236)

Kashif6cf9d6aa1f6f
diff --git a/config/superposition_seed.toml b/config/superposition_seed.toml
index 98ca28653f..cf34416472 100644
--- a/config/superposition_seed.toml
+++ b/config/superposition_seed.toml
@@ -155,7 +155,7 @@ 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"
+description = "Whether to call the PM modular service for a provider merchant, with organization fallback"
change_reason = "Initial setup"
[default-configs.should_perform_sdk_vaulting]
@@ -167,7 +167,7 @@ change_reason = "Initial setup"
[default-configs.should_schedule_modular_forward_compat]
value = false
schema = { type = "boolean" }
-description = "Whether to schedule PM modular forward compatibility PT for a merchant"
+description = "Whether to schedule PM modular forward compatibility PT for a provider merchant, with organization fallback"
change_reason = "Initial setup"
[default-configs.should_trigger_fingerprint_migration]
@@ -180,13 +180,13 @@ change_reason = "Initial setup"
[default-configs.should_schedule_modular_backward_compat]
value = false
schema = { type = "boolean" }
-description = "Whether to schedule PM modular backward compatibility PT for a merchant"
+description = "Whether to schedule PM modular backward compatibility PT for a provider merchant, with organization fallback"
change_reason = "Initial setup"
[default-configs.should_trigger_backwards_compatibility_inline]
value = false
schema = { type = "boolean" }
-description = "Whether to trigger PM modular backward compatibility inline for a merchant"
+description = "Whether to trigger PM modular backward compatibility inline for a provider merchant, with organization fallback"
change_reason = "Initial setup"
[default-configs.should_return_raw_payment_method_details]
diff --git a/crates/router/src/core/configs/dimension_config.rs b/crates/router/src/core/configs/dimension_config.rs
index d8476503be..c430c9db0d 100644
--- a/crates/router/src/core/configs/dimension_config.rs
+++ b/crates/router/src/core/configs/dimension_config.rs
@@ -414,7 +414,7 @@ config! {
superposition_key = SHOULD_CALL_PM_MODULAR_SERVICE,
output = bool,
default = false,
- requires = dimension_state::DimensionsWithOrgId,
+ requires = dimension_state::DimensionsWithProviderMerchantIdAndOrgId,
targeting_key = id_type::CustomerId
}
@@ -432,7 +432,7 @@ config! {
superposition_key = SHOULD_SCHEDULE_MODULAR_FORWARD_COMPAT,
output = bool,
default = false,
- requires = dimension_state::DimensionsWithProviderMerchantId,
+ requires = dimension_state::DimensionsWithProviderMerchantIdAndOrgId,
targeting_key = id_type::CustomerId
}
@@ -450,7 +450,7 @@ config! {
superposition_key = SHOULD_SCHEDULE_MODULAR_BACKWARD_COMPAT,
output = bool,
default = false,
- requires = dimension_state::DimensionsWithProviderMerchantId,
+ requires = dimension_state::DimensionsWithProviderMerchantIdAndOrgId,
targeting_key = id_type::CustomerId
}
@@ -468,7 +468,7 @@ config! {
superposition_key = SHOULD_TRIGGER_BACKWARDS_COMPATIBILITY_INLINE,
output = bool,
default = false,
- requires = dimension_state::DimensionsWithProviderMerchantId,
+ requires = dimension_state::DimensionsWithProviderMerchantIdAndOrgId,
targeting_key = id_type::CustomerId
}
diff --git a/crates/router/src/core/configs/dimension_state.rs b/crates/router/src/core/configs/dimension_state.rs
index 167bd0348f..44b47ad0a3 100644
--- a/crates/router/src/core/configs/dimension_state.rs
+++ b/crates/router/src/core/configs/dimension_state.rs
@@ -566,6 +566,17 @@ pub type DimensionsWithProviderMerchantId = Dimensions<
NoWebhookEvent,
>;
+// Type alias - provider merchant ID and organization ID present
+pub type DimensionsWithProviderMerchantIdAndOrgId = Dimensions<
+ HasProviderMerchantId,
+ NoProcessorMerchantId,
+ HasOrgId,
+ NoProfileId,
+ NoConnector,
+ NoPayoutRetryType,
+ NoWebhookEvent,
+>;
+
// Type alias - only processor merchant ID present
pub type DimensionsWithProcessorMerchantId = Dimensions<
NoProviderMerchantId,
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index b83fd12c4e..2ae4f37f04 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -507,22 +507,27 @@ fn payment_method_compat_modifier(payment_method: &domain::PaymentMethod) -> Opt
pub async fn payment_method_modular_forward_compat_action(
state: &SessionState,
merchant_id: &id_type::MerchantId,
+ organization_id: &id_type::OrganizationId,
customer_id: Option<&id_type::CustomerId>,
) -> Option<domain::PaymentMethodCompatAction> {
let dimensions = dimension_state::Dimensions::new()
- .with_provider_merchant_id(ProviderMerchantId::new(merchant_id.clone()));
+ .with_provider_merchant_id(ProviderMerchantId::new(merchant_id.clone()))
+ .with_organization_id(organization_id.clone());
let should_schedule_modular_forward_compat =
utils::get_should_schedule_modular_forward_compat(state, &dimensions, customer_id).await;
+ let organization_id = organization_id.clone();
should_schedule_modular_forward_compat.then(|| {
let state = state.clone();
domain::PaymentMethodCompatAction::new(move |payment_method| {
let state = state.clone();
+ let organization_id = organization_id.clone();
Box::pin(async move {
let res = add_payment_method_modular_forward_compat_task(
&*state.store,
payment_method,
&payment_method.merchant_id,
+ organization_id,
state.conf.application_source,
payment_method_compat_modifier(payment_method),
)
@@ -544,14 +549,18 @@ pub async fn payment_method_modular_forward_compat_action(
#[cfg(feature = "v2")]
pub fn payment_method_modular_backward_compat_action(
state: &SessionState,
+ organization_id: &id_type::OrganizationId,
) -> domain::PaymentMethodCompatAction {
let state = state.clone();
+ let organization_id = organization_id.clone();
domain::PaymentMethodCompatAction::new(move |payment_method| {
let state = state.clone();
+ let organization_id = organization_id.clone();
Box::pin(async move {
backward_compat::trigger_payment_method_modular_backward_compat(
&state,
payment_method,
+ &organization_id,
payment_method_compat_modifier(payment_method),
)
.await;
@@ -563,18 +572,24 @@ pub fn payment_method_modular_backward_compat_action(
pub async fn payment_method_modular_compat_action(
state: &SessionState,
merchant_id: &id_type::MerchantId,
+ organization_id: &id_type::OrganizationId,
customer_id: Option<&id_type::CustomerId>,
) -> Option<domain::PaymentMethodCompatAction> {
- payment_method_modular_forward_compat_action(state, merchant_id, customer_id).await
+ payment_method_modular_forward_compat_action(state, merchant_id, organization_id, customer_id)
+ .await
}
#[cfg(feature = "v2")]
pub async fn payment_method_modular_compat_action(
state: &SessionState,
_merchant_id: &id_type::MerchantId,
+ organization_id: &id_type::OrganizationId,
_customer_id: Option<&id_type::GlobalCustomerId>,
) -> Option<domain::PaymentMethodCompatAction> {
- Some(payment_method_modular_backward_compat_action(state))
+ Some(payment_method_modular_backward_compat_action(
+ state,
+ organization_id,
+ ))
}
#[cfg(feature = "v1")]
@@ -643,12 +658,14 @@ pub async fn add_payment_method_modular_forward_compat_task(
db: &dyn StorageInterface,
payment_method: &domain::PaymentMethod,
merchant_id: &id_type::MerchantId,
+ organization_id: id_type::OrganizationId,
application_source: common_enums::ApplicationSource,
last_modified_by: Option<String>,
) -> Result<(), ProcessTrackerError> {
let tracking_data = storage::PaymentMethodModularCompatTrackingData {
payment_method_id: payment_method.payment_method_id.clone(),
merchant_id: merchant_id.to_owned(),
+ organization_id,
last_modified_by,
};
@@ -695,6 +712,7 @@ pub async fn add_payment_method_modular_backward_compat_task(
db: &dyn StorageInterface,
payment_method: &domain::PaymentMethod,
merchant_id: &id_type::MerchantId,
+ organization_id: id_type::OrganizationId,
application_source: common_enums::ApplicationSource,
last_modified_by: Option<String>,
) -> Result<(), ProcessTrackerError> {
@@ -703,6 +721,7 @@ pub async fn add_payment_method_modular_backward_compat_task(
let tracking_data = storage::PaymentMethodModularCompatTrackingData {
payment_method_id: payment_method_id.clone(),
merchant_id: merchant_id.to_owned(),
+ organization_id,
last_modified_by,
};
@@ -2466,6 +2485,7 @@ pub async fn create_payment_method_bank_redirect_core(
payment_method_id,
None,
merchant_id,
+ &platform.get_provider().get_account().organization_id,
platform.get_provider().get_key_store(),
platform.get_provider().get_account().storage_scheme,
req.payment_method_type,
@@ -2650,6 +2670,7 @@ impl PaymentMethodResolver {
customer_id,
payment_method_id,
merchant_id,
+ &platform.get_provider().get_account().organization_id,
platform.get_provider().get_key_store(),
platform.get_provider().get_account().storage_scheme,
billing_address.clone(),
@@ -2765,7 +2786,10 @@ async fn execute_payment_method_create(
payment_method,
pm_update,
platform.get_provider().get_account().storage_scheme,
- Some(payment_method_modular_backward_compat_action(state)),
+ Some(payment_method_modular_backward_compat_action(
+ state,
+ &platform.get_provider().get_account().organization_id,
+ )),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -3048,7 +3072,10 @@ pub async fn create_payment_method_wallet_core(
existing_pm,
pm_update,
platform.get_provider().get_account().storage_scheme,
- Some(payment_method_modular_backward_compat_action(state)),
+ Some(payment_method_modular_backward_compat_action(
+ state,
+ &platform.get_provider().get_account().organization_id,
+ )),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -3061,6 +3088,7 @@ pub async fn create_payment_method_wallet_core(
payment_method_id,
None,
merchant_id,
+ &platform.get_provider().get_account().organization_id,
platform.get_provider().get_key_store(),
platform.get_provider().get_account().storage_scheme,
req.payment_method_type,
@@ -3193,6 +3221,7 @@ pub async fn create_payment_method_proxy_card_core(
payment_method_id,
external_vault_source,
merchant_id,
+ &platform.get_provider().get_account().organization_id,
platform.get_provider().get_key_store(),
platform.get_provider().get_account().storage_scheme,
req.payment_method_type,
@@ -3653,6 +3682,7 @@ pub async fn payment_method_intent_create(
&customer_id,
payment_method_id,
merchant_id,
+ &provider.get_account().organization_id,
provider.get_key_store(),
provider.get_account().storage_scheme,
payment_method_billing_address,
@@ -4044,6 +4074,7 @@ pub async fn create_payment_method_for_intent(
customer_id: &id_type::GlobalCustomerId,
payment_method_id: id_type::GlobalPaymentMethodId,
merchant_id: &id_type::MerchantId,
+ organization_id: &id_type::OrganizationId,
key_store: &domain::MerchantKeyStore,
storage_scheme: enums::MerchantStorageScheme,
payment_method_billing_address: Option<
@@ -4096,7 +4127,10 @@ pub async fn create_payment_method_for_intent(
compatibility_updated_at: None,
},
storage_scheme,
- Some(payment_method_modular_backward_compat_action(state)),
+ Some(payment_method_modular_backward_compat_action(
+ state,
+ organization_id,
+ )),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -4197,6 +4231,7 @@ pub async fn create_payment_method_for_confirm(
payment_method_id: id_type::GlobalPaymentMethodId,
external_vault_source: Option<id_type::MerchantConnectorAccountId>,
merchant_id: &id_type::MerchantId,
+ organization_id: &id_type::OrganizationId,
key_store: &domain::MerchantKeyStore,
storage_scheme: enums::MerchantStorageScheme,
payment_method_type: storage_enums::PaymentMethod,
@@ -4255,7 +4290,10 @@ pub async fn create_payment_method_for_confirm(
compatibility_updated_at: None,
},
storage_scheme,
- Some(payment_method_modular_backward_compat_action(state)),
+ Some(payment_method_modular_backward_compat_action(
+ state,
+ organization_id,
+ )),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -7436,7 +7474,10 @@ impl<'a> pm_types::PaymentMethodUpdateHandler<'a> {
self.payment_method.clone(),
pm_update,
self.platform.get_provider().get_account().storage_scheme,
- Some(payment_method_modular_backward_compat_action(self.state)),
+ Some(payment_method_modular_backward_compat_action(
+ self.state,
+ &self.platform.get_provider().get_account().organization_id,
+ )),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/core/payment_methods/backward_compat.rs b/crates/router/src/core/payment_methods/backward_compat.rs
index 4821629239..911e422652 100644
--- a/crates/router/src/core/payment_methods/backward_compat.rs
+++ b/crates/router/src/core/payment_methods/backward_compat.rs
@@ -14,11 +14,13 @@ async fn trigger_payment_method_modular_backward_compat_inline(
state: &SessionState,
payment_method: &domain::PaymentMethod,
merchant_id: &id_type::MerchantId,
+ organization_id: &id_type::OrganizationId,
last_modified_by: Option<String>,
) -> Result<(), ProcessTrackerError> {
let tracking_data = storage::PaymentMethodModularCompatTrackingData {
payment_method_id: payment_method.get_id().get_string_repr().to_owned(),
merchant_id: merchant_id.to_owned(),
+ organization_id: organization_id.clone(),
last_modified_by,
};
@@ -36,12 +38,14 @@ async fn schedule_payment_method_modular_backward_compat_task_best_effort(
state: &SessionState,
payment_method: &domain::PaymentMethod,
merchant_id: &id_type::MerchantId,
+ organization_id: &id_type::OrganizationId,
last_modified_by: Option<String>,
) {
let res = add_payment_method_modular_backward_compat_task(
&*state.store,
payment_method,
merchant_id,
+ organization_id.clone(),
state.conf.application_source,
last_modified_by,
)
@@ -70,11 +74,13 @@ async fn schedule_payment_method_modular_backward_compat_task_best_effort(
pub(super) async fn trigger_payment_method_modular_backward_compat(
state: &SessionState,
payment_method: &domain::PaymentMethod,
+ organization_id: &id_type::OrganizationId,
last_modified_by: Option<String>,
) {
let merchant_id = &payment_method.merchant_id;
let dimensions = dimension_state::Dimensions::new()
- .with_provider_merchant_id(ProviderMerchantId::new(merchant_id.clone()));
+ .with_provider_merchant_id(ProviderMerchantId::new(merchant_id.clone()))
+ .with_organization_id(organization_id.clone());
let should_trigger_backwards_compatibility_inline =
utils::get_should_trigger_backwards_compatibility_inline(state, &dimensions, None).await;
@@ -85,6 +91,7 @@ pub(super) async fn trigger_payment_method_modular_backward_compat(
state,
payment_method,
merchant_id,
+ organization_id,
last_modified_by.clone(),
)),
)
@@ -117,6 +124,7 @@ pub(super) async fn trigger_payment_method_modular_backward_compat(
state,
payment_method,
merchant_id,
+ organization_id,
last_modified_by,
)
.await;
@@ -131,6 +139,7 @@ pub(super) async fn trigger_payment_method_modular_backward_compat(
state,
payment_method,
merchant_id,
+ organization_id,
last_modified_by,
)
.await;
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 24a18a2129..b6c0caa87b 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -167,6 +167,7 @@ impl PaymentMethodsController for PmCards<'_> {
let compat_action = super::payment_method_modular_forward_compat_action(
self.state,
merchant_id,
+ &self.provider.get_account().organization_id,
Some(customer_id),
)
.await;
@@ -474,6 +475,7 @@ impl PaymentMethodsController for PmCards<'_> {
let compat_action = super::payment_method_modular_forward_compat_action(
self.state,
&existing_pm.merchant_id,
+ &self.provider.get_account().organization_id,
existing_pm.customer_id.as_ref(),
)
.await;
@@ -1914,6 +1916,7 @@ impl PaymentMethodsController for PmCards<'_> {
let compat_action = super::payment_method_modular_forward_compat_action(
self.state,
&existing_pm.merchant_id,
+ &self.provider.get_account().organization_id,
existing_pm.customer_id.as_ref(),
)
.await;
@@ -2428,6 +2431,7 @@ pub async fn add_payment_method_data(
let compat_action = super::payment_method_modular_forward_compat_action(
&state,
&payment_method.merchant_id,
+ &provider.get_account().organization_id,
payment_method.customer_id.as_ref(),
)
.await;
@@ -2522,6 +2526,7 @@ pub async fn add_payment_method_data(
let compat_action = super::payment_method_modular_forward_compat_action(
&state,
&payment_method.merchant_id,
+ &provider.get_account().organization_id,
payment_method.customer_id.as_ref(),
)
.await;
@@ -2807,6 +2812,7 @@ pub async fn update_customer_payment_method(
let compat_action = super::payment_method_modular_forward_compat_action(
&state,
&pm.merchant_id,
+ &provider.get_account().organization_id,
pm.customer_id.as_ref(),
)
.await;
@@ -2895,6 +2901,7 @@ pub async fn update_customer_payment_method(
let compat_action = super::payment_method_modular_forward_compat_action(
&state,
&pm.merchant_id,
+ &provider.get_account().organization_id,
pm.customer_id.as_ref(),
)
.await;
@@ -3306,8 +3313,10 @@ pub async fn update_payment_method_and_last_used(
}
#[cfg(feature = "v2")]
+#[allow(clippy::too_many_arguments)]
pub async fn update_payment_method_connector_mandate_details(
state: &routes::SessionState,
+ organization_id: &id_type::OrganizationId,
key_store: &domain::MerchantKeyStore,
db: &dyn db::StorageInterface,
pm: domain::PaymentMethod,
@@ -3327,7 +3336,10 @@ pub async fn update_payment_method_connector_mandate_details(
pm,
pm_update,
storage_scheme,
- Some(super::payment_method_modular_backward_compat_action(state)),
+ Some(super::payment_method_modular_backward_compat_action(
+ state,
+ organization_id,
+ )),
)
.await
.change_context(errors::VaultError::UpdateInPaymentMethodTableFailed)?;
diff --git a/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs b/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs
index 7da430058f..50d29a48db 100644
--- a/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs
+++ b/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs
@@ -417,6 +417,7 @@ impl CardNetworkTokenizeExecutor<'_, domain::TokenizePaymentMethodRequest> {
let compat_action = payment_methods::payment_method_modular_forward_compat_action(
self.state,
&payment_method.merchant_id,
+ &self.merchant_account.organization_id,
payment_method.customer_id.as_ref(),
)
.await;
diff --git a/crates/router/src/core/payment_methods/utils.rs b/crates/router/src/core/payment_methods/utils.rs
index 7daba9f6f0..8cb40b960a 100644
--- a/crates/router/src/core/payment_methods/utils.rs
+++ b/crates/router/src/core/payment_methods/utils.rs
@@ -815,15 +815,16 @@ fn compile_accepted_currency_for_mca(
))
}
-pub async fn get_organization_eligibility_config_for_pm_modular_service(
+pub async fn get_should_call_pm_modular_service(
state: &SessionState,
- dimensions: &dimension_state::DimensionsWithOrgId,
+ dimensions: &dimension_state::DimensionsWithProviderMerchantIdAndOrgId,
+ customer_id: Option<&common_utils::id_type::CustomerId>,
) -> bool {
dimensions
.get_should_call_pm_modular_service(
state.store.as_ref(),
state.superposition_service.as_ref(),
- None,
+ customer_id,
)
.await
}
@@ -843,7 +844,7 @@ pub async fn get_should_perform_sdk_vaulting(
pub async fn get_should_schedule_modular_forward_compat(
state: &SessionState,
- dimensions: &dimension_state::DimensionsWithProviderMerchantId,
+ dimensions: &dimension_state::DimensionsWithProviderMerchantIdAndOrgId,
customer_id: Option<&common_utils::id_type::CustomerId>,
) -> bool {
dimensions
@@ -857,7 +858,7 @@ pub async fn get_should_schedule_modular_forward_compat(
pub async fn get_should_schedule_modular_backward_compat(
state: &SessionState,
- dimensions: &dimension_state::DimensionsWithProviderMerchantId,
+ dimensions: &dimension_state::DimensionsWithProviderMerchantIdAndOrgId,
customer_id: Option<&common_utils::id_type::CustomerId>,
) -> bool {
dimensions
@@ -871,7 +872,7 @@ pub async fn get_should_schedule_modular_backward_compat(
pub async fn get_should_trigger_backwards_compatibility_inline(
state: &SessionState,
- dimensions: &dimension_state::DimensionsWithProviderMerchantId,
+ dimensions: &dimension_state::DimensionsWithProviderMerchantIdAndOrgId,
customer_id: Option<&common_utils::id_type::CustomerId>,
) -> bool {
dimensions
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 3008b81462..f90decc7af 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -2147,12 +2147,12 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R, D>(
let pm_modular_dimensions = dimensions
.without_profile_id()
.with_organization_id(provider.get_account().organization_id.clone())
- .without_provider_merchant_id()
.without_processor_merchant_id();
let should_call_pm_modular_service =
- payment_methods::utils::get_organization_eligibility_config_for_pm_modular_service(
+ payment_methods::utils::get_should_call_pm_modular_service(
state,
&pm_modular_dimensions,
+ None,
)
.await;
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index f17f34fecc..44c48e9842 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -321,6 +321,7 @@ where
let compat_action = payment_methods::payment_method_modular_forward_compat_action(
state,
&payment_method.merchant_id,
+ &provider.get_account().organization_id,
payment_method.customer_id.as_ref(),
)
.await;
@@ -396,6 +397,7 @@ where
let compat_action = payment_methods::payment_method_modular_forward_compat_action(
state,
&payment_method.merchant_id,
+ &provider.get_account().organization_id,
payment_method.customer_id.as_ref(),
)
.await;
@@ -1096,6 +1098,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsSyncData> for
resp.status,
resp.response.clone(),
platform.get_provider().get_account().storage_scheme,
+ &platform.get_provider().get_account().organization_id,
platform.get_initiator(),
)
.await?;
@@ -2091,6 +2094,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::CompleteAuthorizeData
resp.status,
resp.response.clone(),
platform.get_provider().get_account().storage_scheme,
+ &platform.get_provider().get_account().organization_id,
platform.get_initiator(),
)
.await?;
@@ -3170,6 +3174,7 @@ fn get_payment_intent_update_data<F: Clone, T: types::Capturable>(
}
#[cfg(feature = "v2")]
+#[allow(clippy::too_many_arguments)]
async fn update_payment_method_status_and_ntid<F: Clone>(
state: &SessionState,
key_store: &domain::MerchantKeyStore,
@@ -3177,12 +3182,14 @@ async fn update_payment_method_status_and_ntid<F: Clone>(
attempt_status: common_enums::AttemptStatus,
payment_response: Result<types::PaymentsResponseData, ErrorResponse>,
storage_scheme: enums::MerchantStorageScheme,
+ _organization_id: &common_utils::id_type::OrganizationId,
_initiator: Option<&domain::Initiator>,
) -> RouterResult<()> {
todo!()
}
#[cfg(feature = "v1")]
+#[allow(clippy::too_many_arguments)]
async fn update_payment_method_status_and_ntid<F: Clone>(
state: &SessionState,
key_store: &domain::MerchantKeyStore,
@@ -3190,6 +3197,7 @@ async fn update_payment_method_status_and_ntid<F: Clone>(
attempt_status: common_enums::AttemptStatus,
payment_response: Result<types::PaymentsResponseData, ErrorResponse>,
storage_scheme: enums::MerchantStorageScheme,
+ organization_id: &common_utils::id_type::OrganizationId,
initiator: Option<&domain::Initiator>,
) -> RouterResult<()> {
// If the payment_method is deleted then ignore the error related to retrieving payment method
@@ -3286,6 +3294,7 @@ async fn update_payment_method_status_and_ntid<F: Clone>(
let compat_action = payment_methods::payment_method_modular_forward_compat_action(
state,
&payment_method.merchant_id,
+ organization_id,
payment_method.customer_id.as_ref(),
)
.await;
diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rs
index 1c43ab86fa..426fee2dd7 100644
--- a/crates/router/src/core/payments/tokenization.rs
+++ b/crates/router/src/core/payments/tokenization.rs
@@ -523,6 +523,7 @@ where
let compat_action = payment_methods::payment_method_modular_forward_compat_action(
state,
&pm.merchant_id,
+ &platform.get_provider().get_account().organization_id,
pm.customer_id.as_ref(),
)
.await;
@@ -674,6 +675,7 @@ where
let compat_action = payment_methods::payment_method_modular_forward_compat_action(
state,
&pm.merchant_id,
+ &platform.get_provider().get_account().organization_id,
pm.customer_id.as_ref(),
)
.await;
@@ -867,6 +869,7 @@ where
payment_methods::payment_method_modular_forward_compat_action(
state,
&existing_pm.merchant_id,
+ &platform.get_provider().get_account().organization_id,
existing_pm.customer_id.as_ref(),
)
.await;
@@ -2244,6 +2247,7 @@ async fn generate_network_token_and_update_payment_method(
let compat_action = payment_methods::payment_method_modular_forward_compat_action(
state,
&pm_info.merchant_id,
+ &platform.get_provider().get_account().organization_id,
pm_info.customer_id.as_ref(),
)
.await;
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index 03f2b85356..804b0c50c3 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -58,6 +58,7 @@ use crate::{
core::{
configs::dimension_state,
errors::{self, RouterResult, StorageErrorExt},
+ payment_methods,
payments::PaymentData,
},
db::StorageInterface,
@@ -104,14 +105,10 @@ pub async fn get_feature_config(
.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,
- &dimensions,
- )
- .await;
+ let is_payment_method_modular_allowed =
+ payment_methods::utils::get_should_call_pm_modular_service(state, &dimensions, None).await;
FeatureConfig {
is_payment_method_modular_allowed,
}
diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs
index 0b1b49e725..eec4bc1053 100644
--- a/crates/router/src/core/webhooks/incoming.rs
+++ b/crates/router/src/core/webhooks/incoming.rs
@@ -2919,6 +2919,7 @@ async fn update_connector_mandate_details(
let compat_action = payment_methods::payment_method_modular_compat_action(
state,
&payment_method_info.merchant_id,
+ &platform.get_provider().get_account().organization_id,
payment_method_info.customer_id.as_ref(),
)
.await;
diff --git a/crates/router/src/core/webhooks/network_tokenization_incoming.rs b/crates/router/src/core/webhooks/network_tokenization_incoming.rs
index 5f6b41cb0b..cfca635d5d 100644
--- a/crates/router/src/core/webhooks/network_tokenization_incoming.rs
+++ b/crates/router/src/core/webhooks/network_tokenization_incoming.rs
@@ -376,6 +376,7 @@ pub async fn handle_metadata_update(
let compat_action = payment_methods::payment_method_modular_compat_action(
state,
&payment_method.merchant_id,
+ &platform.get_provider().get_account().organization_id,
payment_method.customer_id.as_ref(),
)
.await;
diff --git a/crates/router/src/types/storage/payment_method.rs b/crates/router/src/types/storage/payment_method.rs
index 6f445df845..2029426b74 100644
--- a/crates/router/src/types/storage/payment_method.rs
+++ b/crates/router/src/types/storage/payment_method.rs
@@ -235,5 +235,6 @@ pub struct PaymentMethodStatusTrackingData {
pub struct PaymentMethodModularCompatTrackingData {
pub payment_method_id: String,
pub merchant_id: common_utils::id_type::MerchantId,
+ pub organization_id: common_utils::id_type::OrganizationId,
pub last_modified_by: Option<String>,
}