mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
refactor(business_profile): change id for business profile (#5748)
This commit is contained in:
@ -140,13 +140,13 @@ pub async fn create_routing_algorithm_under_profile(
|
||||
.await?;
|
||||
|
||||
let name_mca_id_set = helpers::ConnectNameAndMCAIdForProfile(
|
||||
all_mcas.filter_by_profile(&business_profile.profile_id, |mca| {
|
||||
all_mcas.filter_by_profile(business_profile.get_id(), |mca| {
|
||||
(&mca.connector_name, mca.get_id())
|
||||
}),
|
||||
);
|
||||
|
||||
let name_set = helpers::ConnectNameForProfile(
|
||||
all_mcas.filter_by_profile(&business_profile.profile_id, |mca| &mca.connector_name),
|
||||
all_mcas.filter_by_profile(business_profile.get_id(), |mca| &mca.connector_name),
|
||||
);
|
||||
|
||||
let algorithm_helper = helpers::RoutingAlgorithmHelpers {
|
||||
@ -160,7 +160,7 @@ pub async fn create_routing_algorithm_under_profile(
|
||||
let algo = RoutingAlgorithmUpdate::create_new_routing_algorithm(
|
||||
&request,
|
||||
merchant_account.get_id(),
|
||||
business_profile.profile_id,
|
||||
business_profile.get_id().to_owned(),
|
||||
transaction_type,
|
||||
);
|
||||
|
||||
@ -853,7 +853,7 @@ pub async fn retrieve_routing_config_under_profile(
|
||||
|
||||
let record = db
|
||||
.list_routing_algorithm_metadata_by_profile_id(
|
||||
&business_profile.profile_id,
|
||||
business_profile.get_id(),
|
||||
i64::from(query_params.limit.unwrap_or_default()),
|
||||
i64::from(query_params.offset.unwrap_or_default()),
|
||||
)
|
||||
@ -914,6 +914,8 @@ pub async fn retrieve_linked_routing_config(
|
||||
let mut active_algorithms = Vec::new();
|
||||
|
||||
for business_profile in business_profiles {
|
||||
let profile_id = business_profile.get_id().to_owned();
|
||||
|
||||
let routing_ref: routing_types::RoutingAlgorithmRef = match transaction_type {
|
||||
enums::TransactionType::Payment => business_profile.routing_algorithm,
|
||||
#[cfg(feature = "payouts")]
|
||||
@ -930,7 +932,7 @@ pub async fn retrieve_linked_routing_config(
|
||||
let record = db
|
||||
.find_routing_algorithm_metadata_by_algorithm_id_profile_id(
|
||||
&algorithm_id,
|
||||
&business_profile.profile_id,
|
||||
&profile_id,
|
||||
)
|
||||
.await
|
||||
.to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?;
|
||||
@ -970,7 +972,7 @@ pub async fn retrieve_default_routing_config_for_profiles(
|
||||
.map(|prof| {
|
||||
helpers::get_merchant_default_config(
|
||||
db,
|
||||
prof.profile_id.get_string_repr(),
|
||||
prof.get_id().get_string_repr(),
|
||||
transaction_type,
|
||||
)
|
||||
})
|
||||
@ -983,7 +985,7 @@ pub async fn retrieve_default_routing_config_for_profiles(
|
||||
|
||||
let default_configs = configs
|
||||
.into_iter()
|
||||
.zip(all_profiles.iter().map(|prof| prof.profile_id.clone()))
|
||||
.zip(all_profiles.iter().map(|prof| prof.get_id().to_owned()))
|
||||
.map(
|
||||
|(config, profile_id)| routing_types::ProfileDefaultRoutingConfig {
|
||||
profile_id,
|
||||
@ -1022,7 +1024,7 @@ pub async fn update_default_routing_config_for_profile(
|
||||
})?;
|
||||
let default_config = helpers::get_merchant_default_config(
|
||||
db,
|
||||
business_profile.profile_id.get_string_repr(),
|
||||
business_profile.get_id().get_string_repr(),
|
||||
transaction_type,
|
||||
)
|
||||
.await?;
|
||||
@ -1064,7 +1066,7 @@ pub async fn update_default_routing_config_for_profile(
|
||||
|
||||
helpers::update_merchant_default_config(
|
||||
db,
|
||||
business_profile.profile_id.get_string_repr(),
|
||||
business_profile.get_id().get_string_repr(),
|
||||
updated_config.clone(),
|
||||
transaction_type,
|
||||
)
|
||||
@ -1073,7 +1075,7 @@ pub async fn update_default_routing_config_for_profile(
|
||||
metrics::ROUTING_UPDATE_CONFIG_FOR_PROFILE_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]);
|
||||
Ok(service_api::ApplicationResponse::Json(
|
||||
routing_types::ProfileDefaultRoutingConfig {
|
||||
profile_id: business_profile.profile_id,
|
||||
profile_id: business_profile.get_id().to_owned(),
|
||||
connectors: updated_config,
|
||||
},
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user