feat(router): add open router integration for debit routing (#7907)

Co-authored-by: Sayak Bhattacharya <sayak.b@Sayak-Bhattacharya-G092THXJ34.local>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Shankar Singh C
2025-05-19 15:34:29 +05:30
committed by GitHub
parent 868ff50d14
commit 140d15bcbd
61 changed files with 1426 additions and 171 deletions

View File

@ -2310,6 +2310,130 @@ pub enum CardNetwork {
RuPay,
#[serde(alias = "MAESTRO")]
Maestro,
#[serde(alias = "STAR")]
Star,
#[serde(alias = "PULSE")]
Pulse,
#[serde(alias = "ACCEL")]
Accel,
#[serde(alias = "NYCE")]
Nyce,
}
#[derive(
Clone,
Debug,
Eq,
Hash,
PartialEq,
serde::Deserialize,
serde::Serialize,
strum::Display,
strum::EnumIter,
strum::EnumString,
utoipa::ToSchema,
)]
#[router_derive::diesel_enum(storage_type = "db_enum")]
#[serde(rename_all = "snake_case")]
pub enum RegulatedName {
#[serde(rename = "GOVERNMENT NON-EXEMPT INTERCHANGE FEE (WITH FRAUD)")]
#[strum(serialize = "GOVERNMENT NON-EXEMPT INTERCHANGE FEE (WITH FRAUD)")]
NonExemptWithFraud,
#[serde(untagged)]
#[strum(default)]
Unknown(String),
}
#[derive(
Clone,
Debug,
Eq,
Hash,
PartialEq,
serde::Deserialize,
serde::Serialize,
strum::Display,
strum::EnumIter,
strum::EnumString,
utoipa::ToSchema,
Copy,
)]
#[router_derive::diesel_enum(storage_type = "db_enum")]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "lowercase")]
pub enum PanOrToken {
Pan,
Token,
}
#[derive(
Clone,
Debug,
Eq,
Hash,
PartialEq,
serde::Deserialize,
serde::Serialize,
strum::Display,
strum::EnumIter,
strum::EnumString,
utoipa::ToSchema,
Copy,
)]
#[router_derive::diesel_enum(storage_type = "db_enum")]
#[strum(serialize_all = "UPPERCASE")]
#[serde(rename_all = "snake_case")]
pub enum CardType {
Credit,
Debit,
}
#[derive(Debug, Clone, Serialize, Deserialize, strum::EnumString, strum::Display)]
#[serde(rename_all = "snake_case")]
pub enum MerchantCategoryCode {
#[serde(rename = "merchant_category_code_0001")]
Mcc0001,
}
impl CardNetwork {
pub fn is_global_network(&self) -> bool {
match self {
Self::Interac
| Self::Star
| Self::Pulse
| Self::Accel
| Self::Nyce
| Self::CartesBancaires => false,
Self::Visa
| Self::Mastercard
| Self::AmericanExpress
| Self::JCB
| Self::DinersClub
| Self::Discover
| Self::UnionPay
| Self::RuPay
| Self::Maestro => true,
}
}
pub fn is_us_local_network(&self) -> bool {
match self {
Self::Star | Self::Pulse | Self::Accel | Self::Nyce => true,
Self::Interac
| Self::CartesBancaires
| Self::Visa
| Self::Mastercard
| Self::AmericanExpress
| Self::JCB
| Self::DinersClub
| Self::Discover
| Self::UnionPay
| Self::RuPay
| Self::Maestro => false,
}
}
}
/// Stage of the dispute