Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(router): add payment method-specific features to connector feature list (#6963)
AkshayaFoigere35f7079e3fc
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.jsonindex 41b2c0f80e..892931256b 100644--- a/api-reference-v2/openapi_spec.json+++ b/api-reference-v2/openapi_spec.json@@ -6393,6 +6393,29 @@}}},+ "CardSpecificFeatures": {+ "type": "object",+ "required": [+ "three_ds",+ "non_three_ds",+ "supported_card_networks"+ ],+ "properties": {+ "three_ds": {+ "$ref": "#/components/schemas/FeatureStatus"+ },+ "non_three_ds": {+ "$ref": "#/components/schemas/FeatureStatus"+ },+ "supported_card_networks": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/CardNetwork"+ },+ "description": "List of supported card networks"+ }+ }+ },"CardToken": {"type": "object","required": [@@ -14117,6 +14140,13 @@}]},+ "PaymentMethodSpecificFeatures": {+ "oneOf": [+ {+ "$ref": "#/components/schemas/CardSpecificFeatures"+ }+ ]+ },"PaymentMethodStatus": {"type": "string","description": "Payment Method Status",@@ -20580,50 +20610,62 @@"additionalProperties": false},"SupportedPaymentMethod": {- "type": "object",- "required": [- "payment_method",- "payment_method_type",- "mandates",- "refunds",- "supported_capture_methods"- ],- "properties": {- "payment_method": {- "$ref": "#/components/schemas/PaymentMethod"- },- "payment_method_type": {- "$ref": "#/components/schemas/PaymentMethodType"- },- "mandates": {- "$ref": "#/components/schemas/FeatureStatus"- },- "refunds": {- "$ref": "#/components/schemas/FeatureStatus"- },- "supported_capture_methods": {- "type": "array",- "items": {- "$ref": "#/components/schemas/CaptureMethod"- }- },- "supported_countries": {- "type": "array",- "items": {- "$ref": "#/components/schemas/CountryAlpha2"- },- "uniqueItems": true,+ "allOf": [+ {+ "allOf": [+ {+ "$ref": "#/components/schemas/PaymentMethodSpecificFeatures"+ }+ ],"nullable": true},- "supported_currencies": {- "type": "array",- "items": {- "$ref": "#/components/schemas/Currency"- },- "uniqueItems": true,- "nullable": true+ {+ "type": "object",+ "required": [+ "payment_method",+ "payment_method_type",+ "mandates",+ "refunds",+ "supported_capture_methods"+ ],+ "properties": {+ "payment_method": {+ "$ref": "#/components/schemas/PaymentMethod"+ },+ "payment_method_type": {+ "$ref": "#/components/schemas/PaymentMethodType"+ },+ "mandates": {+ "$ref": "#/components/schemas/FeatureStatus"+ },+ "refunds": {+ "$ref": "#/components/schemas/FeatureStatus"+ },+ "supported_capture_methods": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/CaptureMethod"+ }+ },+ "supported_countries": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/CountryAlpha2"+ },+ "uniqueItems": true,+ "nullable": true+ },+ "supported_currencies": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/Currency"+ },+ "uniqueItems": true,+ "nullable": true+ }+ }}- }+ ]},"SurchargeCalculationOverride": {"type": "string",diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.jsonindex c29c253b1f..b282566e50 100644--- a/api-reference/openapi_spec.json+++ b/api-reference/openapi_spec.json@@ -9053,6 +9053,29 @@}}},+ "CardSpecificFeatures": {+ "type": "object",+ "required": [+ "three_ds",+ "non_three_ds",+ "supported_card_networks"+ ],+ "properties": {+ "three_ds": {+ "$ref": "#/components/schemas/FeatureStatus"+ },+ "non_three_ds": {+ "$ref": "#/components/schemas/FeatureStatus"+ },+ "supported_card_networks": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/CardNetwork"+ },+ "description": "List of supported card networks"+ }+ }+ },"CardToken": {"type": "object","required": [@@ -17190,6 +17213,13 @@}}},+ "PaymentMethodSpecificFeatures": {+ "oneOf": [+ {+ "$ref": "#/components/schemas/CardSpecificFeatures"+ }+ ]+ },"PaymentMethodStatus": {"type": "string","description": "Payment Method Status",@@ -25176,50 +25206,62 @@}},"SupportedPaymentMethod": {- "type": "object",- "required": [- "payment_method",- "payment_method_type",- "mandates",- "refunds",- "supported_capture_methods"- ],- "properties": {- "payment_method": {- "$ref": "#/components/schemas/PaymentMethod"- },- "payment_method_type": {- "$ref": "#/components/schemas/PaymentMethodType"- },- "mandates": {- "$ref": "#/components/schemas/FeatureStatus"- },- "refunds": {- "$ref": "#/components/schemas/FeatureStatus"- },- "supported_capture_methods": {- "type": "array",- "items": {- "$ref": "#/components/schemas/CaptureMethod"- }- },- "supported_countries": {- "type": "array",- "items": {- "$ref": "#/components/schemas/CountryAlpha2"- },- "uniqueItems": true,+ "allOf": [+ {+ "allOf": [+ {+ "$ref": "#/components/schemas/PaymentMethodSpecificFeatures"+ }+ ],"nullable": true},- "supported_currencies": {- "type": "array",- "items": {- "$ref": "#/components/schemas/Currency"- },- "uniqueItems": true,- "nullable": true+ {+ "type": "object",+ "required": [+ "payment_method",+ "payment_method_type",+ "mandates",+ "refunds",+ "supported_capture_methods"+ ],+ "properties": {+ "payment_method": {+ "$ref": "#/components/schemas/PaymentMethod"+ },+ "payment_method_type": {+ "$ref": "#/components/schemas/PaymentMethodType"+ },+ "mandates": {+ "$ref": "#/components/schemas/FeatureStatus"+ },+ "refunds": {+ "$ref": "#/components/schemas/FeatureStatus"+ },+ "supported_capture_methods": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/CaptureMethod"+ }+ },+ "supported_countries": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/CountryAlpha2"+ },+ "uniqueItems": true,+ "nullable": true+ },+ "supported_currencies": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/Currency"+ },+ "uniqueItems": true,+ "nullable": true+ }+ }}- }+ ]},"SurchargeDetailsResponse": {"type": "object",diff --git a/crates/api_models/src/feature_matrix.rs b/crates/api_models/src/feature_matrix.rsindex 2eaade1b61..c1eb699705 100644--- a/crates/api_models/src/feature_matrix.rs+++ b/crates/api_models/src/feature_matrix.rs@@ -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>>,}diff --git a/crates/hyperswitch_connectors/src/connectors/bambora.rs b/crates/hyperswitch_connectors/src/connectors/bambora.rsindex 193a16df0b..d972e004f2 100644--- a/crates/hyperswitch_connectors/src/connectors/bambora.rs+++ b/crates/hyperswitch_connectors/src/connectors/bambora.rs@@ -825,6 +825,15 @@ lazy_static! {enums::CaptureMethod::SequentialAutomatic,];+ let supported_card_network = vec![+ common_enums::CardNetwork::Visa,+ common_enums::CardNetwork::Mastercard,+ common_enums::CardNetwork::AmericanExpress,+ common_enums::CardNetwork::Discover,+ common_enums::CardNetwork::JCB,+ common_enums::CardNetwork::DinersClub,+ ];+let mut bambora_supported_payment_methods = SupportedPaymentMethods::new();bambora_supported_payment_methods.add(@@ -834,15 +843,15 @@ lazy_static! {mandates: common_enums::FeatureStatus::NotSupported,refunds: common_enums::FeatureStatus::Supported,supported_capture_methods: default_capture_methods.clone(),- },- );- bambora_supported_payment_methods.add(- enums::PaymentMethod::Card,- enums::PaymentMethodType::Debit,- PaymentMethodDetails {- mandates: common_enums::FeatureStatus::NotSupported,- refunds: common_enums::FeatureStatus::Supported,- supported_capture_methods: default_capture_methods.clone(),+ specific_features: Some(+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({+ api_models::feature_matrix::CardSpecificFeatures {+ three_ds: common_enums::FeatureStatus::Supported,+ non_three_ds: common_enums::FeatureStatus::Supported,+ supported_card_networks: supported_card_network.clone(),+ }+ }),+ ),},);diff --git a/crates/hyperswitch_connectors/src/connectors/deutschebank.rs b/crates/hyperswitch_connectors/src/connectors/deutschebank.rsindex f4d5fe5fdf..f98d6843be 100644--- a/crates/hyperswitch_connectors/src/connectors/deutschebank.rs+++ b/crates/hyperswitch_connectors/src/connectors/deutschebank.rs@@ -978,6 +978,12 @@ lazy_static! {enums::CaptureMethod::Manual,enums::CaptureMethod::SequentialAutomatic,];++ let supported_card_network = vec![+ common_enums::CardNetwork::Visa,+ common_enums::CardNetwork::Mastercard,+ ];+let mut deutschebank_supported_payment_methods = SupportedPaymentMethods::new();deutschebank_supported_payment_methods.add(@@ -987,6 +993,7 @@ lazy_static! {mandates: enums::FeatureStatus::Supported,refunds: enums::FeatureStatus::Supported,supported_capture_methods: supported_capture_methods.clone(),+ specific_features: None,});@@ -997,6 +1004,15 @@ lazy_static! {mandates: enums::FeatureStatus::NotSupported,refunds: enums::FeatureStatus::Supported,supported_capture_methods: supported_capture_methods.clone(),+ specific_features: Some(+ api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({+ api_models::feature_matrix::CardSpecificFeatures {+ three_ds: common_enums::FeatureStatus::Supported,+ non_three_ds: common_enums::FeatureStatus::NotSupported,+ supported_card_networks: supported_card_network.clone(),+ }+ }),+ ),});diff --git a/crates/hyperswitch_connectors/src/connectors/zsl.rs b/crates/hyperswitch_connectors/src/connectors/zsl.rsindex 434cfbc343..cf01c31b74 100644--- a/crates/hyperswitch_connectors/src/connectors/zsl.rs+++ b/crates/hyperswitch_connectors/src/connectors/zsl.rs@@ -458,6 +458,7 @@ lazy_static! {mandates: common_enums::FeatureStatus::NotSupported,refunds: common_enums::FeatureStatus::NotSupported,supported_capture_methods,+ specific_features: None,},);diff --git a/crates/hyperswitch_domain_models/src/router_response_types.rs b/crates/hyperswitch_domain_models/src/router_response_types.rsindex 613797e298..1a1488031f 100644--- a/crates/hyperswitch_domain_models/src/router_response_types.rs+++ b/crates/hyperswitch_domain_models/src/router_response_types.rs@@ -531,6 +531,8 @@ pub struct PaymentMethodDetails {pub refunds: common_enums::FeatureStatus,/// List of supported capture methodspub supported_capture_methods: Vec<common_enums::CaptureMethod>,+ /// Payment method specific features+ pub specific_features: Option<api_models::feature_matrix::PaymentMethodSpecificFeatures>,}/// list of payment method types and metadata related to themdiff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rsindex 32c2402e10..f3068e1b50 100644--- a/crates/openapi/src/openapi.rs+++ b/crates/openapi/src/openapi.rs@@ -694,6 +694,8 @@ Never share your secret api keys. Keep them guarded and secure.api_models::feature_matrix::FeatureMatrixListResponse,api_models::feature_matrix::FeatureMatrixRequest,api_models::feature_matrix::ConnectorFeatureMatrixResponse,+ api_models::feature_matrix::PaymentMethodSpecificFeatures,+ api_models::feature_matrix::CardSpecificFeatures,api_models::feature_matrix::SupportedPaymentMethod,)),modifiers(&SecurityAddon)diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rsindex 5b4c89c3f4..3b1fefefa1 100644--- a/crates/openapi/src/openapi_v2.rs+++ b/crates/openapi/src/openapi_v2.rs@@ -643,6 +643,8 @@ Never share your secret api keys. Keep them guarded and secure.api_models::feature_matrix::FeatureMatrixListResponse,api_models::feature_matrix::FeatureMatrixRequest,api_models::feature_matrix::ConnectorFeatureMatrixResponse,+ api_models::feature_matrix::PaymentMethodSpecificFeatures,+ api_models::feature_matrix::CardSpecificFeatures,api_models::feature_matrix::SupportedPaymentMethod,common_utils::types::BrowserInformation,api_models::payments::PaymentAmountDetailsResponse,diff --git a/crates/router/src/routes/feature_matrix.rs b/crates/router/src/routes/feature_matrix.rsindex 08dd7d0d7b..66a9968021 100644--- a/crates/router/src/routes/feature_matrix.rs+++ b/crates/router/src/routes/feature_matrix.rs@@ -98,7 +98,7 @@ fn build_connector_feature_details(.get_supported_webhook_flows().map(|webhook_flows| webhook_flows.to_vec());feature_matrix::ConnectorFeatureMatrixResponse {- name: connector_name,+ name: connector_name.to_uppercase(),description: connector_about.map(|about| about.description.clone()),category: connector_about.map(|about| about.connector_type),supported_webhook_flows,@@ -142,6 +142,7 @@ fn build_payment_method_wise_feature_details(mandates: feature_metadata.mandates,refunds: feature_metadata.refunds,supported_capture_methods: feature_metadata.supported_capture_methods.clone(),+ payment_method_specific_features: feature_metadata.specific_features.clone(),supported_countries,supported_currencies,}