mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 17:47:54 +08:00
feat(routing): Integrate global success rates (#6950)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -779,6 +779,7 @@ impl Default for SuccessBasedRoutingConfig {
|
||||
duration_in_mins: Some(5),
|
||||
max_total_count: Some(2),
|
||||
}),
|
||||
specificity_level: SuccessRateSpecificityLevel::default(),
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -801,6 +802,8 @@ pub struct SuccessBasedRoutingConfigBody {
|
||||
pub default_success_rate: Option<f64>,
|
||||
pub max_aggregates_size: Option<u32>,
|
||||
pub current_block_threshold: Option<CurrentBlockThreshold>,
|
||||
#[serde(default)]
|
||||
pub specificity_level: SuccessRateSpecificityLevel,
|
||||
}
|
||||
|
||||
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, ToSchema)]
|
||||
@ -809,6 +812,14 @@ pub struct CurrentBlockThreshold {
|
||||
pub max_total_count: Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(serde::Serialize, serde::Deserialize, Debug, Default, Clone, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum SuccessRateSpecificityLevel {
|
||||
#[default]
|
||||
Merchant,
|
||||
Global,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct SuccessBasedRoutingPayloadWrapper {
|
||||
pub updated_config: SuccessBasedRoutingConfig,
|
||||
@ -849,6 +860,7 @@ impl SuccessBasedRoutingConfigBody {
|
||||
.as_mut()
|
||||
.map(|threshold| threshold.update(current_block_threshold));
|
||||
}
|
||||
self.specificity_level = new.specificity_level
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user