feat: migration api for migrating routing rules to decision_engine (#8233)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Prajjwal Kumar
2025-06-13 14:34:24 +05:30
committed by GitHub
parent ce85b838f4
commit 9045eb5b65
10 changed files with 318 additions and 5 deletions

View File

@ -1538,3 +1538,50 @@ pub enum ContractUpdationStatusEventResponse {
ContractUpdationSucceeded,
ContractUpdationFailed,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct RuleMigrationQuery {
pub profile_id: common_utils::id_type::ProfileId,
pub merchant_id: common_utils::id_type::MerchantId,
pub limit: Option<u32>,
pub offset: Option<u32>,
}
impl RuleMigrationQuery {
pub fn validated_limit(&self) -> u32 {
self.limit.unwrap_or(50).min(1000)
}
}
#[derive(Debug, serde::Serialize)]
pub struct RuleMigrationResult {
pub success: Vec<RuleMigrationResponse>,
pub errors: Vec<RuleMigrationError>,
}
#[derive(Debug, serde::Serialize)]
pub struct RuleMigrationResponse {
pub profile_id: common_utils::id_type::ProfileId,
pub euclid_algorithm_id: common_utils::id_type::RoutingId,
pub decision_engine_algorithm_id: String,
}
#[derive(Debug, serde::Serialize)]
pub struct RuleMigrationError {
pub profile_id: common_utils::id_type::ProfileId,
pub algorithm_id: common_utils::id_type::RoutingId,
pub error: String,
}
impl RuleMigrationResponse {
pub fn new(
profile_id: common_utils::id_type::ProfileId,
euclid_algorithm_id: common_utils::id_type::RoutingId,
decision_engine_algorithm_id: String,
) -> Self {
Self {
profile_id,
euclid_algorithm_id,
decision_engine_algorithm_id,
}
}
}