mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
refactor(routing): Api v2 for routing create and activate endpoints (#5423)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
use std::fmt::Debug;
|
||||
|
||||
use common_utils::errors::ParsingError;
|
||||
use common_utils::{errors::ParsingError, ext_traits::ValueExt, pii};
|
||||
pub use euclid::{
|
||||
dssa::types::EuclidAnalysable,
|
||||
frontend::{
|
||||
@ -427,6 +427,14 @@ impl RoutingAlgorithmRef {
|
||||
self.surcharge_config_algo_id = Some(ids);
|
||||
self.timestamp = common_utils::date_time::now_unix_timestamp();
|
||||
}
|
||||
|
||||
pub fn parse_routing_algorithm(
|
||||
value: Option<pii::SecretSerdeValue>,
|
||||
) -> Result<Option<Self>, error_stack::Report<ParsingError>> {
|
||||
value
|
||||
.map(|val| val.parse_value::<Self>("RoutingAlgorithmRef"))
|
||||
.transpose()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
|
||||
@ -459,6 +467,12 @@ pub enum RoutingKind {
|
||||
}
|
||||
|
||||
#[repr(transparent)]
|
||||
#[derive(serde::Serialize, serde::Deserialize, Debug)]
|
||||
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
|
||||
#[serde(transparent)]
|
||||
pub struct RoutingAlgorithmId(pub String);
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct RoutingLinkWrapper {
|
||||
pub profile_id: String,
|
||||
pub algorithm_id: RoutingAlgorithmId,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user