mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 17:47:54 +08:00
feat(router): Create a merchant config for enable processor agnostic MIT (#4025)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -11,7 +11,7 @@ pub use euclid::{
|
||||
use serde::{Deserialize, Serialize};
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use crate::enums::{self, RoutableConnectors, TransactionType};
|
||||
use crate::enums::{RoutableConnectors, TransactionType};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
|
||||
#[serde(tag = "type", content = "data", rename_all = "snake_case")]
|
||||
@ -299,34 +299,12 @@ impl From<RoutableConnectorChoice> for ast::ConnectorChoice {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
|
||||
pub struct DetailedConnectorChoice {
|
||||
pub connector: RoutableConnectors,
|
||||
pub business_label: Option<String>,
|
||||
pub business_country: Option<enums::CountryAlpha2>,
|
||||
pub business_sub_label: Option<String>,
|
||||
pub enabled: bool,
|
||||
}
|
||||
|
||||
impl DetailedConnectorChoice {
|
||||
pub fn get_connector_label(&self) -> Option<String> {
|
||||
self.business_country
|
||||
.as_ref()
|
||||
.zip(self.business_label.as_ref())
|
||||
.map(|(business_country, business_label)| {
|
||||
let mut base_label = format!(
|
||||
"{}_{:?}_{}",
|
||||
self.connector, business_country, business_label
|
||||
);
|
||||
|
||||
if let Some(ref sub_label) = self.business_sub_label {
|
||||
base_label.push('_');
|
||||
base_label.push_str(sub_label);
|
||||
}
|
||||
|
||||
base_label
|
||||
})
|
||||
}
|
||||
}
|
||||
impl common_utils::events::ApiEventMetric for DetailedConnectorChoice {}
|
||||
|
||||
#[derive(Debug, Copy, Clone, serde::Serialize, serde::Deserialize, strum::Display, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
|
||||
Reference in New Issue
Block a user