Skip to content

Commit

Permalink
address requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Chethan-rao committed Dec 5, 2023
1 parent 7d7c56f commit 778eaec
Showing 1 changed file with 29 additions and 32 deletions.
61 changes: 29 additions & 32 deletions crates/router/src/core/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1019,39 +1019,36 @@ pub async fn create_payment_connector(
],
);

match is_unroutable_connector {
true => (),
false => {
if let Some(routable_connector_val) = routable_connector {
let choice = routing_types::RoutableConnectorChoice {
#[cfg(feature = "backwards_compatibility")]
choice_kind: routing_types::RoutableChoiceKind::FullStruct,
connector: routable_connector_val,
#[cfg(feature = "connector_choice_mca_id")]
merchant_connector_id: Some(mca.merchant_connector_id.clone()),
#[cfg(not(feature = "connector_choice_mca_id"))]
sub_label: req.business_sub_label.clone(),
};

if !default_routing_config.contains(&choice) {
default_routing_config.push(choice.clone());
routing_helpers::update_merchant_default_config(
&*state.clone().store,
merchant_id,
default_routing_config,
)
.await?;
}
if !is_unroutable_connector {
if let Some(routable_connector_val) = routable_connector {
let choice = routing_types::RoutableConnectorChoice {
#[cfg(feature = "backwards_compatibility")]
choice_kind: routing_types::RoutableChoiceKind::FullStruct,
connector: routable_connector_val,
#[cfg(feature = "connector_choice_mca_id")]
merchant_connector_id: Some(mca.merchant_connector_id.clone()),
#[cfg(not(feature = "connector_choice_mca_id"))]
sub_label: req.business_sub_label.clone(),
};

if !default_routing_config_for_profile.contains(&choice) {
default_routing_config_for_profile.push(choice);
routing_helpers::update_merchant_default_config(
&*state.store,
&profile_id,
default_routing_config_for_profile,
)
.await?;
}
if !default_routing_config.contains(&choice) {
default_routing_config.push(choice.clone());
routing_helpers::update_merchant_default_config(
&*state.clone().store,
merchant_id,
default_routing_config,
)
.await?;
}

if !default_routing_config_for_profile.contains(&choice) {
default_routing_config_for_profile.push(choice);
routing_helpers::update_merchant_default_config(
&*state.store,
&profile_id,
default_routing_config_for_profile,
)
.await?;
}
}
};
Expand Down

0 comments on commit 778eaec

Please sign in to comment.