refactor(routing): Remove backwards compatibility for the routing crate (#3015)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: Shanks <shashank.attarde@juspay.in>
This commit is contained in:
Amisha Prabhat
2024-07-18 15:13:38 +05:30
committed by GitHub
parent a0c367ee8c
commit 78a7804b9c
122 changed files with 498 additions and 1791 deletions

View File

@ -249,14 +249,11 @@ pub async fn update_business_profile_active_algorithm_ref(
let merchant_id = current_business_profile.merchant_id.clone();
#[cfg(feature = "business_profile_routing")]
let profile_id = current_business_profile.profile_id.clone();
#[cfg(feature = "business_profile_routing")]
let routing_cache_key =
cache::CacheKind::Routing(format!("routing_config_{merchant_id}_{profile_id}").into());
#[cfg(not(feature = "business_profile_routing"))]
let routing_cache_key = cache::CacheKind::Routing(format!("dsl_{merchant_id}").into());
let (routing_algorithm, payout_routing_algorithm) = match transaction_type {
storage::enums::TransactionType::Payment => (Some(ref_val), None),
#[cfg(feature = "payouts")]
@ -320,7 +317,6 @@ pub async fn validate_connectors_in_routing_config(
id: merchant_id.to_string(),
})?;
#[cfg(feature = "connector_choice_mca_id")]
let name_mca_id_set = all_mcas
.iter()
.filter(|mca| mca.profile_id.as_deref() == Some(profile_id))
@ -333,7 +329,6 @@ pub async fn validate_connectors_in_routing_config(
.map(|mca| &mca.connector_name)
.collect::<FxHashSet<_>>();
#[cfg(feature = "connector_choice_mca_id")]
let check_connector_choice = |choice: &routing_types::RoutableConnectorChoice| {
if let Some(ref mca_id) = choice.merchant_connector_id {
error_stack::ensure!(
@ -361,21 +356,6 @@ pub async fn validate_connectors_in_routing_config(
Ok(())
};
#[cfg(not(feature = "connector_choice_mca_id"))]
let check_connector_choice = |choice: &routing_types::RoutableConnectorChoice| {
error_stack::ensure!(
name_set.contains(&choice.connector.to_string()),
errors::ApiErrorResponse::InvalidRequestData {
message: format!(
"connector with name '{}' not found for the given profile",
choice.connector,
)
}
);
Ok(())
};
match routing_algorithm {
routing_types::RoutingAlgorithm::Single(choice) => {
check_connector_choice(choice)?;