mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
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:
46
crates/api_models/src/feature_matrix.rs
Normal file
46
crates/api_models/src/feature_matrix.rs
Normal 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 {}
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user