feat(router): add endpoint for listing connector features (#6612)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: Pa1NarK <69745008+pixincreate@users.noreply.github.com>
This commit is contained in:
AkshayaFoiger
2024-12-24 14:37:19 +05:30
committed by GitHub
parent 5e4eded8fa
commit a423ff53d3
124 changed files with 1490 additions and 252 deletions

View File

@ -0,0 +1,46 @@
use std::collections::HashSet;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
use crate::enums::{
CaptureMethod, Connector, CountryAlpha2, Currency, EventClass, FeatureStatus,
PaymentConnectorCategory, PaymentMethod, PaymentMethodType,
};
#[derive(Default, Debug, Deserialize, Serialize, Clone, ToSchema)]
pub struct FeatureMatrixRequest {
// List of connectors for which the feature matrix is requested
pub connectors: Option<Vec<Connector>>,
}
#[derive(Debug, ToSchema, Serialize)]
pub struct SupportedPaymentMethod {
pub payment_method: PaymentMethod,
pub payment_method_type: PaymentMethodType,
pub mandates: FeatureStatus,
pub refunds: FeatureStatus,
pub supported_capture_methods: Vec<CaptureMethod>,
pub supported_countries: Option<HashSet<CountryAlpha2>>,
pub supported_currencies: Option<HashSet<Currency>>,
}
#[derive(Debug, ToSchema, Serialize)]
pub struct ConnectorFeatureMatrixResponse {
pub name: String,
pub description: Option<String>,
pub category: Option<PaymentConnectorCategory>,
pub supported_payment_methods: Vec<SupportedPaymentMethod>,
pub supported_webhook_flows: Option<Vec<EventClass>>,
}
#[derive(Debug, Serialize, ToSchema)]
pub struct FeatureMatrixListResponse {
/// The number of connectors included in the response
pub connector_count: usize,
// The list of payments response objects
pub connectors: Vec<ConnectorFeatureMatrixResponse>,
}
impl common_utils::events::ApiEventMetric for FeatureMatrixListResponse {}
impl common_utils::events::ApiEventMetric for FeatureMatrixRequest {}

View File

@ -16,6 +16,7 @@ pub mod ephemeral_key;
#[cfg(feature = "errors")]
pub mod errors;
pub mod events;
pub mod feature_matrix;
pub mod files;
pub mod gsm;
pub mod health_check;