feat(router): add payment method-specific features to connector feature list (#6963)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
AkshayaFoiger
2025-01-21 13:33:09 +05:30
committed by GitHub
parent d35a922281
commit e35f7079e3
10 changed files with 229 additions and 93 deletions

View File

@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
use crate::enums::{
CaptureMethod, Connector, CountryAlpha2, Currency, EventClass, FeatureStatus,
CaptureMethod, CardNetwork, Connector, CountryAlpha2, Currency, EventClass, FeatureStatus,
PaymentConnectorCategory, PaymentMethod, PaymentMethodType,
};
@ -14,6 +14,23 @@ pub struct FeatureMatrixRequest {
pub connectors: Option<Vec<Connector>>,
}
#[derive(Debug, Clone, ToSchema, Serialize)]
pub struct CardSpecificFeatures {
/// Indicates whether three_ds card payments are supported.
pub three_ds: FeatureStatus,
/// Indicates whether non three_ds card payments are supported.
pub non_three_ds: FeatureStatus,
/// List of supported card networks
pub supported_card_networks: Vec<CardNetwork>,
}
#[derive(Debug, Clone, ToSchema, Serialize)]
#[serde(untagged)]
pub enum PaymentMethodSpecificFeatures {
/// Card specific features
Card(CardSpecificFeatures),
}
#[derive(Debug, ToSchema, Serialize)]
pub struct SupportedPaymentMethod {
pub payment_method: PaymentMethod,
@ -21,6 +38,8 @@ pub struct SupportedPaymentMethod {
pub mandates: FeatureStatus,
pub refunds: FeatureStatus,
pub supported_capture_methods: Vec<CaptureMethod>,
#[serde(flatten)]
pub payment_method_specific_features: Option<PaymentMethodSpecificFeatures>,
pub supported_countries: Option<HashSet<CountryAlpha2>>,
pub supported_currencies: Option<HashSet<Currency>>,
}