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:
Shankar Singh C
2024-04-03 20:30:07 +05:30
committed by GitHub
parent 49cfe72cd2
commit 2a691a5c05
7 changed files with 84 additions and 54 deletions

View File

@ -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")]