mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 12:06:56 +08:00
refactor(routing): Remove backwards compatibility for the routing crate (#3015)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Shanks <shashank.attarde@juspay.in>
This commit is contained in:
@ -12,8 +12,6 @@ use crate::types::{DataType, Metadata};
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
|
||||
pub struct ConnectorChoice {
|
||||
pub connector: RoutableConnectors,
|
||||
#[cfg(not(feature = "connector_choice_mca_id"))]
|
||||
pub sub_label: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ToSchema)]
|
||||
@ -163,18 +161,16 @@ pub struct Program<O> {
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
|
||||
pub struct RoutableConnectorChoice {
|
||||
#[cfg(feature = "connector_choice_bcompat")]
|
||||
#[serde(skip)]
|
||||
pub choice_kind: RoutableChoiceKind,
|
||||
#[cfg(feature = "connector_choice_mca_id")]
|
||||
pub connector: RoutableConnectors,
|
||||
pub merchant_connector_id: Option<String>,
|
||||
#[cfg(not(feature = "connector_choice_mca_id"))]
|
||||
pub sub_label: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, ToSchema)]
|
||||
#[derive(Debug, Default, Clone, Deserialize, Serialize, ToSchema)]
|
||||
pub enum RoutableChoiceKind {
|
||||
OnlyConnector,
|
||||
#[default]
|
||||
FullStruct,
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +9,6 @@ use strum::IntoEnumIterator;
|
||||
use crate::{enums as euclid_enums, frontend::ast, types};
|
||||
|
||||
#[macro_export]
|
||||
#[cfg(feature = "connector_choice_mca_id")]
|
||||
macro_rules! dirval {
|
||||
(Connector = $name:ident) => {
|
||||
$crate::frontend::dir::DirValue::Connector(Box::new(
|
||||
@ -46,53 +45,6 @@ macro_rules! dirval {
|
||||
}};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
#[cfg(not(feature = "connector_choice_mca_id"))]
|
||||
macro_rules! dirval {
|
||||
(Connector = $name:ident) => {
|
||||
$crate::frontend::dir::DirValue::Connector(Box::new(
|
||||
$crate::frontend::ast::ConnectorChoice {
|
||||
connector: $crate::enums::RoutableConnectors::$name,
|
||||
sub_label: None,
|
||||
},
|
||||
))
|
||||
};
|
||||
|
||||
(Connector = ($name:ident, $sub_label:literal)) => {
|
||||
$crate::frontend::dir::DirValue::Connector(Box::new(
|
||||
$crate::frontend::ast::ConnectorChoice {
|
||||
connector: $crate::enums::RoutableConnectors::$name,
|
||||
sub_label: Some($sub_label.to_string()),
|
||||
},
|
||||
))
|
||||
};
|
||||
|
||||
($key:ident = $val:ident) => {{
|
||||
pub use $crate::frontend::dir::enums::*;
|
||||
|
||||
$crate::frontend::dir::DirValue::$key($key::$val)
|
||||
}};
|
||||
|
||||
($key:ident = $num:literal) => {{
|
||||
$crate::frontend::dir::DirValue::$key($crate::types::NumValue {
|
||||
number: common_utils::types::MinorUnit::new($num),
|
||||
refinement: None,
|
||||
})
|
||||
}};
|
||||
|
||||
($key:ident s= $str:literal) => {{
|
||||
$crate::frontend::dir::DirValue::$key($crate::types::StrValue {
|
||||
value: $str.to_string(),
|
||||
})
|
||||
}};
|
||||
($key:literal = $str:literal) => {{
|
||||
$crate::frontend::dir::DirValue::MetaData($crate::types::MetadataValue {
|
||||
key: $key.to_string(),
|
||||
value: $str.to_string(),
|
||||
})
|
||||
}};
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Serialize)]
|
||||
pub struct DirKey {
|
||||
pub kind: DirKeyKind,
|
||||
@ -482,11 +434,7 @@ impl DirKeyKind {
|
||||
Self::Connector => Some(
|
||||
common_enums::RoutableConnectors::iter()
|
||||
.map(|connector| {
|
||||
DirValue::Connector(Box::new(ast::ConnectorChoice {
|
||||
connector,
|
||||
#[cfg(not(feature = "connector_choice_mca_id"))]
|
||||
sub_label: None,
|
||||
}))
|
||||
DirValue::Connector(Box::new(ast::ConnectorChoice { connector }))
|
||||
})
|
||||
.collect(),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user