mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
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:
@ -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"
|
||||
"allOf": [
|
||||
{
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/PaymentMethodSpecificFeatures"
|
||||
}
|
||||
],
|
||||
"nullable": true
|
||||
},
|
||||
"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"
|
||||
{
|
||||
"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
|
||||
}
|
||||
}
|
||||
},
|
||||
"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",
|
||||
|
||||
@ -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"
|
||||
"allOf": [
|
||||
{
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/PaymentMethodSpecificFeatures"
|
||||
}
|
||||
],
|
||||
"nullable": true
|
||||
},
|
||||
"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"
|
||||
{
|
||||
"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
|
||||
}
|
||||
}
|
||||
},
|
||||
"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",
|
||||
|
||||
@ -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>>,
|
||||
}
|
||||
|
||||
@ -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(),
|
||||
}
|
||||
}),
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@ -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(),
|
||||
}
|
||||
}),
|
||||
),
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@ -458,6 +458,7 @@ lazy_static! {
|
||||
mandates: common_enums::FeatureStatus::NotSupported,
|
||||
refunds: common_enums::FeatureStatus::NotSupported,
|
||||
supported_capture_methods,
|
||||
specific_features: None,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@ -531,6 +531,8 @@ pub struct PaymentMethodDetails {
|
||||
pub refunds: common_enums::FeatureStatus,
|
||||
/// List of supported capture methods
|
||||
pub 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 them
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user