mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 12:15:40 +08:00
refactor: Rename business profile to profiles in api, diesel, domain, interface and error types (#5877)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -167,7 +167,7 @@ pub async fn create_routing_algorithm_under_profile(
|
||||
merchant_account.get_id(),
|
||||
)
|
||||
.await?
|
||||
.get_required_value("BusinessProfile")?;
|
||||
.get_required_value("Profile")?;
|
||||
|
||||
core_utils::validate_profile_id_from_auth_layer(authentication_profile_id, &business_profile)?;
|
||||
|
||||
@ -269,7 +269,7 @@ pub async fn create_routing_algorithm_under_profile(
|
||||
merchant_account.get_id(),
|
||||
)
|
||||
.await?
|
||||
.get_required_value("BusinessProfile")?;
|
||||
.get_required_value("Profile")?;
|
||||
|
||||
core_utils::validate_profile_id_from_auth_layer(authentication_profile_id, &business_profile)?;
|
||||
|
||||
@ -337,7 +337,7 @@ pub async fn link_routing_config_under_profile(
|
||||
merchant_account.get_id(),
|
||||
)
|
||||
.await?
|
||||
.get_required_value("BusinessProfile")?;
|
||||
.get_required_value("Profile")?;
|
||||
|
||||
utils::when(
|
||||
routing_algorithm.0.algorithm_for != *transaction_type,
|
||||
@ -360,8 +360,8 @@ pub async fn link_routing_config_under_profile(
|
||||
})
|
||||
},
|
||||
)?;
|
||||
admin::BusinessProfileWrapper::new(business_profile)
|
||||
.update_business_profile_and_invalidate_routing_config_for_active_algorithm_id_update(
|
||||
admin::ProfileWrapper::new(business_profile)
|
||||
.update_profile_and_invalidate_routing_config_for_active_algorithm_id_update(
|
||||
db,
|
||||
key_manager_state,
|
||||
&key_store,
|
||||
@ -405,8 +405,8 @@ pub async fn link_routing_config(
|
||||
merchant_account.get_id(),
|
||||
)
|
||||
.await?
|
||||
.get_required_value("BusinessProfile")
|
||||
.change_context(errors::ApiErrorResponse::BusinessProfileNotFound {
|
||||
.get_required_value("Profile")
|
||||
.change_context(errors::ApiErrorResponse::ProfileNotFound {
|
||||
id: routing_algorithm.profile_id.get_string_repr().to_owned(),
|
||||
})?;
|
||||
|
||||
@ -484,7 +484,7 @@ pub async fn link_routing_config(
|
||||
},
|
||||
)?;
|
||||
routing_ref.update_algorithm_id(algorithm_id);
|
||||
helpers::update_business_profile_active_algorithm_ref(
|
||||
helpers::update_profile_active_algorithm_ref(
|
||||
db,
|
||||
key_manager_state,
|
||||
&key_store,
|
||||
@ -525,7 +525,7 @@ pub async fn retrieve_routing_algorithm_from_algorithm_id(
|
||||
merchant_account.get_id(),
|
||||
)
|
||||
.await?
|
||||
.get_required_value("BusinessProfile")
|
||||
.get_required_value("Profile")
|
||||
.change_context(errors::ApiErrorResponse::ResourceIdNotFound)?;
|
||||
|
||||
core_utils::validate_profile_id_from_auth_layer(authentication_profile_id, &business_profile)?;
|
||||
@ -566,7 +566,7 @@ pub async fn retrieve_routing_algorithm_from_algorithm_id(
|
||||
merchant_account.get_id(),
|
||||
)
|
||||
.await?
|
||||
.get_required_value("BusinessProfile")
|
||||
.get_required_value("Profile")
|
||||
.change_context(errors::ApiErrorResponse::ResourceIdNotFound)?;
|
||||
|
||||
core_utils::validate_profile_id_from_auth_layer(authentication_profile_id, &business_profile)?;
|
||||
@ -599,7 +599,7 @@ pub async fn unlink_routing_config_under_profile(
|
||||
merchant_account.get_id(),
|
||||
)
|
||||
.await?
|
||||
.get_required_value("BusinessProfile")?;
|
||||
.get_required_value("Profile")?;
|
||||
|
||||
let routing_algo_id = match transaction_type {
|
||||
enums::TransactionType::Payment => business_profile.routing_algorithm_id.clone(),
|
||||
@ -615,8 +615,8 @@ pub async fn unlink_routing_config_under_profile(
|
||||
)
|
||||
.await?;
|
||||
let response = record.0.foreign_into();
|
||||
admin::BusinessProfileWrapper::new(business_profile)
|
||||
.update_business_profile_and_invalidate_routing_config_for_active_algorithm_id_update(
|
||||
admin::ProfileWrapper::new(business_profile)
|
||||
.update_profile_and_invalidate_routing_config_for_active_algorithm_id_update(
|
||||
db,
|
||||
key_manager_state,
|
||||
&key_store,
|
||||
@ -701,7 +701,7 @@ pub async fn unlink_routing_config(
|
||||
.await
|
||||
.to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?;
|
||||
let response = record.foreign_into();
|
||||
helpers::update_business_profile_active_algorithm_ref(
|
||||
helpers::update_profile_active_algorithm_ref(
|
||||
db,
|
||||
key_manager_state,
|
||||
&key_store,
|
||||
@ -745,8 +745,8 @@ pub async fn update_default_fallback_routing(
|
||||
merchant_account.get_id(),
|
||||
)
|
||||
.await?
|
||||
.get_required_value("BusinessProfile")?;
|
||||
let profile_wrapper = admin::BusinessProfileWrapper::new(profile);
|
||||
.get_required_value("Profile")?;
|
||||
let profile_wrapper = admin::ProfileWrapper::new(profile);
|
||||
let default_list_of_connectors =
|
||||
profile_wrapper.get_default_fallback_list_of_connector_under_profile()?;
|
||||
|
||||
@ -873,9 +873,9 @@ pub async fn retrieve_default_fallback_algorithm_for_profile(
|
||||
merchant_account.get_id(),
|
||||
)
|
||||
.await?
|
||||
.get_required_value("BusinessProfile")?;
|
||||
.get_required_value("Profile")?;
|
||||
|
||||
let connectors_choice = admin::BusinessProfileWrapper::new(profile)
|
||||
let connectors_choice = admin::ProfileWrapper::new(profile)
|
||||
.get_default_fallback_list_of_connector_under_profile()?;
|
||||
|
||||
metrics::ROUTING_RETRIEVE_DEFAULT_CONFIG_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]);
|
||||
@ -924,7 +924,7 @@ pub async fn retrieve_routing_config_under_profile(
|
||||
merchant_account.get_id(),
|
||||
)
|
||||
.await?
|
||||
.get_required_value("BusinessProfile")?;
|
||||
.get_required_value("Profile")?;
|
||||
|
||||
let record = db
|
||||
.list_routing_algorithm_metadata_by_profile_id(
|
||||
@ -970,17 +970,13 @@ pub async fn retrieve_linked_routing_config(
|
||||
)
|
||||
.await?
|
||||
.map(|profile| vec![profile])
|
||||
.get_required_value("BusinessProfile")
|
||||
.change_context(errors::ApiErrorResponse::BusinessProfileNotFound {
|
||||
.get_required_value("Profile")
|
||||
.change_context(errors::ApiErrorResponse::ProfileNotFound {
|
||||
id: profile_id.get_string_repr().to_owned(),
|
||||
})?
|
||||
} else {
|
||||
let business_profile = db
|
||||
.list_business_profile_by_merchant_id(
|
||||
key_manager_state,
|
||||
&key_store,
|
||||
merchant_account.get_id(),
|
||||
)
|
||||
.list_profile_by_merchant_id(key_manager_state, &key_store, merchant_account.get_id())
|
||||
.await
|
||||
.to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?;
|
||||
core_utils::filter_objects_based_on_profile_id_list(
|
||||
@ -1036,11 +1032,7 @@ pub async fn retrieve_default_routing_config_for_profiles(
|
||||
let key_manager_state = &(&state).into();
|
||||
|
||||
let all_profiles = db
|
||||
.list_business_profile_by_merchant_id(
|
||||
key_manager_state,
|
||||
&key_store,
|
||||
merchant_account.get_id(),
|
||||
)
|
||||
.list_profile_by_merchant_id(key_manager_state, &key_store, merchant_account.get_id())
|
||||
.await
|
||||
.to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)
|
||||
.attach_printable("error retrieving all business profiles for merchant")?;
|
||||
@ -1097,8 +1089,8 @@ pub async fn update_default_routing_config_for_profile(
|
||||
merchant_account.get_id(),
|
||||
)
|
||||
.await?
|
||||
.get_required_value("BusinessProfile")
|
||||
.change_context(errors::ApiErrorResponse::BusinessProfileNotFound {
|
||||
.get_required_value("Profile")
|
||||
.change_context(errors::ApiErrorResponse::ProfileNotFound {
|
||||
id: profile_id.get_string_repr().to_owned(),
|
||||
})?;
|
||||
let default_config = helpers::get_merchant_default_config(
|
||||
@ -1176,7 +1168,7 @@ pub async fn toggle_success_based_routing(
|
||||
let db = state.store.as_ref();
|
||||
let key_manager_state = &(&state).into();
|
||||
|
||||
let business_profile: domain::BusinessProfile = core_utils::validate_and_get_business_profile(
|
||||
let business_profile: domain::Profile = core_utils::validate_and_get_business_profile(
|
||||
db,
|
||||
key_manager_state,
|
||||
&key_store,
|
||||
@ -1184,8 +1176,8 @@ pub async fn toggle_success_based_routing(
|
||||
merchant_account.get_id(),
|
||||
)
|
||||
.await?
|
||||
.get_required_value("BusinessProfile")
|
||||
.change_context(errors::ApiErrorResponse::BusinessProfileNotFound {
|
||||
.get_required_value("Profile")
|
||||
.change_context(errors::ApiErrorResponse::ProfileNotFound {
|
||||
id: profile_id.get_string_repr().to_owned(),
|
||||
})?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user