Skip to content

Commit

Permalink
chore: Resolved comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarthak1799 committed Dec 19, 2024
1 parent cbc9478 commit f4dec0b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
19 changes: 18 additions & 1 deletion crates/api_models/src/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,13 @@ pub struct LabelInformation {
pub mca_id: common_utils::id_type::MerchantConnectorAccountId,
}

impl LabelInformation {
pub fn update(&mut self, new: Self) {
self.target_count = new.target_count;
self.target_time = new.target_time;
}
}

#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum ContractBasedTimeScale {
Expand All @@ -1003,7 +1010,17 @@ impl ContractBasedRoutingConfig {
self.config.as_mut().map(|config| config.update(new_config));
}
if let Some(new_label_info) = new.label_info {
self.label_info = Some(new_label_info)
new_label_info.iter().for_each(|new_label_info| {
if let Some(existing_label_infos) = &mut self.label_info {
for existing_label_info in existing_label_infos {
if &existing_label_info.mca_id == &new_label_info.mca_id {
existing_label_info.update(new_label_info.clone());
}
}
} else {
self.label_info = Some(vec![new_label_info.clone()]);
}
});
}
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/router/src/core/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ pub async fn link_routing_config(
)?
.unwrap_or_default();

// Need to add contract based routing here
utils::when(
matches!(
dynamic_routing_ref.success_based_algorithm,
Expand Down

0 comments on commit f4dec0b

Please sign in to comment.