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(superposition): introduce provider and processor merchant dimensions in superposition context (#11678)

Aniket Burman7dfa91069c84
diff --git a/config/superposition_seed.toml b/config/superposition_seed.toml
index 2b4ecbca42..3a51aa988f 100644
--- a/config/superposition_seed.toml
+++ b/config/superposition_seed.toml
@@ -16,20 +16,26 @@ schema = { type = "string" }
description = "Organization identifier"
change_reason = "Initial setup"
-[dimensions.merchant_id]
+[dimensions.provider_merchant_id]
position = 2
schema = { type = "string" }
-description = "Merchant identifier"
+description = "Provider merchant identifier (hyperswitch merchant id)"
change_reason = "Initial setup"
-[dimensions.profile_id]
+[dimensions.processor_merchant_id]
position = 3
schema = { type = "string" }
+description = "Processor merchant identifier (connector-side merchant id)"
+change_reason = "Initial setup"
+
+[dimensions.profile_id]
+position = 4
+schema = { type = "string" }
description = "Business profile identifier"
change_reason = "Initial setup"
[dimensions.connector]
-position = 4
+position = 5
schema = { type = "string" }
description = "Payment connector identifier (e.g. stripe, adyen)"
change_reason = "Initial setup"
diff --git a/crates/hyperswitch_domain_models/src/platform.rs b/crates/hyperswitch_domain_models/src/platform.rs
index 7428deec04..4b68cbfab4 100644
--- a/crates/hyperswitch_domain_models/src/platform.rs
+++ b/crates/hyperswitch_domain_models/src/platform.rs
@@ -25,6 +25,21 @@ impl Provider {
pub fn get_key_store(&self) -> &MerchantKeyStore {
&self.key_store
}
+
+ /// Returns the provider merchant
+ pub fn get_provider_merchant_id(&self) -> ProviderMerchantId {
+ ProviderMerchantId(self.account.get_id().clone())
+ }
+}
+
+/// Provider Merchant ID
+#[derive(Debug, Clone)]
+pub struct ProviderMerchantId(common_utils::id_type::MerchantId);
+
+impl ProviderMerchantId {
+ pub fn inner(&self) -> &common_utils::id_type::MerchantId {
+ &self.0
+ }
}
/// Processor = The merchant account whose processor credentials are used
@@ -49,6 +64,21 @@ impl Processor {
pub fn get_key_store(&self) -> &MerchantKeyStore {
&self.key_store
}
+
+ /// Returns the processor merchant ID
+ pub fn get_processor_merchant_id(&self) -> ProcessorMerchantId {
+ ProcessorMerchantId(self.account.get_id().clone())
+ }
+}
+
+/// Processor Merchant ID
+#[derive(Debug, Clone)]
+pub struct ProcessorMerchantId(common_utils::id_type::MerchantId);
+
+impl ProcessorMerchantId {
+ pub fn inner(&self) -> &common_utils::id_type::MerchantId {
+ &self.0
+ }
}
/// Initiator = The entity that initiated the operation.
diff --git a/crates/router/src/core/configs.rs b/crates/router/src/core/configs.rs
index 0b3604625b..eb1c206caa 100644
--- a/crates/router/src/core/configs.rs
+++ b/crates/router/src/core/configs.rs
@@ -123,7 +123,7 @@ impl ConfigType for serde_json::Value {
/// Fetch configuration value from Superposition with database fallback using dimension-aware key.
/// This function accepts any type that implements DimensionsBase (including type aliases).
-/// This allows configs to be used with pre-defined dimension type aliases like DimensionsWithMerchantId or DimensionsWithMerchantIdAndProfileId.
+/// This allows configs to be used with pre-defined dimension type aliases like DimensionsWithProcessorAndProviderMerchantId or DimensionsWithProcessorAndProviderMerchantIdAndProfileId.
pub async fn fetch_db_config_for_dimensions<C>(
storage: &dyn db::StorageInterface,
superposition_client: &superposition::SuperpositionClient,
diff --git a/crates/router/src/core/configs/dimension_config.rs b/crates/router/src/core/configs/dimension_config.rs
index c10c045690..1d76c86bf8 100644
--- a/crates/router/src/core/configs/dimension_config.rs
+++ b/crates/router/src/core/configs/dimension_config.rs
@@ -2,13 +2,16 @@ use external_services::superposition;
use scheduler::consumer::types::process_data::RetryMapping;
use super::{
- dimension_state::{DimensionsWithMerchantId, DimensionsWithMerchantIdAndProfileId},
+ dimension_state::{
+ DimensionsWithProcessorAndProviderMerchantId,
+ DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
+ },
fetch_db_config_for_dimensions, DatabaseBackedConfig,
};
use crate::{
consts::superposition as superposition_consts,
- core::configs::dimension_state::DimensionsWithMerchantIdAndConnector, db::StorageInterface,
- utils::id_type,
+ core::configs::dimension_state::DimensionsWithProcessorAndProviderMerchantIdAndConnector,
+ db::StorageInterface, utils::id_type,
};
/// Macro to generate config struct and superposition::Config trait implementation.
@@ -123,7 +126,7 @@ config! {
superposition_key = REQUIRES_CVV,
output = bool,
default = true,
- requires = DimensionsWithMerchantId,
+ requires = DimensionsWithProcessorAndProviderMerchantId,
targeting_key = id_type::CustomerId
}
@@ -131,7 +134,7 @@ impl DatabaseBackedConfig for RequiresCvv {
const KEY: &'static str = "requires_cvv";
fn db_key(dimensions: &impl super::dimension_state::DimensionsBase) -> Option<String> {
let merchant_id = dimensions
- .get_merchant_id()
+ .get_processor_merchant_id()
.map(|id| id.get_string_repr())
.unwrap_or_default();
Some(format!("{}_{}", merchant_id, Self::KEY))
@@ -142,7 +145,7 @@ config! {
superposition_key = IMPLICIT_CUSTOMER_UPDATE,
output = bool,
default = false,
- requires = DimensionsWithMerchantIdAndProfileId,
+ requires = DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
targeting_key = id_type::CustomerId
}
@@ -150,7 +153,7 @@ impl DatabaseBackedConfig for ImplicitCustomerUpdate {
const KEY: &'static str = "implicit_customer_update";
fn db_key(dimensions: &impl super::dimension_state::DimensionsBase) -> Option<String> {
let merchant_id = dimensions
- .get_merchant_id()
+ .get_provider_merchant_id()
.map(|id| id.get_string_repr())
.unwrap_or_default();
Some(format!("{}_{}", merchant_id, Self::KEY))
@@ -162,7 +165,7 @@ config! {
output = RetryMapping,
default = RetryMapping::default(),
object = true,
- requires = DimensionsWithMerchantIdAndConnector,
+ requires = DimensionsWithProcessorAndProviderMerchantIdAndConnector,
targeting_key = id_type::PayoutId
}
@@ -170,7 +173,7 @@ config! {
superposition_key = CLIENT_SESSION_VALIDATION_ENABLED,
output = bool,
default = true,
- requires = DimensionsWithMerchantId,
+ requires = DimensionsWithProcessorAndProviderMerchantId,
targeting_key = id_type::PaymentId
}
diff --git a/crates/router/src/core/configs/dimension_state.rs b/crates/router/src/core/configs/dimension_state.rs
index 49762e4d2a..9af9787af5 100644
--- a/crates/router/src/core/configs/dimension_state.rs
+++ b/crates/router/src/core/configs/dimension_state.rs
@@ -3,11 +3,14 @@ use std::marker::PhantomData;
use common_enums::connector_enums::Connector;
use common_utils::id_type;
use external_services::superposition;
+pub use hyperswitch_domain_models::platform::{ProcessorMerchantId, ProviderMerchantId};
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
pub enum DimensionError {
- #[error("merchant_id not available in dimension state")]
- MissingMerchantId,
+ #[error("provider_merchant_id not available in dimension state")]
+ MissingProviderMerchantId,
+ #[error("processor_merchant_id not available in dimension state")]
+ MissingProcessorMerchantId,
#[error("organization_id not available in dimension state")]
MissingOrganizationId,
#[error("profile_id not available in dimension state")]
@@ -16,18 +19,28 @@ pub enum DimensionError {
MissingConnector,
}
-/// Marker for state WITHOUT merchant_id
-pub struct NoMerchantId;
+/// Marker for state WITHOUT provider_merchant_id
+#[derive(Clone)]
+pub struct NoProviderMerchantId;
+
+/// Marker for state WITH provider_merchant_id
+#[derive(Clone)]
+pub struct HasProviderMerchantId;
+
+/// Marker for state WITHOUT processor_merchant_id
+#[derive(Clone)]
+pub struct NoProcessorMerchantId;
-/// Marker for state WITH merchant_id
+/// Marker for state WITH processor_merchant_id
#[derive(Clone)]
-pub struct HasMerchantId;
+pub struct HasProcessorMerchantId;
/// Marker for state WITHOUT organization_id
#[derive(Clone)]
pub struct NoOrgId;
/// Marker for state WITH organization_id
+#[derive(Clone)]
pub struct HasOrgId;
/// Marker for state WITHOUT profile_id
@@ -35,6 +48,7 @@ pub struct HasOrgId;
pub struct NoProfileId;
/// Marker for state WITH profile_id
+#[derive(Clone)]
pub struct HasProfileId;
/// Marker for state WITHOUT connector
@@ -42,6 +56,7 @@ pub struct HasProfileId;
pub struct NoConnector;
/// Marker for state WITH connector
+#[derive(Clone)]
pub struct HasConnector;
// Dimensional State with type parameters
@@ -51,23 +66,26 @@ pub struct HasConnector;
/// Uses the type-state pattern where type parameters indicate which fields are available.
///
/// # Type Parameters
-/// * `M` - Merchant ID type: `HasMerchantId` (present) or `NoMerchantId` (absent)
+/// * `Pm` - Provider Merchant ID type: `HasProviderMerchantId` (present) or `NoProviderMerchantId` (absent)
+/// * `M` - Processor Merchant ID type: `HasProcessorMerchantId` (present) or `NoProcessorMerchantId` (absent)
/// * `O` - Organization ID type: `HasOrgId` (present) or `NoOrgId` (absent)
/// * `P` - Profile ID type: `HasProfileId` (present) or `NoProfileId` (absent)
/// * `Cn` - Connector type: `HasConnector` (present) or `NoConnector` (absent)
#[derive(Clone)]
-pub struct Dimensions<M, O, P, Cn> {
- merchant_id: Option<id_type::MerchantId>,
+pub struct Dimensions<Pm, M, O, P, Cn> {
+ provider_merchant_id: Option<ProviderMerchantId>,
+ processor_merchant_id: Option<ProcessorMerchantId>,
organization_id: Option<id_type::OrganizationId>,
profile_id: Option<id_type::ProfileId>,
connector: Option<Connector>,
- _phantom: PhantomData<(M, O, P, Cn)>,
+ _phantom: PhantomData<(Pm, M, O, P, Cn)>,
}
-impl Dimensions<NoMerchantId, NoOrgId, NoProfileId, NoConnector> {
+impl Dimensions<NoProviderMerchantId, NoProcessorMerchantId, NoOrgId, NoProfileId, NoConnector> {
pub fn new() -> Self {
Self {
- merchant_id: None,
+ provider_merchant_id: None,
+ processor_merchant_id: None,
organization_id: None,
profile_id: None,
connector: None,
@@ -76,11 +94,32 @@ impl Dimensions<NoMerchantId, NoOrgId, NoProfileId, NoConnector> {
}
}
-/// Can only add merchant_id if not already present
-impl<O, P, Cn> Dimensions<NoMerchantId, O, P, Cn> {
- pub fn with_merchant_id(&self, id: id_type::MerchantId) -> Dimensions<HasMerchantId, O, P, Cn> {
+/// Can only add provider_merchant_id if not already present
+impl<M, O, P, Cn> Dimensions<NoProviderMerchantId, M, O, P, Cn> {
+ pub fn with_provider_merchant_id(
+ &self,
+ id: ProviderMerchantId,
+ ) -> Dimensions<HasProviderMerchantId, M, O, P, Cn> {
+ Dimensions {
+ provider_merchant_id: Some(id),
+ processor_merchant_id: self.processor_merchant_id.clone(),
+ organization_id: self.organization_id.clone(),
+ profile_id: self.profile_id.clone(),
+ connector: self.connector,
+ _phantom: PhantomData,
+ }
+ }
+}
+
+/// Can only add processor_merchant_id if not already present
+impl<Pm, O, P, Cn> Dimensions<Pm, NoProcessorMerchantId, O, P, Cn> {
+ pub fn with_processor_merchant_id(
+ &self,
+ id: ProcessorMerchantId,
+ ) -> Dimensions<Pm, HasProcessorMerchantId, O, P, Cn> {
Dimensions {
- merchant_id: Some(id),
+ provider_merchant_id: self.provider_merchant_id.clone(),
+ processor_merchant_id: Some(id),
organization_id: self.organization_id.clone(),
profile_id: self.profile_id.clone(),
connector: self.connector,
@@ -90,13 +129,14 @@ impl<O, P, Cn> Dimensions<NoMerchantId, O, P, Cn> {
}
/// Can only add organization_id if not already present
-impl<M, P, Cn> Dimensions<M, NoOrgId, P, Cn> {
+impl<Pm, M, P, Cn> Dimensions<Pm, M, NoOrgId, P, Cn> {
pub fn with_organization_id(
&self,
id: id_type::OrganizationId,
- ) -> Dimensions<M, HasOrgId, P, Cn> {
+ ) -> Dimensions<Pm, M, HasOrgId, P, Cn> {
Dimensions {
- merchant_id: self.merchant_id.clone(),
+ provider_merchant_id: self.provider_merchant_id.clone(),
+ processor_merchant_id: self.processor_merchant_id.clone(),
organization_id: Some(id),
profile_id: self.profile_id.clone(),
connector: self.connector,
@@ -106,10 +146,14 @@ impl<M, P, Cn> Dimensions<M, NoOrgId, P, Cn> {
}
/// Can only add profile_id if not already present
-impl<M, O, Cn> Dimensions<M, O, NoProfileId, Cn> {
- pub fn with_profile_id(&self, id: id_type::ProfileId) -> Dimensions<M, O, HasProfileId, Cn> {
+impl<Pm, M, O, Cn> Dimensions<Pm, M, O, NoProfileId, Cn> {
+ pub fn with_profile_id(
+ &self,
+ id: id_type::ProfileId,
+ ) -> Dimensions<Pm, M, O, HasProfileId, Cn> {
Dimensions {
- merchant_id: self.merchant_id.clone(),
+ provider_merchant_id: self.provider_merchant_id.clone(),
+ processor_merchant_id: self.processor_merchant_id.clone(),
organization_id: self.organization_id.clone(),
profile_id: Some(id),
connector: self.connector,
@@ -119,10 +163,11 @@ impl<M, O, Cn> Dimensions<M, O, NoProfileId, Cn> {
}
/// Can only add connector if not already present
-impl<M, O, P> Dimensions<M, O, P, NoConnector> {
- pub fn with_connector(&self, connector: Connector) -> Dimensions<M, O, P, HasConnector> {
+impl<Pm, M, O, P> Dimensions<Pm, M, O, P, NoConnector> {
+ pub fn with_connector(&self, connector: Connector) -> Dimensions<Pm, M, O, P, HasConnector> {
Dimensions {
- merchant_id: self.merchant_id.clone(),
+ provider_merchant_id: self.provider_merchant_id.clone(),
+ processor_merchant_id: self.processor_merchant_id.clone(),
organization_id: self.organization_id.clone(),
profile_id: self.profile_id.clone(),
connector: Some(connector),
@@ -131,11 +176,26 @@ impl<M, O, P> Dimensions<M, O, P, NoConnector> {
}
}
-/// Can only remove merchant_id if currently present
-impl<O, P, Cn> Dimensions<HasMerchantId, O, P, Cn> {
- pub fn without_merchant_id(&self) -> Dimensions<NoMerchantId, O, P, Cn> {
+/// Can only remove provider_merchant_id if currently present
+impl<M, O, P, Cn> Dimensions<HasProviderMerchantId, M, O, P, Cn> {
+ pub fn without_provider_merchant_id(&self) -> Dimensions<NoProviderMerchantId, M, O, P, Cn> {
Dimensions {
- merchant_id: None,
+ provider_merchant_id: None,
+ processor_merchant_id: self.processor_merchant_id.clone(),
+ organization_id: self.organization_id.clone(),
+ profile_id: self.profile_id.clone(),
+ connector: self.connector,
+ _phantom: PhantomData,
+ }
+ }
+}
+
+/// Can only remove processor_merchant_id if currently present
+impl<Pm, O, P, Cn> Dimensions<Pm, HasProcessorMerchantId, O, P, Cn> {
+ pub fn without_processor_merchant_id(&self) -> Dimensions<Pm, NoProcessorMerchantId, O, P, Cn> {
+ Dimensions {
+ provider_merchant_id: self.provider_merchant_id.clone(),
+ processor_merchant_id: None,
organization_id: self.organization_id.clone(),
profile_id: self.profile_id.clone(),
connector: self.connector,
@@ -145,10 +205,11 @@ impl<O, P, Cn> Dimensions<HasMerchantId, O, P, Cn> {
}
/// Can only remove organization_id if currently present
-impl<M, P, Cn> Dimensions<M, HasOrgId, P, Cn> {
- pub fn without_organization_id(&self) -> Dimensions<M, NoOrgId, P, Cn> {
+impl<Pm, M, P, Cn> Dimensions<Pm, M, HasOrgId, P, Cn> {
+ pub fn without_organization_id(&self) -> Dimensions<Pm, M, NoOrgId, P, Cn> {
Dimensions {
- merchant_id: self.merchant_id.clone(),
+ provider_merchant_id: self.provider_merchant_id.clone(),
+ processor_merchant_id: self.processor_merchant_id.clone(),
organization_id: None,
profile_id: self.profile_id.clone(),
connector: self.connector,
@@ -158,10 +219,11 @@ impl<M, P, Cn> Dimensions<M, HasOrgId, P, Cn> {
}
/// Can only remove profile_id if currently present
-impl<M, O, Cn> Dimensions<M, O, HasProfileId, Cn> {
- pub fn without_profile_id(&self) -> Dimensions<M, O, NoProfileId, Cn> {
+impl<Pm, M, O, Cn> Dimensions<Pm, M, O, HasProfileId, Cn> {
+ pub fn without_profile_id(&self) -> Dimensions<Pm, M, O, NoProfileId, Cn> {
Dimensions {
- merchant_id: self.merchant_id.clone(),
+ provider_merchant_id: self.provider_merchant_id.clone(),
+ processor_merchant_id: self.processor_merchant_id.clone(),
organization_id: self.organization_id.clone(),
profile_id: None,
connector: self.connector,
@@ -171,10 +233,11 @@ impl<M, O, Cn> Dimensions<M, O, HasProfileId, Cn> {
}
/// Can only remove connector if currently present
-impl<M, O, P> Dimensions<M, O, P, HasConnector> {
- pub fn without_connector(&self) -> Dimensions<M, O, P, NoConnector> {
+impl<Pm, M, O, P> Dimensions<Pm, M, O, P, HasConnector> {
+ pub fn without_connector(&self) -> Dimensions<Pm, M, O, P, NoConnector> {
Dimensions {
- merchant_id: self.merchant_id.clone(),
+ provider_merchant_id: self.provider_merchant_id.clone(),
+ processor_merchant_id: self.processor_merchant_id.clone(),
organization_id: self.organization_id.clone(),
profile_id: self.profile_id.clone(),
connector: None,
@@ -183,17 +246,28 @@ impl<M, O, P> Dimensions<M, O, P, HasConnector> {
}
}
-/// merchant_id getter - only available if HasMerchantId
-impl<O, P, Cn> Dimensions<HasMerchantId, O, P, Cn> {
- pub fn merchant_id(&self) -> Result<&id_type::MerchantId, DimensionError> {
- self.merchant_id
+/// provider_merchant_id getter - only available if HasProviderMerchantId
+impl<M, O, P, Cn> Dimensions<HasProviderMerchantId, M, O, P, Cn> {
+ pub fn provider_merchant_id(&self) -> Result<&id_type::MerchantId, DimensionError> {
+ self.provider_merchant_id
+ .as_ref()
+ .map(|id| id.inner())
+ .ok_or(DimensionError::MissingProviderMerchantId)
+ }
+}
+
+/// processor_merchant_id getter - only available if HasProcessorMerchantId
+impl<Pm, O, P, Cn> Dimensions<Pm, HasProcessorMerchantId, O, P, Cn> {
+ pub fn processor_merchant_id(&self) -> Result<&id_type::MerchantId, DimensionError> {
+ self.processor_merchant_id
.as_ref()
- .ok_or(DimensionError::MissingMerchantId)
+ .map(|id| id.inner())
+ .ok_or(DimensionError::MissingProcessorMerchantId)
}
}
/// organization_id getter - only available if HasOrgId
-impl<M, P, Cn> Dimensions<M, HasOrgId, P, Cn> {
+impl<Pm, M, P, Cn> Dimensions<Pm, M, HasOrgId, P, Cn> {
pub fn organization_id(&self) -> Result<&id_type::OrganizationId, DimensionError> {
self.organization_id
.as_ref()
@@ -202,7 +276,7 @@ impl<M, P, Cn> Dimensions<M, HasOrgId, P, Cn> {
}
/// profile_id getter - only available if HasProfileId
-impl<M, O, Cn> Dimensions<M, O, HasProfileId, Cn> {
+impl<Pm, M, O, Cn> Dimensions<Pm, M, O, HasProfileId, Cn> {
pub fn profile_id(&self) -> Result<&id_type::ProfileId, DimensionError> {
self.profile_id
.as_ref()
@@ -211,16 +285,20 @@ impl<M, O, Cn> Dimensions<M, O, HasProfileId, Cn> {
}
/// connector getter - only available if HasConnector
-impl<M, O, P> Dimensions<M, O, P, HasConnector> {
+impl<Pm, M, O, P> Dimensions<Pm, M, O, P, HasConnector> {
pub fn connector(&self) -> Result<Connector, DimensionError> {
self.connector.ok_or(DimensionError::MissingConnector)
}
}
// Optional getters (available in any state)
-impl<M, O, P, Cn> Dimensions<M, O, P, Cn> {
- pub fn get_merchant_id(&self) -> Option<&id_type::MerchantId> {
- self.merchant_id.as_ref()
+impl<Pm, M, O, P, Cn> Dimensions<Pm, M, O, P, Cn> {
+ pub fn get_provider_merchant_id(&self) -> Option<&id_type::MerchantId> {
+ self.provider_merchant_id.as_ref().map(|id| id.inner())
+ }
+
+ pub fn get_processor_merchant_id(&self) -> Option<&id_type::MerchantId> {
+ self.processor_merchant_id.as_ref().map(|id| id.inner())
}
pub fn get_organization_id(&self) -> Option<&id_type::OrganizationId> {
@@ -237,13 +315,17 @@ impl<M, O, P, Cn> Dimensions<M, O, P, Cn> {
}
// Superposition context conversion
-impl<M, O, P, Cn> Dimensions<M, O, P, Cn> {
+impl<Pm, M, O, P, Cn> Dimensions<Pm, M, O, P, Cn> {
/// Converts dimension state to Superposition config context
pub fn to_superposition_context(&self) -> Option<superposition::ConfigContext> {
let mut ctx = superposition::ConfigContext::new();
- if let Some(ref mid) = self.merchant_id {
- ctx = ctx.with("merchant_id", mid.get_string_repr());
+ if let Some(ref pm_id) = self.provider_merchant_id {
+ ctx = ctx.with("provider_merchant_id", pm_id.inner().get_string_repr());
+ }
+
+ if let Some(ref mid) = self.processor_merchant_id {
+ ctx = ctx.with("processor_merchant_id", mid.inner().get_string_repr());
}
if let Some(ref oid) = self.organization_id {
@@ -262,7 +344,9 @@ impl<M, O, P, Cn> Dimensions<M, O, P, Cn> {
}
}
-impl Default for Dimensions<NoMerchantId, NoOrgId, NoProfileId, NoConnector> {
+impl Default
+ for Dimensions<NoProviderMerchantId, NoProcessorMerchantId, NoOrgId, NoProfileId, NoConnector>
+{
fn default() -> Self {
Self::new()
}
@@ -273,8 +357,11 @@ pub trait DimensionsBase {
/// Converts dimension state to Superposition config context
fn to_superposition_context(&self) -> Option<superposition::ConfigContext>;
- /// Get merchant_id (if available)
- fn get_merchant_id(&self) -> Option<&id_type::MerchantId>;
+ /// Get provider_merchant_id (if available)
+ fn get_provider_merchant_id(&self) -> Option<&id_type::MerchantId>;
+
+ /// Get processor_merchant_id (if available)
+ fn get_processor_merchant_id(&self) -> Option<&id_type::MerchantId>;
/// Get organization_id (if available)
fn get_organization_id(&self) -> Option<&id_type::OrganizationId>;
@@ -286,13 +373,17 @@ pub trait DimensionsBase {
fn get_connector(&self) -> Option<Connector>;
}
-impl<M, O, P, Cn> DimensionsBase for Dimensions<M, O, P, Cn> {
+impl<Pm, M, O, P, Cn> DimensionsBase for Dimensions<Pm, M, O, P, Cn> {
fn to_superposition_context(&self) -> Option<superposition::ConfigContext> {
self.to_superposition_context()
}
- fn get_merchant_id(&self) -> Option<&id_type::MerchantId> {
- self.get_merchant_id()
+ fn get_provider_merchant_id(&self) -> Option<&id_type::MerchantId> {
+ self.get_provider_merchant_id()
+ }
+
+ fn get_processor_merchant_id(&self) -> Option<&id_type::MerchantId> {
+ self.get_processor_merchant_id()
}
fn get_organization_id(&self) -> Option<&id_type::OrganizationId> {
@@ -308,14 +399,16 @@ impl<M, O, P, Cn> DimensionsBase for Dimensions<M, O, P, Cn> {
}
}
-pub type DimensionsWithMerchantId = Dimensions<HasMerchantId, NoOrgId, NoProfileId, NoConnector>;
-pub type DimensionsWithOrgIdAndMerchantId =
- Dimensions<HasMerchantId, HasOrgId, NoProfileId, NoConnector>;
-pub type DimensionsWithOrgIdAndMerchantIdAndProfileId =
- Dimensions<HasMerchantId, HasOrgId, HasProfileId, NoConnector>;
-pub type DimensionsWithMerchantIdAndProfileId =
- Dimensions<HasMerchantId, NoOrgId, HasProfileId, NoConnector>;
-pub type DimensionsWithMerchantIdAndConnector =
- Dimensions<HasMerchantId, NoOrgId, NoProfileId, HasConnector>;
-pub type DimensionsWithMerchantIdAndProfileIdAndConnector =
- Dimensions<HasMerchantId, NoOrgId, HasProfileId, HasConnector>;
+// Type aliases - both provider and processor merchant IDs present
+pub type DimensionsWithProcessorAndProviderMerchantId =
+ Dimensions<HasProviderMerchantId, HasProcessorMerchantId, NoOrgId, NoProfileId, NoConnector>;
+pub type DimensionsWithProcessorAndProviderMerchantIdAndProfileId =
+ Dimensions<HasProviderMerchantId, HasProcessorMerchantId, NoOrgId, HasProfileId, NoConnector>;
+pub type DimensionsWithProcessorAndProviderMerchantIdAndConnector =
+ Dimensions<HasProviderMerchantId, HasProcessorMerchantId, NoOrgId, NoProfileId, HasConnector>;
+pub type DimensionsWithProcessorAndProviderMerchantIdAndProfileIdAndConnector =
+ Dimensions<HasProviderMerchantId, HasProcessorMerchantId, NoOrgId, HasProfileId, HasConnector>;
+pub type DimensionsWithProcessorAndProviderMerchantIdAndOrgId =
+ Dimensions<HasProviderMerchantId, HasProcessorMerchantId, HasOrgId, NoProfileId, NoConnector>;
+pub type DimensionsWithProcessorAndProviderMerchantIdAndOrgIdAndProfileId =
+ Dimensions<HasProviderMerchantId, HasProcessorMerchantId, HasOrgId, HasProfileId, NoConnector>;
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 887fa334a9..3a3697cfb2 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -78,7 +78,7 @@ use crate::{
consts as router_consts,
core::{
configs,
- configs::dimension_state::DimensionsWithMerchantId,
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantId,
errors::{self, StorageErrorExt},
payment_methods::{
network_tokenization, transformers as payment_methods, utils as payment_method_utils,
@@ -4570,7 +4570,8 @@ pub async fn do_list_customer_pm_fetch_customer_if_not_passed(
ephemeral_api_key: Option<&str>,
) -> errors::RouterResponse<api::CustomerPaymentMethodsListResponse> {
let dimensions = configs::dimension_state::Dimensions::new()
- .with_merchant_id(platform.get_processor().get_account().get_id().clone());
+ .with_processor_merchant_id(platform.get_processor().get_processor_merchant_id())
+ .with_provider_merchant_id(platform.get_provider().get_provider_merchant_id());
let limit = req.clone().and_then(|pml_req| pml_req.limit);
let auth_cust = if let Some(key) = ephemeral_api_key {
@@ -4636,7 +4637,7 @@ pub async fn list_customer_payment_method(
payment_intent: Option<storage::PaymentIntent>,
customer_id: &id_type::CustomerId,
limit: Option<i64>,
- dimensions: DimensionsWithMerchantId,
+ dimensions: DimensionsWithProcessorAndProviderMerchantId,
) -> errors::RouterResponse<api::CustomerPaymentMethodsListResponse> {
let db = &*state.store;
let off_session_payment_flag = payment_intent
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 74738f2e49..e340071d1c 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -110,6 +110,8 @@ use super::{
},
};
#[cfg(feature = "v1")]
+use crate::core::blocklist::utils as blocklist_utils;
+#[cfg(feature = "v1")]
use crate::core::card_testing_guard::utils as card_testing_guard_utils;
#[cfg(feature = "v1")]
use crate::core::debit_routing;
@@ -123,11 +125,6 @@ use crate::core::revenue_recovery::get_workflow_entries;
use crate::core::revenue_recovery::map_to_recovery_payment_item;
#[cfg(feature = "v1")]
use crate::core::routing::helpers as routing_helpers;
-#[cfg(feature = "v1")]
-use crate::core::{
- blocklist::utils as blocklist_utils,
- configs::{self as configs, dimension_state::DimensionsWithMerchantId},
-};
#[cfg(all(feature = "v1", feature = "dynamic_routing"))]
use crate::types::api::convert_connector_data_to_routable_connectors;
use crate::{
@@ -136,6 +133,7 @@ use crate::{
},
consts,
core::{
+ configs::{self as configs, dimension_state::DimensionsWithProcessorAndProviderMerchantId},
errors::{self, CustomResult, RouterResponse, RouterResult},
payment_methods::{cards, network_tokenization},
payments::helpers::{
@@ -215,6 +213,10 @@ where
PaymentResponse: Operation<F, FData, Data = D>,
FData: Send + Sync + Clone,
{
+ let dimensions = configs::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 operation: BoxedOperation<'_, F, Req, D> = Box::new(operation);
// Get the trackers related to track the state of the payment
@@ -321,6 +323,7 @@ where
#[cfg(feature = "frm")]
None,
call_connector_service_response,
+ &dimensions,
)
.await?;
@@ -424,6 +427,7 @@ where
#[cfg(feature = "frm")]
None,
call_connector_service_response,
+ &dimensions,
)
.await?;
@@ -632,7 +636,7 @@ pub async fn payments_operation_core<'a, F, Req, Op, FData, D>(
auth_flow: services::AuthFlow,
eligible_connectors: Option<Vec<enums::RoutableConnectors>>,
header_payload: HeaderPayload,
- dimensions: DimensionsWithMerchantId,
+ dimensions: DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(D, Req, Option<u16>, Option<u128>)>
where
F: Send + Clone + Sync + Debug + 'static,
@@ -731,7 +735,7 @@ where
customer_details, // TODO: Remove this field after implicit customer update is removed
platform.get_provider(),
platform.get_initiator(),
- dimensions,
+ &dimensions,
)
.await
.to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)
@@ -1043,6 +1047,7 @@ where
#[cfg(not(feature = "frm"))]
None,
call_connector_service_response,
+ &dimensions.without_profile_id(),
)
.await?;
@@ -1231,6 +1236,7 @@ where
#[cfg(not(feature = "frm"))]
None,
call_connector_service_response,
+ &dimensions.without_profile_id(),
)
.await?;
@@ -1418,6 +1424,7 @@ where
#[cfg(not(feature = "frm"))]
None,
header_payload.clone(),
+ &dimensions.without_profile_id(),
)
.await?;
}
@@ -1448,6 +1455,7 @@ where
payment_data.clone(),
None,
header_payload.clone(),
+ &dimensions.without_profile_id(),
)
.await?;
}
@@ -1501,7 +1509,7 @@ pub async fn proxy_for_payments_operation_core<F, Req, Op, FData, D>(
auth_flow: services::AuthFlow,
header_payload: HeaderPayload,
return_raw_connector_response: Option<bool>,
- dimensions: DimensionsWithMerchantId,
+ dimensions: DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(D, Req, Option<u16>, Option<u128>)>
where
F: Send + Clone + Sync,
@@ -1625,7 +1633,7 @@ where
customer_details,
platform.get_provider(),
platform.get_initiator(),
- dimensions,
+ &dimensions,
)
.await
.to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)
@@ -1850,6 +1858,10 @@ where
// Get the trackers related to track the state of the payment
let operations::GetTrackerResponse { mut payment_data } = get_tracker_response;
+ let dimensions = configs::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 (_operation, customer) = operation
.to_domain()?
.get_customer_details(
@@ -1916,6 +1928,7 @@ where
external_vault_mca_type_details,
router_data,
updated_customer,
+ &dimensions,
)
.await?;
@@ -1968,6 +1981,9 @@ where
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
{
let operation: BoxedOperation<'_, F, Req, D> = Box::new(operation);
+ let dimensions = configs::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",
@@ -2017,6 +2033,7 @@ where
payment_data,
None,
header_payload,
+ &dimensions,
)
.await?;
@@ -2043,6 +2060,9 @@ where
D: OperationSessionGetters<F> + Send + Sync + Clone,
{
let operation: BoxedOperation<'_, F, Req, D> = Box::new(operation);
+ let dimensions = configs::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",
@@ -2092,6 +2112,7 @@ where
payment_data,
None,
header_payload,
+ &dimensions,
)
.await?;
@@ -2554,7 +2575,8 @@ where
.collect()
});
let dimensions = configs::dimension_state::Dimensions::new()
- .with_merchant_id(platform.get_processor().get_account().get_id().clone());
+ .with_processor_merchant_id(platform.get_processor().get_processor_merchant_id())
+ .with_provider_merchant_id(platform.get_provider().get_provider_merchant_id());
let (payment_data, _req, connector_http_status_code, external_latency) =
payments_operation_core::<_, _, _, _, _>(
&state,
@@ -2618,7 +2640,8 @@ where
PaymentResponse: Operation<F, FData, Data = D>,
{
let dimensions = configs::dimension_state::Dimensions::new()
- .with_merchant_id(platform.get_processor().get_account().get_id().clone());
+ .with_processor_merchant_id(platform.get_processor().get_processor_merchant_id())
+ .with_provider_merchant_id(platform.get_provider().get_provider_merchant_id());
let (payment_data, _req, connector_http_status_code, external_latency) =
proxy_for_payments_operation_core::<_, _, _, _, _>(
&state,
@@ -2826,6 +2849,10 @@ pub async fn record_attempt_core(
.get_string_repr(),
);
+ let dimensions = configs::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 operation: &operations::payment_attempt_record::PaymentAttemptRecord =
&operations::payment_attempt_record::PaymentAttemptRecord;
let boxed_operation: BoxedOperation<
@@ -2927,6 +2954,7 @@ pub async fn record_attempt_core(
record_payment_data,
None,
header_payload.clone(),
+ &dimensions,
)
.await?;
@@ -4795,6 +4823,7 @@ pub async fn complete_connector_service<F, RouterDReq, ApiRequest, D>(
header_payload: HeaderPayload,
frm_suggestion: Option<storage_enums::FrmSuggestion>,
call_connector_service_response: ConnectorServiceIntermediateState<F, RouterDReq>,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(
RouterData<F, RouterDReq, router_types::PaymentsResponseData>,
helpers::MerchantConnectorAccountType,
@@ -4822,6 +4851,7 @@ where
payment_data.clone(),
frm_suggestion,
header_payload.clone(),
+ dimensions,
)
.await?;
*payment_data = new_payment_data;
@@ -5287,6 +5317,7 @@ pub async fn complete_connector_service<F, RouterDReq, ApiRequest, D>(
header_payload: HeaderPayload,
frm_suggestion: Option<storage_enums::FrmSuggestion>,
call_connector_service_response: ConnectorServiceIntermediateState<F, RouterDReq>,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(
RouterData<F, RouterDReq, router_types::PaymentsResponseData>,
domain::MerchantConnectorAccountTypeDetails,
@@ -5314,6 +5345,7 @@ where
payment_data.clone(),
frm_suggestion,
header_payload.clone(),
+ dimensions,
)
.await?;
*payment_data = new_payment_data;
@@ -5656,6 +5688,10 @@ where
)
.await?;
+ let dimensions = configs::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_data.add_guest_customer(&mut router_data, &guest_customer)?;
// Extract previous gateway from payment data
@@ -5722,6 +5758,7 @@ where
payment_data.clone(),
None, // frm_suggestion is not used in internal flows
header_payload.clone(),
+ &dimensions,
)
.await?;
@@ -5870,6 +5907,7 @@ pub async fn call_unified_connector_service_for_external_proxy<F, RouterDReq, Ap
external_vault_merchant_connector_account_type_details: domain::MerchantConnectorAccountTypeDetails,
mut router_data: RouterData<F, RouterDReq, router_types::PaymentsResponseData>,
_updated_customer: Option<storage::CustomerUpdate>,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<RouterData<F, RouterDReq, router_types::PaymentsResponseData>>
where
F: Send + Clone + Sync,
@@ -5893,6 +5931,7 @@ where
payment_data.clone(),
frm_suggestion,
header_payload.clone(),
+ dimensions,
)
.await?;
let lineage_ids = grpc_client::LineageIds::new(
@@ -5951,6 +5990,10 @@ where
dyn api::Connector:
services::api::ConnectorIntegration<F, RouterDReq, router_types::PaymentsResponseData>,
{
+ let dimensions = configs::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(
@@ -6088,6 +6131,7 @@ where
payment_data.clone(),
frm_suggestion,
header_payload.clone(),
+ &dimensions,
)
.await?;
@@ -6158,6 +6202,10 @@ where
)
.await?,
));
+ let dimensions = configs::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 profile_id = payment_data.get_payment_intent().profile_id.clone();
let default_gateway_context = gateway_context::RouterGatewayContext::direct(
platform.get_processor().clone(),
@@ -6226,6 +6274,7 @@ where
payment_data.clone(),
None,
header_payload.clone(),
+ &dimensions,
)
.await?;
@@ -6282,6 +6331,10 @@ where
{
let stime_connector = Instant::now();
+ let dimensions = configs::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 merchant_connector_account =
domain::MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(Box::new(
helpers::get_merchant_connector_account_v2(
@@ -6349,6 +6402,7 @@ where
payment_data.clone(),
None,
header_payload.clone(),
+ &dimensions,
)
.await?;
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 3366a13f83..03321d8d08 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -89,7 +89,7 @@ use crate::{
consts::{self, BASE64_ENGINE},
core::{
authentication,
- configs::dimension_state::DimensionsWithMerchantIdAndProfileId,
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
errors::{self, CustomResult, RouterResult, StorageErrorExt},
mandate::helpers::MandateGenericData,
payment_methods::{
@@ -1928,7 +1928,7 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R, D>(
_payment_data: &mut PaymentData<F>,
_req: Option<CustomerDetails>,
_provider: &domain::Provider,
- _dimensions: DimensionsWithMerchantIdAndProfileId,
+ _dimensions: DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> CustomResult<(BoxedOperation<'a, F, R, D>, Option<domain::Customer>), errors::StorageError> {
todo!()
}
@@ -1943,7 +1943,7 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R, D>(
req: Option<CustomerDetails>,
provider: &domain::Provider,
initiator: Option<&domain::Initiator>,
- dimensions: DimensionsWithMerchantIdAndProfileId,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> CustomResult<(BoxedOperation<'a, F, R, D>, Option<domain::Customer>), errors::StorageError> {
let merchant_id = provider.get_account().get_id();
let storage_scheme = provider.get_account().storage_scheme;
diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs
index 8b019ca094..e52eada96f 100644
--- a/crates/router/src/core/payments/operations.rs
+++ b/crates/router/src/core/payments/operations.rs
@@ -107,7 +107,10 @@ use crate::core::payments;
use crate::core::utils as core_utils;
use crate::{
core::{
- configs::dimension_state::DimensionsWithMerchantIdAndProfileId,
+ configs::dimension_state::{
+ DimensionsWithProcessorAndProviderMerchantId,
+ DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
+ },
errors::{self, CustomResult, RouterResult},
},
routes::{app::ReqState, SessionState},
@@ -279,7 +282,7 @@ pub trait Domain<F: Clone, R, D>: Send + Sync {
request: Option<CustomerDetails>,
provider: &domain::Provider,
initiator: Option<&domain::Initiator>,
- _dimensions: DimensionsWithMerchantIdAndProfileId,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> CustomResult<(BoxedOperation<'a, F, R, D>, Option<domain::Customer>), errors::StorageError>;
#[cfg(feature = "v2")]
@@ -543,6 +546,7 @@ pub trait UpdateTracker<F, D, Req>: Send {
payment_data: D,
frm_suggestion: Option<FrmSuggestion>,
header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(BoxedOperation<'b, F, Req, D>, D)>
where
F: 'b + Send;
@@ -673,7 +677,7 @@ where
_request: Option<CustomerDetails>,
_provider: &domain::Provider,
_initiator: Option<&domain::Initiator>,
- _dimensions: DimensionsWithMerchantIdAndProfileId,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> CustomResult<
(
BoxedOperation<'a, F, api::PaymentsRetrieveRequest, D>,
@@ -744,7 +748,7 @@ where
_request: Option<CustomerDetails>,
_provider: &domain::Provider,
_initiator: Option<&domain::Initiator>,
- _dimensions: DimensionsWithMerchantIdAndProfileId,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> CustomResult<
(
BoxedOperation<'a, F, api::PaymentsCaptureRequest, D>,
@@ -833,7 +837,7 @@ where
_request: Option<CustomerDetails>,
_provider: &domain::Provider,
_initiator: Option<&domain::Initiator>,
- _dimensions: DimensionsWithMerchantIdAndProfileId,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> CustomResult<
(
BoxedOperation<'a, F, api::PaymentsCancelRequest, D>,
@@ -922,7 +926,7 @@ where
_request: Option<CustomerDetails>,
_provider: &domain::Provider,
_initiator: Option<&domain::Initiator>,
- _dimensions: DimensionsWithMerchantIdAndProfileId,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> CustomResult<
(
BoxedOperation<'a, F, api::PaymentsRejectRequest, D>,
diff --git a/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs b/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs
index a2ce85d5cc..da58ae8852 100644
--- a/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs
+++ b/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs
@@ -17,6 +17,7 @@ use router_env::{instrument, tracing};
use super::{Domain, GetTracker, Operation, PostUpdateTracker, UpdateTracker, ValidateRequest};
use crate::{
core::{
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantId,
errors::{self, CustomResult, RouterResult, StorageErrorExt},
payment_methods::{self, PaymentMethodExt},
payments::{
@@ -484,6 +485,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, ExternalVaultProxy
mut payment_data: PaymentConfirmData<F>,
_frm_suggestion: Option<api_models::enums::FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(BoxedConfirmOperation<'b, F>, PaymentConfirmData<F>)>
where
F: 'b + Send,
diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs
index 7c1953a66f..af0ad0aa52 100644
--- a/crates/router/src/core/payments/operations/payment_approve.rs
+++ b/crates/router/src/core/payments/operations/payment_approve.rs
@@ -9,6 +9,7 @@ use router_env::{instrument, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantId,
errors::{self, RouterResult, StorageErrorExt},
payments::{helpers, operations, PaymentData},
},
@@ -232,6 +233,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsCaptureReque
mut payment_data: PaymentData<F>,
frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(PaymentApproveOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
diff --git a/crates/router/src/core/payments/operations/payment_attempt_list.rs b/crates/router/src/core/payments/operations/payment_attempt_list.rs
index c45ecf6209..d82785fafb 100644
--- a/crates/router/src/core/payments/operations/payment_attempt_list.rs
+++ b/crates/router/src/core/payments/operations/payment_attempt_list.rs
@@ -9,6 +9,7 @@ use router_env::{instrument, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantId,
errors::{self, RouterResult},
payments::{self, operations},
},
@@ -127,6 +128,7 @@ impl<F: Clone + Sync>
payment_data: payments::PaymentAttemptListData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(
PaymentAttemptsListOperation<'b, F>,
payments::PaymentAttemptListData<F>,
diff --git a/crates/router/src/core/payments/operations/payment_attempt_record.rs b/crates/router/src/core/payments/operations/payment_attempt_record.rs
index 25c7047368..629a42b4da 100644
--- a/crates/router/src/core/payments/operations/payment_attempt_record.rs
+++ b/crates/router/src/core/payments/operations/payment_attempt_record.rs
@@ -15,6 +15,7 @@ use router_env::{instrument, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantId,
errors::{self, StorageErrorExt},
payments::{
self,
@@ -249,6 +250,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentAttemptRecordData<F>, PaymentsAtte
mut payment_data: PaymentAttemptRecordData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(
PaymentsAttemptRecordOperation<'b, F>,
PaymentAttemptRecordData<F>,
diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs
index 875fbe21c8..a6681cae54 100644
--- a/crates/router/src/core/payments/operations/payment_cancel.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel.rs
@@ -9,6 +9,7 @@ use router_env::{instrument, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantId,
errors::{self, RouterResult, StorageErrorExt},
payments::{helpers, operations, PaymentData},
},
@@ -244,6 +245,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsCancelReques
mut payment_data: PaymentData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(PaymentCancelOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
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.rs
index 1dcb7741d6..ed66d99074 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
@@ -8,7 +8,10 @@ use router_env::{instrument, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
- configs::dimension_state::DimensionsWithMerchantIdAndProfileId,
+ configs::dimension_state::{
+ DimensionsWithProcessorAndProviderMerchantId,
+ DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
+ },
errors::{self, RouterResult, StorageErrorExt},
payments::{self, helpers, operations, PaymentData},
},
@@ -250,7 +253,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsCancelPostCaptureRequest, Pa
_request: Option<payments::CustomerDetails>,
_provider: &domain::Provider,
_initiator: Option<&domain::Initiator>,
- _dimensions: DimensionsWithMerchantIdAndProfileId,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> errors::CustomResult<
(
PaymentCancelPostCaptureOperation<'a, F>,
@@ -313,6 +316,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsCancelPostCa
payment_data: PaymentData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(PaymentCancelPostCaptureOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
diff --git a/crates/router/src/core/payments/operations/payment_cancel_v2.rs b/crates/router/src/core/payments/operations/payment_cancel_v2.rs
index dbfc7da691..b53de14050 100644
--- a/crates/router/src/core/payments/operations/payment_cancel_v2.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel_v2.rs
@@ -12,6 +12,7 @@ use super::{
};
use crate::{
core::{
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantId,
errors::{self, CustomResult, RouterResult, StorageErrorExt},
payments::operations,
},
@@ -204,6 +205,7 @@ impl<F: Clone + Send + Sync>
mut payment_data: hyperswitch_domain_models::payments::PaymentCancelData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(
BoxedCancelOperation<'b, F>,
hyperswitch_domain_models::payments::PaymentCancelData<F>,
diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs
index 7aa95e2605..049cec742f 100644
--- a/crates/router/src/core/payments/operations/payment_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_capture.rs
@@ -9,6 +9,7 @@ use router_env::{instrument, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantId,
errors::{self, RouterResult, StorageErrorExt},
payments::{self, helpers, operations, types::MultipleCaptureData},
},
@@ -300,6 +301,7 @@ impl<F: Clone + Sync> UpdateTracker<F, payments::PaymentData<F>, api::PaymentsCa
mut payment_data: payments::PaymentData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(PaymentCaptureOperation<'b, F>, payments::PaymentData<F>)>
where
F: 'b + Send,
diff --git a/crates/router/src/core/payments/operations/payment_capture_v2.rs b/crates/router/src/core/payments/operations/payment_capture_v2.rs
index c2393108ad..e67ab61ef4 100644
--- a/crates/router/src/core/payments/operations/payment_capture_v2.rs
+++ b/crates/router/src/core/payments/operations/payment_capture_v2.rs
@@ -7,6 +7,7 @@ use router_env::{instrument, tracing};
use super::{Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantId,
errors::{self, CustomResult, RouterResult, StorageErrorExt},
payments::{
helpers,
@@ -298,6 +299,7 @@ impl<F: Clone> UpdateTracker<F, PaymentCaptureData<F>, PaymentsCaptureRequest> f
mut payment_data: PaymentCaptureData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(BoxedConfirmOperation<'b, F>, PaymentCaptureData<F>)>
where
F: 'b + Send,
diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
index c460a0ae18..69d2e87137 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -10,7 +10,10 @@ use router_env::{instrument, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
- configs::dimension_state::DimensionsWithMerchantIdAndProfileId,
+ configs::dimension_state::{
+ DimensionsWithProcessorAndProviderMerchantId,
+ DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
+ },
errors::{self, CustomResult, RouterResult, StorageErrorExt},
mandate::helpers as m_helpers,
payments::{
@@ -413,7 +416,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
_request: Option<CustomerDetails>,
provider: &domain::Provider,
_initiator: Option<&domain::Initiator>,
- _dimensions: DimensionsWithMerchantIdAndProfileId,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> CustomResult<
(CompleteAuthorizeOperation<'a, F>, Option<domain::Customer>),
errors::StorageError,
@@ -518,6 +521,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
mut payment_data: PaymentData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(CompleteAuthorizeOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 48dc30a599..50f8b95002 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -43,7 +43,10 @@ use crate::{
authentication,
blocklist::utils as blocklist_utils,
card_testing_guard::utils as card_testing_guard_utils,
- configs::dimension_state::DimensionsWithMerchantIdAndProfileId,
+ configs::dimension_state::{
+ DimensionsWithProcessorAndProviderMerchantId,
+ DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
+ },
errors::{self, CustomResult, RouterResult, StorageErrorExt},
mandate::helpers as m_helpers,
metrics,
@@ -1059,7 +1062,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
request: Option<CustomerDetails>,
provider: &domain::Provider,
initiator: Option<&domain::Initiator>,
- dimensions: DimensionsWithMerchantIdAndProfileId,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> CustomResult<
(PaymentConfirmOperation<'a, F>, Option<domain::Customer>),
errors::StorageError,
@@ -2270,6 +2273,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: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(
BoxedOperation<'b, F, api::PaymentsRequest, PaymentData<F>>,
PaymentData<F>,
@@ -2293,6 +2297,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
mut payment_data: PaymentData<F>,
frm_suggestion: Option<FrmSuggestion>,
header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(
BoxedOperation<'b, F, api::PaymentsRequest, PaymentData<F>>,
PaymentData<F>,
diff --git a/crates/router/src/core/payments/operations/payment_confirm_intent.rs b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
index 38f8af63fc..3f84a3fee7 100644
--- a/crates/router/src/core/payments/operations/payment_confirm_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
@@ -11,6 +11,7 @@ use super::{Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
admin,
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantId,
errors::{self, CustomResult, RouterResult, StorageErrorExt},
payment_methods,
payments::{
@@ -756,6 +757,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, PaymentsConfirmInt
mut payment_data: PaymentConfirmData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(BoxedConfirmOperation<'b, F>, PaymentConfirmData<F>)>
where
F: 'b + Send,
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index e1f335c7ff..adce7a9043 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -33,7 +33,10 @@ use crate::core::payment_methods::transformers as pm_transformers;
use crate::{
consts,
core::{
- configs::dimension_state::{Dimensions, DimensionsWithMerchantIdAndProfileId},
+ configs::dimension_state::{
+ Dimensions, DimensionsWithProcessorAndProviderMerchantId,
+ DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
+ },
errors::{self, CustomResult, RouterResult, StorageErrorExt},
mandate::helpers as m_helpers,
payment_link,
@@ -663,7 +666,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
// Check if client session validation is enabled
let dimensions = Dimensions::new()
- .with_merchant_id(platform.get_processor().get_account().get_id().clone());
+ .with_provider_merchant_id(platform.get_provider().get_provider_merchant_id())
+ .with_processor_merchant_id(platform.get_processor().get_processor_merchant_id());
let session_validation_enabled = dimensions
.get_client_session_validation_enabled(
@@ -763,7 +767,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
request: Option<CustomerDetails>,
provider: &domain::Provider,
initiator: Option<&domain::Initiator>,
- dimensions: DimensionsWithMerchantIdAndProfileId,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> CustomResult<(PaymentCreateOperation<'a, F>, Option<domain::Customer>), errors::StorageError>
{
match provider.get_account().merchant_account_type {
@@ -1037,6 +1041,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
mut payment_data: PaymentData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(PaymentCreateOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
diff --git a/crates/router/src/core/payments/operations/payment_create_intent.rs b/crates/router/src/core/payments/operations/payment_create_intent.rs
index 607fe7e156..b647006869 100644
--- a/crates/router/src/core/payments/operations/payment_create_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_create_intent.rs
@@ -14,6 +14,7 @@ use router_env::{instrument, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantId,
errors::{self, RouterResult, StorageErrorExt},
payments::{self, helpers, operations},
},
@@ -201,6 +202,7 @@ impl<F: Clone + Sync> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsC
payment_data: payments::PaymentIntentData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(
PaymentsCreateIntentOperation<'b, F>,
payments::PaymentIntentData<F>,
diff --git a/crates/router/src/core/payments/operations/payment_get.rs b/crates/router/src/core/payments/operations/payment_get.rs
index 31dd9b4cc1..2f4dc79719 100644
--- a/crates/router/src/core/payments/operations/payment_get.rs
+++ b/crates/router/src/core/payments/operations/payment_get.rs
@@ -8,6 +8,7 @@ use router_env::{instrument, tracing};
use super::{Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantId,
errors::{self, CustomResult, RouterResult, StorageErrorExt},
payments::{
helpers,
@@ -372,6 +373,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentStatusData<F>, PaymentsRetrieveReq
payment_data: PaymentStatusData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(BoxedConfirmOperation<'b, F>, PaymentStatusData<F>)>
where
F: 'b + Send,
diff --git a/crates/router/src/core/payments/operations/payment_get_intent.rs b/crates/router/src/core/payments/operations/payment_get_intent.rs
index 2b74473d7d..b7c046534c 100644
--- a/crates/router/src/core/payments/operations/payment_get_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_get_intent.rs
@@ -8,6 +8,7 @@ use router_env::{instrument, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantId,
errors::{self, RouterResult},
payments::{self, helpers, operations},
},
@@ -129,6 +130,7 @@ impl<F: Clone + Sync> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsG
payment_data: payments::PaymentIntentData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(
PaymentsGetIntentOperation<'b, F>,
payments::PaymentIntentData<F>,
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.rs
index 2210c2e609..74f168a3c2 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
@@ -10,7 +10,10 @@ use router_env::{instrument, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
- configs::dimension_state::DimensionsWithMerchantIdAndProfileId,
+ configs::dimension_state::{
+ DimensionsWithProcessorAndProviderMerchantId,
+ DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
+ },
errors::{self, RouterResult, StorageErrorExt},
payments::{self, helpers, operations, PaymentData},
},
@@ -210,7 +213,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsPostSessionTokensRequest, Pa
_request: Option<payments::CustomerDetails>,
_provider: &domain::Provider,
_initiator: Option<&domain::Initiator>,
- _dimensions: DimensionsWithMerchantIdAndProfileId,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> errors::CustomResult<
(
PaymentPostSessionTokensOperation<'a, F>,
@@ -273,6 +276,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsPostSessionT
payment_data: PaymentData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(PaymentPostSessionTokensOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
diff --git a/crates/router/src/core/payments/operations/payment_recurrence.rs b/crates/router/src/core/payments/operations/payment_recurrence.rs
index d7ee67aa32..4a0a1ff466 100644
--- a/crates/router/src/core/payments/operations/payment_recurrence.rs
+++ b/crates/router/src/core/payments/operations/payment_recurrence.rs
@@ -20,7 +20,10 @@ use crate::{
};
use crate::{
core::{
- configs::dimension_state::DimensionsWithMerchantIdAndProfileId,
+ configs::dimension_state::{
+ DimensionsWithProcessorAndProviderMerchantId,
+ DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
+ },
errors::{self, CustomResult, RouterResult, StorageErrorExt},
mandate::helpers as m_helpers,
payment_methods::transformers as pm_transformers,
@@ -418,7 +421,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
request: Option<CustomerDetails>,
provider: &domain::Provider,
_initiator: Option<&domain::Initiator>,
- _dimensions: DimensionsWithMerchantIdAndProfileId,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> CustomResult<
(PaymentRecurrenceOperation<'a, F>, Option<domain::Customer>),
errors::StorageError,
@@ -524,6 +527,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
mut payment_data: PaymentData<F>,
frm_suggestion: Option<FrmSuggestion>,
header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(
BoxedOperation<'b, F, api::PaymentsRequest, PaymentData<F>>,
PaymentData<F>,
diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs
index cff2474c3f..d058f2bf23 100644
--- a/crates/router/src/core/payments/operations/payment_reject.rs
+++ b/crates/router/src/core/payments/operations/payment_reject.rs
@@ -8,6 +8,7 @@ use router_env::{instrument, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantId,
errors::{self, RouterResult, StorageErrorExt},
payments::{helpers, operations, PaymentAddress, PaymentData},
},
@@ -229,6 +230,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, PaymentsCancelRequest> fo
mut payment_data: PaymentData<F>,
_should_decline_transaction: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(PaymentRejectOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index 7553e77173..4d68eff600 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -10,7 +10,10 @@ use router_env::{instrument, logger, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
- configs::dimension_state::DimensionsWithMerchantIdAndProfileId,
+ configs::dimension_state::{
+ DimensionsWithProcessorAndProviderMerchantId,
+ DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
+ },
errors::{self, RouterResult, StorageErrorExt},
payments::{self, helpers, operations, PaymentData},
},
@@ -257,6 +260,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsSessionReque
mut payment_data: PaymentData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(PaymentSessionOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
@@ -332,7 +336,7 @@ where
request: Option<payments::CustomerDetails>,
provider: &domain::Provider,
initiator: Option<&domain::Initiator>,
- dimensions: DimensionsWithMerchantIdAndProfileId,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> errors::CustomResult<
(PaymentSessionOperation<'a, F>, Option<domain::Customer>),
errors::StorageError,
diff --git a/crates/router/src/core/payments/operations/payment_session_intent.rs b/crates/router/src/core/payments/operations/payment_session_intent.rs
index 2c1854729d..4bddef996b 100644
--- a/crates/router/src/core/payments/operations/payment_session_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_session_intent.rs
@@ -10,6 +10,7 @@ use router_env::{instrument, logger, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantId,
errors::{self, RouterResult, StorageErrorExt},
payments::{self, helpers, operations, operations::ValidateStatusForOperation},
},
@@ -170,6 +171,7 @@ impl<F: Clone + Sync> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsS
mut payment_data: payments::PaymentIntentData<F>,
_frm_suggestion: Option<common_enums::FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(
PaymentSessionOperation<'b, F>,
payments::PaymentIntentData<F>,
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index ab54a4b5d2..918e54033a 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -11,7 +11,10 @@ use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, Valida
use crate::core::utils;
use crate::{
core::{
- configs::dimension_state::DimensionsWithMerchantIdAndProfileId,
+ configs::dimension_state::{
+ DimensionsWithProcessorAndProviderMerchantId,
+ DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
+ },
errors::{self, CustomResult, RouterResult, StorageErrorExt},
payments::{helpers, operations, CustomerDetails, PaymentAddress, PaymentData},
},
@@ -271,6 +274,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsStartRequest
payment_data: PaymentData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(PaymentSessionOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
@@ -325,7 +329,7 @@ where
_request: Option<CustomerDetails>,
_provider: &domain::Provider,
_initiator: Option<&domain::Initiator>,
- _dimensions: DimensionsWithMerchantIdAndProfileId,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> CustomResult<
(PaymentSessionOperation<'a, F>, Option<domain::Customer>),
errors::StorageError,
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index c3f9220eeb..3112c9e849 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -10,7 +10,10 @@ use router_env::{instrument, logger, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
- configs::dimension_state::DimensionsWithMerchantIdAndProfileId,
+ configs::dimension_state::{
+ DimensionsWithProcessorAndProviderMerchantId,
+ DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
+ },
errors::{self, CustomResult, RouterResult, StorageErrorExt},
payments::{
helpers, operations, types as payment_types, CustomerDetails, PaymentAddress,
@@ -68,7 +71,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
request: Option<CustomerDetails>,
provider: &domain::Provider,
initiator: Option<&domain::Initiator>,
- dimensions: DimensionsWithMerchantIdAndProfileId,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> CustomResult<
(
PaymentStatusOperation<'a, F, api::PaymentsRequest>,
@@ -169,6 +172,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
payment_data: PaymentData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(
PaymentStatusOperation<'b, F, api::PaymentsRequest>,
PaymentData<F>,
@@ -198,6 +202,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRetrieveRequ
payment_data: PaymentData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(
PaymentStatusOperation<'b, F, api::PaymentsRetrieveRequest>,
PaymentData<F>,
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index bdbb3eb2f5..64cb3da987 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -19,7 +19,10 @@ use router_env::{instrument, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
- configs::dimension_state::{Dimensions, DimensionsWithMerchantIdAndProfileId},
+ configs::dimension_state::{
+ DimensionsWithProcessorAndProviderMerchantId,
+ DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
+ },
errors::{self, CustomResult, RouterResult, StorageErrorExt},
mandate::helpers as m_helpers,
payment_methods::cards::create_encrypted_data,
@@ -593,7 +596,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
request: Option<CustomerDetails>,
provider: &domain::Provider,
initiator: Option<&domain::Initiator>,
- dimensions: DimensionsWithMerchantIdAndProfileId,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> CustomResult<(PaymentUpdateOperation<'a, F>, Option<domain::Customer>), errors::StorageError>
{
match provider.get_account().merchant_account_type {
@@ -811,6 +814,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: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(PaymentUpdateOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
@@ -828,6 +832,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
mut payment_data: PaymentData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(PaymentUpdateOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
@@ -1088,8 +1093,6 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
let payment_id = payment_data.payment_intent.payment_id.clone();
// Check if client session validation is enabled
- let dimensions = Dimensions::new().with_merchant_id(processor_merchant_id.clone());
-
let session_validation_enabled = dimensions
.get_client_session_validation_enabled(
state.store.as_ref(),
diff --git a/crates/router/src/core/payments/operations/payment_update_intent.rs b/crates/router/src/core/payments/operations/payment_update_intent.rs
index 7c7906e7dc..3d12f91d6a 100644
--- a/crates/router/src/core/payments/operations/payment_update_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_update_intent.rs
@@ -22,6 +22,7 @@ use router_env::{instrument, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantId,
errors::{self, RouterResult},
payments::{
self, helpers,
@@ -333,6 +334,7 @@ impl<F: Clone> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsUpdateIn
mut payment_data: payments::PaymentIntentData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(
PaymentsUpdateIntentOperation<'b, F>,
payments::PaymentIntentData<F>,
diff --git a/crates/router/src/core/payments/operations/payment_update_metadata.rs b/crates/router/src/core/payments/operations/payment_update_metadata.rs
index d90b6075ac..861ef8f762 100644
--- a/crates/router/src/core/payments/operations/payment_update_metadata.rs
+++ b/crates/router/src/core/payments/operations/payment_update_metadata.rs
@@ -11,7 +11,10 @@ use router_env::{instrument, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
- configs::dimension_state::DimensionsWithMerchantIdAndProfileId,
+ configs::dimension_state::{
+ DimensionsWithProcessorAndProviderMerchantId,
+ DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
+ },
errors::{self, RouterResult, StorageErrorExt},
payments::{self, helpers, operations, PaymentData},
},
@@ -216,7 +219,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsUpdateMetadataRequest, Payme
_request: Option<payments::CustomerDetails>,
_provider: &domain::Provider,
_initiator: Option<&domain::Initiator>,
- _dimensions: DimensionsWithMerchantIdAndProfileId,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> errors::CustomResult<
(
PaymentUpdateMetadataOperation<'a, F>,
@@ -279,6 +282,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsUpdateMetada
mut payment_data: PaymentData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(PaymentUpdateMetadataOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
diff --git a/crates/router/src/core/payments/operations/payments_extend_authorization.rs b/crates/router/src/core/payments/operations/payments_extend_authorization.rs
index bd9c924724..65a1e47640 100644
--- a/crates/router/src/core/payments/operations/payments_extend_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_extend_authorization.rs
@@ -8,7 +8,10 @@ use router_env::{instrument, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
- configs::dimension_state::DimensionsWithMerchantIdAndProfileId,
+ configs::dimension_state::{
+ DimensionsWithProcessorAndProviderMerchantId,
+ DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
+ },
errors::{self, RouterResult, StorageErrorExt},
payments::{self, helpers, operations, PaymentData},
},
@@ -232,7 +235,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsExtendAuthorizationRequest,
_request: Option<payments::CustomerDetails>,
_provider: &domain::Provider,
_initiator: Option<&domain::Initiator>,
- _dimensions: DimensionsWithMerchantIdAndProfileId,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> errors::CustomResult<
(
PaymentExtendAuthorizationOperation<'a, F>,
@@ -295,6 +298,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsExtendAuthor
payment_data: PaymentData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(PaymentExtendAuthorizationOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
index da6bb861cb..cf4249c984 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -10,7 +10,10 @@ use router_env::{instrument, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
- configs::dimension_state::DimensionsWithMerchantIdAndProfileId,
+ configs::dimension_state::{
+ DimensionsWithProcessorAndProviderMerchantId,
+ DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
+ },
errors::{self, RouterResult, StorageErrorExt},
payments::{
self, helpers, operations, CustomerDetails, IncrementalAuthorizationDetails,
@@ -213,6 +216,7 @@ impl<F: Clone + Sync>
mut payment_data: payments::PaymentData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(
PaymentIncrementalAuthorizationOperation<'b, F>,
payments::PaymentData<F>,
@@ -330,7 +334,7 @@ impl<F: Clone + Send + Sync>
request: Option<CustomerDetails>,
provider: &domain::Provider,
_initiator: Option<&domain::Initiator>,
- _dimensions: DimensionsWithMerchantIdAndProfileId,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> CustomResult<
(
BoxedOperation<
diff --git a/crates/router/src/core/payments/operations/proxy_payments_intent.rs b/crates/router/src/core/payments/operations/proxy_payments_intent.rs
index d9a5cc45e7..5fe51d48f3 100644
--- a/crates/router/src/core/payments/operations/proxy_payments_intent.rs
+++ b/crates/router/src/core/payments/operations/proxy_payments_intent.rs
@@ -13,6 +13,7 @@ use router_env::{instrument, tracing};
use super::{Domain, GetTracker, Operation, PostUpdateTracker, UpdateTracker, ValidateRequest};
use crate::{
core::{
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantId,
errors::{self, CustomResult, RouterResult, StorageErrorExt},
payments::{
operations::{self, ValidateStatusForOperation},
@@ -368,6 +369,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, ProxyPaymentsReque
mut payment_data: PaymentConfirmData<F>,
_frm_suggestion: Option<api_models::enums::FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(BoxedConfirmOperation<'b, F>, PaymentConfirmData<F>)>
where
F: 'b + Send,
diff --git a/crates/router/src/core/payments/operations/tax_calculation.rs b/crates/router/src/core/payments/operations/tax_calculation.rs
index 55303c05c2..a11ab48845 100644
--- a/crates/router/src/core/payments/operations/tax_calculation.rs
+++ b/crates/router/src/core/payments/operations/tax_calculation.rs
@@ -11,7 +11,10 @@ use router_env::{instrument, tracing};
use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
- configs::dimension_state::DimensionsWithMerchantIdAndProfileId,
+ configs::dimension_state::{
+ DimensionsWithProcessorAndProviderMerchantId,
+ DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
+ },
errors::{self, RouterResult, StorageErrorExt},
payment_methods::cards::create_encrypted_data,
payments::{self, helpers, operations, PaymentData, PaymentMethodChecker},
@@ -226,7 +229,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsDynamicTaxCalculationRequest
_request: Option<payments::CustomerDetails>,
_provider: &domain::Provider,
_initiator: Option<&domain::Initiator>,
- _dimensions: DimensionsWithMerchantIdAndProfileId,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndProfileId,
) -> errors::CustomResult<
(
PaymentSessionUpdateOperation<'a, F>,
@@ -392,6 +395,7 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsDynamicTaxCa
mut payment_data: PaymentData<F>,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<(PaymentSessionUpdateOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rs
index a6fe313788..6944bf0c9f 100644
--- a/crates/router/src/core/payments/retry.rs
+++ b/crates/router/src/core/payments/retry.rs
@@ -14,6 +14,7 @@ use crate::core::utils as core_utils;
use crate::{
consts,
core::{
+ configs,
errors::{self, RouterResult, StorageErrorExt},
payments::{
self, complete_connector_service,
@@ -392,6 +393,10 @@ where
types::RouterData<F, FData, types::PaymentsResponseData>: Feature<F, FData>,
dyn api::Connector: services::api::ConnectorIntegration<F, FData, types::PaymentsResponseData>,
{
+ let dimensions = configs::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());
+
metrics::AUTO_RETRY_PAYMENT_COUNT.add(1, &[]);
modify_trackers(
@@ -472,6 +477,7 @@ where
hyperswitch_domain_models::payments::HeaderPayload::default(),
frm_suggestion,
call_connector_service_response,
+ &dimensions,
)
.await?;
Ok(router_data)
diff --git a/crates/router/src/core/payments/session_operation.rs b/crates/router/src/core/payments/session_operation.rs
index 74aefeb460..a134dccdd8 100644
--- a/crates/router/src/core/payments/session_operation.rs
+++ b/crates/router/src/core/payments/session_operation.rs
@@ -22,6 +22,7 @@ use router_env::{env::Env, instrument, tracing};
use crate::{
core::{
+ configs::dimension_state::{Dimensions, DimensionsWithProcessorAndProviderMerchantId},
errors::{self, utils::StorageErrorExt, RouterResult},
payments::{
self as payments_core, call_multiple_connectors_service,
@@ -130,6 +131,10 @@ where
{
let operation: BoxedOperation<'_, F, Req, D> = Box::new(operation);
+ let dimensions = 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)?;
@@ -191,6 +196,7 @@ where
payment_data.clone(),
None,
header_payload.clone(),
+ &dimensions,
)
.await?;
// todo: call surcharge manager for session token call.
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index 9d540eafda..b2fb4fd351 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -51,7 +51,7 @@ use crate::types::domain::behaviour::Conversion;
use crate::types::PayoutActionData;
use crate::{
core::{
- configs::{self as configs, dimension_state::DimensionsWithMerchantId},
+ configs::{self as configs, dimension_state::DimensionsWithProcessorAndProviderMerchantId},
errors::{
self, ConnectorErrorExt, CustomResult, RouterResponse, RouterResult, StorageErrorExt,
},
@@ -184,7 +184,7 @@ pub async fn make_connector_decision(
header_payload: HeaderPayload,
connector_call_type: api::ConnectorCallType,
payout_data: &mut PayoutData,
- dimensions: DimensionsWithMerchantId,
+ dimensions: DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<()> {
match connector_call_type {
api::ConnectorCallType::PreDetermined(routing_data) => {
@@ -296,7 +296,7 @@ pub async fn payouts_core(
payout_data: &mut PayoutData,
routing_algorithm: Option<serde_json::Value>,
eligible_connectors: Option<Vec<api_enums::PayoutConnectors>>,
- dimensions: DimensionsWithMerchantId,
+ dimensions: DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<()> {
let payout_attempt = &payout_data.payout_attempt;
@@ -332,7 +332,7 @@ pub async fn payouts_core(
payout_data: &mut PayoutData,
routing_algorithm: Option<serde_json::Value>,
eligible_connectors: Option<Vec<api_enums::PayoutConnectors>>,
- dimensions: DimensionsWithMerchantId,
+ dimensions: DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<()> {
todo!()
}
@@ -348,7 +348,8 @@ pub async fn payouts_create_core(
let (payout_id, payout_method_data, profile_id, customer, payment_method) =
validator::validate_create_request(&state, &platform, &req).await?;
let dimensions = configs::dimension_state::Dimensions::new()
- .with_merchant_id(platform.get_processor().get_account().get_id().clone());
+ .with_processor_merchant_id(platform.get_processor().get_processor_merchant_id())
+ .with_provider_merchant_id(platform.get_provider().get_provider_merchant_id());
// Create DB entries
let mut payout_data = payout_create_db_entries(
@@ -412,7 +413,8 @@ pub async fn payouts_confirm_core(
header_payload: HeaderPayload,
) -> RouterResponse<payouts::PayoutCreateResponse> {
let dimensions = configs::dimension_state::Dimensions::new()
- .with_merchant_id(platform.get_processor().get_account().get_id().clone());
+ .with_processor_merchant_id(platform.get_processor().get_processor_merchant_id())
+ .with_provider_merchant_id(platform.get_provider().get_provider_merchant_id());
let mut payout_data = Box::pin(make_payout_data(
&state,
@@ -479,7 +481,8 @@ pub async fn payouts_update_core(
header_payload: HeaderPayload,
) -> RouterResponse<payouts::PayoutCreateResponse> {
let dimensions = configs::dimension_state::Dimensions::new()
- .with_merchant_id(platform.get_processor().get_account().get_id().clone());
+ .with_processor_merchant_id(platform.get_processor().get_processor_merchant_id())
+ .with_provider_merchant_id(platform.get_provider().get_provider_merchant_id());
let payout_id = req.payout_id.clone().get_required_value("payout_id")?;
let mut payout_data = Box::pin(make_payout_data(
@@ -714,7 +717,8 @@ pub async fn payouts_fulfill_core(
let payout_attempt = payout_data.payout_attempt.to_owned();
let status = payout_attempt.status;
let dimensions = configs::dimension_state::Dimensions::new()
- .with_merchant_id(platform.get_processor().get_account().get_id().clone());
+ .with_processor_merchant_id(platform.get_processor().get_processor_merchant_id())
+ .with_provider_merchant_id(platform.get_provider().get_provider_merchant_id());
// Verify if fulfillment can be triggered
if helpers::is_payout_terminal_state(status)
@@ -1120,7 +1124,7 @@ pub async fn call_connector_payout(
header_payload: HeaderPayload,
connector_data: &api::ConnectorData,
payout_data: &mut PayoutData,
- dimensions: &DimensionsWithMerchantId,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<()> {
let payout_attempt = &payout_data.payout_attempt.to_owned();
let payouts = &payout_data.payouts.to_owned();
@@ -2604,7 +2608,7 @@ pub async fn fulfill_payout(
header_payload: HeaderPayload,
connector_data: &api::ConnectorData,
payout_data: &mut PayoutData,
- dimensions: &DimensionsWithMerchantId,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<()> {
// 1. Form Router data
let mut router_data =
diff --git a/crates/router/src/core/payouts/retry.rs b/crates/router/src/core/payouts/retry.rs
index 835484e396..a13f3f640f 100644
--- a/crates/router/src/core/payouts/retry.rs
+++ b/crates/router/src/core/payouts/retry.rs
@@ -12,7 +12,7 @@ use super::{call_connector_payout, PayoutData};
use crate::{
consts,
core::{
- configs::dimension_state::DimensionsWithMerchantId,
+ configs::dimension_state::DimensionsWithProcessorAndProviderMerchantId,
errors::{self, RouterResult, StorageErrorExt},
payouts,
},
@@ -30,7 +30,7 @@ pub async fn do_gsm_multiple_connector_actions(
original_connector_data: api::ConnectorData,
payout_data: &mut PayoutData,
platform: &domain::Platform,
- dimensions: &DimensionsWithMerchantId,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantId,
header_payload: HeaderPayload,
) -> RouterResult<()> {
let mut retries = None;
@@ -91,7 +91,7 @@ pub async fn do_gsm_single_connector_actions(
original_connector_data: api::ConnectorData,
payout_data: &mut PayoutData,
platform: &domain::Platform,
- dimensions: &DimensionsWithMerchantId,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantId,
header_payload: HeaderPayload,
) -> RouterResult<()> {
let mut retries = None;
@@ -215,7 +215,7 @@ pub async fn do_retry(
platform: &domain::Platform,
header_payload: HeaderPayload,
payout_data: &mut PayoutData,
- dimensions: &DimensionsWithMerchantId,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantId,
) -> RouterResult<()> {
metrics::AUTO_RETRY_PAYOUT_COUNT.add(1, &[]);
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index dc3221562f..24f9d7e0f8 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -2374,7 +2374,8 @@ where
.collect()
});
let dimensions = Dimensions::new()
- .with_merchant_id(platform.get_processor().get_account().get_id().clone());
+ .with_processor_merchant_id(platform.get_processor().get_processor_merchant_id())
+ .with_provider_merchant_id(platform.get_provider().get_provider_merchant_id());
match req.payment_type.unwrap_or_default() {
api_models::enums::PaymentType::Normal
| api_models::enums::PaymentType::RecurringMandate
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index 9c2515e956..85ca23b446 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -3440,7 +3440,9 @@ where
let processor_merchant_id = platform.get_processor().get_account().get_id();
// Check if client session validation is enabled
- let dimensions = Dimensions::new().with_merchant_id(processor_merchant_id.clone());
+ let dimensions = Dimensions::new()
+ .with_provider_merchant_id(platform.get_provider().get_provider_merchant_id())
+ .with_processor_merchant_id(platform.get_processor().get_processor_merchant_id());
let session_validation_enabled = dimensions
.get_client_session_validation_enabled(
diff --git a/crates/router/src/workflows/attach_payout_account_workflow.rs b/crates/router/src/workflows/attach_payout_account_workflow.rs
index b2217c53a7..4e50fa44eb 100644
--- a/crates/router/src/workflows/attach_payout_account_workflow.rs
+++ b/crates/router/src/workflows/attach_payout_account_workflow.rs
@@ -35,8 +35,6 @@ impl ProcessTrackerWorkflow<SessionState> for AttachPayoutAccountWorkflow {
.merchant_id
.clone()
.get_required_value("merchant_id")?;
- let dimensions =
- configs::dimension_state::Dimensions::new().with_merchant_id(merchant_id.clone());
let key_store = db
.get_merchant_key_store_by_merchant_id(
@@ -58,6 +56,9 @@ impl ProcessTrackerWorkflow<SessionState> for AttachPayoutAccountWorkflow {
key_store,
None,
);
+ let dimensions = configs::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());
let mut payout_data = Box::pin(payouts::make_payout_data(
state,
&platform,
diff --git a/crates/router/src/workflows/payment_sync.rs b/crates/router/src/workflows/payment_sync.rs
index c17ac4b8f7..d08b0b9d2b 100644
--- a/crates/router/src/workflows/payment_sync.rs
+++ b/crates/router/src/workflows/payment_sync.rs
@@ -81,7 +81,8 @@ impl ProcessTrackerWorkflow<SessionState> for PaymentsSyncWorkflow {
None,
);
let dimensions = configs::dimension_state::Dimensions::new()
- .with_merchant_id(platform.get_processor().get_account().get_id().clone());
+ .with_processor_merchant_id(platform.get_processor().get_processor_merchant_id())
+ .with_provider_merchant_id(platform.get_provider().get_provider_merchant_id());
// TODO: Add support for ReqState in PT flows
let (mut payment_data, _, _, _) = Box::pin(payment_flows::payments_operation_core::<
api::PSync,
diff --git a/crates/router/src/workflows/payout_sync.rs b/crates/router/src/workflows/payout_sync.rs
index 033e6ef84f..13e728e56c 100644
--- a/crates/router/src/workflows/payout_sync.rs
+++ b/crates/router/src/workflows/payout_sync.rs
@@ -13,7 +13,9 @@ use scheduler::{
use crate::{
core::{
- configs::{self, dimension_state::DimensionsWithMerchantIdAndConnector},
+ configs::{
+ self, dimension_state::DimensionsWithProcessorAndProviderMerchantIdAndConnector,
+ },
payouts, webhooks,
},
errors as core_errors,
@@ -108,7 +110,8 @@ impl ProcessTrackerWorkflow<SessionState> for PayoutSyncWorkFlow {
.await?;
let dimensions = configs::dimension_state::Dimensions::new()
- .with_merchant_id(merchant_id.clone())
+ .with_provider_merchant_id(platform.get_provider().get_provider_merchant_id())
+ .with_processor_merchant_id(platform.get_processor().get_processor_merchant_id())
.with_connector(connector_data.connector_name);
if payout_data.payout_attempt.status.is_terminal_status() {
@@ -148,7 +151,7 @@ impl PayoutSyncWorkFlow {
state: &SessionState,
payout_data: &payouts::PayoutData,
application_source: common_enums::ApplicationSource,
- dimensions: &DimensionsWithMerchantIdAndConnector,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndConnector,
) -> common_utils::errors::CustomResult<(), core_errors::ApiErrorResponse> {
let db = &*state.store;
let scheduled_time = Self::get_payout_sync_process_schedule_time(
@@ -221,7 +224,7 @@ impl PayoutSyncWorkFlow {
state: &SessionState,
payout_id: common_utils::id_type::PayoutId,
retry_count: i32,
- dimensions: &DimensionsWithMerchantIdAndConnector,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndConnector,
) -> Result<Option<time::PrimitiveDateTime>, errors::ProcessTrackerError> {
let value = dimensions
.get_payout_tracker_mapping(
@@ -296,7 +299,7 @@ impl PayoutSyncWorkFlow {
state: &SessionState,
payout_id: common_utils::id_type::PayoutId,
pt: storage::ProcessTracker,
- dimensions: &DimensionsWithMerchantIdAndConnector,
+ dimensions: &DimensionsWithProcessorAndProviderMerchantIdAndConnector,
) -> Result<(), errors::ProcessTrackerError> {
let db = &*state.store;
let schedule_time: Option<time::PrimitiveDateTime> =