Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(superposition): add backend apis to support dashboard's superposition embeddable UI (#12203)
AdityaWNLcb6312c25b57
diff --git a/Cargo.lock b/Cargo.lockindex f5bff5986b..04f4d7b56a 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -1550,7 +1550,7 @@ dependencies = ["bitflags 2.9.0","cexpr","clang-sys",- "itertools 0.10.5",+ "itertools 0.11.0","log 0.4.27","prettyplease","proc-macro2",@@ -3377,6 +3377,7 @@ dependencies = ["aws-sdk-sesv2","aws-sdk-sts","aws-smithy-runtime",+ "aws-smithy-runtime-api","aws-smithy-types","base64 0.22.1","common_enums",@@ -6835,7 +6836,7 @@ dependencies = ["regex-cache","serde","serde_derive",- "strum 0.25.0",+ "strum 0.26.3","thiserror 1.0.69",]@@ -7156,8 +7157,8 @@ version = "0.14.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "343d3bd7056eda839b03204e68deff7d1b13aba7af2b2fd16890697274262ee7"dependencies = [- "heck 0.4.1",- "itertools 0.10.5",+ "heck 0.5.0",+ "itertools 0.11.0","log 0.4.27","multimap","petgraph",@@ -7178,7 +7179,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d"dependencies = ["anyhow",- "itertools 0.10.5",+ "itertools 0.11.0","proc-macro2","quote","syn 2.0.101",@@ -7191,7 +7192,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "27c6023962132f4b30eb4c172c91ce92d933da334c59c23cddee82358ddafb0b"dependencies = ["anyhow",- "itertools 0.10.5",+ "itertools 0.11.0","proc-macro2","quote","syn 2.0.101",@@ -8080,6 +8081,7 @@ dependencies = ["storage_impl","strum 0.26.3","subscriptions",+ "superposition_sdk","tera","test_utils","thiserror 1.0.69",@@ -9586,9 +9588,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"[[package]]name = "superposition_core"-version = "0.102.0"+version = "0.114.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c8408c05eaa6d5e4ab17769e8a008b7b6908d4cf12995649bad45bd9e4ccac66"+checksum = "6b97214039991ceebacd02afa5fde5fa7de3c421145d3aad60c4000ab58c904e"dependencies = ["bigdecimal 0.3.1","blake3",@@ -9607,9 +9609,9 @@ dependencies = [[[package]]name = "superposition_derives"-version = "0.102.0"+version = "0.114.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "15ce4c755b62951f53d8ba1f686dfebe0a0fb22ea2e1abf437028b14130aabdb"+checksum = "94ce01eca383050e056a97cb540bc866c17a4caa5e1690dacd39b2099f83294d"dependencies = ["proc-macro-crate 3.2.0","quote",@@ -9618,9 +9620,9 @@ dependencies = [[[package]]name = "superposition_provider"-version = "0.102.0"+version = "0.114.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e0bc4b0c15a02a10d89deb0d4bc9e382193c9d745ac3057feac89f5503f6096b"+checksum = "aac9de6c9317dd04c25c6cdd3985d8cec7de60cf146ca478089a190803d82d46"dependencies = ["async-trait","aws-smithy-types",@@ -9643,9 +9645,9 @@ dependencies = [[[package]]name = "superposition_sdk"-version = "0.102.0"+version = "0.114.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d53945cde9e454e8bdfe3560646c63556a25ec1242f28215a6fe709269de0126"+checksum = "dff0c2b933ada9b3fb9e70b796de73d5374d13faa7e606aa10e5730c0fcbf3d0"dependencies = ["aws-smithy-async","aws-smithy-http 0.62.1",@@ -9661,9 +9663,9 @@ dependencies = [[[package]]name = "superposition_types"-version = "0.102.0"+version = "0.114.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0751b1d31773b2dc67adaa208a270b5a5189b435f69f63f32f528878f8c33c72"+checksum = "4e91fcc93ef75fee0a68c709b13219f9b90d7a4efa432f2e680969208a4b9fa0"dependencies = ["bigdecimal 0.3.1","chrono",diff --git a/crates/api_models/Cargo.toml b/crates/api_models/Cargo.tomlindex 88bb9e8196..b65d8d4285 100644--- a/crates/api_models/Cargo.toml+++ b/crates/api_models/Cargo.toml@@ -38,7 +38,7 @@ url = { version = "2.5.4", features = ["serde"] }utoipa = { version = "4.2.3", features = ["preserve_order", "preserve_path_order"] }nutype = { version = "0.4.3", features = ["serde"] }deserialize_form_style_query_parameter = "0.2.2"-superposition_types = "0.102.0"+superposition_types = "0.114.0"# First party cratescards = { version = "0.1.0", path = "../cards" }diff --git a/crates/api_models/src/lib.rs b/crates/api_models/src/lib.rsindex 59a46fff7a..ab617c2797 100644--- a/crates/api_models/src/lib.rs+++ b/crates/api_models/src/lib.rs@@ -47,6 +47,7 @@ pub mod relay;pub mod revenue_recovery_data_backfill;pub mod routing;pub mod subscription;+pub mod superposition_proxy;pub mod superposition_sdk_config;pub mod surcharge_decision_configs;pub mod three_ds_decision_rule;diff --git a/crates/api_models/src/superposition_proxy.rs b/crates/api_models/src/superposition_proxy.rsnew file mode 100644index 0000000000..854cb990f2--- /dev/null+++ b/crates/api_models/src/superposition_proxy.rs@@ -0,0 +1,175 @@+use std::collections::BTreeMap;++use common_utils::events::{ApiEventMetric, ApiEventsType};++/// Context entry returned by Superposition list/create endpoints.+#[derive(Debug, Clone, serde::Serialize)]+pub struct ContextResponse {+ /// Unique identifier of the context.+ pub id: String,+ /// Dimension values that define the context match condition.+ pub value: serde_json::Value,+ /// Override values applied when this context matches.+ pub r#override: serde_json::Value,+ /// Identifier of the override record.+ pub override_id: String,+ /// Priority weight used during context resolution.+ pub weight: String,+ /// Human-readable description of the context.+ pub description: String,+ /// Reason recorded for the most recent change.+ pub change_reason: String,+ /// Creation timestamp in RFC3339 format.+ pub created_at: String,+ /// User who created the context.+ pub created_by: String,+ /// Last modification timestamp in RFC3339 format.+ pub last_modified_at: String,+ /// User who last modified the context.+ pub last_modified_by: String,+}++impl ApiEventMetric for ContextResponse {+ fn get_api_event_type(&self) -> Option<ApiEventsType> {+ Some(ApiEventsType::Miscellaneous)+ }+}++/// Default configuration entry returned by Superposition.+#[derive(Debug, Clone, serde::Serialize)]+pub struct DefaultConfigResponse {+ /// Configuration key.+ pub key: String,+ /// Default value for the configuration key.+ pub value: serde_json::Value,+ /// JSON schema describing the value.+ pub schema: serde_json::Value,+ /// Human-readable description.+ pub description: String,+ /// Reason recorded for the most recent change.+ pub change_reason: String,+ /// Optional name of the validation function.+ pub value_validation_function_name: Option<String>,+ /// Optional name of the compute function.+ pub value_compute_function_name: Option<String>,+ /// Creation timestamp in RFC3339 format.+ pub created_at: String,+ /// User who created the config.+ pub created_by: String,+ /// Last modification timestamp in RFC3339 format.+ pub last_modified_at: String,+ /// User who last modified the config.+ pub last_modified_by: String,+}++impl ApiEventMetric for DefaultConfigResponse {+ fn get_api_event_type(&self) -> Option<ApiEventsType> {+ Some(ApiEventsType::Miscellaneous)+ }+}++/// Dimension definition returned by Superposition.+#[derive(Debug, Clone, serde::Serialize)]+pub struct DimensionResponse {+ /// Dimension name.+ pub dimension: String,+ /// Evaluation order for this dimension.+ pub position: i32,+ /// JSON schema describing the dimension value.+ pub schema: serde_json::Value,+ /// Optional name of the validation function.+ pub value_validation_function_name: Option<String>,+ /// Human-readable description.+ pub description: String,+ /// Reason recorded for the most recent change.+ pub change_reason: String,+ /// Last modification timestamp in RFC3339 format.+ pub last_modified_at: String,+ /// User who last modified the dimension.+ pub last_modified_by: String,+ /// Creation timestamp in RFC3339 format.+ pub created_at: String,+ /// User who created the dimension.+ pub created_by: String,+ /// Mapping of dependent dimensions.+ pub dependency_graph: serde_json::Value,+ /// Dimension type (regular, local cohort, remote cohort).+ pub dimension_type: serde_json::Value,+ /// Optional name of the compute function.+ pub value_compute_function_name: Option<String>,+ /// Whether the dimension is mandatory.+ pub mandatory: bool,+}++impl ApiEventMetric for DimensionResponse {+ fn get_api_event_type(&self) -> Option<ApiEventsType> {+ Some(ApiEventsType::Miscellaneous)+ }+}++/// Audit log entry returned by Superposition.+#[derive(Debug, Clone, serde::Serialize)]+pub struct AuditLogResponse {+ /// Unique identifier of the audit log entry.+ pub id: String,+ /// Name of the table the action was performed on.+ pub table_name: String,+ /// User who performed the action.+ pub user_name: String,+ /// Timestamp of the action in RFC3339 format.+ pub timestamp: String,+ /// Action performed (e.g. CREATE, UPDATE, DELETE).+ pub action: String,+ /// Snapshot of the record prior to the change.+ pub original_data: Option<serde_json::Value>,+ /// Snapshot of the record after the change.+ pub new_data: Option<serde_json::Value>,+ /// Query string associated with the action.+ pub query: String,+}++impl ApiEventMetric for AuditLogResponse {+ fn get_api_event_type(&self) -> Option<ApiEventsType> {+ Some(ApiEventsType::Miscellaneous)+ }+}++#[derive(Debug, serde::Serialize)]+pub struct PaginatedListResponse<T> {+ pub total_pages: i32,+ pub total_items: i32,+ pub data: Vec<T>,+}++impl<T> ApiEventMetric for PaginatedListResponse<T> {+ fn get_api_event_type(&self) -> Option<ApiEventsType> {+ Some(ApiEventsType::Miscellaneous)+ }+}++/// A single resolved configuration entry returned by Superposition's detailed-resolve+/// endpoint: the resolved value alongside its default-config metadata.+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]+pub struct ResolvedConfigEntry {+ /// Human-readable description of the configuration key.+ pub description: String,+ /// JSON schema describing the value.+ pub schema: serde_json::Value,+ /// The resolved value for this key.+ pub value: serde_json::Value,+}++/// Detailed resolved configuration returned by the Superposition resolve endpoint.+///+/// Maps each configuration key to its resolved value and metadata, mirroring the body of+/// Superposition's `/config/resolve/detailed`. The upstream `version` / `last_modified` /+/// `audit_id` are returned as HTTP headers, not in the body.+#[derive(Debug, serde::Serialize)]+#[serde(transparent)]+pub struct ResolveConfigResponse(pub BTreeMap<String, ResolvedConfigEntry>);++impl ApiEventMetric for ResolveConfigResponse {+ fn get_api_event_type(&self) -> Option<ApiEventsType> {+ Some(ApiEventsType::Miscellaneous)+ }+}diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rsindex c2a3583883..8e4a0a7bbf 100644--- a/crates/common_enums/src/enums.rs+++ b/crates/common_enums/src/enums.rs@@ -9708,6 +9708,8 @@ pub enum PermissionGroup {CloneConnectorManage,ThemeView,ThemeManage,+ ConfigurationsView,+ ConfigurationsManage,ReconSourcesView,ReconSourcesManage,ReconExceptionsView,@@ -9732,6 +9734,7 @@ pub enum ParentGroup {ApiKeys,CloneConnector,Theme,+ Configurations,ReconSources,ReconExceptions,ReconTransactions,@@ -9767,6 +9770,7 @@ pub enum Resource {ReconStagingEntry,ReconTransaction,ReconRule,+ SuperpositionConfig,}#[derive(diff --git a/crates/external_services/Cargo.toml b/crates/external_services/Cargo.tomlindex 29b284d765..04b7ede6a2 100644--- a/crates/external_services/Cargo.toml+++ b/crates/external_services/Cargo.toml@@ -16,6 +16,7 @@ superposition = ["dep:open-feature","dep:superposition_provider","dep:superposition_sdk",+ "dep:api_models",]v1 = ["hyperswitch_interfaces/v1", "common_utils/v1"]v2 = ["hyperswitch_interfaces/v2", "common_utils/v2"]@@ -50,6 +51,7 @@ aws-sdk-sesv2 = "1.57.0"aws-sdk-sts = "1.51.0"aws-sdk-s3 = { version = "1.65.0", optional = true }aws-smithy-runtime = "1.8.3"+aws-smithy-runtime-api = { version = "1.7", features = ["client"] }aws-smithy-types = "1.3.1"base64 = "0.22.1"dyn-clone = "1.0.19"@@ -82,9 +84,9 @@ quick-xml = { version = "0.31.0", features = ["serialize"] }unified-connector-service-client = { git = "https://github.com/juspay/connector-service", tag = "2026.06.30.1", package = "rust-grpc-client" }open-feature = { version = "0.2.5", optional = true }-superposition_provider = { version = "0.102.0", optional = true }-superposition_types = "0.102.0"-superposition_sdk = { version = "0.102.0", optional = true }+superposition_provider = { version = "0.114.0", optional = true}+superposition_types = "0.114.0"+superposition_sdk = { version = "0.114.0", optional = true }# First party cratesdiff --git a/crates/external_services/src/superposition.rs b/crates/external_services/src/superposition.rsindex 15a454052a..4ac7c8622e 100644--- a/crates/external_services/src/superposition.rs+++ b/crates/external_services/src/superposition.rs@@ -5,16 +5,338 @@ pub mod types;use std::collections::HashMap;-use aws_smithy_types::Document;+use api_models::superposition_proxy::{+ AuditLogResponse, ContextResponse, DefaultConfigResponse, DimensionResponse,+ PaginatedListResponse,+};+pub use aws_smithy_types::DateTime;+use aws_smithy_types::{Document, Number};use common_utils::{errors::CustomResult, id_type::TargetingKey};use error_stack::{report, ResultExt};use hyperswitch_masking::ExposeInterface;use serde_json::Map;use superposition_provider::traits::AllFeatureProvider;+use superposition_sdk::operation::{+ list_audit_logs::ListAuditLogsOutput, list_contexts::ListContextsOutput,+ list_default_configs::ListDefaultConfigsOutput, list_dimensions::ListDimensionsOutput,+};+pub use superposition_sdk::{+ operation::{+ create_context::builders::CreateContextInputBuilder,+ get_detailed_resolved_config::builders::GetDetailedResolvedConfigInputBuilder,+ list_audit_logs::builders::ListAuditLogsInputBuilder,+ list_contexts::builders::ListContextsInputBuilder,+ list_default_configs::builders::ListDefaultConfigsInputBuilder,+ list_dimensions::builders::ListDimensionsInputBuilder,+ },+ types::{AuditAction, ContextFilterSortOn, DimensionMatchStrategy, SortBy},+};+pub use superposition_types::api::{+ config::ContextPayload as ResolveConfigBody, context::PutRequest as ContextPutRequest,+};pub use self::types::{ConfigContext, SuperpositionClientConfig, SuperpositionError, ToDocument};use crate::config_metrics;+/// Convert an `aws_smithy_types::Document` to a `serde_json::Value`.+pub fn document_to_value(doc: Document) -> serde_json::Value {+ match doc {+ Document::Object(obj) => serde_json::Value::Object(+ obj.into_iter()+ .map(|(k, v)| (k, document_to_value(v)))+ .collect(),+ ),+ Document::Array(arr) => {+ serde_json::Value::Array(arr.into_iter().map(document_to_value).collect())+ }+ Document::Number(num) => match num {+ Number::PosInt(v) => serde_json::Value::Number(serde_json::Number::from(v)),+ Number::NegInt(v) => serde_json::Value::Number(serde_json::Number::from(v)),+ Number::Float(v) => serde_json::Number::from_f64(v)+ .map(serde_json::Value::Number)+ .unwrap_or(serde_json::Value::Null),+ },+ Document::String(s) => serde_json::Value::String(s),+ Document::Bool(b) => serde_json::Value::Bool(b),+ Document::Null => serde_json::Value::Null,+ }+}++/// Convert a `serde_json::Value` to an `aws_smithy_types::Document`.+pub fn value_to_document(val: serde_json::Value) -> Document {+ match val {+ serde_json::Value::Null => Document::Null,+ serde_json::Value::Bool(b) => Document::Bool(b),+ serde_json::Value::Number(n) => {+ if let Some(i) = n.as_u64() {+ Document::Number(Number::PosInt(i))+ } else if let Some(i) = n.as_i64() {+ Document::Number(Number::NegInt(i))+ } else {+ Document::Number(Number::Float(n.as_f64().unwrap_or(0.0)))+ }+ }+ serde_json::Value::String(s) => Document::String(s),+ serde_json::Value::Array(arr) => {+ Document::Array(arr.into_iter().map(value_to_document).collect())+ }+ serde_json::Value::Object(obj) => Document::Object(+ obj.into_iter()+ .map(|(k, v)| (k, value_to_document(v)))+ .collect(),+ ),+ }+}++/// Format a smithy `DateTime` as an RFC3339 string.+pub fn datetime_to_string(dt: &DateTime) -> String {+ dt.fmt(aws_smithy_types::date_time::Format::DateTime)+ .unwrap_or_default()+}++/// Parse an ISO 8601 datetime string into an `aws_smithy_types::DateTime`.+pub fn parse_datetime(s: &str) -> Result<DateTime, String> {+ DateTime::from_str(s, aws_smithy_types::date_time::Format::DateTime).map_err(|e| e.to_string())+}++/// Convert a `HashMap<String, Document>` to a JSON object value.+pub fn doc_map_to_json(map: &HashMap<String, Document>) -> serde_json::Value {+ serde_json::Value::Object(+ map.iter()+ .map(|(k, v)| (k.clone(), document_to_value(v.clone())))+ .collect(),+ )+}++/// Serialize a `DimensionType` to its JSON representation.+pub fn dimension_type_to_value(dt: &superposition_sdk::types::DimensionType) -> serde_json::Value {+ use superposition_sdk::types::DimensionType;+ match dt {+ DimensionType::Regular => serde_json::Value::String("REGULAR".to_string()),+ DimensionType::LocalCohort(s) => serde_json::json!({ "LOCAL_COHORT": s }),+ DimensionType::RemoteCohort(s) => serde_json::json!({ "REMOTE_COHORT": s }),+ _ => serde_json::Value::String("UNKNOWN".to_string()),+ }+}++/// Map a Superposition SDK error to a `SuperpositionError` based on HTTP status.+pub fn map_sdk_error<E: std::fmt::Debug>(+ err: superposition_sdk::error::SdkError<E>,+) -> SuperpositionError {+ let status = err.raw_response().map(|r| r.status().as_u16());+ match status {+ Some(404) => SuperpositionError::NotFound(format!("{err:?}")),+ Some(s) if (400..500).contains(&s) => SuperpositionError::BadRequest(format!("{err:?}")),+ _ => SuperpositionError::ClientError(format!("{err:?}")),+ }+}++/// Convert a Superposition SDK `ContextResponse` into the typed response struct.+pub fn context_response_to_struct(+ ctx: &superposition_sdk::types::ContextResponse,+) -> ContextResponse {+ ContextResponse {+ id: ctx.id().to_owned(),+ value: doc_map_to_json(ctx.value()),+ r#override: doc_map_to_json(ctx.r#override()),+ override_id: ctx.override_id().to_owned(),+ weight: ctx.weight().to_owned(),+ description: ctx.description().to_owned(),+ change_reason: ctx.change_reason().to_owned(),+ created_at: datetime_to_string(ctx.created_at()),+ created_by: ctx.created_by().to_owned(),+ last_modified_at: datetime_to_string(ctx.last_modified_at()),+ last_modified_by: ctx.last_modified_by().to_owned(),+ }+}++/// Convert a Superposition SDK `DefaultConfigResponse` into the typed response struct.+pub fn default_config_response_to_struct(+ cfg: &superposition_sdk::types::DefaultConfigResponse,+) -> DefaultConfigResponse {+ DefaultConfigResponse {+ key: cfg.key().to_owned(),+ value: document_to_value(cfg.value().clone()),+ schema: doc_map_to_json(cfg.schema()),+ description: cfg.description().to_owned(),+ change_reason: cfg.change_reason().to_owned(),+ value_validation_function_name: cfg.value_validation_function_name().map(str::to_owned),+ value_compute_function_name: cfg.value_compute_function_name().map(str::to_owned),+ created_at: datetime_to_string(cfg.created_at()),+ created_by: cfg.created_by().to_owned(),+ last_modified_at: datetime_to_string(cfg.last_modified_at()),+ last_modified_by: cfg.last_modified_by().to_owned(),+ }+}++/// Convert a Superposition SDK `DimensionResponse` into the typed response struct.+pub fn dimension_response_to_struct(+ dim: &superposition_sdk::types::DimensionResponse,+) -> DimensionResponse {+ let dep_graph: Map<String, serde_json::Value> = dim+ .dependency_graph()+ .iter()+ .map(|(k, v)| {+ (+ k.clone(),+ serde_json::Value::Array(+ v.iter()+ .map(|s| serde_json::Value::String(s.clone()))+ .collect(),+ ),+ )+ })+ .collect();+ DimensionResponse {+ dimension: dim.dimension().to_owned(),+ position: dim.position(),+ schema: doc_map_to_json(dim.schema()),+ value_validation_function_name: dim.value_validation_function_name().map(str::to_owned),+ description: dim.description().to_owned(),+ change_reason: dim.change_reason().to_owned(),+ last_modified_at: datetime_to_string(dim.last_modified_at()),+ last_modified_by: dim.last_modified_by().to_owned(),+ created_at: datetime_to_string(dim.created_at()),+ created_by: dim.created_by().to_owned(),+ dependency_graph: serde_json::Value::Object(dep_graph),+ dimension_type: dimension_type_to_value(dim.dimension_type()),+ value_compute_function_name: dim.value_compute_function_name().map(str::to_owned),+ mandatory: dim.mandatory(),+ }+}++/// Convert a Superposition SDK `AuditLogFull` into the typed response struct.+pub fn audit_log_full_to_struct(log: &superposition_sdk::types::AuditLogFull) -> AuditLogResponse {+ AuditLogResponse {+ id: log.id().to_owned(),+ table_name: log.table_name().to_owned(),+ user_name: log.user_name().to_owned(),+ timestamp: datetime_to_string(log.timestamp()),+ action: log.action().as_str().to_owned(),+ original_data: log.original_data().map(|d| document_to_value(d.clone())),+ new_data: log.new_data().map(|d| document_to_value(d.clone())),+ query: log.query().to_owned(),+ }+}++/// Convert a Superposition SDK `ListContextsOutput` into the paginated response.+pub fn list_contexts_to_response(+ output: &ListContextsOutput,+) -> PaginatedListResponse<ContextResponse> {+ PaginatedListResponse {+ total_pages: output.total_pages(),+ total_items: output.total_items(),+ data: output+ .data()+ .iter()+ .map(context_response_to_struct)+ .collect(),+ }+}++/// Convert a Superposition SDK `ListDefaultConfigsOutput` into the paginated response.+pub fn list_default_configs_to_response(+ output: &ListDefaultConfigsOutput,+) -> PaginatedListResponse<DefaultConfigResponse> {+ PaginatedListResponse {+ total_pages: output.total_pages(),+ total_items: output.total_items(),+ data: output+ .data()+ .iter()+ .map(default_config_response_to_struct)+ .collect(),+ }+}++/// Convert a Superposition SDK `ListDimensionsOutput` into the paginated response.+pub fn list_dimensions_to_response(+ output: &ListDimensionsOutput,+) -> PaginatedListResponse<DimensionResponse> {+ PaginatedListResponse {+ total_pages: output.total_pages(),+ total_items: output.total_items(),+ data: output+ .data()+ .iter()+ .map(dimension_response_to_struct)+ .collect(),+ }+}++/// Convert a Superposition SDK `ListAuditLogsOutput` into the paginated response.+pub fn list_audit_logs_to_response(+ output: &ListAuditLogsOutput,+) -> PaginatedListResponse<AuditLogResponse> {+ PaginatedListResponse {+ total_pages: output.total_pages(),+ total_items: output.total_items(),+ data: output.data().iter().map(audit_log_full_to_struct).collect(),+ }+}++/// Convert a `ContextPutRequest` into the SDK `ContextPut` type.+pub fn context_put_from_request(+ body: &ContextPutRequest,+) -> CustomResult<superposition_sdk::types::ContextPut, SuperpositionError> {+ let context_json = serde_json::to_value(&body.context).map_err(|e| {+ report!(SuperpositionError::ClientError(format!(+ "Failed to serialize context: {e}"+ )))+ })?;++ let override_json = serde_json::to_value(&body.r#override).map_err(|e| {+ report!(SuperpositionError::ClientError(format!(+ "Failed to serialize override: {e}"+ )))+ })?;++ let mut builder = superposition_sdk::types::ContextPut::builder();++ if let serde_json::Value::Object(ctx_map) = context_json {+ for (k, v) in ctx_map {+ builder = builder.context(k, value_to_document(v));+ }+ }++ if let serde_json::Value::Object(ovr_map) = override_json {+ for (k, v) in ovr_map {+ builder = builder.r#override(k, value_to_document(v));+ }+ }++ if let Some(desc) = &body.description {+ builder = builder.description(String::from(desc));+ }++ builder = builder.change_reason(String::from(&body.change_reason));++ builder.build().map_err(|e| {+ report!(SuperpositionError::ClientError(format!(+ "Failed to build ContextPut: {e:?}"+ )))+ })+}++/// Convert a Superposition SDK `CreateContextOutput` into the shared `ContextResponse` struct.+pub fn create_context_output_to_struct(+ out: &superposition_sdk::operation::create_context::CreateContextOutput,+) -> ContextResponse {+ ContextResponse {+ id: out.id().to_owned(),+ value: doc_map_to_json(out.value()),+ r#override: doc_map_to_json(out.r#override()),+ override_id: out.override_id().to_owned(),+ weight: out.weight().to_owned(),+ description: out.description().to_owned(),+ change_reason: out.change_reason().to_owned(),+ created_at: datetime_to_string(out.created_at()),+ created_by: out.created_by().to_owned(),+ last_modified_at: datetime_to_string(out.last_modified_at()),+ last_modified_by: out.last_modified_by().to_owned(),+ }+}+/// Generate a default change reason from the config keyfn generate_change_reason(key: &str) -> String {format!("Updating {key} configuration")@@ -169,11 +491,22 @@ impl SuperpositionClient {"Configuring Superposition file fallback: path={:?}",backup_path);- Some(Box::new(- superposition_provider::data_source::file::FileDataSource::new(- backup_path.clone(),- ),- ))+ match superposition_provider::data_source::file::FileDataSource::new(+ backup_path.clone(),+ ) {+ Ok(source) => {+ let boxed: Box<+ dyn superposition_provider::data_source::SuperpositionDataSource,+ > = Box::new(source);+ Some(boxed)+ }+ Err(e) => {+ router_env::logger::warn!(+ "Failed to create Superposition file fallback source: {e}"+ );+ None+ }+ }}None => None,};@@ -328,7 +661,7 @@ impl SuperpositionClient {)))})?;match response {- superposition_provider::data_source::FetchResponse::Data(data) => Ok(data.config),+ superposition_provider::data_source::FetchResponse::Data(data) => Ok(data.data),superposition_provider::data_source::FetchResponse::NotModified => {Err(report!(SuperpositionError::ProviderError("Config not modified but no data available".to_string()@@ -396,6 +729,11 @@ impl SuperpositionClient {Ok(())}++ /// Return a reference to the underlying Superposition SDK client.+ pub fn superposition_sdk_client(&self) -> &superposition_sdk::Client {+ &self.sdk_client+ }}/// Trait for configs that can be written to Superposition.diff --git a/crates/external_services/src/superposition/types.rs b/crates/external_services/src/superposition/types.rsindex e8d5cb7e5e..5534d7c92e 100644--- a/crates/external_services/src/superposition/types.rs+++ b/crates/external_services/src/superposition/types.rs@@ -110,6 +110,12 @@ pub enum SuperpositionError {/// Error from the Superposition client#[error("Superposition client error: {0}")]ClientError(String),+ /// Bad request rejected by Superposition+ #[error("Superposition bad request: {0}")]+ BadRequest(String),+ /// Resource not found in Superposition (404)+ #[error("Superposition resource not found: {0}")]+ NotFound(String),/// Invalid configuration provided#[error("Invalid configuration: {0}")]InvalidConfiguration(String),diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.tomlindex 8acb211f89..8dbebf779f 100644--- a/crates/router/Cargo.toml+++ b/crates/router/Cargo.toml@@ -146,6 +146,7 @@ storage_impl = { version = "0.1.0", path = "../storage_impl", default-features =payment_link = { version = "0.1.0", path = "../payment_link", default-features = false }payment_methods = { version = "0.1.0", path = "../payment_methods", default-features = false }subscriptions = { version = "0.1.0", path = "../subscriptions", default-features = false }+superposition_sdk = {version = "0.114.0"}[build-dependencies]router_env = { version = "0.1.0", path = "../router_env", default-features = false }diff --git a/crates/router/src/core.rs b/crates/router/src/core.rsindex b7e8a51d7b..fdc8cce083 100644--- a/crates/router/src/core.rs+++ b/crates/router/src/core.rs@@ -63,6 +63,7 @@ pub mod revenue_recovery;#[cfg(feature = "v2")]pub mod revenue_recovery_data_backfill;pub mod routing;+pub mod superposition_proxy;#[cfg(feature = "v1")]pub mod superposition_sdk_config;pub mod surcharge_decision_config;diff --git a/crates/router/src/core/superposition_proxy.rs b/crates/router/src/core/superposition_proxy.rsnew file mode 100644index 0000000000..b5983faf74--- /dev/null+++ b/crates/router/src/core/superposition_proxy.rs@@ -0,0 +1,667 @@+use actix_web::{HttpRequest, HttpResponse};+pub use api_models::superposition_proxy::{+ AuditLogResponse, ContextResponse, DefaultConfigResponse, DimensionResponse,+ PaginatedListResponse, ResolveConfigResponse,+};+use async_trait::async_trait;+use common_utils::events::ApiEventMetric;+use external_services::superposition::{+ context_put_from_request, create_context_output_to_struct, doc_map_to_json, document_to_value,+ list_audit_logs_to_response, list_contexts_to_response, list_default_configs_to_response,+ list_dimensions_to_response, map_sdk_error, parse_datetime, value_to_document, AuditAction,+ ContextFilterSortOn, ContextPutRequest, CreateContextInputBuilder, DateTime,+ DimensionMatchStrategy, GetDetailedResolvedConfigInputBuilder, ListAuditLogsInputBuilder,+ ListContextsInputBuilder, ListDefaultConfigsInputBuilder, ListDimensionsInputBuilder, SortBy,+ SuperpositionError,+};++use crate::{+ consts::user_role::{ROLE_ID_MERCHANT_ADMIN, ROLE_ID_PROFILE_ADMIN},+ core::errors::{self, RouterResponse},+ services::{authentication::UserFromToken, ApplicationResponse},+ SessionState,+};++#[derive(Clone, Copy, Debug, PartialEq, Eq)]+#[allow(clippy::enum_variant_names)]+enum ScopingDimension {+ OrganizationId,+ MerchantId,+ ProfileId,+ ProviderMerchantId,+ ProcessorMerchantId,+}++impl ScopingDimension {+ fn from_context_key(key: &str) -> Option<Self> {+ match key {+ "organization_id" => Some(Self::OrganizationId),+ "merchant_id" => Some(Self::MerchantId),+ "profile_id" => Some(Self::ProfileId),+ "provider_merchant_id" => Some(Self::ProviderMerchantId),+ "processor_merchant_id" => Some(Self::ProcessorMerchantId),+ _ => None,+ }+ }++ fn from_dimension_param(key: &str) -> Option<Self> {+ key.strip_prefix("dimension[")+ .and_then(|s| s.strip_suffix(']'))+ .and_then(Self::from_context_key)+ }++ fn expected_value(self, auth: &UserFromToken) -> &str {+ match self {+ Self::OrganizationId => auth.org_id.get_string_repr(),+ Self::MerchantId | Self::ProviderMerchantId | Self::ProcessorMerchantId => {+ auth.merchant_id.get_string_repr()+ }+ Self::ProfileId => auth.profile_id.get_string_repr(),+ }+ }+}++fn validate_superposition_params(+ params: &[(String, String)],+ auth: &UserFromToken,+) -> Result<(), error_stack::Report<errors::ApiErrorResponse>> {+ let unauthorized = || {+ error_stack::report!(errors::ApiErrorResponse::AccessForbidden {+ resource: "superposition".to_string(),+ })+ };+ for (key, value) in params {+ if let Some(dimension) = ScopingDimension::from_dimension_param(key) {+ if value != dimension.expected_value(auth) {+ return Err(unauthorized());+ }+ }+ }+ Ok(())+}++fn require_superposition_context(+ params: &[(String, String)],+) -> Result<(), error_stack::Report<errors::ApiErrorResponse>> {+ let has_scoping_dimension = params+ .iter()+ .any(|(k, _)| ScopingDimension::from_dimension_param(k).is_some());+ if !has_scoping_dimension {+ return Err(error_stack::report!(+ errors::ApiErrorResponse::InvalidRequestData {+ message: "at least one dimension filter (organization_id, provider_merchant_id, processor_merchant_id, merchant_id, or profile_id) is required".to_string(),+ }+ ));+ }+ Ok(())+}++fn validate_superposition_context_body(+ context: &serde_json::Value,+ auth: &UserFromToken,+) -> Result<(), error_stack::Report<errors::ApiErrorResponse>> {+ let Some(context_obj) = context.as_object() else {+ return Ok(());+ };+ let has_scoping_dim = context_obj+ .keys()+ .any(|k| ScopingDimension::from_context_key(k).is_some());+ if !has_scoping_dim {+ return Err(error_stack::report!(+ errors::ApiErrorResponse::InvalidRequestData {+ message: "context must contain at least one of: organization_id, profile_id, provider_merchant_id, processor_merchant_id".to_string(),+ }+ ));+ }+ let is_merchant_admin_role = auth.role_id == ROLE_ID_MERCHANT_ADMIN;+ let is_profile_admin_role = auth.role_id == ROLE_ID_PROFILE_ADMIN;+ let has_merchant_level_dim = context_obj.contains_key("merchant_id")+ || context_obj.contains_key("profile_id")+ || context_obj.contains_key("processor_merchant_id")+ || context_obj.contains_key("provider_merchant_id");+ if is_merchant_admin_role+ && context_obj.contains_key("organization_id")+ && !has_merchant_level_dim+ {+ return Err(error_stack::report!(+ errors::ApiErrorResponse::AccessForbidden {+ resource: "superposition".to_string(),+ }+ ));+ }+ // Profile admin: body must carry profile_id (no org-only/merchant-only contexts).+ if is_profile_admin_role && !context_obj.contains_key("profile_id") {+ return Err(error_stack::report!(+ errors::ApiErrorResponse::AccessForbidden {+ resource: "superposition".to_string(),+ }+ ));+ }+ let params = context_obj+ .iter()+ .filter_map(|(k, v)| {+ v.as_str()+ .map(|s| (format!("dimension[{k}]"), s.to_owned()))+ })+ .collect::<Vec<_>>();+ validate_superposition_params(¶ms, auth)+}++fn map_superposition_err(+ superposition_error: error_stack::Report<SuperpositionError>,+ context: &'static str,+) -> error_stack::Report<errors::ApiErrorResponse> {+ match superposition_error.current_context() {+ SuperpositionError::BadRequest(error_message) => {+ error_stack::report!(errors::ApiErrorResponse::InvalidRequestData {+ message: error_message.clone(),+ })+ }+ SuperpositionError::NotFound(_) => {+ error_stack::report!(errors::ApiErrorResponse::InvalidRequestData {+ message: "The specified org_id or workspace_id was not found in Superposition"+ .to_string(),+ })+ }+ _ => superposition_error+ .change_context(errors::ApiErrorResponse::InternalServerError)+ .attach_printable(context),+ }+}++/// Extract the `x-org-id` and `x-workspace` headers required by every proxy+/// endpoint, returning a `400` response if either is missing.+pub fn extract_proxy_headers(req: &HttpRequest) -> Result<(String, String), HttpResponse> {+ let org_id = req+ .headers()+ .get("x-org-id")+ .and_then(|v| v.to_str().ok())+ .map(String::from)+ .ok_or_else(|| {+ HttpResponse::BadRequest().json(serde_json::json!({+ "error": { "message": "missing required header: x-org-id" }+ }))+ })?;++ let workspace_id = req+ .headers()+ .get("x-workspace")+ .and_then(|v| v.to_str().ok())+ .map(String::from)+ .ok_or_else(|| {+ HttpResponse::BadRequest().json(serde_json::json!({+ "error": { "message": "missing required header: x-workspace" }+ }))+ })?;++ Ok((org_id, workspace_id))+}++/// Typed `ListContexts` query params, parsed from the raw key/value pairs+#[derive(Debug, Default, Clone)]+pub struct ListContextsQuery {+ count: Option<i32>,+ page: Option<i32>,+ all: Option<bool>,+ prefix: Vec<String>,+ sort_on: Option<ContextFilterSortOn>,+ sort_by: Option<SortBy>,+ created_by: Vec<String>,+ last_modified_by: Vec<String>,+ plaintext: Option<String>,+ dimension_match_strategy: Option<DimensionMatchStrategy>,+ dimension_params: Vec<(String, String)>,+}++impl From<Vec<(String, String)>> for ListContextsQuery {+ fn from(params: Vec<(String, String)>) -> Self {+ let first_value = |name: &str| {+ params+ .iter()+ .find(|(k, _)| k == name)+ .map(|(_, v)| v.clone())+ };+ let all_values = |name: &str| {+ params+ .iter()+ .filter(|(k, _)| k == name)+ .map(|(_, v)| v.clone())+ .collect::<Vec<_>>()+ };++ Self {+ count: first_value("count").and_then(|v| v.parse().ok()),+ page: first_value("page").and_then(|v| v.parse().ok()),+ all: first_value("all").and_then(|v| v.parse().ok()),+ prefix: all_values("prefix"),+ sort_on: first_value("sort_on").map(|v| ContextFilterSortOn::from(v.as_str())),+ sort_by: first_value("sort_by").map(|v| SortBy::from(v.as_str())),+ created_by: all_values("created_by"),+ last_modified_by: all_values("last_modified_by"),+ plaintext: first_value("plaintext"),+ dimension_match_strategy: first_value("dimension_match_strategy")+ .map(|v| DimensionMatchStrategy::from(v.as_str())),+ dimension_params: params+ .iter()+ .filter(|(k, _)| k.starts_with("dimension["))+ .cloned()+ .collect(),+ }+ }+}++/// Typed `ListDimensions` query params.+#[derive(Debug, Clone, serde::Deserialize)]+pub struct ListDimensionsQuery {+ pub count: Option<i32>,+ pub page: Option<i32>,+ pub all: Option<bool>,+}++/// Typed `ListDefaultConfigs` query params.+#[derive(Debug, Clone, serde::Deserialize)]+pub struct ListDefaultConfigsQuery {+ pub count: Option<i32>,+ pub page: Option<i32>,+ pub all: Option<bool>,+ pub name: Option<String>,+}++/// Typed `ListAuditLogs` query params, parsed from the raw key/value pairs.+#[derive(Debug, Default, Clone)]+pub struct ListAuditLogsQuery {+ count: Option<i32>,+ page: Option<i32>,+ all: Option<bool>,+ from_date: Option<DateTime>,+ to_date: Option<DateTime>,+ table: Vec<String>,+ action: Vec<String>,+ username: Option<String>,+ sort_by: Option<SortBy>,+ dimension_params: Vec<(String, String)>,+}++impl From<Vec<(String, String)>> for ListAuditLogsQuery {+ fn from(params: Vec<(String, String)>) -> Self {+ let first_value = |name: &str| {+ params+ .iter()+ .find(|(k, _)| k == name)+ .map(|(_, v)| v.clone())+ };+ // `table`/`action` accept comma-separated values across one or more keys.+ let csv_values = |name: &str| {+ params+ .iter()+ .filter(|(k, _)| k == name)+ .flat_map(|(_, v)| v.split(',').map(|s| s.trim().to_owned()))+ .collect::<Vec<_>>()+ };+ // Dates are parsed leniently: malformed values are ignored rather than rejected.+ let parse_date = |name: &str| first_value(name).and_then(|v| parse_datetime(&v).ok());++ Self {+ count: first_value("count").and_then(|v| v.parse().ok()),+ page: first_value("page").and_then(|v| v.parse().ok()),+ all: first_value("all").and_then(|v| v.parse().ok()),+ from_date: parse_date("from_date"),+ to_date: parse_date("to_date"),+ table: csv_values("table"),+ action: csv_values("action"),+ username: first_value("username"),+ sort_by: first_value("sort_by").map(|v| SortBy::from(v.as_str())),+ dimension_params: params+ .iter()+ .filter(|(k, _)| k.starts_with("dimension["))+ .cloned()+ .collect(),+ }+ }+}++/// A Superposition proxy flow: a request type that knows how to validate the caller's+/// scope, build its SDK input, dispatch the upstream call, and convert the SDK output+/// into the client-facing response.+#[async_trait(?Send)]+pub trait SuperpositionProxyFlow: Sized {+ /// The Superposition SDK input builder this request maps to.+ type InputBuilder;+ /// The response payload returned to the client.+ type Response: serde::Serialize + std::fmt::Debug + ApiEventMetric;++ /// Build the Superposition SDK input builder from this request.+ fn into_input(+ self,+ org_id: String,+ workspace_id: String,+ ) -> Result<Self::InputBuilder, error_stack::Report<errors::ApiErrorResponse>>;++ /// Validate the request, send the built input upstream, and convert the response.+ async fn execute(+ self,+ state: &SessionState,+ auth: &UserFromToken,+ org_id: String,+ workspace_id: String,+ ) -> Result<Self::Response, error_stack::Report<errors::ApiErrorResponse>>;+}++/// Generic entry point shared by every Superposition proxy handler: runs the flow and+/// wraps the result in a JSON `ApplicationResponse`.+pub async fn handle_proxy_flow<R: SuperpositionProxyFlow>(+ state: SessionState,+ auth: UserFromToken,+ request: R,+ org_id: String,+ workspace_id: String,+) -> RouterResponse<R::Response> {+ let response = request.execute(&state, &auth, org_id, workspace_id).await?;+ Ok(ApplicationResponse::Json(response))+}++#[async_trait(?Send)]+impl SuperpositionProxyFlow for ListContextsQuery {+ type InputBuilder = ListContextsInputBuilder;+ type Response = PaginatedListResponse<ContextResponse>;++ fn into_input(+ self,+ org_id: String,+ workspace_id: String,+ ) -> Result<Self::InputBuilder, error_stack::Report<errors::ApiErrorResponse>> {+ let mut builder = ListContextsInputBuilder::default()+ .org_id(org_id)+ .workspace_id(workspace_id)+ .set_count(self.count)+ .set_page(self.page)+ .set_all(self.all)+ .set_sort_on(self.sort_on)+ .set_sort_by(self.sort_by)+ .set_plaintext(self.plaintext)+ .set_dimension_match_strategy(self.dimension_match_strategy)+ .set_prefix((!self.prefix.is_empty()).then_some(self.prefix))+ .set_created_by((!self.created_by.is_empty()).then_some(self.created_by))+ .set_last_modified_by(+ (!self.last_modified_by.is_empty()).then_some(self.last_modified_by),+ );++ for (key, value) in self.dimension_params {+ builder = builder.dimension_params(key, value);+ }++ Ok(builder)+ }++ async fn execute(+ self,+ state: &SessionState,+ auth: &UserFromToken,+ org_id: String,+ workspace_id: String,+ ) -> Result<Self::Response, error_stack::Report<errors::ApiErrorResponse>> {+ require_superposition_context(&self.dimension_params)?;+ validate_superposition_params(&self.dimension_params, auth)?;++ let output = self+ .into_input(org_id, workspace_id)?+ .send_with(state.superposition_service.superposition_sdk_client())+ .await+ .map_err(|sdk_error| {+ map_superposition_err(+ error_stack::report!(map_sdk_error(sdk_error)),+ "Failed to list contexts from Superposition",+ )+ })?;++ Ok(list_contexts_to_response(&output))+ }+}++#[async_trait(?Send)]+impl SuperpositionProxyFlow for ListDefaultConfigsQuery {+ type InputBuilder = ListDefaultConfigsInputBuilder;+ type Response = PaginatedListResponse<DefaultConfigResponse>;++ fn into_input(+ self,+ org_id: String,+ workspace_id: String,+ ) -> Result<Self::InputBuilder, error_stack::Report<errors::ApiErrorResponse>> {+ Ok(ListDefaultConfigsInputBuilder::default()+ .org_id(org_id)+ .workspace_id(workspace_id)+ .set_count(self.count)+ .set_page(self.page)+ .set_all(self.all)+ .set_name(self.name))+ }++ async fn execute(+ self,+ state: &SessionState,+ _auth: &UserFromToken,+ org_id: String,+ workspace_id: String,+ ) -> Result<Self::Response, error_stack::Report<errors::ApiErrorResponse>> {+ let output = self+ .into_input(org_id, workspace_id)?+ .send_with(state.superposition_service.superposition_sdk_client())+ .await+ .map_err(|sdk_error| {+ map_superposition_err(+ error_stack::report!(map_sdk_error(sdk_error)),+ "Failed to list default configs from Superposition",+ )+ })?;++ Ok(list_default_configs_to_response(&output))+ }+}++#[async_trait(?Send)]+impl SuperpositionProxyFlow for ListDimensionsQuery {+ type InputBuilder = ListDimensionsInputBuilder;+ type Response = PaginatedListResponse<DimensionResponse>;++ fn into_input(+ self,+ org_id: String,+ workspace_id: String,+ ) -> Result<Self::InputBuilder, error_stack::Report<errors::ApiErrorResponse>> {+ Ok(ListDimensionsInputBuilder::default()+ .org_id(org_id)+ .workspace_id(workspace_id)+ .set_count(self.count)+ .set_page(self.page)+ .set_all(self.all))+ }++ async fn execute(+ self,+ state: &SessionState,+ _auth: &UserFromToken,+ org_id: String,+ workspace_id: String,+ ) -> Result<Self::Response, error_stack::Report<errors::ApiErrorResponse>> {+ let output = self+ .into_input(org_id, workspace_id)?+ .send_with(state.superposition_service.superposition_sdk_client())+ .await+ .map_err(|sdk_error| {+ map_superposition_err(+ error_stack::report!(map_sdk_error(sdk_error)),+ "Failed to list dimensions from Superposition",+ )+ })?;++ Ok(list_dimensions_to_response(&output))+ }+}++#[async_trait(?Send)]+impl SuperpositionProxyFlow for ContextPutRequest {+ type InputBuilder = CreateContextInputBuilder;+ type Response = ContextResponse;++ fn into_input(+ self,+ org_id: String,+ workspace_id: String,+ ) -> Result<Self::InputBuilder, error_stack::Report<errors::ApiErrorResponse>> {+ let context_put = context_put_from_request(&self)+ .map_err(|error| map_superposition_err(error, "Invalid context request body"))?;++ Ok(CreateContextInputBuilder::default()+ .org_id(org_id)+ .workspace_id(workspace_id)+ .request(context_put))+ }++ async fn execute(+ self,+ state: &SessionState,+ auth: &UserFromToken,+ org_id: String,+ workspace_id: String,+ ) -> Result<Self::Response, error_stack::Report<errors::ApiErrorResponse>> {+ let input = self.into_input(org_id, workspace_id)?;++ // Read context dims off the built request for auth-scoped validation.+ let context_json = input+ .get_request()+ .as_ref()+ .map(|context_put| doc_map_to_json(context_put.context()))+ .unwrap_or_else(|| serde_json::Value::Object(serde_json::Map::new()));+ validate_superposition_context_body(&context_json, auth)?;++ let output = input+ .send_with(state.superposition_service.superposition_sdk_client())+ .await+ .map_err(|sdk_error| {+ map_superposition_err(+ error_stack::report!(map_sdk_error(sdk_error)),+ "Failed to create context in Superposition",+ )+ })?;++ Ok(create_context_output_to_struct(&output))+ }+}++/// `GetDetailedResolvedConfig` request: the context dimensions to resolve against.+#[derive(Debug, Clone)]+pub struct ResolveDetailedConfigRequest(pub serde_json::Map<String, serde_json::Value>);++#[async_trait(?Send)]+impl SuperpositionProxyFlow for ResolveDetailedConfigRequest {+ type InputBuilder = GetDetailedResolvedConfigInputBuilder;+ type Response = ResolveConfigResponse;++ fn into_input(+ self,+ org_id: String,+ workspace_id: String,+ ) -> Result<Self::InputBuilder, error_stack::Report<errors::ApiErrorResponse>> {+ let mut builder = GetDetailedResolvedConfigInputBuilder::default()+ .org_id(org_id)+ .workspace_id(workspace_id);++ for (dimension_key, dimension_value) in self.0 {+ builder = builder.context(dimension_key, value_to_document(dimension_value));+ }++ Ok(builder)+ }++ async fn execute(+ self,+ state: &SessionState,+ auth: &UserFromToken,+ org_id: String,+ workspace_id: String,+ ) -> Result<Self::Response, error_stack::Report<errors::ApiErrorResponse>> {+ let context_json = serde_json::Value::Object(self.0.clone());+ validate_superposition_context_body(&context_json, auth)?;++ let output = self+ .into_input(org_id, workspace_id)?+ .send_with(state.superposition_service.superposition_sdk_client())+ .await+ .map_err(|sdk_error| {+ map_superposition_err(+ error_stack::report!(map_sdk_error(sdk_error)),+ "Failed to resolve config from Superposition",+ )+ })?;++ let resolved_entries = serde_json::from_value(document_to_value(output.config().clone()))+ .map_err(|err| {+ map_superposition_err(+ error_stack::report!(SuperpositionError::ClientError(err.to_string())),+ "Failed to parse resolved config from Superposition",+ )+ })?;++ Ok(ResolveConfigResponse(resolved_entries))+ }+}++#[async_trait(?Send)]+impl SuperpositionProxyFlow for ListAuditLogsQuery {+ type InputBuilder = ListAuditLogsInputBuilder;+ type Response = PaginatedListResponse<AuditLogResponse>;++ fn into_input(+ self,+ org_id: String,+ workspace_id: String,+ ) -> Result<Self::InputBuilder, error_stack::Report<errors::ApiErrorResponse>> {+ let action = (!self.action.is_empty()).then(|| {+ self.action+ .iter()+ .map(|a| AuditAction::from(a.as_str()))+ .collect()+ });++ let mut builder = ListAuditLogsInputBuilder::default()+ .org_id(org_id)+ .workspace_id(workspace_id)+ .set_count(self.count)+ .set_page(self.page)+ .set_all(self.all)+ .set_from_date(self.from_date)+ .set_to_date(self.to_date)+ .set_username(self.username)+ .set_sort_by(self.sort_by)+ .set_tables((!self.table.is_empty()).then_some(self.table))+ .set_action(action);++ for (key, value) in self.dimension_params {+ builder = builder.dimension_params(key, value);+ }++ Ok(builder)+ }++ async fn execute(+ self,+ state: &SessionState,+ _auth: &UserFromToken,+ org_id: String,+ workspace_id: String,+ ) -> Result<Self::Response, error_stack::Report<errors::ApiErrorResponse>> {+ let output = self+ .into_input(org_id, workspace_id)?+ .send_with(state.superposition_service.superposition_sdk_client())+ .await+ .map_err(|sdk_error| {+ map_superposition_err(+ error_stack::report!(map_sdk_error(sdk_error)),+ "Failed to list audit logs from Superposition",+ )+ })?;++ Ok(list_audit_logs_to_response(&output))+ }+}diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rsindex 7beab05ffb..7a1293bf8e 100644--- a/crates/router/src/lib.rs+++ b/crates/router/src/lib.rs@@ -184,7 +184,8 @@ pub fn mk_app(.service(routes::Refunds::server(state.clone())).service(routes::Mandates::server(state.clone())).service(routes::Authentication::server(state.clone()))- .service(routes::SdkConfig::server(state.clone()));+ .service(routes::SdkConfig::server(state.clone()))+ .service(routes::SuperpositionProxy::server(state.clone()));}}diff --git a/crates/router/src/routes.rs b/crates/router/src/routes.rsindex 5229055977..ded3707dc0 100644--- a/crates/router/src/routes.rs+++ b/crates/router/src/routes.rs@@ -54,6 +54,7 @@ pub mod revenue_recovery_redis;pub mod routing;#[cfg(feature = "v1")]pub mod subscription;+pub mod superposition_proxy;pub mod superposition_sdk_config;pub mod three_ds_decision_rule;pub mod tokenization;@@ -94,7 +95,7 @@ pub use self::app::{Files, Forex, Gsm, Health, Hypersense, Mandates, MerchantAccount, MerchantConnectorAccount,Oidc, PaymentLink, PaymentMethods, Payments, Poll, ProcessTracker, ProcessTrackerDeprecated,Profile, ProfileAcquirer, ProfileNew, Refunds, Relay, RelayWebhooks, SdkConfig, SessionState,- ThreeDsDecisionRule, User, UserDeprecated, Webhooks,+ SuperpositionProxy, ThreeDsDecisionRule, User, UserDeprecated, Webhooks,};#[cfg(feature = "olap")]pub use self::app::{Blocklist, Organization, Routing, Subscription, Verify, WebhookEvents};diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rsindex b810ff890a..606d41c931 100644--- a/crates/router/src/routes/app.rs+++ b/crates/router/src/routes/app.rs@@ -3420,3 +3420,33 @@ impl SdkConfig {)}}++pub struct SuperpositionProxy;+#[cfg(feature = "v1")]+impl SuperpositionProxy {+ pub fn server(state: AppState) -> Scope {+ web::scope("/v1/superposition")+ .app_data(web::Data::new(state))+ .service(+ web::resource("/context")+ .route(web::get().to(super::superposition_proxy::list_contexts))+ .route(web::put().to(super::superposition_proxy::create_context)),+ )+ .service(+ web::resource("/default-config")+ .route(web::get().to(super::superposition_proxy::list_default_configs)),+ )+ .service(+ web::resource("/dimension")+ .route(web::get().to(super::superposition_proxy::list_dimensions)),+ )+ .service(+ web::resource("/config/resolve/detailed")+ .route(web::post().to(super::superposition_proxy::resolve_detailed_config)),+ )+ .service(+ web::resource("/audit")+ .route(web::get().to(super::superposition_proxy::list_audit_logs)),+ )+ }+}diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rsindex 7ed80ca2c8..660b7e0967 100644--- a/crates/router/src/routes/lock_utils.rs+++ b/crates/router/src/routes/lock_utils.rs@@ -394,7 +394,13 @@ impl From<Flow> for ApiIdentifier {| Flow::NetworkTokenEligibilityCheck => Self::GenericTokenization,Flow::RecoveryDataBackfill | Flow::RevenueRecoveryRedis => Self::RecoveryRecovery,- Flow::GetSuperpositionSdkConfig => Self::Superposition,+ Flow::GetSuperpositionSdkConfig+ | Flow::SuperpositionListContexts+ | Flow::SuperpositionListDefaultConfigs+ | Flow::SuperpositionListDimensions+ | Flow::SuperpositionCreateContext+ | Flow::SuperpositionResolveDetailedConfig+ | Flow::SuperpositionListAuditLogs => Self::Superposition,Flow::MerchantConnectorWebhookRegister| Flow::MerchantConnectorWebhookList| Flow::MerchantConnectorWebhookGenerateSecret => {diff --git a/crates/router/src/routes/superposition_proxy.rs b/crates/router/src/routes/superposition_proxy.rsnew file mode 100644index 0000000000..1cf55cca68--- /dev/null+++ b/crates/router/src/routes/superposition_proxy.rs@@ -0,0 +1,237 @@+use actix_web::{web, HttpRequest, HttpResponse};+use external_services::superposition::{ContextPutRequest, ResolveConfigBody};+use router_env::{instrument, tracing, Flow};++use super::app::AppState;+use crate::{+ core::{+ api_locking,+ superposition_proxy::{+ self, ListAuditLogsQuery, ListContextsQuery, ListDefaultConfigsQuery,+ ListDimensionsQuery, ResolveDetailedConfigRequest,+ },+ },+ services::{api, authentication as auth, authorization::permissions::Permission},+};++#[instrument(skip_all, fields(flow = ?Flow::SuperpositionListContexts))]+pub async fn list_contexts(+ state: web::Data<AppState>,+ req: HttpRequest,+ query: web::Query<Vec<(String, String)>>,+) -> HttpResponse {+ let flow = Flow::SuperpositionListContexts;+ let (org_id, workspace_id) = match superposition_proxy::extract_proxy_headers(&req) {+ Ok(headers) => headers,+ Err(response) => return response,+ };+ let request = ListContextsQuery::from(query.into_inner());++ Box::pin(api::server_wrap(+ flow,+ state,+ &req,+ (),+ move |state, user, _, _| {+ let request = request.clone();+ let org_id = org_id.clone();+ let workspace_id = workspace_id.clone();+ async move {+ superposition_proxy::handle_proxy_flow(state, user, request, org_id, workspace_id)+ .await+ }+ },+ &auth::JWTAuth {+ permission: Permission::ProfileSuperpositionConfigRead,+ allow_connected: true,+ allow_platform: true,+ },+ api_locking::LockAction::NotApplicable,+ ))+ .await+}++#[instrument(skip_all, fields(flow = ?Flow::SuperpositionListDefaultConfigs))]+pub async fn list_default_configs(+ state: web::Data<AppState>,+ req: HttpRequest,+ query: web::Query<ListDefaultConfigsQuery>,+) -> HttpResponse {+ let flow = Flow::SuperpositionListDefaultConfigs;+ let (org_id, workspace_id) = match superposition_proxy::extract_proxy_headers(&req) {+ Ok(headers) => headers,+ Err(response) => return response,+ };+ let request = query.into_inner();++ Box::pin(api::server_wrap(+ flow,+ state,+ &req,+ (),+ move |state, user, _, _| {+ let request = request.clone();+ let org_id = org_id.clone();+ let workspace_id = workspace_id.clone();+ async move {+ superposition_proxy::handle_proxy_flow(state, user, request, org_id, workspace_id)+ .await+ }+ },+ &auth::JWTAuth {+ permission: Permission::ProfileSuperpositionConfigRead,+ allow_connected: true,+ allow_platform: true,+ },+ api_locking::LockAction::NotApplicable,+ ))+ .await+}++#[instrument(skip_all, fields(flow = ?Flow::SuperpositionListDimensions))]+pub async fn list_dimensions(+ state: web::Data<AppState>,+ req: HttpRequest,+ query: web::Query<ListDimensionsQuery>,+) -> HttpResponse {+ let flow = Flow::SuperpositionListDimensions;+ let (org_id, workspace_id) = match superposition_proxy::extract_proxy_headers(&req) {+ Ok(headers) => headers,+ Err(response) => return response,+ };+ let request = query.into_inner();++ Box::pin(api::server_wrap(+ flow,+ state,+ &req,+ (),+ move |state, user, _, _| {+ let request = request.clone();+ let org_id = org_id.clone();+ let workspace_id = workspace_id.clone();+ async move {+ superposition_proxy::handle_proxy_flow(state, user, request, org_id, workspace_id)+ .await+ }+ },+ &auth::JWTAuth {+ permission: Permission::ProfileSuperpositionConfigRead,+ allow_connected: true,+ allow_platform: true,+ },+ api_locking::LockAction::NotApplicable,+ ))+ .await+}++#[instrument(skip_all, fields(flow = ?Flow::SuperpositionCreateContext))]+pub async fn create_context(+ state: web::Data<AppState>,+ req: HttpRequest,+ body: web::Json<ContextPutRequest>,+) -> HttpResponse {+ let flow = Flow::SuperpositionCreateContext;+ let (org_id, workspace_id) = match superposition_proxy::extract_proxy_headers(&req) {+ Ok((org_id, workspace_id)) => (org_id, workspace_id),+ Err(response) => return response,+ };+ let request = body.into_inner();++ Box::pin(api::server_wrap(+ flow,+ state,+ &req,+ (),+ move |state, user, _, _| {+ let request = request.clone();+ let org_id = org_id.clone();+ let workspace_id = workspace_id.clone();+ async move {+ superposition_proxy::handle_proxy_flow(state, user, request, org_id, workspace_id)+ .await+ }+ },+ &auth::JWTAuth {+ permission: Permission::ProfileSuperpositionConfigWrite,+ allow_connected: true,+ allow_platform: true,+ },+ api_locking::LockAction::NotApplicable,+ ))+ .await+}++#[instrument(skip_all, fields(flow = ?Flow::SuperpositionResolveDetailedConfig))]+pub async fn resolve_detailed_config(+ state: web::Data<AppState>,+ req: HttpRequest,+ body: web::Json<ResolveConfigBody>,+) -> HttpResponse {+ let flow = Flow::SuperpositionResolveDetailedConfig;+ let (org_id, workspace_id) = match superposition_proxy::extract_proxy_headers(&req) {+ Ok((org_id, workspace_id)) => (org_id, workspace_id),+ Err(response) => return response,+ };+ let request = ResolveDetailedConfigRequest(body.into_inner().context);++ Box::pin(api::server_wrap(+ flow,+ state,+ &req,+ (),+ move |state, user, _, _| {+ let request = request.clone();+ let org_id = org_id.clone();+ let workspace_id = workspace_id.clone();+ async move {+ superposition_proxy::handle_proxy_flow(state, user, request, org_id, workspace_id)+ .await+ }+ },+ &auth::JWTAuth {+ permission: Permission::ProfileSuperpositionConfigRead,+ allow_connected: true,+ allow_platform: true,+ },+ api_locking::LockAction::NotApplicable,+ ))+ .await+}++#[instrument(skip_all, fields(flow = ?Flow::SuperpositionListAuditLogs))]+pub async fn list_audit_logs(+ state: web::Data<AppState>,+ req: HttpRequest,+ query: web::Query<Vec<(String, String)>>,+) -> HttpResponse {+ let flow = Flow::SuperpositionListAuditLogs;+ let (org_id, workspace_id) = match superposition_proxy::extract_proxy_headers(&req) {+ Ok(headers) => headers,+ Err(response) => return response,+ };+ let request = ListAuditLogsQuery::from(query.into_inner());++ Box::pin(api::server_wrap(+ flow,+ state,+ &req,+ (),+ move |state, user, _, _| {+ let request = request.clone();+ let org_id = org_id.clone();+ let workspace_id = workspace_id.clone();+ async move {+ superposition_proxy::handle_proxy_flow(state, user, request, org_id, workspace_id)+ .await+ }+ },+ &auth::JWTAuth {+ permission: Permission::ProfileSuperpositionConfigRead,+ allow_connected: true,+ allow_platform: true,+ },+ api_locking::LockAction::NotApplicable,+ ))+ .await+}diff --git a/crates/router/src/services/authorization/info.rs b/crates/router/src/services/authorization/info.rsindex 27abbd9b6e..8838b08f5c 100644--- a/crates/router/src/services/authorization/info.rs+++ b/crates/router/src/services/authorization/info.rs@@ -50,6 +50,8 @@ fn get_group_description(group: PermissionGroup) -> Option<&'static str> {PermissionGroup::ApiKeysManage => None,PermissionGroup::ThemeView => Some("View Themes"),PermissionGroup::ThemeManage => Some("Manage Themes"),+ PermissionGroup::ConfigurationsView => Some("View Configurations"),+ PermissionGroup::ConfigurationsManage => Some("Create, modify and delete Configurations"),PermissionGroup::CloneConnectorManage => None, // Admin-only, no user-facing descriptionPermissionGroup::ReconSourcesView => Some("View recon ingestion and transformation configs and files"),PermissionGroup::ReconSourcesManage => Some("Create and edit recon ingestion and transformation configs and download files"),@@ -74,6 +76,7 @@ pub fn get_parent_group_description(group: ParentGroup) -> Option<&'static str>ParentGroup::Webhook => None,ParentGroup::ApiKeys => None,ParentGroup::Theme => Some("Manage and view themes for the organization"),+ ParentGroup::Configurations => Some("Manage and view configurations"),ParentGroup::CloneConnector => None, // Admin-only, no user-facing descriptionParentGroup::ReconSources => Some("Recon ingestion and transformation pipelines"),ParentGroup::ReconExceptions => Some("Recon exception investigation and resolution"),diff --git a/crates/router/src/services/authorization/permission_groups.rs b/crates/router/src/services/authorization/permission_groups.rsindex 98fbd621bf..7756adb35e 100644--- a/crates/router/src/services/authorization/permission_groups.rs+++ b/crates/router/src/services/authorization/permission_groups.rs@@ -26,6 +26,7 @@ impl PermissionGroupExt for PermissionGroup {| Self::WebhooksView| Self::ApiKeysView| Self::ThemeView+ | Self::ConfigurationsView| Self::ReconSourcesView| Self::ReconTransactionsView| Self::ReconExceptionsView@@ -40,6 +41,7 @@ impl PermissionGroupExt for PermissionGroup {| Self::ApiKeysManage| Self::CloneConnectorManage| Self::ThemeManage+ | Self::ConfigurationsManage| Self::ReconSourcesManage| Self::ReconExceptionsManage| Self::ReconTransactionsManage@@ -59,6 +61,7 @@ impl PermissionGroupExt for PermissionGroup {Self::ApiKeysView | Self::ApiKeysManage => ParentGroup::ApiKeys,Self::ThemeView | Self::ThemeManage => ParentGroup::Theme,+ Self::ConfigurationsView | Self::ConfigurationsManage => ParentGroup::Configurations,Self::CloneConnectorManage => ParentGroup::CloneConnector,Self::ReconSourcesView | Self::ReconSourcesManage => ParentGroup::ReconSources,Self::ReconExceptionsView | Self::ReconExceptionsManage => ParentGroup::ReconExceptions,@@ -114,6 +117,11 @@ impl PermissionGroupExt for PermissionGroup {Self::ThemeView => vec![Self::ThemeView, Self::AccountView],Self::ThemeManage => vec![Self::ThemeManage, Self::AccountView],+ Self::ConfigurationsView => vec![Self::ConfigurationsView],+ Self::ConfigurationsManage => {+ vec![Self::ConfigurationsView, Self::ConfigurationsManage]+ }+Self::ReconSourcesView => vec![Self::ReconSourcesView,Self::ReconTransactionsView,@@ -173,7 +181,9 @@ impl PermissionGroupExt for PermissionGroup {| Self::ApiKeysManage| Self::CloneConnectorManage| Self::ThemeView- | Self::ThemeManage => RoleProductCategory::Orchestration,+ | Self::ThemeManage+ | Self::ConfigurationsView+ | Self::ConfigurationsManage => RoleProductCategory::Orchestration,// Recon-only groups.Self::ReconSourcesView@@ -210,6 +220,7 @@ impl ParentGroupExt for ParentGroup {Self::ApiKeys => API_KEYS.to_vec(),Self::CloneConnector => CLONE_CONNECTOR.to_vec(),Self::Theme => THEME.to_vec(),+ Self::Configurations => CONFIGURATIONS.to_vec(),Self::ReconSources => RECON_SOURCES.to_vec(),Self::ReconExceptions => RECON_EXCEPTIONS.to_vec(),Self::ReconTransactions => RECON_TRANSACTIONS.to_vec(),@@ -288,6 +299,8 @@ pub static CLONE_CONNECTOR: [Resource; 1] = [Resource::CloneConnector];pub static THEME: [Resource; 1] = [Resource::Theme];+pub static CONFIGURATIONS: [Resource; 1] = [Resource::SuperpositionConfig];+pub static RECON_SOURCES: [Resource; 3] = [Resource::ReconIngestion,Resource::ReconTransformation,diff --git a/crates/router/src/services/authorization/permissions.rs b/crates/router/src/services/authorization/permissions.rsindex 73eb93e6fa..3738ce87d2 100644--- a/crates/router/src/services/authorization/permissions.rs+++ b/crates/router/src/services/authorization/permissions.rs@@ -107,6 +107,10 @@ generate_permissions! {scopes: [Read, Write],entities: [Profile]},+ SuperpositionConfig: {+ scopes: [Read, Write],+ entities: [Profile]+ },]}@@ -143,6 +147,7 @@ pub fn get_resource_name(resource: Resource, entity_type: EntityType) -> Option<(Resource::ReconStagingEntry, _) => Some("Recon Staging Entries"),(Resource::ReconTransaction, _) => Some("Recon Transactions"),(Resource::ReconRule, _) => Some("Recon Rules"),+ (Resource::SuperpositionConfig, _) => Some("Superposition Configs"),}}diff --git a/crates/router/src/services/authorization/roles/predefined_roles.rs b/crates/router/src/services/authorization/roles/predefined_roles.rsindex 2407cb5fa0..878e431e19 100644--- a/crates/router/src/services/authorization/roles/predefined_roles.rs+++ b/crates/router/src/services/authorization/roles/predefined_roles.rs@@ -126,6 +126,8 @@ pub static PREDEFINED_ROLES: LazyLock<HashMap<&'static str, RoleInfo>> = LazyLocPermissionGroup::CloneConnectorManage,PermissionGroup::ThemeView,PermissionGroup::ThemeManage,+ PermissionGroup::ConfigurationsView,+ PermissionGroup::ConfigurationsManage,PermissionGroup::ReconSourcesView,PermissionGroup::ReconSourcesManage,PermissionGroup::ReconExceptionsView,@@ -164,6 +166,8 @@ pub static PREDEFINED_ROLES: LazyLock<HashMap<&'static str, RoleInfo>> = LazyLocPermissionGroup::UsersManage,PermissionGroup::AccountView,PermissionGroup::AccountManage,+ PermissionGroup::ConfigurationsView,+ PermissionGroup::ConfigurationsManage,PermissionGroup::CloneConnectorManage,],role_id: consts::user_role::ROLE_ID_MERCHANT_ADMIN.to_string(),@@ -302,6 +306,8 @@ pub static PREDEFINED_ROLES: LazyLock<HashMap<&'static str, RoleInfo>> = LazyLocPermissionGroup::UsersManage,PermissionGroup::AccountView,PermissionGroup::AccountManage,+ PermissionGroup::ConfigurationsView,+ PermissionGroup::ConfigurationsManage,],role_id: consts::user_role::ROLE_ID_PROFILE_ADMIN.to_string(),role_name: "profile_admin".to_string(),diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rsindex 8a813d51ab..50502966c7 100644--- a/crates/router_env/src/logger/types.rs+++ b/crates/router_env/src/logger/types.rs@@ -759,6 +759,18 @@ pub enum Flow {EmbeddedTokenInfo,/// Superposition SDK Config Get flowGetSuperpositionSdkConfig,+ /// Superposition Proxy Get Context List flow+ SuperpositionListContexts,+ /// Superposition Proxy Get Default Configs List flow+ SuperpositionListDefaultConfigs,+ /// Superposition Proxy Get Dimensions List flow+ SuperpositionListDimensions,+ /// Superposition Proxy Create Context flow+ SuperpositionCreateContext,+ /// Superposition Proxy Resolve Detailed Config flow+ SuperpositionResolveDetailedConfig,+ /// Superposition Proxy List Audit Logs flow+ SuperpositionListAuditLogs,// Get user details internalGetUserDetailsInternal,// List users internaldiff --git a/docker-compose-development.yml b/docker-compose-development.ymlindex 676d5489f3..35a68d9f56 100644--- a/docker-compose-development.yml+++ b/docker-compose-development.yml@@ -65,7 +65,7 @@ services:- DATABASE_URL=postgresql://db_user:db_pass@pg:5432/hyperswitch_dbsuperposition:- image: ghcr.io/juspay/superposition-demo:0.102.0+ image: ghcr.io/juspay/superposition-demo:0.113.0ports:- "8081:8080"networks:diff --git a/docker-compose.yml b/docker-compose.ymlindex cd13aa4a70..5ce17716e6 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -78,7 +78,7 @@ services:- DATABASE_URL=postgresql://db_user:db_pass@pg:5432/hyperswitch_dbsuperposition:- image: ghcr.io/juspay/superposition-demo:0.102.0+ image: ghcr.io/juspay/superposition-demo:0.113.0ports:- "8081:8080"networks: