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(connector_cloning): clone a connector across profiles within a merchant (#12660)
Kanika Bansal33f483b606c2
diff --git a/config/config.example.toml b/config/config.example.tomlindex b8a6d84661..8796a09c16 100644--- a/config/config.example.toml+++ b/config/config.example.toml@@ -1379,8 +1379,10 @@ max_random_schedule_delay_in_seconds = 300 # max random delay in seconds to schredis_ttl_buffer_in_seconds= 300 # buffer time in seconds to be added to redis ttl for Revenue Recovery[clone_connector_allowlist]-merchant_ids = "merchant_ids" # Comma-separated list of allowed merchant IDs-connector_names = "connector_names" # Comma-separated list of allowed connector names+connector_names = "connector_names" # Comma-separated list of cloneable connector names++[clone_connector_allowlist.payment_method_types]+payment_method = "payment_method_types" # <payment_method> = comma-separated cloneable payment_method_types[infra_values]cluster = "CLUSTER" # value of CLUSTER from deploymentdiff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.tomlindex a65c10ab46..d0a33a3fa7 100644--- a/config/deployments/env_specific.toml+++ b/config/deployments/env_specific.toml@@ -403,8 +403,10 @@ base_url = "http://localhost:8000" #base url to call unified authentication servbase_url = "http://localhost:8080" # base url to call hyperswitch vault service[clone_connector_allowlist]-merchant_ids = "merchant_ids" # Comma-separated list of allowed merchant IDs-connector_names = "connector_names" # Comma-separated list of allowed connector names+connector_names = "connector_names" # Comma-separated list of cloneable connector names++[clone_connector_allowlist.payment_method_types]+payment_method = "payment_method_types" # <payment_method> = comma-separated cloneable payment_method_types[grpc_client.unified_connector_service]base_url = "http://localhost:8000" # Unified Connector Service Base URLdiff --git a/config/development.toml b/config/development.tomlindex 7f57d9a67b..8188a9befb 100644--- a/config/development.toml+++ b/config/development.toml@@ -1518,8 +1518,11 @@ max_retries_per_day = 20max_retry_count_for_thirty_day = 20[clone_connector_allowlist]-merchant_ids = "merchant_123, merchant_234" # Comma-separated list of allowed merchant IDs-connector_names = "stripe, adyen" # Comma-separated list of allowed connector names+connector_names = "stripe, adyen, peachpayments" # Comma-separated list of cloneable connector names++[clone_connector_allowlist.payment_method_types]+card = "credit, debit" # <payment_method> = comma-separated cloneable payment_method_types+network_token = "network_token"[infra_values]cluster = "CLUSTER"diff --git a/config/docker_compose.toml b/config/docker_compose.tomlindex ed1fd4afe6..62ed4d2278 100644--- a/config/docker_compose.toml+++ b/config/docker_compose.toml@@ -1389,8 +1389,11 @@ job_schedule_buffer_time_in_seconds = 3600 # time in seconds to be added in schreopen_workflow_buffer_time_in_seconds = 60 # time in seconds to be added in scheduling for calculate workflow[clone_connector_allowlist]-merchant_ids = "merchant_123, merchant_234" # Comma-separated list of allowed merchant IDs-connector_names = "stripe, adyen" # Comma-separated list of allowed connector names+connector_names = "stripe, adyen, peachpayments" # Comma-separated list of cloneable connector names++[clone_connector_allowlist.payment_method_types]+card = "credit, debit" # <payment_method> = comma-separated cloneable payment_method_types+network_token = "network_token"[infra_values]cluster = "CLUSTER" # value of CLUSTER from deploymentdiff --git a/crates/api_models/src/user.rs b/crates/api_models/src/user.rsindex 2766b03e4a..9966331893 100644--- a/crates/api_models/src/user.rs+++ b/crates/api_models/src/user.rs@@ -128,23 +128,11 @@ pub struct SwitchProfileRequest {pub profile_id: id_type::ProfileId,}-#[derive(Debug, serde::Deserialize, serde::Serialize)]-pub struct CloneConnectorSource {- pub mca_id: id_type::MerchantConnectorAccountId,- pub merchant_id: id_type::MerchantId,-}--#[derive(Debug, serde::Deserialize, serde::Serialize)]-pub struct CloneConnectorDestination {- pub connector_label: Option<String>,- pub profile_id: id_type::ProfileId,- pub merchant_id: id_type::MerchantId,-}-#[derive(Debug, serde::Deserialize, serde::Serialize)]pub struct CloneConnectorRequest {- pub source: CloneConnectorSource,- pub destination: CloneConnectorDestination,+ pub source_mca_id: id_type::MerchantConnectorAccountId,+ pub destination_profile_id: id_type::ProfileId,+ pub connector_label: Option<String>,}#[derive(serde::Deserialize, Debug, serde::Serialize)]diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rsindex 026ca6fc29..ca8ead4aa7 100644--- a/crates/common_enums/src/enums.rs+++ b/crates/common_enums/src/enums.rs@@ -9661,7 +9661,7 @@ pub enum PermissionGroup {WebhooksManage,ApiKeysView,ApiKeysManage,- InternalManage,+ CloneConnectorManage,ThemeView,ThemeManage,ReconSourcesView,@@ -9686,7 +9686,7 @@ pub enum ParentGroup {Account,Webhook,ApiKeys,- Internal,+ CloneConnector,Theme,ReconSources,ReconExceptions,@@ -9715,7 +9715,7 @@ pub enum Resource {Report,RevenueRecovery,Subscription,- InternalConnector,+ CloneConnector,Theme,ReconIngestion,ReconTransformation,diff --git a/crates/common_utils/src/consts.rs b/crates/common_utils/src/consts.rsindex ba37744b6d..1919d1ce30 100644--- a/crates/common_utils/src/consts.rs+++ b/crates/common_utils/src/consts.rs@@ -141,8 +141,6 @@ pub const ROLE_ID_ORGANIZATION_ADMIN: &str = "org_admin";pub const ROLE_ID_INTERNAL_VIEW_ONLY_USER: &str = "internal_view_only";/// Role ID for Internal Adminpub const ROLE_ID_INTERNAL_ADMIN: &str = "internal_admin";-/// Role ID for Internal Demo-pub const ROLE_ID_INTERNAL_DEMO: &str = "internal_demo";/// Max length allowed for Descriptionpub const MAX_DESCRIPTION_LENGTH: u16 = 255;diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rsindex a0476a3279..a6d207d9b6 100644--- a/crates/router/src/configs/settings.rs+++ b/crates/router/src/configs/settings.rs@@ -223,10 +223,10 @@ pub struct OpenRouter {#[derive(Debug, Deserialize, Clone, Default)]#[serde(default)]pub struct CloneConnectorAllowlistConfig {- #[serde(deserialize_with = "deserialize_merchant_ids")]- pub merchant_ids: HashSet<id_type::MerchantId>,#[serde(deserialize_with = "deserialize_hashset")]pub connector_names: HashSet<enums::Connector>,+ #[serde(deserialize_with = "deserialize_hashmap")]+ pub payment_method_types: HashMap<enums::PaymentMethod, HashSet<enums::PaymentMethodType>>,}#[derive(Debug, Deserialize, Clone, Default)]diff --git a/crates/router/src/core/user.rs b/crates/router/src/core/user.rsindex ef980bb66b..321933f85d 100644--- a/crates/router/src/core/user.rs+++ b/crates/router/src/core/user.rs@@ -22,7 +22,7 @@ use diesel_models::{};use error_stack::{report, ResultExt};use hyperswitch_masking::{ExposeInterface, PeekInterface, Secret};-use router_env::{env, logger};+use router_env::{env, instrument, logger, tracing};use storage_impl::errors::StorageError;#[cfg(feature = "v1")]use subscriptions::RouterResponse;@@ -3883,60 +3883,77 @@ pub async fn switch_profile_for_user_in_org_and_merchant(}#[cfg(feature = "v1")]+#[instrument(skip_all)]pub async fn clone_connector(state: SessionState,+ user_from_token: auth::UserFromToken,request: user_api::CloneConnectorRequest,) -> UserResponse<api_models::admin::MerchantConnectorResponse> {let Some(allowlist) = &state.conf.clone_connector_allowlist else {return Err(UserErrors::InvalidCloneConnectorOperation(- "Cloning is not allowed".to_string(),+ "Connector cloning is not enabled".to_string(),).into());};fp_utils::when(- allowlist- .merchant_ids- .contains(&request.source.merchant_id)- .not(),+ user_from_token.profile_id == request.destination_profile_id,|| {Err(UserErrors::InvalidCloneConnectorOperation(- "Cloning is not allowed from this merchant".to_string(),+ "Source and destination profiles cannot be the same".to_string(),))},)?;- let source_key_store = state+ let key_store = state.store.get_merchant_key_store_by_merchant_id(- &request.source.merchant_id,+ &user_from_token.merchant_id,&state.store.get_master_key().to_vec().into(),).await.to_not_found_response(UserErrors::InvalidCloneConnectorOperation(- "Source merchant account not found".to_string(),+ "Merchant account not found".to_string(),))?;let source_mca = state.store.find_by_merchant_connector_account_merchant_id_merchant_connector_id(- &request.source.merchant_id,- &request.source.mca_id,- &source_key_store,+ &user_from_token.merchant_id,+ &request.source_mca_id,+ &key_store,).await.to_not_found_response(UserErrors::InvalidCloneConnectorOperation("Source merchant connector account not found".to_string(),))?;- let source_mca_name = source_mca+ fp_utils::when(source_mca.profile_id != user_from_token.profile_id, || {+ Err(UserErrors::InvalidCloneConnectorOperation(+ "Source connector does not belong to the current profile".to_string(),+ ))+ })?;++ state+ .store+ .find_business_profile_by_merchant_id_profile_id(+ &key_store,+ &user_from_token.merchant_id,+ &request.destination_profile_id,+ )+ .await+ .to_not_found_response(UserErrors::InvalidCloneConnectorOperation(+ "Destination profile does not belong to the merchant".to_string(),+ ))?;++ let source_connector = source_mca.connector_name.parse::<connector_enums::Connector>().change_context(UserErrors::InternalServerError).attach_printable("Invalid connector name received")?;fp_utils::when(- allowlist.connector_names.contains(&source_mca_name).not(),+ allowlist.connector_names.contains(&source_connector).not(),|| {Err(UserErrors::InvalidCloneConnectorOperation("Cloning is not allowed for this connector".to_string(),@@ -3946,46 +3963,33 @@ pub async fn clone_connector(let merchant_connector_create = utils::user::build_cloned_connector_create_request(source_mca,- Some(request.destination.profile_id.clone()),- request.destination.connector_label,+ request.destination_profile_id.clone(),+ request.connector_label,+ &allowlist.payment_method_types,).await?;- let destination_key_store = state- .store- .get_merchant_key_store_by_merchant_id(- &request.destination.merchant_id,- &state.store.get_master_key().to_vec().into(),- )- .await- .to_not_found_response(UserErrors::InvalidCloneConnectorOperation(- "Destination merchant account not found".to_string(),- ))?;-- let destination_merchant_account = state+ let merchant_account = state.store- .find_merchant_account_by_merchant_id(- &request.destination.merchant_id,- &destination_key_store,- )+ .find_merchant_account_by_merchant_id(&user_from_token.merchant_id, &key_store).await.to_not_found_response(UserErrors::InvalidCloneConnectorOperation(- "Destination merchant account not found".to_string(),+ "Merchant account not found".to_string(),))?;- let destination_context = domain::Platform::new(- destination_merchant_account.clone(),- destination_key_store.clone(),- destination_merchant_account.clone(),- destination_key_store.clone(),+ let platform = domain::Platform::new(+ merchant_account.clone(),+ key_store.clone(),+ merchant_account.clone(),+ key_store.clone(),None,);admin::create_connector(state,merchant_connector_create,- destination_context.get_processor().clone(),- Some(request.destination.profile_id),+ platform.get_processor().clone(),+ Some(request.destination_profile_id),).await.map_err(|e| {diff --git a/crates/router/src/routes/user.rs b/crates/router/src/routes/user.rsindex 0554d9de49..d542aba42f 100644--- a/crates/router/src/routes/user.rs+++ b/crates/router/src/routes/user.rs@@ -1109,9 +1109,11 @@ pub async fn clone_connector(state.clone(),&req,json_payload.into_inner(),- |state, _: auth::UserFromToken, req, _| user_core::clone_connector(state, req),+ |state, user_from_token: auth::UserFromToken, req, _| {+ user_core::clone_connector(state, user_from_token, req)+ },&auth::JWTAuth {- permission: Permission::MerchantInternalConnectorWrite,+ permission: Permission::MerchantCloneConnectorWrite,allow_connected: true,allow_platform: true,},diff --git a/crates/router/src/services/authorization/info.rs b/crates/router/src/services/authorization/info.rsindex d5d569e796..27abbd9b6e 100644--- a/crates/router/src/services/authorization/info.rs+++ b/crates/router/src/services/authorization/info.rs@@ -50,7 +50,7 @@ fn get_group_description(group: PermissionGroup) -> Option<&'static str> {PermissionGroup::ApiKeysManage => None,PermissionGroup::ThemeView => Some("View Themes"),PermissionGroup::ThemeManage => Some("Manage Themes"),- PermissionGroup::InternalManage => None, // Internal group, no user-facing description+ 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"),PermissionGroup::ReconExceptionsView => Some("Investigate Exceptions and view resolutions"),@@ -74,7 +74,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::Internal => None, // Internal group, no user-facing description+ ParentGroup::CloneConnector => None, // Admin-only, no user-facing descriptionParentGroup::ReconSources => Some("Recon ingestion and transformation pipelines"),ParentGroup::ReconExceptions => Some("Recon exception investigation and resolution"),ParentGroup::ReconTransactions => Some("Recon staging entries and transactions"),diff --git a/crates/router/src/services/authorization/permission_groups.rs b/crates/router/src/services/authorization/permission_groups.rsindex 1b4ec4c993..98fbd621bf 100644--- a/crates/router/src/services/authorization/permission_groups.rs+++ b/crates/router/src/services/authorization/permission_groups.rs@@ -38,7 +38,7 @@ impl PermissionGroupExt for PermissionGroup {| Self::AccountManage| Self::WebhooksManage| Self::ApiKeysManage- | Self::InternalManage+ | Self::CloneConnectorManage| Self::ThemeManage| Self::ReconSourcesManage| Self::ReconExceptionsManage@@ -59,7 +59,7 @@ impl PermissionGroupExt for PermissionGroup {Self::ApiKeysView | Self::ApiKeysManage => ParentGroup::ApiKeys,Self::ThemeView | Self::ThemeManage => ParentGroup::Theme,- Self::InternalManage => ParentGroup::Internal,+ Self::CloneConnectorManage => ParentGroup::CloneConnector,Self::ReconSourcesView | Self::ReconSourcesManage => ParentGroup::ReconSources,Self::ReconExceptionsView | Self::ReconExceptionsManage => ParentGroup::ReconExceptions,Self::ReconTransactionsView | Self::ReconTransactionsManage => {@@ -110,7 +110,7 @@ impl PermissionGroupExt for PermissionGroup {Self::ApiKeysView => vec![Self::ApiKeysView, Self::AccountView],Self::ApiKeysManage => vec![Self::ApiKeysView, Self::ApiKeysManage, Self::AccountView],- Self::InternalManage => vec![Self::InternalManage],+ Self::CloneConnectorManage => vec![Self::CloneConnectorManage],Self::ThemeView => vec![Self::ThemeView, Self::AccountView],Self::ThemeManage => vec![Self::ThemeManage, Self::AccountView],@@ -171,7 +171,7 @@ impl PermissionGroupExt for PermissionGroup {| Self::WebhooksManage| Self::ApiKeysView| Self::ApiKeysManage- | Self::InternalManage+ | Self::CloneConnectorManage| Self::ThemeView| Self::ThemeManage => RoleProductCategory::Orchestration,@@ -208,7 +208,7 @@ impl ParentGroupExt for ParentGroup {Self::Account => ACCOUNT.to_vec(),Self::Webhook => WEBHOOK.to_vec(),Self::ApiKeys => API_KEYS.to_vec(),- Self::Internal => INTERNAL.to_vec(),+ Self::CloneConnector => CLONE_CONNECTOR.to_vec(),Self::Theme => THEME.to_vec(),Self::ReconSources => RECON_SOURCES.to_vec(),Self::ReconExceptions => RECON_EXCEPTIONS.to_vec(),@@ -284,7 +284,7 @@ pub static WEBHOOK: [Resource; 1] = [Resource::WebhookEvent];pub static API_KEYS: [Resource; 1] = [Resource::ApiKey];-pub static INTERNAL: [Resource; 1] = [Resource::InternalConnector];+pub static CLONE_CONNECTOR: [Resource; 1] = [Resource::CloneConnector];pub static THEME: [Resource; 1] = [Resource::Theme];diff --git a/crates/router/src/services/authorization/permissions.rs b/crates/router/src/services/authorization/permissions.rsindex 2cb6f6d576..73eb93e6fa 100644--- a/crates/router/src/services/authorization/permissions.rs+++ b/crates/router/src/services/authorization/permissions.rs@@ -75,7 +75,7 @@ generate_permissions! {scopes: [Read],entities: [Profile]},- InternalConnector: {+ CloneConnector: {scopes: [Write],entities: [Merchant]},@@ -136,7 +136,7 @@ pub fn get_resource_name(resource: Resource, entity_type: EntityType) -> Option<(Resource::Account, EntityType::Organization) => Some("Organization Account"),(Resource::Account, EntityType::Tenant) => Some("Tenant Account"),(Resource::Theme, _) => Some("Themes"),- (Resource::InternalConnector, _) => None,+ (Resource::CloneConnector, _) => None,(Resource::ReconIngestion, _) => Some("Recon Ingestion Configs"),(Resource::ReconTransformation, _) => Some("Recon Transformation Configs"),(Resource::ReconException, _) => Some("Recon Exception Management"),diff --git a/crates/router/src/services/authorization/roles/predefined_roles.rs b/crates/router/src/services/authorization/roles/predefined_roles.rsindex f1d4092516..2407cb5fa0 100644--- a/crates/router/src/services/authorization/roles/predefined_roles.rs+++ b/crates/router/src/services/authorization/roles/predefined_roles.rs@@ -70,34 +70,6 @@ pub static PREDEFINED_ROLES: LazyLock<HashMap<&'static str, RoleInfo>> = LazyLocproduct_type_filter: None,},);- roles.insert(- common_utils::consts::ROLE_ID_INTERNAL_DEMO,- RoleInfo {- groups: vec![- PermissionGroup::OperationsView,- PermissionGroup::ConnectorsView,- PermissionGroup::WorkflowsView,- PermissionGroup::AnalyticsView,- PermissionGroup::UsersView,- PermissionGroup::AccountView,- PermissionGroup::ReconSourcesView,- PermissionGroup::ReconExceptionsView,- PermissionGroup::ReconTransactionsView,- PermissionGroup::ReconRulesView,- PermissionGroup::InternalManage,- ],- role_id: common_utils::consts::ROLE_ID_INTERNAL_DEMO.to_string(),- role_name: "internal_demo".to_string(),- scope: RoleScope::Organization,- entity_type: EntityType::Merchant,- is_invitable: false,- is_deletable: false,- is_updatable: false,- is_internal: true,- product_type_filter: None,- },- );-// Tenant Rolesroles.insert(common_utils::consts::ROLE_ID_TENANT_ADMIN,@@ -151,6 +123,7 @@ pub static PREDEFINED_ROLES: LazyLock<HashMap<&'static str, RoleInfo>> = LazyLocPermissionGroup::UsersManage,PermissionGroup::AccountView,PermissionGroup::AccountManage,+ PermissionGroup::CloneConnectorManage,PermissionGroup::ThemeView,PermissionGroup::ThemeManage,PermissionGroup::ReconSourcesView,@@ -191,6 +164,7 @@ pub static PREDEFINED_ROLES: LazyLock<HashMap<&'static str, RoleInfo>> = LazyLocPermissionGroup::UsersManage,PermissionGroup::AccountView,PermissionGroup::AccountManage,+ PermissionGroup::CloneConnectorManage,],role_id: consts::user_role::ROLE_ID_MERCHANT_ADMIN.to_string(),role_name: "merchant_admin".to_string(),diff --git a/crates/router/src/utils/user.rs b/crates/router/src/utils/user.rsindex d1dc9392f6..f54e891c95 100644--- a/crates/router/src/utils/user.rs+++ b/crates/router/src/utils/user.rs@@ -18,14 +18,10 @@ use diesel_models::organization::{self, OrganizationBridge};use error_stack::ResultExt;#[cfg(feature = "v1")]use hyperswitch_domain_models::merchant_connector_account::MerchantConnectorAccount as DomainMerchantConnectorAccount;-#[cfg(feature = "v1")]-use hyperswitch_masking::PeekInterface;use hyperswitch_masking::{ExposeInterface, Secret};use redis_interface::RedisConnectionPool;-use router_env::{env, logger};+use router_env::{env, instrument, logger, tracing};-#[cfg(feature = "v1")]-use crate::types::AdditionalMerchantData;use crate::{consts::user::{REDIS_SSO_PREFIX, REDIS_SSO_TTL},core::errors::{StorageError, UserErrors, UserResult},@@ -408,10 +404,15 @@ pub fn get_base_url(state: &SessionState) -> &str {}#[cfg(feature = "v1")]+#[instrument(skip_all)]pub async fn build_cloned_connector_create_request(source_mca: DomainMerchantConnectorAccount,- destination_profile_id: Option<id_type::ProfileId>,+ destination_profile_id: id_type::ProfileId,destination_connector_label: Option<String>,+ payment_method_types: &std::collections::HashMap<+ common_enums::PaymentMethod,+ std::collections::HashSet<common_enums::PaymentMethodType>,+ >,) -> UserResult<admin_api::MerchantConnectorCreate> {let source_mca_name = source_mca.connector_name@@ -425,29 +426,33 @@ pub async fn build_cloned_connector_create_request(.map(|data| {let val = data.into_iter().map(|secret| secret.expose()).collect();serde_json::Value::Array(val)- .parse_value("PaymentMethods")+ .parse_value::<Vec<admin_api::PaymentMethodsEnabled>>("PaymentMethods").change_context(UserErrors::InternalServerError).attach_printable("Unable to deserialize PaymentMethods")})- .transpose()?;-- let frm_configs = source_mca- .frm_configs- .as_ref()- .map(|configs_vec| {- configs_vec- .iter()- .map(|config_secret| {- config_secret- .peek()- .clone()- .parse_value("FrmConfigs")- .change_context(UserErrors::InternalServerError)- .attach_printable("Unable to deserialize FrmConfigs")+ .transpose()?+ .map(|payment_methods| {+ payment_methods+ .into_iter()+ .filter_map(|mut payment_method| {+ let allowed_subtypes =+ payment_method_types.get(&payment_method.payment_method)?;+ payment_method.payment_method_types =+ payment_method.payment_method_types.map(|subtypes| {+ subtypes+ .into_iter()+ .filter(|subtype| {+ allowed_subtypes.contains(&subtype.payment_method_type)+ })+ .collect::<Vec<_>>()+ });+ match &payment_method.payment_method_types {+ Some(subtypes) if subtypes.is_empty() => None,+ _ => Some(payment_method),+ }})- .collect::<Result<Vec<_>, _>>()- })- .transpose()?;+ .collect::<Vec<_>>()+ });let connector_webhook_details = source_mca.connector_webhook_details@@ -461,31 +466,6 @@ pub async fn build_cloned_connector_create_request(}).transpose()?;- let connector_wallets_details = source_mca- .connector_wallets_details- .map(|secret_value| {- secret_value- .into_inner()- .expose()- .parse_value::<admin_api::ConnectorWalletDetails>("ConnectorWalletDetails")- .change_context(UserErrors::InternalServerError)- .attach_printable("Unable to parse ConnectorWalletDetails from Value")- })- .transpose()?;-- let additional_merchant_data = source_mca- .additional_merchant_data- .map(|secret_value| {- secret_value- .into_inner()- .expose()- .parse_value::<AdditionalMerchantData>("AdditionalMerchantData")- .change_context(UserErrors::InternalServerError)- .attach_printable("Unable to parse AdditionalMerchantData from Value")- })- .transpose()?- .map(admin_api::AdditionalMerchantData::foreign_from);-Ok(admin_api::MerchantConnectorCreate {connector_type: source_mca.connector_type,connector_name: source_mca_name,@@ -499,12 +479,12 @@ pub async fn build_cloned_connector_create_request(business_country: source_mca.business_country,business_label: source_mca.business_label.clone(),business_sub_label: source_mca.business_sub_label.clone(),- frm_configs,+ frm_configs: None,connector_webhook_details,- profile_id: destination_profile_id,- pm_auth_config: source_mca.pm_auth_config.clone(),- connector_wallets_details,+ profile_id: Some(destination_profile_id),+ pm_auth_config: None,+ connector_wallets_details: None,status: Some(source_mca.status),- additional_merchant_data,+ additional_merchant_data: None,})}diff --git a/crates/router/src/utils/user_role.rs b/crates/router/src/utils/user_role.rsindex b662e2f7d5..84763d85ff 100644--- a/crates/router/src/utils/user_role.rs+++ b/crates/router/src/utils/user_role.rs@@ -59,7 +59,7 @@ pub fn validate_role_groups(let unique_groups: HashSet<_> = groups.iter().copied().collect();- if unique_groups.contains(&PermissionGroup::InternalManage) {+ if unique_groups.contains(&PermissionGroup::CloneConnectorManage) {return Err(report!(UserErrors::InvalidRoleOperation)).attach_printable("Invalid groups present in the custom role");}