mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
refactor(routing): Routing events core refactor (#8323)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: prajjwalkumar17 <prajjwal.kumar@juspay.in>
This commit is contained in:
@ -58,14 +58,14 @@ pub struct PaymentInfo {
|
||||
// cardSwitchProvider: Option<Secret<String>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
pub struct DecidedGateway {
|
||||
pub gateway_priority_map: Option<HashMap<String, f64>>,
|
||||
pub debit_routing_output: Option<DebitRoutingOutput>,
|
||||
pub routing_approach: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
pub struct DebitRoutingOutput {
|
||||
pub co_badged_card_networks: Vec<common_enums::CardNetwork>,
|
||||
pub issuer_country: common_enums::CountryAlpha2,
|
||||
@ -121,7 +121,7 @@ pub struct DebitRoutingRequestData {
|
||||
pub card_type: common_enums::CardType,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct ErrorResponse {
|
||||
pub status: String,
|
||||
pub error_code: String,
|
||||
@ -132,7 +132,7 @@ pub struct ErrorResponse {
|
||||
pub is_dynamic_mga_enabled: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct UnifiedError {
|
||||
pub code: String,
|
||||
pub user_message: String,
|
||||
|
||||
@ -1384,160 +1384,6 @@ impl std::fmt::Display for RoutingApproach {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct BucketInformationEventResponse {
|
||||
pub is_eliminated: bool,
|
||||
pub bucket_name: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct EliminationInformationEventResponse {
|
||||
pub entity: Option<BucketInformationEventResponse>,
|
||||
pub global: Option<BucketInformationEventResponse>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct LabelWithStatusEliminationEventResponse {
|
||||
pub label: String,
|
||||
pub elimination_information: Option<EliminationInformationEventResponse>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct EliminationEventResponse {
|
||||
pub labels_with_status: Vec<LabelWithStatusEliminationEventResponse>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct ScoreDataEventResponse {
|
||||
pub score: f64,
|
||||
pub label: String,
|
||||
pub current_count: u64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct CalContractScoreEventResponse {
|
||||
pub labels_with_score: Vec<ScoreDataEventResponse>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct CalGlobalSuccessRateConfigEventRequest {
|
||||
pub entity_min_aggregates_size: u32,
|
||||
pub entity_default_success_rate: f64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct CalGlobalSuccessRateEventRequest {
|
||||
pub entity_id: String,
|
||||
pub entity_params: String,
|
||||
pub entity_labels: Vec<String>,
|
||||
pub global_labels: Vec<String>,
|
||||
pub config: Option<CalGlobalSuccessRateConfigEventRequest>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct UpdateSuccessRateWindowConfig {
|
||||
pub max_aggregates_size: Option<u32>,
|
||||
pub current_block_threshold: Option<CurrentBlockThreshold>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct UpdateLabelWithStatusEventRequest {
|
||||
pub label: String,
|
||||
pub status: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct UpdateSuccessRateWindowEventRequest {
|
||||
pub id: String,
|
||||
pub params: String,
|
||||
pub labels_with_status: Vec<UpdateLabelWithStatusEventRequest>,
|
||||
pub config: Option<UpdateSuccessRateWindowConfig>,
|
||||
pub global_labels_with_status: Vec<UpdateLabelWithStatusEventRequest>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct UpdateSuccessRateWindowEventResponse {
|
||||
pub status: UpdationStatusEventResponse,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum UpdationStatusEventResponse {
|
||||
WindowUpdationSucceeded,
|
||||
WindowUpdationFailed,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct LabelWithBucketNameEventRequest {
|
||||
pub label: String,
|
||||
pub bucket_name: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct UpdateEliminationBucketEventRequest {
|
||||
pub id: String,
|
||||
pub params: String,
|
||||
pub labels_with_bucket_name: Vec<LabelWithBucketNameEventRequest>,
|
||||
pub config: Option<EliminationRoutingEventBucketConfig>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct UpdateEliminationBucketEventResponse {
|
||||
pub status: EliminationUpdationStatusEventResponse,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum EliminationUpdationStatusEventResponse {
|
||||
BucketUpdationSucceeded,
|
||||
BucketUpdationFailed,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct ContractLabelInformationEventRequest {
|
||||
pub label: String,
|
||||
pub target_count: u64,
|
||||
pub target_time: u64,
|
||||
pub current_count: u64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct UpdateContractRequestEventRequest {
|
||||
pub id: String,
|
||||
pub params: String,
|
||||
pub labels_information: Vec<ContractLabelInformationEventRequest>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct UpdateContractEventResponse {
|
||||
pub status: ContractUpdationStatusEventResponse,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ContractUpdationStatusEventResponse {
|
||||
ContractUpdationSucceeded,
|
||||
ContractUpdationFailed,
|
||||
}
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||
pub struct RuleMigrationQuery {
|
||||
pub profile_id: common_utils::id_type::ProfileId,
|
||||
|
||||
Reference in New Issue
Block a user