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 endpoint for listing connector features (#6612)
AkshayaFoigera423ff53d352
diff --git a/Cargo.lock b/Cargo.lockindex 9c020d9d4d..e34c80bd92 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -4003,6 +4003,7 @@ dependencies = ["hyperswitch_domain_models","hyperswitch_interfaces","image",+ "lazy_static","masking","mime","once_cell",diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.jsonindex 3f9167ab75..636723d808 100644--- a/api-reference-v2/openapi_spec.json+++ b/api-reference-v2/openapi_spec.json@@ -6700,6 +6700,43 @@"zsl"]},+ "ConnectorFeatureMatrixResponse": {+ "type": "object",+ "required": [+ "name",+ "supported_payment_methods"+ ],+ "properties": {+ "name": {+ "type": "string"+ },+ "description": {+ "type": "string",+ "nullable": true+ },+ "category": {+ "allOf": [+ {+ "$ref": "#/components/schemas/PaymentConnectorCategory"+ }+ ],+ "nullable": true+ },+ "supported_payment_methods": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/SupportedPaymentMethod"+ }+ },+ "supported_webhook_flows": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/EventClass"+ },+ "nullable": true+ }+ }+ },"ConnectorMetadata": {"type": "object","description": "Some connectors like Apple Pay, Airwallex and Noon might require some additional information, find specific details in the child attributes below.",@@ -8672,6 +8709,38 @@}}},+ "FeatureMatrixListResponse": {+ "type": "object",+ "required": [+ "connector_count",+ "connectors"+ ],+ "properties": {+ "connector_count": {+ "type": "integer",+ "description": "The number of connectors included in the response",+ "minimum": 0+ },+ "connectors": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/ConnectorFeatureMatrixResponse"+ }+ }+ }+ },+ "FeatureMatrixRequest": {+ "type": "object",+ "properties": {+ "connectors": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/Connector"+ },+ "nullable": true+ }+ }+ },"FeatureMetadata": {"type": "object","description": "additional data that might be required by hyperswitch",@@ -8702,6 +8771,14 @@}}},+ "FeatureStatus": {+ "type": "string",+ "description": "The status of the feature",+ "enum": [+ "not_supported",+ "supported"+ ]+ },"FieldType": {"oneOf": [{@@ -12746,6 +12823,15 @@}]},+ "PaymentConnectorCategory": {+ "type": "string",+ "description": "Connector Access Method",+ "enum": [+ "payment_gateway",+ "alternative_payment_method",+ "bank_acquirer"+ ]+ },"PaymentCreatePaymentLinkConfig": {"allOf": [{@@ -20591,6 +20677,52 @@},"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,+ "nullable": true+ },+ "supported_currencies": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/Currency"+ },+ "uniqueItems": true,+ "nullable": true+ }+ }+ },"SurchargeCalculationOverride": {"type": "string","enum": [diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.jsonindex 2aa19e4e22..3c80fd8c46 100644--- a/api-reference/openapi_spec.json+++ b/api-reference/openapi_spec.json@@ -9319,6 +9319,43 @@"zsl"]},+ "ConnectorFeatureMatrixResponse": {+ "type": "object",+ "required": [+ "name",+ "supported_payment_methods"+ ],+ "properties": {+ "name": {+ "type": "string"+ },+ "description": {+ "type": "string",+ "nullable": true+ },+ "category": {+ "allOf": [+ {+ "$ref": "#/components/schemas/PaymentConnectorCategory"+ }+ ],+ "nullable": true+ },+ "supported_payment_methods": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/SupportedPaymentMethod"+ }+ },+ "supported_webhook_flows": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/EventClass"+ },+ "nullable": true+ }+ }+ },"ConnectorMetadata": {"type": "object","description": "Some connectors like Apple Pay, Airwallex and Noon might require some additional information, find specific details in the child attributes below.",@@ -11269,6 +11306,38 @@}}},+ "FeatureMatrixListResponse": {+ "type": "object",+ "required": [+ "connector_count",+ "connectors"+ ],+ "properties": {+ "connector_count": {+ "type": "integer",+ "description": "The number of connectors included in the response",+ "minimum": 0+ },+ "connectors": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/ConnectorFeatureMatrixResponse"+ }+ }+ }+ },+ "FeatureMatrixRequest": {+ "type": "object",+ "properties": {+ "connectors": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/Connector"+ },+ "nullable": true+ }+ }+ },"FeatureMetadata": {"type": "object","description": "additional data that might be required by hyperswitch",@@ -11299,6 +11368,14 @@}}},+ "FeatureStatus": {+ "type": "string",+ "description": "The status of the feature",+ "enum": [+ "not_supported",+ "supported"+ ]+ },"FieldType": {"oneOf": [{@@ -15782,6 +15859,15 @@}]},+ "PaymentConnectorCategory": {+ "type": "string",+ "description": "Connector Access Method",+ "enum": [+ "payment_gateway",+ "alternative_payment_method",+ "bank_acquirer"+ ]+ },"PaymentCreatePaymentLinkConfig": {"allOf": [{@@ -25077,6 +25163,52 @@}}},+ "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,+ "nullable": true+ },+ "supported_currencies": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/Currency"+ },+ "uniqueItems": true,+ "nullable": true+ }+ }+ },"SurchargeDetailsResponse": {"type": "object","required": [diff --git a/config/config.example.toml b/config/config.example.tomlindex 11e8bed7da..9992663211 100644--- a/config/config.example.toml+++ b/config/config.example.toml@@ -516,6 +516,10 @@ seicomart = { country = "JP", currency = "JPY" }pay_easy = { country = "JP", currency = "JPY" }boleto = { country = "BR", currency = "BRL" }+[pm_filters.bambora]+credit = { country = "US,CA", currency = "USD" }+debit = { country = "US,CA", currency = "USD" }+[pm_filters.volt]open_banking_uk = { country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL" }diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.tomlindex 65ce1fdbc0..dd4938d8d6 100644--- a/config/deployments/integration_test.toml+++ b/config/deployments/integration_test.toml@@ -278,6 +278,10 @@ we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DKgoogle_pay.currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD"paypal.currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD"+[pm_filters.bambora]+credit = { country = "US,CA", currency = "USD" }+debit = { country = "US,CA", currency = "USD" }+[pm_filters.bankofamerica]credit = { currency = "USD" }debit = { currency = "USD" }diff --git a/config/deployments/production.toml b/config/deployments/production.tomlindex 8900b0ac38..9ad4f90b71 100644--- a/config/deployments/production.toml+++ b/config/deployments/production.toml@@ -292,6 +292,10 @@ we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DKgoogle_pay.currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD"paypal.currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD"+[pm_filters.bambora]+credit = { country = "US,CA", currency = "USD" }+debit = { country = "US,CA", currency = "USD" }+[pm_filters.bankofamerica]credit = { currency = "USD" }debit = { currency = "USD" }diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.tomlindex ae4afb2ec3..d2132cd1e4 100644--- a/config/deployments/sandbox.toml+++ b/config/deployments/sandbox.toml@@ -294,6 +294,10 @@ pix = { country = "BR", currency = "BRL" }google_pay.currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD"paypal.currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD"+[pm_filters.bambora]+credit = { country = "US,CA", currency = "USD" }+debit = { country = "US,CA", currency = "USD" }+[pm_filters.bankofamerica]credit = { currency = "USD" }debit = { currency = "USD" }diff --git a/config/development.toml b/config/development.tomlindex 7e3c3c8ba0..d157894ac7 100644--- a/config/development.toml+++ b/config/development.toml@@ -459,6 +459,10 @@ pay_easy = { country = "JP", currency = "JPY" }pix = { country = "BR", currency = "BRL" }boleto = { country = "BR", currency = "BRL" }+[pm_filters.bambora]+credit = { country = "US,CA", currency = "USD" }+debit = { country = "US,CA", currency = "USD" }+[pm_filters.bankofamerica]credit = { currency = "USD" }debit = { currency = "USD" }diff --git a/config/docker_compose.toml b/config/docker_compose.tomlindex 09b27d6bd7..3bbb110635 100644--- a/config/docker_compose.toml+++ b/config/docker_compose.toml@@ -430,6 +430,9 @@ vipps = { country = "NO", currency = "NOK" }walley = { country = "SE,NO,DK,FI", currency = "DKK,EUR,NOK,SEK" }we_chat_pay = { country = "AU,NZ,CN,JP,HK,SG,ES,GB,SE,NO,AT,NL,DE,CY,CH,BE,FR,DK,LI,MT,SI,GR,PT,IT,CA,US", currency = "AUD,CAD,CNY,EUR,GBP,HKD,JPY,NZD,SGD,USD,CNY" }+[pm_filters.bambora]+credit = { country = "US,CA", currency = "USD" }+debit = { country = "US,CA", currency = "USD" }[pm_filters.volt]open_banking_uk = { country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL" }diff --git a/connector-template/mod.rs b/connector-template/mod.rsindex ae450aecf2..ee5f4872d6 100644--- a/connector-template/mod.rs+++ b/connector-template/mod.rs@@ -32,7 +32,7 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation, ConnectorSpecifications},configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -551,3 +551,6 @@ impl webhooks::IncomingWebhook for {{project-name | downcase | pascal_case}} {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for {{project-name | downcase | pascal_case}} {}+diff --git a/crates/api_models/src/feature_matrix.rs b/crates/api_models/src/feature_matrix.rsnew file mode 100644index 0000000000..2eaade1b61--- /dev/null+++ b/crates/api_models/src/feature_matrix.rs@@ -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 {}diff --git a/crates/api_models/src/lib.rs b/crates/api_models/src/lib.rsindex 2d1e87ebf0..60d1d11f27 100644--- a/crates/api_models/src/lib.rs+++ b/crates/api_models/src/lib.rs@@ -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;diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rsindex 193998c3fd..0833ab37e3 100644--- a/crates/common_enums/src/enums.rs+++ b/crates/common_enums/src/enums.rs@@ -3574,3 +3574,42 @@ pub enum StripeChargeType {Direct,Destination,}++/// Connector Access Method+#[derive(+ Clone,+ Copy,+ Debug,+ Eq,+ PartialEq,+ serde::Deserialize,+ serde::Serialize,+ strum::Display,+ ToSchema,+)]+#[strum(serialize_all = "snake_case")]+#[serde(rename_all = "snake_case")]+pub enum PaymentConnectorCategory {+ PaymentGateway,+ AlternativePaymentMethod,+ BankAcquirer,+}++/// The status of the feature+#[derive(+ Clone,+ Copy,+ Debug,+ Eq,+ PartialEq,+ serde::Deserialize,+ serde::Serialize,+ strum::Display,+ ToSchema,+)]+#[strum(serialize_all = "snake_case")]+#[serde(rename_all = "snake_case")]+pub enum FeatureStatus {+ NotSupported,+ Supported,+}diff --git a/crates/hyperswitch_connectors/Cargo.toml b/crates/hyperswitch_connectors/Cargo.tomlindex 6405ac8ae8..ca9e77283c 100644--- a/crates/hyperswitch_connectors/Cargo.toml+++ b/crates/hyperswitch_connectors/Cargo.toml@@ -40,6 +40,7 @@ time = "0.3.35"url = "2.5.0"urlencoding = "2.1.3"uuid = { version = "1.8.0", features = ["v4"] }+lazy_static = "1.4.0"# First party cratesapi_models = { version = "0.1.0", path = "../api_models", features = ["errors"], default-features = false }diff --git a/crates/hyperswitch_connectors/src/connectors/airwallex.rs b/crates/hyperswitch_connectors/src/connectors/airwallex.rsindex 2b7b301ab9..f37bef8302 100644--- a/crates/hyperswitch_connectors/src/connectors/airwallex.rs+++ b/crates/hyperswitch_connectors/src/connectors/airwallex.rs@@ -34,7 +34,7 @@ use hyperswitch_domain_models::{use hyperswitch_interfaces::{api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorRedirectResponse,- ConnectorValidation,+ ConnectorSpecifications, ConnectorValidation,},configs::Connectors,disputes::DisputePayload,@@ -127,9 +127,10 @@ impl ConnectorCommon for Airwallex {}impl ConnectorValidation for Airwallex {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -1105,3 +1106,5 @@ impl ConnectorRedirectResponse for Airwallex {}}}++impl ConnectorSpecifications for Airwallex {}diff --git a/crates/hyperswitch_connectors/src/connectors/amazonpay.rs b/crates/hyperswitch_connectors/src/connectors/amazonpay.rsindex da4d3d79bb..f895954157 100644--- a/crates/hyperswitch_connectors/src/connectors/amazonpay.rs+++ b/crates/hyperswitch_connectors/src/connectors/amazonpay.rs@@ -26,7 +26,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -565,3 +568,5 @@ impl webhooks::IncomingWebhook for Amazonpay {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Amazonpay {}diff --git a/crates/hyperswitch_connectors/src/connectors/bambora.rs b/crates/hyperswitch_connectors/src/connectors/bambora.rsindex 4e69a39fed..193a16df0b 100644--- a/crates/hyperswitch_connectors/src/connectors/bambora.rs+++ b/crates/hyperswitch_connectors/src/connectors/bambora.rs@@ -22,7 +22,10 @@ use hyperswitch_domain_models::{PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData,PaymentsSyncData, RefundsData, SetupMandateRequestData,},- router_response_types::{PaymentsResponseData, RefundsResponseData},+ router_response_types::{+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,+ SupportedPaymentMethods, SupportedPaymentMethodsExt,+ },types::{PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,PaymentsCompleteAuthorizeRouterData, PaymentsSyncRouterData, RefundSyncRouterData,@@ -32,7 +35,7 @@ use hyperswitch_domain_models::{use hyperswitch_interfaces::{api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorRedirectResponse,- ConnectorValidation,+ ConnectorSpecifications, ConnectorValidation,},configs::Connectors,errors,@@ -43,6 +46,7 @@ use hyperswitch_interfaces::{},webhooks,};+use lazy_static::lazy_static;use masking::Mask;use transformers as bambora;@@ -144,23 +148,7 @@ impl ConnectorCommon for Bambora {}}-impl ConnectorValidation for Bambora {- fn validate_capture_method(- &self,- capture_method: Option<enums::CaptureMethod>,- _pmt: Option<enums::PaymentMethodType>,- ) -> CustomResult<(), errors::ConnectorError> {- let capture_method = capture_method.unwrap_or_default();- match capture_method {- enums::CaptureMethod::Automatic- | enums::CaptureMethod::Manual- | enums::CaptureMethod::SequentialAutomatic => Ok(()),- enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err(- utils::construct_not_implemented_error_report(capture_method, self.id()),- ),- }- }-}+impl ConnectorValidation for Bambora {}impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>for Bambora@@ -828,3 +816,56 @@ impl webhooks::IncomingWebhook for Bambora {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++lazy_static! {+ static ref BAMBORA_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {+ let default_capture_methods = vec![+ enums::CaptureMethod::Automatic,+ enums::CaptureMethod::Manual,+ enums::CaptureMethod::SequentialAutomatic,+ ];++ let mut bambora_supported_payment_methods = SupportedPaymentMethods::new();++ bambora_supported_payment_methods.add(+ enums::PaymentMethod::Card,+ enums::PaymentMethodType::Credit,+ PaymentMethodDetails {+ 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(),+ },+ );++ bambora_supported_payment_methods+ };+ static ref BAMBORA_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {+ description: "Bambora is a leading online payment provider in Canada and United States."+ .to_string(),+ connector_type: enums::PaymentConnectorCategory::PaymentGateway,+ };+ static ref BAMBORA_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();+}++impl ConnectorSpecifications for Bambora {+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {+ Some(&*BAMBORA_CONNECTOR_INFO)+ }++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {+ Some(&*BAMBORA_SUPPORTED_PAYMENT_METHODS)+ }++ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {+ Some(&*BAMBORA_SUPPORTED_WEBHOOK_FLOWS)+ }+}diff --git a/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs b/crates/hyperswitch_connectors/src/connectors/bamboraapac.rsindex 9954c56807..cdfacbf3ec 100644--- a/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs+++ b/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs@@ -29,7 +29,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE},errors,@@ -95,9 +98,10 @@ where}impl ConnectorValidation for Bamboraapac {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -742,3 +746,5 @@ impl IncomingWebhook for Bamboraapac {fn html_to_xml_string_conversion(res: String) -> String {res.replace("<", "<").replace(">", ">")}++impl ConnectorSpecifications for Bamboraapac {}diff --git a/crates/hyperswitch_connectors/src/connectors/billwerk.rs b/crates/hyperswitch_connectors/src/connectors/billwerk.rsindex 7a6fefa820..3987039de9 100644--- a/crates/hyperswitch_connectors/src/connectors/billwerk.rs+++ b/crates/hyperswitch_connectors/src/connectors/billwerk.rs@@ -29,7 +29,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE},errors,@@ -151,9 +154,10 @@ impl ConnectorCommon for Billwerk {}impl ConnectorValidation for Billwerk {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<common_enums::CaptureMethod>,+ _payment_method: common_enums::PaymentMethod,_pmt: Option<common_enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -813,3 +817,5 @@ impl IncomingWebhook for Billwerk {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Billwerk {}diff --git a/crates/hyperswitch_connectors/src/connectors/bitpay.rs b/crates/hyperswitch_connectors/src/connectors/bitpay.rsindex 032b8cf051..c2a2c7b76a 100644--- a/crates/hyperswitch_connectors/src/connectors/bitpay.rs+++ b/crates/hyperswitch_connectors/src/connectors/bitpay.rs@@ -27,7 +27,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,consts, errors,events::connector_api_logs::ConnectorEvent,@@ -412,3 +415,5 @@ impl webhooks::IncomingWebhook for Bitpay {Ok(Box::new(notif))}}++impl ConnectorSpecifications for Bitpay {}diff --git a/crates/hyperswitch_connectors/src/connectors/bluesnap.rs b/crates/hyperswitch_connectors/src/connectors/bluesnap.rsindex 3267637b09..8fac36424e 100644--- a/crates/hyperswitch_connectors/src/connectors/bluesnap.rs+++ b/crates/hyperswitch_connectors/src/connectors/bluesnap.rs@@ -35,7 +35,7 @@ use hyperswitch_domain_models::{use hyperswitch_interfaces::{api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorRedirectResponse,- ConnectorValidation,+ ConnectorSpecifications, ConnectorValidation,},configs::Connectors,consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE},@@ -204,9 +204,10 @@ impl ConnectorCommon for Bluesnap {}impl ConnectorValidation for Bluesnap {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -1369,3 +1370,5 @@ fn get_rsync_url_with_connector_refund_id(req.request.get_connector_refund_id()?))}++impl ConnectorSpecifications for Bluesnap {}diff --git a/crates/hyperswitch_connectors/src/connectors/boku.rs b/crates/hyperswitch_connectors/src/connectors/boku.rsindex 73b17ca802..6819597987 100644--- a/crates/hyperswitch_connectors/src/connectors/boku.rs+++ b/crates/hyperswitch_connectors/src/connectors/boku.rs@@ -28,7 +28,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,consts::NO_ERROR_CODE,errors,@@ -168,9 +171,10 @@ impl ConnectorCommon for Boku {}impl ConnectorValidation for Boku {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -705,3 +709,5 @@ fn get_xml_deserialized(}}}++impl ConnectorSpecifications for Boku {}diff --git a/crates/hyperswitch_connectors/src/connectors/cashtocode.rs b/crates/hyperswitch_connectors/src/connectors/cashtocode.rsindex b4e066ebd9..cc7ac38123 100644--- a/crates/hyperswitch_connectors/src/connectors/cashtocode.rs+++ b/crates/hyperswitch_connectors/src/connectors/cashtocode.rs@@ -25,7 +25,10 @@ use hyperswitch_domain_models::{types::{PaymentsAuthorizeRouterData, PaymentsSyncRouterData},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -148,9 +151,10 @@ impl ConnectorCommon for Cashtocode {}impl ConnectorValidation for Cashtocode {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -452,3 +456,5 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Cashtocimpl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Cashtocode {// default implementation of build_request method will be executed}++impl ConnectorSpecifications for Cashtocode {}diff --git a/crates/hyperswitch_connectors/src/connectors/coinbase.rs b/crates/hyperswitch_connectors/src/connectors/coinbase.rsindex 168cb2132d..f58437ff07 100644--- a/crates/hyperswitch_connectors/src/connectors/coinbase.rs+++ b/crates/hyperswitch_connectors/src/connectors/coinbase.rs@@ -29,7 +29,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -133,9 +136,10 @@ impl ConnectorCommon for Coinbase {}impl ConnectorValidation for Coinbase {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -440,3 +444,5 @@ impl webhooks::IncomingWebhook for Coinbase {Ok(Box::new(notif.event))}}++impl ConnectorSpecifications for Coinbase {}diff --git a/crates/hyperswitch_connectors/src/connectors/cryptopay.rs b/crates/hyperswitch_connectors/src/connectors/cryptopay.rsindex dcd629f433..2650d8f1e9 100644--- a/crates/hyperswitch_connectors/src/connectors/cryptopay.rs+++ b/crates/hyperswitch_connectors/src/connectors/cryptopay.rs@@ -27,7 +27,10 @@ use hyperswitch_domain_models::{types::{PaymentsAuthorizeRouterData, PaymentsSyncRouterData},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -496,3 +499,5 @@ impl webhooks::IncomingWebhook for Cryptopay {Ok(Box::new(notif))}}++impl ConnectorSpecifications for Cryptopay {}diff --git a/crates/hyperswitch_connectors/src/connectors/ctp_mastercard.rs b/crates/hyperswitch_connectors/src/connectors/ctp_mastercard.rsindex 1d82b98af8..6a1c7e0881 100644--- a/crates/hyperswitch_connectors/src/connectors/ctp_mastercard.rs+++ b/crates/hyperswitch_connectors/src/connectors/ctp_mastercard.rs@@ -15,7 +15,10 @@ use hyperswitch_domain_models::{router_response_types::{PaymentsResponseData, RefundsResponseData},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors, webhooks,};@@ -122,3 +125,5 @@ impl webhooks::IncomingWebhook for CtpMastercard {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for CtpMastercard {}diff --git a/crates/hyperswitch_connectors/src/connectors/datatrans.rs b/crates/hyperswitch_connectors/src/connectors/datatrans.rsindex 081fedc6a3..2a19a99c0f 100644--- a/crates/hyperswitch_connectors/src/connectors/datatrans.rs+++ b/crates/hyperswitch_connectors/src/connectors/datatrans.rs@@ -2,7 +2,7 @@ pub mod transformers;use api_models::webhooks::{IncomingWebhookEvent, ObjectReferenceId};use base64::Engine;-use common_enums::{CaptureMethod, PaymentMethodType};+use common_enums::{CaptureMethod, PaymentMethod, PaymentMethodType};use common_utils::{consts::BASE64_ENGINE,errors::CustomResult,@@ -30,7 +30,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -153,9 +156,10 @@ impl ConnectorCommon for Datatrans {impl ConnectorValidation for Datatrans {//TODO: implement functions when support enabled- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<CaptureMethod>,+ _payment_method: PaymentMethod,_pmt: Option<PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -682,3 +686,5 @@ impl IncomingWebhook for Datatrans {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Datatrans {}diff --git a/crates/hyperswitch_connectors/src/connectors/deutschebank.rs b/crates/hyperswitch_connectors/src/connectors/deutschebank.rsindex 28bcd8afca..3098d27e7e 100644--- a/crates/hyperswitch_connectors/src/connectors/deutschebank.rs+++ b/crates/hyperswitch_connectors/src/connectors/deutschebank.rs@@ -27,7 +27,10 @@ use hyperswitch_domain_models::{PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData,PaymentsSyncData, RefundsData, SetupMandateRequestData,},- router_response_types::{PaymentsResponseData, RefundsResponseData},+ router_response_types::{+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,+ SupportedPaymentMethods, SupportedPaymentMethodsExt,+ },types::{PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,PaymentsCompleteAuthorizeRouterData, PaymentsSyncRouterData, RefreshTokenRouterData,@@ -35,13 +38,17 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,types::{self, Response},webhooks,};+use lazy_static::lazy_static;use masking::{ExposeInterface, Mask, Secret};use rand::distributions::{Alphanumeric, DistString};use ring::hmac;@@ -172,22 +179,6 @@ impl ConnectorCommon for Deutschebank {}impl ConnectorValidation for Deutschebank {- fn validate_capture_method(- &self,- capture_method: Option<enums::CaptureMethod>,- _pmt: Option<enums::PaymentMethodType>,- ) -> CustomResult<(), errors::ConnectorError> {- let capture_method = capture_method.unwrap_or_default();- match capture_method {- enums::CaptureMethod::Automatic- | enums::CaptureMethod::Manual- | enums::CaptureMethod::SequentialAutomatic => Ok(()),- enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err(- utils::construct_not_implemented_error_report(capture_method, self.id()),- ),- }- }-fn validate_mandate_payment(&self,pm_type: Option<enums::PaymentMethodType>,@@ -948,3 +939,50 @@ impl webhooks::IncomingWebhook for Deutschebank {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++lazy_static! {+ static ref DEUTSCHEBANK_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {+ let supported_capture_methods = vec![+ enums::CaptureMethod::Automatic,+ enums::CaptureMethod::Manual,+ enums::CaptureMethod::SequentialAutomatic,+ ];+ let mut deutschebank_supported_payment_methods = SupportedPaymentMethods::new();++ deutschebank_supported_payment_methods.add(+ enums::PaymentMethod::BankDebit,+ enums::PaymentMethodType::Sepa,+ PaymentMethodDetails{+ mandates: enums::FeatureStatus::NotSupported,+ refunds: enums::FeatureStatus::NotSupported,+ supported_capture_methods,+ }+ );++ deutschebank_supported_payment_methods+ };++ static ref DEUTSCHEBANK_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {+ description:+ "Deutsche Bank is a German multinational investment bank and financial services company "+ .to_string(),+ connector_type: enums::PaymentConnectorCategory::BankAcquirer,+ };++ static ref DEUTSCHEBANK_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();++}++impl ConnectorSpecifications for Deutschebank {+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {+ Some(&*DEUTSCHEBANK_CONNECTOR_INFO)+ }++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {+ Some(&*DEUTSCHEBANK_SUPPORTED_PAYMENT_METHODS)+ }++ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {+ Some(&*DEUTSCHEBANK_SUPPORTED_WEBHOOK_FLOWS)+ }+}diff --git a/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs b/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rsindex 0f84bfa619..74d76c4754 100644--- a/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs+++ b/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs@@ -35,7 +35,7 @@ use hyperswitch_domain_models::{use hyperswitch_interfaces::{api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorRedirectResponse,- ConnectorValidation,+ ConnectorSpecifications, ConnectorValidation,},configs::Connectors,errors,@@ -163,9 +163,10 @@ impl ConnectorCommon for Digitalvirgo {}impl ConnectorValidation for Digitalvirgo {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -538,3 +539,5 @@ impl webhooks::IncomingWebhook for Digitalvirgo {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Digitalvirgo {}diff --git a/crates/hyperswitch_connectors/src/connectors/dlocal.rs b/crates/hyperswitch_connectors/src/connectors/dlocal.rsindex a61110435e..0aefd65e4a 100644--- a/crates/hyperswitch_connectors/src/connectors/dlocal.rs+++ b/crates/hyperswitch_connectors/src/connectors/dlocal.rs@@ -32,7 +32,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -154,9 +157,10 @@ impl ConnectorCommon for Dlocal {}impl ConnectorValidation for Dlocal {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -688,3 +692,5 @@ impl webhooks::IncomingWebhook for Dlocal {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Dlocal {}diff --git a/crates/hyperswitch_connectors/src/connectors/elavon.rs b/crates/hyperswitch_connectors/src/connectors/elavon.rsindex 4fcc75296f..28ffecff73 100644--- a/crates/hyperswitch_connectors/src/connectors/elavon.rs+++ b/crates/hyperswitch_connectors/src/connectors/elavon.rs@@ -1,7 +1,7 @@pub mod transformers;use std::{collections::HashMap, str};-use common_enums::{CaptureMethod, PaymentMethodType};+use common_enums::{CaptureMethod, PaymentMethod, PaymentMethodType};use common_utils::{errors::CustomResult,request::{Method, Request, RequestBuilder, RequestContent},@@ -28,7 +28,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -579,9 +582,10 @@ impl webhooks::IncomingWebhook for Elavon {}impl ConnectorValidation for Elavon {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<CaptureMethod>,+ _payment_method: PaymentMethod,_pmt: Option<PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -603,3 +607,5 @@ impl ConnectorValidation for Elavon {utils::is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id())}}++impl ConnectorSpecifications for Elavon {}diff --git a/crates/hyperswitch_connectors/src/connectors/fiserv.rs b/crates/hyperswitch_connectors/src/connectors/fiserv.rsindex e241990f8e..e80c57454a 100644--- a/crates/hyperswitch_connectors/src/connectors/fiserv.rs+++ b/crates/hyperswitch_connectors/src/connectors/fiserv.rs@@ -29,7 +29,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,consts, errors,events::connector_api_logs::ConnectorEvent,@@ -179,9 +182,10 @@ impl ConnectorCommon for Fiserv {}impl ConnectorValidation for Fiserv {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -784,3 +788,5 @@ impl webhooks::IncomingWebhook for Fiserv {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Fiserv {}diff --git a/crates/hyperswitch_connectors/src/connectors/fiservemea.rs b/crates/hyperswitch_connectors/src/connectors/fiservemea.rsindex 86a626908b..13ec1870e0 100644--- a/crates/hyperswitch_connectors/src/connectors/fiservemea.rs+++ b/crates/hyperswitch_connectors/src/connectors/fiservemea.rs@@ -28,7 +28,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,consts, errors,events::connector_api_logs::ConnectorEvent,@@ -247,9 +250,10 @@ impl ConnectorCommon for Fiservemea {}impl ConnectorValidation for Fiservemea {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -786,3 +790,5 @@ impl webhooks::IncomingWebhook for Fiservemea {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Fiservemea {}diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu.rs b/crates/hyperswitch_connectors/src/connectors/fiuu.rsindex df2d0f5006..7805281c4b 100644--- a/crates/hyperswitch_connectors/src/connectors/fiuu.rs+++ b/crates/hyperswitch_connectors/src/connectors/fiuu.rs@@ -2,7 +2,7 @@ pub mod transformers;use std::collections::{HashMap, HashSet};-use common_enums::{CaptureMethod, PaymentMethodType};+use common_enums::{CaptureMethod, PaymentMethod, PaymentMethodType};use common_utils::{crypto::{self, GenerateDigest},errors::{self as common_errors, CustomResult},@@ -31,7 +31,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -202,9 +205,10 @@ pub fn build_form_from_struct<T: Serialize>(data: T) -> Result<Form, common_erro}impl ConnectorValidation for Fiuu {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<CaptureMethod>,+ _payment_method: PaymentMethod,_pmt: Option<PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -925,3 +929,5 @@ impl webhooks::IncomingWebhook for Fiuu {Ok(mandate_reference)}}++impl ConnectorSpecifications for Fiuu {}diff --git a/crates/hyperswitch_connectors/src/connectors/forte.rs b/crates/hyperswitch_connectors/src/connectors/forte.rsindex b35efc7c5f..1068922faa 100644--- a/crates/hyperswitch_connectors/src/connectors/forte.rs+++ b/crates/hyperswitch_connectors/src/connectors/forte.rs@@ -30,7 +30,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,consts::NO_ERROR_CODE,errors,@@ -167,9 +170,10 @@ impl ConnectorCommon for Forte {}impl ConnectorValidation for Forte {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -727,3 +731,5 @@ impl IncomingWebhook for Forte {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Forte {}diff --git a/crates/hyperswitch_connectors/src/connectors/globepay.rs b/crates/hyperswitch_connectors/src/connectors/globepay.rsindex c9e316707c..f11b7b5977 100644--- a/crates/hyperswitch_connectors/src/connectors/globepay.rs+++ b/crates/hyperswitch_connectors/src/connectors/globepay.rs@@ -28,7 +28,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,consts, errors,events::connector_api_logs::ConnectorEvent,@@ -553,3 +556,5 @@ impl webhooks::IncomingWebhook for Globepay {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Globepay {}diff --git a/crates/hyperswitch_connectors/src/connectors/gocardless.rs b/crates/hyperswitch_connectors/src/connectors/gocardless.rsindex 4e866d6f13..0ecf8bac4a 100644--- a/crates/hyperswitch_connectors/src/connectors/gocardless.rs+++ b/crates/hyperswitch_connectors/src/connectors/gocardless.rs@@ -32,7 +32,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -333,9 +336,10 @@ impl ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResp}impl ConnectorValidation for Gocardless {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -868,3 +872,5 @@ impl IncomingWebhook for Gocardless {}}}++impl ConnectorSpecifications for Gocardless {}diff --git a/crates/hyperswitch_connectors/src/connectors/helcim.rs b/crates/hyperswitch_connectors/src/connectors/helcim.rsindex a9344beac1..5f0e49d84e 100644--- a/crates/hyperswitch_connectors/src/connectors/helcim.rs+++ b/crates/hyperswitch_connectors/src/connectors/helcim.rs@@ -29,7 +29,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,consts::NO_ERROR_CODE,errors,@@ -170,9 +173,10 @@ impl ConnectorCommon for Helcim {}impl ConnectorValidation for Helcim {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -810,3 +814,5 @@ impl IncomingWebhook for Helcim {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Helcim {}diff --git a/crates/hyperswitch_connectors/src/connectors/inespay.rs b/crates/hyperswitch_connectors/src/connectors/inespay.rsindex 89bf50c60c..3d3ea346b7 100644--- a/crates/hyperswitch_connectors/src/connectors/inespay.rs+++ b/crates/hyperswitch_connectors/src/connectors/inespay.rs@@ -26,7 +26,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -561,3 +564,5 @@ impl webhooks::IncomingWebhook for Inespay {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Inespay {}diff --git a/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs b/crates/hyperswitch_connectors/src/connectors/jpmorgan.rsindex 9e5a24faab..2689e1a62d 100644--- a/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs+++ b/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs@@ -27,7 +27,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,consts, errors,events::connector_api_logs::ConnectorEvent,@@ -165,9 +168,10 @@ impl ConnectorCommon for Jpmorgan {}impl ConnectorValidation for Jpmorgan {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -820,3 +824,5 @@ impl webhooks::IncomingWebhook for Jpmorgan {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Jpmorgan {}diff --git a/crates/hyperswitch_connectors/src/connectors/mollie.rs b/crates/hyperswitch_connectors/src/connectors/mollie.rsindex 010ae90c56..8cdf4f03a7 100644--- a/crates/hyperswitch_connectors/src/connectors/mollie.rs+++ b/crates/hyperswitch_connectors/src/connectors/mollie.rs@@ -30,7 +30,7 @@ use hyperswitch_domain_models::{use hyperswitch_interfaces::{api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorRedirectResponse,- ConnectorValidation,+ ConnectorSpecifications, ConnectorValidation,},configs::Connectors,consts, errors,@@ -634,3 +634,5 @@ impl ConnectorRedirectResponse for Mollie {}}}++impl ConnectorSpecifications for Mollie {}diff --git a/crates/hyperswitch_connectors/src/connectors/multisafepay.rs b/crates/hyperswitch_connectors/src/connectors/multisafepay.rsindex 562f84cbe8..3403f2213d 100644--- a/crates/hyperswitch_connectors/src/connectors/multisafepay.rs+++ b/crates/hyperswitch_connectors/src/connectors/multisafepay.rs@@ -29,7 +29,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -127,9 +130,10 @@ impl ConnectorCommon for Multisafepay {}impl ConnectorValidation for Multisafepay {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -565,3 +569,5 @@ impl IncomingWebhook for Multisafepay {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Multisafepay {}diff --git a/crates/hyperswitch_connectors/src/connectors/nexinets.rs b/crates/hyperswitch_connectors/src/connectors/nexinets.rsindex 35899737c2..f93eef6572 100644--- a/crates/hyperswitch_connectors/src/connectors/nexinets.rs+++ b/crates/hyperswitch_connectors/src/connectors/nexinets.rs@@ -28,7 +28,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -164,9 +167,10 @@ impl ConnectorCommon for Nexinets {}impl ConnectorValidation for Nexinets {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -738,3 +742,5 @@ impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, Pay{// Not Implemented (R)}++impl ConnectorSpecifications for Nexinets {}diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay.rsindex 0b09b5ea28..9ec2ac7390 100644--- a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs+++ b/crates/hyperswitch_connectors/src/connectors/nexixpay.rs@@ -33,7 +33,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,consts, errors,events::connector_api_logs::ConnectorEvent,@@ -201,9 +204,10 @@ impl ConnectorCommon for Nexixpay {}impl ConnectorValidation for Nexixpay {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -994,3 +998,5 @@ impl webhooks::IncomingWebhook for Nexixpay {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Nexixpay {}diff --git a/crates/hyperswitch_connectors/src/connectors/nomupay.rs b/crates/hyperswitch_connectors/src/connectors/nomupay.rsindex a08bbddc52..9ed1e501cf 100644--- a/crates/hyperswitch_connectors/src/connectors/nomupay.rs+++ b/crates/hyperswitch_connectors/src/connectors/nomupay.rs@@ -26,7 +26,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -561,3 +564,5 @@ impl webhooks::IncomingWebhook for Nomupay {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Nomupay {}diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet.rs b/crates/hyperswitch_connectors/src/connectors/novalnet.rsindex 0f53158187..99da9c5cac 100644--- a/crates/hyperswitch_connectors/src/connectors/novalnet.rs+++ b/crates/hyperswitch_connectors/src/connectors/novalnet.rs@@ -34,7 +34,7 @@ use hyperswitch_domain_models::{use hyperswitch_interfaces::{api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorRedirectResponse,- ConnectorValidation,+ ConnectorSpecifications, ConnectorValidation,},configs::Connectors,disputes, errors,@@ -158,9 +158,10 @@ impl ConnectorCommon for Novalnet {}impl ConnectorValidation for Novalnet {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -920,3 +921,5 @@ impl webhooks::IncomingWebhook for Novalnet {})}}++impl ConnectorSpecifications for Novalnet {}diff --git a/crates/hyperswitch_connectors/src/connectors/paybox.rs b/crates/hyperswitch_connectors/src/connectors/paybox.rsindex 4f85f31c69..89453364d8 100644--- a/crates/hyperswitch_connectors/src/connectors/paybox.rs+++ b/crates/hyperswitch_connectors/src/connectors/paybox.rs@@ -33,7 +33,7 @@ use hyperswitch_domain_models::{use hyperswitch_interfaces::{api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorRedirectResponse,- ConnectorValidation,+ ConnectorSpecifications, ConnectorValidation,},configs::Connectors,errors,@@ -158,9 +158,10 @@ impl ConnectorCommon for Paybox {}impl ConnectorValidation for Paybox {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -701,3 +702,5 @@ impl ConnectorRedirectResponse for Paybox {}}}++impl ConnectorSpecifications for Paybox {}diff --git a/crates/hyperswitch_connectors/src/connectors/payeezy.rs b/crates/hyperswitch_connectors/src/connectors/payeezy.rsindex d2e21a927d..5621b9d123 100644--- a/crates/hyperswitch_connectors/src/connectors/payeezy.rs+++ b/crates/hyperswitch_connectors/src/connectors/payeezy.rs@@ -2,7 +2,7 @@ pub mod transformers;use api_models::webhooks::IncomingWebhookEvent;use base64::Engine;-use common_enums::{CaptureMethod, PaymentMethodType};+use common_enums::{CaptureMethod, PaymentMethod, PaymentMethodType};use common_utils::{errors::CustomResult,ext_traits::ByteSliceExt,@@ -28,7 +28,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -151,9 +154,10 @@ impl ConnectorCommon for Payeezy {}impl ConnectorValidation for Payeezy {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<CaptureMethod>,+ _payment_method: PaymentMethod,_pmt: Option<PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -590,3 +594,5 @@ impl IncomingWebhook for Payeezy {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Payeezy {}diff --git a/crates/hyperswitch_connectors/src/connectors/payu.rs b/crates/hyperswitch_connectors/src/connectors/payu.rsindex 6007b542e9..5ceb759df8 100644--- a/crates/hyperswitch_connectors/src/connectors/payu.rs+++ b/crates/hyperswitch_connectors/src/connectors/payu.rs@@ -28,7 +28,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -139,9 +142,10 @@ impl ConnectorCommon for Payu {}impl ConnectorValidation for Payu {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -796,3 +800,5 @@ impl IncomingWebhook for Payu {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Payu {}diff --git a/crates/hyperswitch_connectors/src/connectors/placetopay.rs b/crates/hyperswitch_connectors/src/connectors/placetopay.rsindex 5f8426e75b..6e593c53e1 100644--- a/crates/hyperswitch_connectors/src/connectors/placetopay.rs+++ b/crates/hyperswitch_connectors/src/connectors/placetopay.rs@@ -28,7 +28,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -136,9 +139,10 @@ impl ConnectorCommon for Placetopay {}impl ConnectorValidation for Placetopay {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -677,3 +681,5 @@ impl IncomingWebhook for Placetopay {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Placetopay {}diff --git a/crates/hyperswitch_connectors/src/connectors/powertranz.rs b/crates/hyperswitch_connectors/src/connectors/powertranz.rsindex 7da88269c7..80a3559052 100644--- a/crates/hyperswitch_connectors/src/connectors/powertranz.rs+++ b/crates/hyperswitch_connectors/src/connectors/powertranz.rs@@ -30,7 +30,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,consts, errors,events::connector_api_logs::ConnectorEvent,@@ -145,9 +148,10 @@ impl ConnectorCommon for Powertranz {}impl ConnectorValidation for Powertranz {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -613,3 +617,5 @@ impl webhooks::IncomingWebhook for Powertranz {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Powertranz {}diff --git a/crates/hyperswitch_connectors/src/connectors/prophetpay.rs b/crates/hyperswitch_connectors/src/connectors/prophetpay.rsindex b6e16fc235..245eaf73e7 100644--- a/crates/hyperswitch_connectors/src/connectors/prophetpay.rs+++ b/crates/hyperswitch_connectors/src/connectors/prophetpay.rs@@ -31,7 +31,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE},errors,@@ -710,3 +713,5 @@ impl IncomingWebhook for Prophetpay {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Prophetpay {}diff --git a/crates/hyperswitch_connectors/src/connectors/rapyd.rs b/crates/hyperswitch_connectors/src/connectors/rapyd.rsindex f909de4dcc..63659c6aad 100644--- a/crates/hyperswitch_connectors/src/connectors/rapyd.rs+++ b/crates/hyperswitch_connectors/src/connectors/rapyd.rs@@ -31,7 +31,9 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,+ },configs::Connectors,disputes::DisputePayload,errors,@@ -146,9 +148,10 @@ impl ConnectorCommon for Rapyd {}impl ConnectorValidation for Rapyd {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -946,3 +949,5 @@ impl IncomingWebhook for Rapyd {})}}++impl ConnectorSpecifications for Rapyd {}diff --git a/crates/hyperswitch_connectors/src/connectors/razorpay.rs b/crates/hyperswitch_connectors/src/connectors/razorpay.rsindex e05be5b107..f5f3aa85e8 100644--- a/crates/hyperswitch_connectors/src/connectors/razorpay.rs+++ b/crates/hyperswitch_connectors/src/connectors/razorpay.rs@@ -27,7 +27,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,consts::NO_ERROR_CODE,errors,@@ -672,3 +675,5 @@ fn get_webhook_object_from_body(Ok(details.payload)}++impl ConnectorSpecifications for Razorpay {}diff --git a/crates/hyperswitch_connectors/src/connectors/redsys.rs b/crates/hyperswitch_connectors/src/connectors/redsys.rsindex 760ce148b4..501182dec0 100644--- a/crates/hyperswitch_connectors/src/connectors/redsys.rs+++ b/crates/hyperswitch_connectors/src/connectors/redsys.rs@@ -26,7 +26,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -561,3 +564,5 @@ impl webhooks::IncomingWebhook for Redsys {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Redsys {}diff --git a/crates/hyperswitch_connectors/src/connectors/shift4.rs b/crates/hyperswitch_connectors/src/connectors/shift4.rsindex 89f81cb3dd..019f681ec5 100644--- a/crates/hyperswitch_connectors/src/connectors/shift4.rs+++ b/crates/hyperswitch_connectors/src/connectors/shift4.rs@@ -31,7 +31,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,consts::NO_ERROR_CODE,errors,@@ -138,9 +141,10 @@ impl ConnectorCommon for Shift4 {}impl ConnectorValidation for Shift4 {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -851,3 +855,5 @@ impl IncomingWebhook for Shift4 {Ok(Box::new(details.data))}}++impl ConnectorSpecifications for Shift4 {}diff --git a/crates/hyperswitch_connectors/src/connectors/square.rs b/crates/hyperswitch_connectors/src/connectors/square.rsindex d3bfd5201e..e07d85800f 100644--- a/crates/hyperswitch_connectors/src/connectors/square.rs+++ b/crates/hyperswitch_connectors/src/connectors/square.rs@@ -34,7 +34,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,consts, errors,events::connector_api_logs::ConnectorEvent,@@ -156,9 +159,10 @@ impl ConnectorCommon for Square {}impl ConnectorValidation for Square {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -922,3 +926,5 @@ impl IncomingWebhook for Square {})}}++impl ConnectorSpecifications for Square {}diff --git a/crates/hyperswitch_connectors/src/connectors/stax.rs b/crates/hyperswitch_connectors/src/connectors/stax.rsindex 63716a20e8..27be4d309d 100644--- a/crates/hyperswitch_connectors/src/connectors/stax.rs+++ b/crates/hyperswitch_connectors/src/connectors/stax.rs@@ -33,7 +33,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,consts, errors,events::connector_api_logs::ConnectorEvent,@@ -137,9 +140,10 @@ impl ConnectorCommon for Stax {}impl ConnectorValidation for Stax {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -918,3 +922,5 @@ impl webhooks::IncomingWebhook for Stax {Ok(Box::new(reference_object))}}++impl ConnectorSpecifications for Stax {}diff --git a/crates/hyperswitch_connectors/src/connectors/taxjar.rs b/crates/hyperswitch_connectors/src/connectors/taxjar.rsindex c2466799cd..30b92d9ceb 100644--- a/crates/hyperswitch_connectors/src/connectors/taxjar.rs+++ b/crates/hyperswitch_connectors/src/connectors/taxjar.rs@@ -28,7 +28,10 @@ use hyperswitch_domain_models::{types::PaymentsTaxCalculationRouterData,};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -292,3 +295,5 @@ impl webhooks::IncomingWebhook for Taxjar {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Taxjar {}diff --git a/crates/hyperswitch_connectors/src/connectors/thunes.rs b/crates/hyperswitch_connectors/src/connectors/thunes.rsindex 972ba0d7dd..b26c0e67fe 100644--- a/crates/hyperswitch_connectors/src/connectors/thunes.rs+++ b/crates/hyperswitch_connectors/src/connectors/thunes.rs@@ -26,7 +26,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -561,3 +564,5 @@ impl webhooks::IncomingWebhook for Thunes {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Thunes {}diff --git a/crates/hyperswitch_connectors/src/connectors/tsys.rs b/crates/hyperswitch_connectors/src/connectors/tsys.rsindex 2575006b0d..39c8f91869 100644--- a/crates/hyperswitch_connectors/src/connectors/tsys.rs+++ b/crates/hyperswitch_connectors/src/connectors/tsys.rs@@ -27,7 +27,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -102,9 +105,10 @@ impl ConnectorCommon for Tsys {}impl ConnectorValidation for Tsys {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -653,3 +657,5 @@ impl webhooks::IncomingWebhook for Tsys {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Tsys {}diff --git a/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs b/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rsindex 00d2d31cd1..ece7130bb1 100644--- a/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs+++ b/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs@@ -28,7 +28,10 @@ use hyperswitch_domain_models::{types::{UasPostAuthenticationRouterData, UasPreAuthenticationRouterData},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,consts::NO_ERROR_MESSAGE,errors,@@ -411,3 +414,5 @@ impl webhooks::IncomingWebhook for UnifiedAuthenticationService {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for UnifiedAuthenticationService {}diff --git a/crates/hyperswitch_connectors/src/connectors/volt.rs b/crates/hyperswitch_connectors/src/connectors/volt.rsindex e902489701..6302188144 100644--- a/crates/hyperswitch_connectors/src/connectors/volt.rs+++ b/crates/hyperswitch_connectors/src/connectors/volt.rs@@ -28,7 +28,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -727,3 +730,5 @@ impl webhooks::IncomingWebhook for Volt {Ok(Box::new(details))}}++impl ConnectorSpecifications for Volt {}diff --git a/crates/hyperswitch_connectors/src/connectors/worldline.rs b/crates/hyperswitch_connectors/src/connectors/worldline.rsindex b68a1e7a65..1bfef7b752 100644--- a/crates/hyperswitch_connectors/src/connectors/worldline.rs+++ b/crates/hyperswitch_connectors/src/connectors/worldline.rs@@ -31,8 +31,8 @@ use hyperswitch_domain_models::{};use hyperswitch_interfaces::{api::{- self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation,- PaymentCapture, PaymentSync,+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation, PaymentCapture, PaymentSync,},configs::Connectors,errors,@@ -170,9 +170,10 @@ impl ConnectorCommon for Worldline {}impl ConnectorValidation for Worldline {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -837,3 +838,5 @@ impl webhooks::IncomingWebhook for Worldline {Ok(response)}}++impl ConnectorSpecifications for Worldline {}diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay.rs b/crates/hyperswitch_connectors/src/connectors/worldpay.rsindex d43739f197..07e4c178f9 100644--- a/crates/hyperswitch_connectors/src/connectors/worldpay.rs+++ b/crates/hyperswitch_connectors/src/connectors/worldpay.rs@@ -36,7 +36,7 @@ use hyperswitch_domain_models::{use hyperswitch_interfaces::{api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorRedirectResponse,- ConnectorValidation,+ ConnectorSpecifications, ConnectorValidation,},configs::Connectors,errors,@@ -161,9 +161,10 @@ impl ConnectorCommon for Worldpay {}impl ConnectorValidation for Worldpay {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -1215,3 +1216,5 @@ impl ConnectorRedirectResponse for Worldpay {}}}++impl ConnectorSpecifications for Worldpay {}diff --git a/crates/hyperswitch_connectors/src/connectors/xendit.rs b/crates/hyperswitch_connectors/src/connectors/xendit.rsindex c3f75a7673..571bd87e83 100644--- a/crates/hyperswitch_connectors/src/connectors/xendit.rs+++ b/crates/hyperswitch_connectors/src/connectors/xendit.rs@@ -26,7 +26,10 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,@@ -561,3 +564,5 @@ impl webhooks::IncomingWebhook for Xendit {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Xendit {}diff --git a/crates/hyperswitch_connectors/src/connectors/zen.rs b/crates/hyperswitch_connectors/src/connectors/zen.rsindex 5dc9e4d317..70703b3164 100644--- a/crates/hyperswitch_connectors/src/connectors/zen.rs+++ b/crates/hyperswitch_connectors/src/connectors/zen.rs@@ -34,7 +34,7 @@ use hyperswitch_domain_models::{use hyperswitch_interfaces::{api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorRedirectResponse,- ConnectorValidation,+ ConnectorSpecifications, ConnectorValidation,},configs::Connectors,consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE},@@ -695,3 +695,5 @@ impl ConnectorRedirectResponse for Zen {}}}++impl ConnectorSpecifications for Zen {}diff --git a/crates/hyperswitch_connectors/src/connectors/zsl.rs b/crates/hyperswitch_connectors/src/connectors/zsl.rsindex 1eeeeafbb2..434cfbc343 100644--- a/crates/hyperswitch_connectors/src/connectors/zsl.rs+++ b/crates/hyperswitch_connectors/src/connectors/zsl.rs@@ -23,7 +23,10 @@ use hyperswitch_domain_models::{PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,RefundsData, SetupMandateRequestData,},- router_response_types::{PaymentsResponseData, RefundsResponseData},+ router_response_types::{+ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,+ SupportedPaymentMethods, SupportedPaymentMethodsExt,+ },types::{PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,PaymentsSessionRouterData, PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,@@ -31,20 +34,23 @@ use hyperswitch_domain_models::{},};use hyperswitch_interfaces::{- api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},+ api::{+ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,+ ConnectorValidation,+ },configs::Connectors,errors,events::connector_api_logs::ConnectorEvent,types::{self, Response},webhooks::{IncomingWebhook, IncomingWebhookFlowError, IncomingWebhookRequestDetails},};+use lazy_static::lazy_static;use masking::{ExposeInterface, Secret};use transformers::{self as zsl, get_status};use crate::{constants::headers,types::{RefreshTokenRouterData, ResponseRouterData},- utils::construct_not_supported_error_report,};#[derive(Debug, Clone)]@@ -122,23 +128,6 @@ impl ConnectorCommon for Zsl {}impl ConnectorValidation for Zsl {- fn validate_capture_method(- &self,- capture_method: Option<enums::CaptureMethod>,- _pmt: Option<enums::PaymentMethodType>,- ) -> CustomResult<(), errors::ConnectorError> {- let capture_method = capture_method.unwrap_or_default();- match capture_method {- enums::CaptureMethod::Automatic | enums::CaptureMethod::SequentialAutomatic => Ok(()),- enums::CaptureMethod::Manual- | enums::CaptureMethod::ManualMultiple- | enums::CaptureMethod::Scheduled => Err(construct_not_supported_error_report(- capture_method,- self.id(),- )),- }- }-fn is_webhook_source_verification_mandatory(&self) -> bool {true}@@ -456,3 +445,46 @@ fn get_webhook_object_from_body(.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;Ok(response)}++lazy_static! {+ static ref ZSL_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {+ let supported_capture_methods = vec![enums::CaptureMethod::Automatic];++ let mut zsl_supported_payment_methods = SupportedPaymentMethods::new();+ zsl_supported_payment_methods.add(+ enums::PaymentMethod::BankTransfer,+ enums::PaymentMethodType::LocalBankTransfer,+ PaymentMethodDetails{+ mandates: common_enums::FeatureStatus::NotSupported,+ refunds: common_enums::FeatureStatus::NotSupported,+ supported_capture_methods,+ },+ );++ zsl_supported_payment_methods+ };++ static ref ZSL_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {+ description:+ "Zsl is a payment gateway operating in China, specializing in facilitating local bank transfers"+ .to_string(),+ connector_type: enums::PaymentConnectorCategory::PaymentGateway,+ };++ static ref ZSL_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();++}++impl ConnectorSpecifications for Zsl {+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {+ Some(&*ZSL_CONNECTOR_INFO)+ }++ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {+ Some(&*ZSL_SUPPORTED_PAYMENT_METHODS)+ }++ fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {+ Some(&*ZSL_SUPPORTED_WEBHOOK_FLOWS)+ }+}diff --git a/crates/hyperswitch_domain_models/src/router_response_types.rs b/crates/hyperswitch_domain_models/src/router_response_types.rsindex 89eb7f9b3c..61453f36b8 100644--- a/crates/hyperswitch_domain_models/src/router_response_types.rs+++ b/crates/hyperswitch_domain_models/src/router_response_types.rs@@ -511,3 +511,56 @@ pub struct CompleteAuthorizeRedirectResponse {pub params: Option<masking::Secret<String>>,pub payload: Option<common_utils::pii::SecretSerdeValue>,}++/// Represents details of a payment method.+#[derive(Debug, Clone)]+pub struct PaymentMethodDetails {+ /// Indicates whether mandates are supported by this payment method.+ pub mandates: common_enums::FeatureStatus,+ /// Indicates whether refund is supported by this payment method.+ pub refunds: common_enums::FeatureStatus,+ /// List of supported capture methods+ pub supported_capture_methods: Vec<common_enums::CaptureMethod>,+}++/// list of payment method types and metadata related to them+pub type PaymentMethodTypeMetadata = HashMap<common_enums::PaymentMethodType, PaymentMethodDetails>;++/// list of payment methods, payment method types and metadata related to them+pub type SupportedPaymentMethods = HashMap<common_enums::PaymentMethod, PaymentMethodTypeMetadata>;++#[derive(Debug, Clone)]+pub struct ConnectorInfo {+ /// Description of the connector.+ pub description: String,++ /// Connector Type+ pub connector_type: common_enums::PaymentConnectorCategory,+}++pub trait SupportedPaymentMethodsExt {+ fn add(+ &mut self,+ payment_method: common_enums::PaymentMethod,+ payment_method_type: common_enums::PaymentMethodType,+ payment_method_details: PaymentMethodDetails,+ );+}++impl SupportedPaymentMethodsExt for SupportedPaymentMethods {+ fn add(+ &mut self,+ payment_method: common_enums::PaymentMethod,+ payment_method_type: common_enums::PaymentMethodType,+ payment_method_details: PaymentMethodDetails,+ ) {+ if let Some(payment_method_data) = self.get_mut(&payment_method) {+ payment_method_data.insert(payment_method_type, payment_method_details);+ } else {+ let mut payment_method_type_metadata = PaymentMethodTypeMetadata::new();+ payment_method_type_metadata.insert(payment_method_type, payment_method_details);++ self.insert(payment_method, payment_method_type_metadata);+ }+ }+}diff --git a/crates/hyperswitch_interfaces/src/api.rs b/crates/hyperswitch_interfaces/src/api.rsindex bb6b2a4e4f..ca2d806762 100644--- a/crates/hyperswitch_interfaces/src/api.rs+++ b/crates/hyperswitch_interfaces/src/api.rs@@ -16,7 +16,11 @@ pub mod payouts;pub mod payouts_v2;pub mod refunds;pub mod refunds_v2;-use common_enums::enums::{CallConnectorAction, CaptureMethod, PaymentAction, PaymentMethodType};++use common_enums::{+ enums::{CallConnectorAction, CaptureMethod, EventClass, PaymentAction, PaymentMethodType},+ PaymentMethod,+};use common_utils::{errors::CustomResult,request::{Method, Request, RequestContent},@@ -40,7 +44,10 @@ use hyperswitch_domain_models::{},AccessTokenRequestData, MandateRevokeRequestData, VerifyWebhookSourceRequestData,},- router_response_types::{MandateRevokeResponseData, VerifyWebhookSourceResponseData},+ router_response_types::{+ ConnectorInfo, MandateRevokeResponseData, PaymentMethodDetails, SupportedPaymentMethods,+ VerifyWebhookSourceResponseData,+ },};use masking::Maskable;use serde_json::json;@@ -280,6 +287,24 @@ pub trait ConnectorCommon {}}+/// The trait that provides specifications about the connector+pub trait ConnectorSpecifications {+ /// Details related to payment method supported by the connector+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {+ None+ }++ /// Supported webhooks flows+ fn get_supported_webhook_flows(&self) -> Option<&'static [EventClass]> {+ None+ }++ /// About the connector+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {+ None+ }+}+/// Extended trait for connector common to allow functions with generic typepub trait ConnectorCommonExt<Flow, Req, Resp>:ConnectorCommon + ConnectorIntegration<Flow, Req, Resp>@@ -399,23 +424,46 @@ pub trait UasPostAuthenticationV2:}/// trait ConnectorValidation-pub trait ConnectorValidation: ConnectorCommon {- /// fn validate_capture_method- fn validate_capture_method(+pub trait ConnectorValidation: ConnectorCommon + ConnectorSpecifications {+ /// Validate, the payment request against the connector supported features+ fn validate_connector_against_payment_request(&self,capture_method: Option<CaptureMethod>,- _pmt: Option<PaymentMethodType>,+ payment_method: PaymentMethod,+ pmt: Option<PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();- match capture_method {- CaptureMethod::Automatic | CaptureMethod::SequentialAutomatic => Ok(()),- CaptureMethod::Manual | CaptureMethod::ManualMultiple | CaptureMethod::Scheduled => {- Err(errors::ConnectorError::NotSupported {- message: capture_method.to_string(),- connector: self.id(),- }- .into())+ let is_default_capture_method =+ [CaptureMethod::Automatic, CaptureMethod::SequentialAutomatic]+ .contains(&capture_method);+ let is_feature_supported = match self.get_supported_payment_methods() {+ Some(supported_payment_methods) => {+ let connector_payment_method_type_info = get_connector_payment_method_type_info(+ supported_payment_methods,+ payment_method,+ pmt,+ self.id(),+ )?;++ connector_payment_method_type_info+ .map(|payment_method_type_info| {+ payment_method_type_info+ .supported_capture_methods+ .contains(&capture_method)+ })+ .unwrap_or_else(|| is_default_capture_method)}+ None => is_default_capture_method,+ };++ if is_feature_supported {+ Ok(())+ } else {+ Err(errors::ConnectorError::NotSupported {+ message: capture_method.to_string(),+ connector: self.id(),+ }+ .into())}}@@ -476,3 +524,30 @@ pub trait ConnectorRedirectResponse {/// Empty trait for when payouts feature is disabled#[cfg(not(feature = "payouts"))]pub trait Payouts {}++fn get_connector_payment_method_type_info(+ supported_payment_method: &SupportedPaymentMethods,+ payment_method: PaymentMethod,+ payment_method_type: Option<PaymentMethodType>,+ connector: &'static str,+) -> CustomResult<Option<PaymentMethodDetails>, errors::ConnectorError> {+ let payment_method_details =+ supported_payment_method+ .get(&payment_method)+ .ok_or_else(|| errors::ConnectorError::NotSupported {+ message: payment_method.to_string(),+ connector,+ })?;++ payment_method_type+ .map(|pmt| {+ payment_method_details.get(&pmt).cloned().ok_or_else(|| {+ errors::ConnectorError::NotSupported {+ message: format!("{} {}", payment_method, pmt),+ connector,+ }+ .into()+ })+ })+ .transpose()+}diff --git a/crates/hyperswitch_interfaces/src/api/payments.rs b/crates/hyperswitch_interfaces/src/api/payments.rsindex b3ac7e0fa9..ab327d0629 100644--- a/crates/hyperswitch_interfaces/src/api/payments.rs+++ b/crates/hyperswitch_interfaces/src/api/payments.rs@@ -23,6 +23,7 @@ use crate::api;/// trait Paymentpub trait Payment:api::ConnectorCommon+ + api::ConnectorSpecifications+ api::ConnectorValidation+ PaymentAuthorize+ PaymentAuthorizeSessionTokendiff --git a/crates/hyperswitch_interfaces/src/api/payments_v2.rs b/crates/hyperswitch_interfaces/src/api/payments_v2.rsindex e2ddf49e0c..366024f7da 100644--- a/crates/hyperswitch_interfaces/src/api/payments_v2.rs+++ b/crates/hyperswitch_interfaces/src/api/payments_v2.rs@@ -19,7 +19,9 @@ use hyperswitch_domain_models::{router_response_types::{PaymentsResponseData, TaxCalculationResponseData},};-use crate::api::{ConnectorCommon, ConnectorIntegrationV2, ConnectorValidation};+use crate::api::{+ ConnectorCommon, ConnectorIntegrationV2, ConnectorSpecifications, ConnectorValidation,+};/// trait PaymentAuthorizeV2pub trait PaymentAuthorizeV2:@@ -182,6 +184,7 @@ pub trait PaymentsPostProcessingV2:/// trait PaymentV2pub trait PaymentV2:ConnectorCommon+ + ConnectorSpecifications+ ConnectorValidation+ PaymentAuthorizeV2+ PaymentAuthorizeSessionTokenV2diff --git a/crates/hyperswitch_interfaces/src/types.rs b/crates/hyperswitch_interfaces/src/types.rsindex dd344edf9d..eb31fd221d 100644--- a/crates/hyperswitch_interfaces/src/types.rs+++ b/crates/hyperswitch_interfaces/src/types.rs@@ -1,4 +1,5 @@//! Types interface+use hyperswitch_domain_models::{router_data::AccessToken,router_flow_types::{diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rsindex daf43fded0..2f068b5609 100644--- a/crates/openapi/src/openapi.rs+++ b/crates/openapi/src/openapi.rs@@ -306,6 +306,8 @@ Never share your secret api keys. Keep them guarded and secure.api_models::enums::PaymentLinkDetailsLayout,api_models::enums::PaymentMethodStatus,api_models::enums::UIWidgetFormLayout,+ api_models::enums::PaymentConnectorCategory,+ api_models::enums::FeatureStatus,api_models::admin::MerchantConnectorCreate,api_models::admin::AdditionalMerchantData,api_models::admin::ConnectorWalletDetails,@@ -688,7 +690,11 @@ Never share your secret api keys. Keep them guarded and secure.api_models::payments::DisplayAmountOnSdk,api_models::payments::PaymentsPostSessionTokensRequest,api_models::payments::PaymentsPostSessionTokensResponse,- api_models::payments::CtpServiceDetails+ api_models::payments::CtpServiceDetails,+ api_models::feature_matrix::FeatureMatrixListResponse,+ api_models::feature_matrix::FeatureMatrixRequest,+ api_models::feature_matrix::ConnectorFeatureMatrixResponse,+ api_models::feature_matrix::SupportedPaymentMethod,)),modifiers(&SecurityAddon))]diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rsindex 6ea55ba6b7..12b0fd0035 100644--- a/crates/openapi/src/openapi_v2.rs+++ b/crates/openapi/src/openapi_v2.rs@@ -261,6 +261,8 @@ Never share your secret api keys. Keep them guarded and secure.api_models::enums::SizeVariants,api_models::enums::PaymentLinkDetailsLayout,api_models::enums::PaymentMethodStatus,+ api_models::enums::PaymentConnectorCategory,+ api_models::enums::FeatureStatus,api_models::enums::OrderFulfillmentTimeOrigin,api_models::enums::UIWidgetFormLayout,api_models::admin::MerchantConnectorCreate,@@ -639,6 +641,10 @@ Never share your secret api keys. Keep them guarded and secure.api_models::payments::DisplayAmountOnSdk,api_models::payments::ErrorDetails,api_models::payments::CtpServiceDetails,+ api_models::feature_matrix::FeatureMatrixListResponse,+ api_models::feature_matrix::FeatureMatrixRequest,+ api_models::feature_matrix::ConnectorFeatureMatrixResponse,+ api_models::feature_matrix::SupportedPaymentMethod,common_utils::types::BrowserInformation,api_models::payments::PaymentAmountDetailsResponse,routes::payments::ForceSync,diff --git a/crates/router/src/connector/aci.rs b/crates/router/src/connector/aci.rsindex 6f800194a4..c59c0ce075 100644--- a/crates/router/src/connector/aci.rs+++ b/crates/router/src/connector/aci.rs@@ -6,6 +6,7 @@ use common_utils::{types::{AmountConvertor, StringMajorUnit, StringMajorUnitForConnector},};use error_stack::{report, ResultExt};+use hyperswitch_interfaces::api::ConnectorSpecifications;use masking::PeekInterface;use transformers as aci;@@ -616,3 +617,5 @@ impl api::IncomingWebhook for Aci {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Aci {}diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rsindex 112842efc6..b9ab7ea87e 100644--- a/crates/router/src/connector/adyen.rs+++ b/crates/router/src/connector/adyen.rs@@ -27,7 +27,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorValidation,+ ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -98,9 +98,10 @@ impl ConnectorCommon for Adyen {}impl ConnectorValidation for Adyen {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<storage_enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,pmt: Option<PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -2291,3 +2292,5 @@ impl api::FileUpload for Adyen {Ok(())}}++impl ConnectorSpecifications for Adyen {}diff --git a/crates/router/src/connector/adyenplatform.rs b/crates/router/src/connector/adyenplatform.rsindex 2ee80699a5..f95e9cd4d6 100644--- a/crates/router/src/connector/adyenplatform.rs+++ b/crates/router/src/connector/adyenplatform.rs@@ -29,7 +29,7 @@ use crate::{configs::settings,core::errors::{self, CustomResult},headers,- services::{self, request::Mask, ConnectorValidation},+ services::{self, request::Mask, ConnectorSpecifications, ConnectorValidation},types::{self,api::{self, ConnectorCommon},@@ -461,3 +461,5 @@ impl api::IncomingWebhook for Adyenplatform {}}}++impl ConnectorSpecifications for Adyenplatform {}diff --git a/crates/router/src/connector/authorizedotnet.rs b/crates/router/src/connector/authorizedotnet.rsindex fecfa315ab..afc8f063e4 100644--- a/crates/router/src/connector/authorizedotnet.rs+++ b/crates/router/src/connector/authorizedotnet.rs@@ -19,7 +19,7 @@ use crate::{},events::connector_api_logs::ConnectorEvent,headers,- services::{self, request, ConnectorIntegration, ConnectorValidation},+ services::{self, request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation},types::{self,api::{self, ConnectorCommon, ConnectorCommonExt, PaymentsCompleteAuthorize},@@ -66,9 +66,10 @@ impl ConnectorCommon for Authorizedotnet {}impl ConnectorValidation for Authorizedotnet {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -1057,3 +1058,5 @@ impl services::ConnectorRedirectResponse for Authorizedotnet {}}}++impl ConnectorSpecifications for Authorizedotnet {}diff --git a/crates/router/src/connector/bankofamerica.rs b/crates/router/src/connector/bankofamerica.rsindex fc6594442c..95ceee5558 100644--- a/crates/router/src/connector/bankofamerica.rs+++ b/crates/router/src/connector/bankofamerica.rs@@ -25,7 +25,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorIntegration, ConnectorValidation,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -278,9 +278,10 @@ impl ConnectorCommon for Bankofamerica {}impl ConnectorValidation for Bankofamerica {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -1065,3 +1066,5 @@ impl api::IncomingWebhook for Bankofamerica {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Bankofamerica {}diff --git a/crates/router/src/connector/braintree.rs b/crates/router/src/connector/braintree.rsindex a462010eeb..7a88180c64 100644--- a/crates/router/src/connector/braintree.rs+++ b/crates/router/src/connector/braintree.rs@@ -30,7 +30,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorIntegration, ConnectorValidation,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -173,9 +173,10 @@ impl ConnectorCommon for Braintree {}impl ConnectorValidation for Braintree {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -1209,3 +1210,5 @@ implself.build_error_response(res, event_builder)}}++impl ConnectorSpecifications for Braintree {}diff --git a/crates/router/src/connector/checkout.rs b/crates/router/src/connector/checkout.rsindex f73d5cb14e..96b30dc80f 100644--- a/crates/router/src/connector/checkout.rs+++ b/crates/router/src/connector/checkout.rs@@ -27,7 +27,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorIntegration, ConnectorValidation,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -154,9 +154,10 @@ impl ConnectorCommon for Checkout {}impl ConnectorValidation for Checkout {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -1489,3 +1490,5 @@ impl ConnectorErrorTypeMapping for Checkout {}}}++impl ConnectorSpecifications for Checkout {}diff --git a/crates/router/src/connector/cybersource.rs b/crates/router/src/connector/cybersource.rsindex f676d6ca25..078f66335f 100644--- a/crates/router/src/connector/cybersource.rs+++ b/crates/router/src/connector/cybersource.rs@@ -27,7 +27,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorIntegration, ConnectorValidation,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -246,9 +246,10 @@ impl ConnectorCommon for Cybersource {}impl ConnectorValidation for Cybersource {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -1718,3 +1719,5 @@ impl api::IncomingWebhook for Cybersource {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Cybersource {}diff --git a/crates/router/src/connector/dummyconnector.rs b/crates/router/src/connector/dummyconnector.rsindex b87b495a93..15a2ff6903 100644--- a/crates/router/src/connector/dummyconnector.rs+++ b/crates/router/src/connector/dummyconnector.rs@@ -16,7 +16,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorIntegration, ConnectorValidation,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -124,9 +124,10 @@ impl<const T: u8> ConnectorCommon for DummyConnector<T> {}impl<const T: u8> ConnectorValidation for DummyConnector<T> {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -613,3 +614,5 @@ impl<const T: u8> api::IncomingWebhook for DummyConnector<T> {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl<const T: u8> ConnectorSpecifications for DummyConnector<T> {}diff --git a/crates/router/src/connector/ebanx.rs b/crates/router/src/connector/ebanx.rsindex e5e7f2e259..01db54c1f6 100644--- a/crates/router/src/connector/ebanx.rs+++ b/crates/router/src/connector/ebanx.rs@@ -15,7 +15,7 @@ use crate::{configs::settings,core::errors::{self, CustomResult},events::connector_api_logs::ConnectorEvent,- services::{ConnectorIntegration, ConnectorValidation},+ services::{ConnectorIntegration, ConnectorSpecifications, ConnectorValidation},types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -466,3 +466,5 @@ impl api::IncomingWebhook for Ebanx {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Ebanx {}diff --git a/crates/router/src/connector/globalpay.rs b/crates/router/src/connector/globalpay.rsindex 2c8bfb548e..2e971f8034 100644--- a/crates/router/src/connector/globalpay.rs+++ b/crates/router/src/connector/globalpay.rs@@ -28,7 +28,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorIntegration, ConnectorValidation,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -127,9 +127,10 @@ impl ConnectorCommon for Globalpay {}impl ConnectorValidation for Globalpay {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -1043,3 +1044,5 @@ impl services::ConnectorRedirectResponse for Globalpay {}}}++impl ConnectorSpecifications for Globalpay {}diff --git a/crates/router/src/connector/gpayments.rs b/crates/router/src/connector/gpayments.rsindex 9f88e21513..1febbfa788 100644--- a/crates/router/src/connector/gpayments.rs+++ b/crates/router/src/connector/gpayments.rs@@ -14,7 +14,7 @@ use crate::{core::errors::{self, CustomResult},events::connector_api_logs::ConnectorEvent,headers, services,- services::{request, ConnectorIntegration, ConnectorValidation},+ services::{request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation},types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -613,3 +613,5 @@ implself.build_error_response(res, event_builder)}}++impl ConnectorSpecifications for Gpayments {}diff --git a/crates/router/src/connector/iatapay.rs b/crates/router/src/connector/iatapay.rsindex cf4a1d6e16..e694968ee0 100644--- a/crates/router/src/connector/iatapay.rs+++ b/crates/router/src/connector/iatapay.rs@@ -22,7 +22,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorIntegration, ConnectorValidation,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -757,3 +757,5 @@ impl api::IncomingWebhook for Iatapay {}}}++impl ConnectorSpecifications for Iatapay {}diff --git a/crates/router/src/connector/itaubank.rs b/crates/router/src/connector/itaubank.rsindex 0c99a95e0e..2087c72ba8 100644--- a/crates/router/src/connector/itaubank.rs+++ b/crates/router/src/connector/itaubank.rs@@ -14,7 +14,7 @@ use crate::{core::errors::{self, CustomResult},events::connector_api_logs::ConnectorEvent,headers,- services::{self, request, ConnectorIntegration, ConnectorValidation},+ services::{self, request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation},types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -785,3 +785,5 @@ impl api::IncomingWebhook for Itaubank {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Itaubank {}diff --git a/crates/router/src/connector/klarna.rs b/crates/router/src/connector/klarna.rsindex 77e2a027d8..4e54311a89 100644--- a/crates/router/src/connector/klarna.rs+++ b/crates/router/src/connector/klarna.rs@@ -21,7 +21,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorValidation,+ ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -110,9 +110,10 @@ impl ConnectorCommon for Klarna {}impl ConnectorValidation for Klarna {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -1158,3 +1159,5 @@ impl api::IncomingWebhook for Klarna {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Klarna {}diff --git a/crates/router/src/connector/mifinity.rs b/crates/router/src/connector/mifinity.rsindex d8ac2d1012..dcf95a576e 100644--- a/crates/router/src/connector/mifinity.rs+++ b/crates/router/src/connector/mifinity.rs@@ -16,7 +16,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorIntegration, ConnectorValidation,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -501,3 +501,5 @@ impl api::IncomingWebhook for Mifinity {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Mifinity {}diff --git a/crates/router/src/connector/netcetera.rs b/crates/router/src/connector/netcetera.rsindex edf56365f4..459ac93e06 100644--- a/crates/router/src/connector/netcetera.rs+++ b/crates/router/src/connector/netcetera.rs@@ -13,7 +13,7 @@ use crate::{core::errors::{self, CustomResult},events::connector_api_logs::ConnectorEvent,headers,- services::{self, request, ConnectorIntegration, ConnectorValidation},+ services::{self, request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation},types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -462,3 +462,5 @@ impl> for Netcetera{}++impl ConnectorSpecifications for Netcetera {}diff --git a/crates/router/src/connector/nmi.rs b/crates/router/src/connector/nmi.rsindex 42a04e7e7e..73aaec55e5 100644--- a/crates/router/src/connector/nmi.rs+++ b/crates/router/src/connector/nmi.rs@@ -19,7 +19,7 @@ use crate::{payments,},events::connector_api_logs::ConnectorEvent,- services::{self, request, ConnectorIntegration, ConnectorValidation},+ services::{self, request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation},types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -108,9 +108,10 @@ impl ConnectorCommon for Nmi {}impl ConnectorValidation for Nmi {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -1033,3 +1034,5 @@ impl services::ConnectorRedirectResponse for Nmi {}}}++impl ConnectorSpecifications for Nmi {}diff --git a/crates/router/src/connector/noon.rs b/crates/router/src/connector/noon.rsindex 76526ca2eb..c8780af3ce 100644--- a/crates/router/src/connector/noon.rs+++ b/crates/router/src/connector/noon.rs@@ -27,7 +27,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorIntegration, ConnectorValidation,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -176,9 +176,10 @@ impl ConnectorCommon for Noon {}impl ConnectorValidation for Noon {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -945,3 +946,5 @@ impl api::IncomingWebhook for Noon {Ok(Box::new(noon::NoonPaymentsResponse::from(resource)))}}++impl ConnectorSpecifications for Noon {}diff --git a/crates/router/src/connector/nuvei.rs b/crates/router/src/connector/nuvei.rsindex 7c50f87fc4..c72bee24fa 100644--- a/crates/router/src/connector/nuvei.rs+++ b/crates/router/src/connector/nuvei.rs@@ -21,7 +21,7 @@ use crate::{},events::connector_api_logs::ConnectorEvent,headers,- services::{self, request, ConnectorIntegration, ConnectorValidation},+ services::{self, request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation},types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -73,9 +73,10 @@ impl ConnectorCommon for Nuvei {}impl ConnectorValidation for Nuvei {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -980,3 +981,5 @@ impl services::ConnectorRedirectResponse for Nuvei {}}}++impl ConnectorSpecifications for Nuvei {}diff --git a/crates/router/src/connector/opayo.rs b/crates/router/src/connector/opayo.rsindex 4a093c019a..a9fc439e54 100644--- a/crates/router/src/connector/opayo.rs+++ b/crates/router/src/connector/opayo.rs@@ -18,7 +18,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorIntegration, ConnectorValidation,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -131,9 +131,10 @@ impl ConnectorCommon for Opayo {}impl ConnectorValidation for Opayo {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -601,3 +602,5 @@ impl api::IncomingWebhook for Opayo {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Opayo {}diff --git a/crates/router/src/connector/opennode.rs b/crates/router/src/connector/opennode.rsindex 0a1de1fdde..1c11da0571 100644--- a/crates/router/src/connector/opennode.rs+++ b/crates/router/src/connector/opennode.rs@@ -16,7 +16,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorIntegration, ConnectorValidation,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -449,3 +449,5 @@ impl api::IncomingWebhook for Opennode {Ok(Box::new(notif.status))}}++impl ConnectorSpecifications for Opennode {}diff --git a/crates/router/src/connector/payme.rs b/crates/router/src/connector/payme.rsindex c00ab061a3..10a0fe6756 100644--- a/crates/router/src/connector/payme.rs+++ b/crates/router/src/connector/payme.rs@@ -23,7 +23,7 @@ use crate::{},events::connector_api_logs::ConnectorEvent,headers,- services::{self, request, ConnectorIntegration, ConnectorValidation},+ services::{self, request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation},types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -138,9 +138,10 @@ impl ConnectorCommon for Payme {}impl ConnectorValidation for Payme {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -1294,3 +1295,5 @@ impl api::IncomingWebhook for Payme {})}}++impl ConnectorSpecifications for Payme {}diff --git a/crates/router/src/connector/payone.rs b/crates/router/src/connector/payone.rsindex 6bc04ed79c..58b179e579 100644--- a/crates/router/src/connector/payone.rs+++ b/crates/router/src/connector/payone.rs@@ -30,7 +30,7 @@ use crate::{headers,services::{request::{self, Mask},- ConnectorIntegration, ConnectorValidation,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -429,3 +429,5 @@ impl ConnectorErrorTypeMapping for Payone {}}}++impl ConnectorSpecifications for Payone {}diff --git a/crates/router/src/connector/paypal.rs b/crates/router/src/connector/paypal.rsindex 375853e27a..fb635708c2 100644--- a/crates/router/src/connector/paypal.rs+++ b/crates/router/src/connector/paypal.rs@@ -36,7 +36,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorIntegration, ConnectorValidation, PaymentAction,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation, PaymentAction,},types::{self,@@ -320,9 +320,10 @@ impl ConnectorCommon for Paypal {}impl ConnectorValidation for Paypal {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -2206,3 +2207,5 @@ impl ConnectorErrorTypeMapping for Paypal {}}}++impl ConnectorSpecifications for Paypal {}diff --git a/crates/router/src/connector/plaid.rs b/crates/router/src/connector/plaid.rsindex 5bfd429942..f24d7bd8d6 100644--- a/crates/router/src/connector/plaid.rs+++ b/crates/router/src/connector/plaid.rs@@ -13,7 +13,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorIntegration, ConnectorValidation,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -456,3 +456,5 @@ impl api::IncomingWebhook for Plaid {Err((errors::ConnectorError::WebhooksNotImplemented).into())}}++impl ConnectorSpecifications for Plaid {}diff --git a/crates/router/src/connector/riskified.rs b/crates/router/src/connector/riskified.rsindex 7d9feec717..1268e04160 100644--- a/crates/router/src/connector/riskified.rs+++ b/crates/router/src/connector/riskified.rs@@ -22,7 +22,7 @@ use super::utils::{self as connector_utils, FrmTransactionRouterDataRequest};use crate::{configs::settings,core::errors::{self, CustomResult},- services::{self, ConnectorIntegration, ConnectorValidation},+ services::{self, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation},types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -677,3 +677,5 @@ impl api::IncomingWebhook for Riskified {Ok(Box::new(resource))}}++impl ConnectorSpecifications for Riskified {}diff --git a/crates/router/src/connector/signifyd.rs b/crates/router/src/connector/signifyd.rsindex 4ee36d8966..21452819c3 100644--- a/crates/router/src/connector/signifyd.rs+++ b/crates/router/src/connector/signifyd.rs@@ -20,7 +20,7 @@ use crate::{configs::settings,core::errors::{self, CustomResult},headers,- services::{self, request, ConnectorIntegration, ConnectorValidation},+ services::{self, request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation},types::{self,api::{self, ConnectorCommon, ConnectorCommonExt},@@ -754,3 +754,5 @@ impl api::IncomingWebhook for Signifyd {Ok(Box::new(resource))}}++impl ConnectorSpecifications for Signifyd {}diff --git a/crates/router/src/connector/stripe.rs b/crates/router/src/connector/stripe.rsindex 31cc0a713a..6d37717112 100644--- a/crates/router/src/connector/stripe.rs+++ b/crates/router/src/connector/stripe.rs@@ -30,7 +30,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorValidation,+ ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -134,9 +134,10 @@ impl ConnectorCommon for Stripe {}impl ConnectorValidation for Stripe {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -2932,3 +2933,5 @@ implself.build_error_response(res, event_builder)}}++impl ConnectorSpecifications for Stripe {}diff --git a/crates/router/src/connector/threedsecureio.rs b/crates/router/src/connector/threedsecureio.rsindex a051cf471f..aec8f78045 100644--- a/crates/router/src/connector/threedsecureio.rs+++ b/crates/router/src/connector/threedsecureio.rs@@ -15,7 +15,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorIntegration, ConnectorValidation,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -530,3 +530,5 @@ impl> for Threedsecureio{}++impl ConnectorSpecifications for Threedsecureio {}diff --git a/crates/router/src/connector/trustpay.rs b/crates/router/src/connector/trustpay.rsindex 6562ba3197..10c71a5d37 100644--- a/crates/router/src/connector/trustpay.rs+++ b/crates/router/src/connector/trustpay.rs@@ -29,7 +29,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorIntegration, ConnectorValidation,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -1077,3 +1077,5 @@ impl ConnectorErrorTypeMapping for Trustpay {}}}++impl ConnectorSpecifications for Trustpay {}diff --git a/crates/router/src/connector/wellsfargo.rs b/crates/router/src/connector/wellsfargo.rsindex df0de2c0c5..b47b366225 100644--- a/crates/router/src/connector/wellsfargo.rs+++ b/crates/router/src/connector/wellsfargo.rs@@ -27,7 +27,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorIntegration, ConnectorValidation,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -245,9 +245,10 @@ impl ConnectorCommon for Wellsfargo {}impl ConnectorValidation for Wellsfargo {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<enums::CaptureMethod>,+ _payment_method: enums::PaymentMethod,_pmt: Option<enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {let capture_method = capture_method.unwrap_or_default();@@ -1316,3 +1317,5 @@ impl api::IncomingWebhook for Wellsfargo {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Wellsfargo {}diff --git a/crates/router/src/connector/wellsfargopayout.rs b/crates/router/src/connector/wellsfargopayout.rsindex fe8f5dda25..33111ee7be 100644--- a/crates/router/src/connector/wellsfargopayout.rs+++ b/crates/router/src/connector/wellsfargopayout.rs@@ -14,7 +14,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorIntegration, ConnectorValidation,+ ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -581,3 +581,5 @@ impl api::IncomingWebhook for Wellsfargopayout {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Wellsfargopayout {}diff --git a/crates/router/src/connector/wise.rs b/crates/router/src/connector/wise.rsindex 9f41651b2f..e4493f5016 100644--- a/crates/router/src/connector/wise.rs+++ b/crates/router/src/connector/wise.rs@@ -19,7 +19,7 @@ use crate::{services::{self,request::{self, Mask},- ConnectorValidation,+ ConnectorSpecifications, ConnectorValidation,},types::{self,@@ -748,3 +748,5 @@ impl api::IncomingWebhook for Wise {Err(report!(errors::ConnectorError::WebhooksNotImplemented))}}++impl ConnectorSpecifications for Wise {}diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rsindex 75eda0ed91..7efa9a5e18 100644--- a/crates/router/src/core/payments/flows/authorize_flow.rs+++ b/crates/router/src/core/payments/flows/authorize_flow.rs@@ -337,8 +337,9 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAupayments::CallConnectorAction::Trigger => {connector.connector- .validate_capture_method(+ .validate_connector_against_payment_request(self.request.capture_method,+ self.payment_method,self.request.payment_method_type,).to_payment_failed_response()?;diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rsindex 9ed724c36e..4fe9318f64 100644--- a/crates/router/src/lib.rs+++ b/crates/router/src/lib.rs@@ -192,7 +192,8 @@ pub fn mk_app(.service(routes::ConnectorOnboarding::server(state.clone())).service(routes::Verify::server(state.clone())).service(routes::Analytics::server(state.clone()))- .service(routes::WebhookEvents::server(state.clone()));+ .service(routes::WebhookEvents::server(state.clone()))+ .service(routes::FeatureMatrix::server(state.clone()));}}diff --git a/crates/router/src/routes.rs b/crates/router/src/routes.rsindex 53e5d5aac7..462861d331 100644--- a/crates/router/src/routes.rs+++ b/crates/router/src/routes.rs@@ -17,6 +17,7 @@ pub mod disputes;#[cfg(feature = "dummy_connector")]pub mod dummy_connector;pub mod ephemeral_key;+pub mod feature_matrix;pub mod files;#[cfg(feature = "frm")]pub mod fraud_check;@@ -66,9 +67,9 @@ pub use self::app::DummyConnector;pub use self::app::Recon;pub use self::app::{ApiKeys, AppState, ApplePayCertificatesMigration, Cache, Cards, Configs, ConnectorOnboarding,- Customers, Disputes, EphemeralKey, Files, Forex, Gsm, Health, Mandates, MerchantAccount,- MerchantConnectorAccount, PaymentLink, PaymentMethods, Payments, Poll, Profile, ProfileNew,- Refunds, Relay, SessionState, User, Webhooks,+ Customers, Disputes, EphemeralKey, FeatureMatrix, Files, Forex, Gsm, Health, Mandates,+ MerchantAccount, MerchantConnectorAccount, PaymentLink, PaymentMethods, Payments, Poll,+ Profile, ProfileNew, Refunds, Relay, SessionState, User, Webhooks,};#[cfg(feature = "olap")]pub use self::app::{Blocklist, Organization, Routing, Verify, WebhookEvents};diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rsindex 28a994fdf3..f9dbec7745 100644--- a/crates/router/src/routes/app.rs+++ b/crates/router/src/routes/app.rs@@ -70,6 +70,8 @@ use crate::analytics::AnalyticsProvider;use crate::errors::RouterResult;#[cfg(feature = "v1")]use crate::routes::cards_info::card_iin_info;+#[cfg(all(feature = "olap", feature = "v1"))]+use crate::routes::feature_matrix;#[cfg(all(feature = "frm", feature = "oltp"))]use crate::routes::fraud_check as frm_routes;#[cfg(all(feature = "recon", feature = "olap"))]@@ -2254,3 +2256,15 @@ impl WebhookEvents {)}}++#[cfg(feature = "olap")]+pub struct FeatureMatrix;++#[cfg(all(feature = "olap", feature = "v1"))]+impl FeatureMatrix {+ pub fn server(state: AppState) -> Scope {+ web::scope("/feature_matrix")+ .app_data(web::Data::new(state))+ .service(web::resource("").route(web::get().to(feature_matrix::fetch_feature_matrix)))+ }+}diff --git a/crates/router/src/routes/feature_matrix.rs b/crates/router/src/routes/feature_matrix.rsnew file mode 100644index 0000000000..08dd7d0d7b--- /dev/null+++ b/crates/router/src/routes/feature_matrix.rs@@ -0,0 +1,150 @@+use actix_web::{web, HttpRequest, Responder};+use api_models::{connector_enums::Connector, feature_matrix};+use common_enums::enums;+use hyperswitch_domain_models::{+ api::ApplicationResponse, router_response_types::PaymentMethodTypeMetadata,+};+use hyperswitch_interfaces::api::ConnectorSpecifications;+use router_env::{instrument, tracing, Flow};+use strum::IntoEnumIterator;++use crate::{+ self as app,+ core::{api_locking::LockAction, errors::RouterResponse},+ services::{api, authentication as auth, connector_integration_interface::ConnectorEnum},+ settings,+ types::api::{self as api_types, payments as payment_types},+};++#[instrument(skip_all)]+pub async fn fetch_feature_matrix(+ state: web::Data<app::AppState>,+ req: HttpRequest,+ json_payload: Option<web::Json<payment_types::FeatureMatrixRequest>>,+) -> impl Responder {+ let flow: Flow = Flow::FeatureMatrix;+ let payload = json_payload+ .map(|json_request| json_request.into_inner())+ .unwrap_or_else(|| payment_types::FeatureMatrixRequest { connectors: None });++ Box::pin(api::server_wrap(+ flow,+ state,+ &req,+ payload,+ |state, (), req, _| generate_feature_matrix(state, req),+ &auth::NoAuth,+ LockAction::NotApplicable,+ ))+ .await+}++pub async fn generate_feature_matrix(+ state: app::SessionState,+ req: payment_types::FeatureMatrixRequest,+) -> RouterResponse<feature_matrix::FeatureMatrixListResponse> {+ let connector_list = req+ .connectors+ .unwrap_or_else(|| Connector::iter().collect());++ let feature_matrix_response: Vec<payment_types::ConnectorFeatureMatrixResponse> =+ connector_list+ .into_iter()+ .filter_map(|connector_name| {+ api_types::ConnectorData::convert_connector(&connector_name.to_string())+ .inspect_err(|_| {+ router_env::logger::warn!("Failed to fetch {:?} details", connector_name)+ })+ .ok()+ .and_then(|connector| {+ build_connector_feature_details(+ &state,+ connector,+ connector_name.to_string(),+ )+ })+ })+ .collect();++ Ok(ApplicationResponse::Json(+ payment_types::FeatureMatrixListResponse {+ connector_count: feature_matrix_response.len(),+ connectors: feature_matrix_response,+ },+ ))+}++fn build_connector_feature_details(+ state: &app::SessionState,+ connector: ConnectorEnum,+ connector_name: String,+) -> Option<feature_matrix::ConnectorFeatureMatrixResponse> {+ let connector_integration_features = connector.get_supported_payment_methods();+ connector_integration_features.map(|connector_integration_feature_data| {+ let supported_payment_methods = connector_integration_feature_data+ .iter()+ .flat_map(|(payment_method, supported_payment_method_types)| {+ build_payment_method_wise_feature_details(+ state,+ &connector_name,+ *payment_method,+ supported_payment_method_types,+ )+ })+ .collect::<Vec<feature_matrix::SupportedPaymentMethod>>();++ let connector_about = connector.get_connector_about();+ let supported_webhook_flows = connector+ .get_supported_webhook_flows()+ .map(|webhook_flows| webhook_flows.to_vec());+ feature_matrix::ConnectorFeatureMatrixResponse {+ name: connector_name,+ description: connector_about.map(|about| about.description.clone()),+ category: connector_about.map(|about| about.connector_type),+ supported_webhook_flows,+ supported_payment_methods,+ }+ })+}++fn build_payment_method_wise_feature_details(+ state: &app::SessionState,+ connector_name: &str,+ payment_method: enums::PaymentMethod,+ supported_payment_method_types: &PaymentMethodTypeMetadata,+) -> Vec<feature_matrix::SupportedPaymentMethod> {+ supported_payment_method_types+ .iter()+ .map(|(payment_method_type, feature_metadata)| {+ let payment_method_type_config =+ state+ .conf+ .pm_filters+ .0+ .get(connector_name)+ .and_then(|selected_connector| {+ selected_connector.0.get(+ &settings::PaymentMethodFilterKey::PaymentMethodType(+ *payment_method_type,+ ),+ )+ });++ let supported_countries =+ payment_method_type_config.and_then(|config| config.country.clone());++ let supported_currencies =+ payment_method_type_config.and_then(|config| config.currency.clone());++ feature_matrix::SupportedPaymentMethod {+ payment_method,+ payment_method_type: *payment_method_type,+ mandates: feature_metadata.mandates,+ refunds: feature_metadata.refunds,+ supported_capture_methods: feature_metadata.supported_capture_methods.clone(),+ supported_countries,+ supported_currencies,+ }+ })+ .collect()+}diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rsindex 1bc31451fa..9d7ae1874c 100644--- a/crates/router/src/routes/lock_utils.rs+++ b/crates/router/src/routes/lock_utils.rs@@ -38,6 +38,7 @@ pub enum ApiIdentifier {Poll,ApplePayCertificatesMigration,Relay,+ Documentation,}impl From<Flow> for ApiIdentifier {@@ -303,6 +304,8 @@ impl From<Flow> for ApiIdentifier {| Flow::ReconVerifyToken => Self::Recon,Flow::RetrievePollStatus => Self::Poll,++ Flow::FeatureMatrix => Self::Documentation,}}}diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rsindex f746aa28fd..cac856b2c4 100644--- a/crates/router/src/services/api.rs+++ b/crates/router/src/services/api.rs@@ -39,7 +39,8 @@ pub use hyperswitch_domain_models::{pub use hyperswitch_interfaces::{api::{BoxedConnectorIntegration, CaptureSyncMethod, ConnectorIntegration,- ConnectorIntegrationAny, ConnectorRedirectResponse, ConnectorValidation,+ ConnectorIntegrationAny, ConnectorRedirectResponse, ConnectorSpecifications,+ ConnectorValidation,},connector_integration_v2::{BoxedConnectorIntegrationV2, ConnectorIntegrationAnyV2, ConnectorIntegrationV2,diff --git a/crates/router/src/services/connector_integration_interface.rs b/crates/router/src/services/connector_integration_interface.rsindex 934b2d8086..5903c8e9cc 100644--- a/crates/router/src/services/connector_integration_interface.rs+++ b/crates/router/src/services/connector_integration_interface.rs@@ -1,11 +1,15 @@use common_utils::{crypto, errors::CustomResult, request::Request};-use hyperswitch_domain_models::{router_data::RouterData, router_data_v2::RouterDataV2};+use hyperswitch_domain_models::{+ router_data::RouterData,+ router_data_v2::RouterDataV2,+ router_response_types::{ConnectorInfo, SupportedPaymentMethods},+};use hyperswitch_interfaces::{authentication::ExternalAuthenticationPayload,connector_integration_v2::ConnectorIntegrationV2, webhooks::IncomingWebhookFlowError,};-use super::{BoxedConnectorIntegrationV2, ConnectorValidation};+use super::{BoxedConnectorIntegrationV2, ConnectorSpecifications, ConnectorValidation};use crate::{core::payments,errors,@@ -363,14 +367,23 @@ impl ConnectorRedirectResponse for ConnectorEnum {}impl ConnectorValidation for ConnectorEnum {- fn validate_capture_method(+ fn validate_connector_against_payment_request(&self,capture_method: Option<common_enums::CaptureMethod>,+ payment_method: common_enums::PaymentMethod,pmt: Option<common_enums::PaymentMethodType>,) -> CustomResult<(), errors::ConnectorError> {match self {- Self::Old(connector) => connector.validate_capture_method(capture_method, pmt),- Self::New(connector) => connector.validate_capture_method(capture_method, pmt),+ Self::Old(connector) => connector.validate_connector_against_payment_request(+ capture_method,+ payment_method,+ pmt,+ ),+ Self::New(connector) => connector.validate_connector_against_payment_request(+ capture_method,+ payment_method,+ pmt,+ ),}}@@ -416,6 +429,31 @@ impl ConnectorValidation for ConnectorEnum {}}+impl ConnectorSpecifications for ConnectorEnum {+ fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {+ match self {+ Self::Old(connector) => connector.get_supported_payment_methods(),+ Self::New(connector) => connector.get_supported_payment_methods(),+ }+ }++ /// Supported webhooks flows+ fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::EventClass]> {+ match self {+ Self::Old(connector) => connector.get_supported_webhook_flows(),+ Self::New(connector) => connector.get_supported_webhook_flows(),+ }+ }++ /// Details related to connector+ fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {+ match self {+ Self::Old(connector) => connector.get_connector_about(),+ Self::New(connector) => connector.get_connector_about(),+ }+ }+}+impl api::ConnectorCommon for ConnectorEnum {fn id(&self) -> &'static str {match self {diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rsindex df5d497ea8..b0c3d2d21d 100644--- a/crates/router/src/types/api.rs+++ b/crates/router/src/types/api.rs@@ -278,12 +278,12 @@ pub enum ConnectorChoice {impl ConnectorData {pub fn get_connector_by_name(- connectors: &Connectors,+ _connectors: &Connectors,name: &str,connector_type: GetToken,connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,) -> CustomResult<Self, errors::ApiErrorResponse> {- let connector = Self::convert_connector(connectors, name)?;+ let connector = Self::convert_connector(name)?;let connector_name = api_enums::Connector::from_str(name).change_context(errors::ConnectorError::InvalidConnectorName).change_context(errors::ApiErrorResponse::InternalServerError)@@ -298,12 +298,12 @@ impl ConnectorData {#[cfg(feature = "payouts")]pub fn get_payout_connector_by_name(- connectors: &Connectors,+ _connectors: &Connectors,name: &str,connector_type: GetToken,connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,) -> CustomResult<Self, errors::ApiErrorResponse> {- let connector = Self::convert_connector(connectors, name)?;+ let connector = Self::convert_connector(name)?;let payout_connector_name = api_enums::PayoutConnectors::from_str(name).change_context(errors::ConnectorError::InvalidConnectorName).change_context(errors::ApiErrorResponse::InternalServerError)@@ -318,7 +318,6 @@ impl ConnectorData {}pub fn convert_connector(- _connectors: &Connectors,connector_name: &str,) -> CustomResult<ConnectorEnum, errors::ApiErrorResponse> {match enums::Connector::from_str(connector_name) {diff --git a/crates/router/src/types/api/payments.rs b/crates/router/src/types/api/payments.rsindex 8be423c037..6ec0fe701e 100644--- a/crates/router/src/types/api/payments.rs+++ b/crates/router/src/types/api/payments.rs@@ -1,27 +1,33 @@#[cfg(feature = "v1")]pub use api_models::payments::PaymentsRequest;-pub use api_models::payments::{- AcceptanceType, Address, AddressDetails, Amount, AuthenticationForStartResponse, Card,- CryptoData, CustomerAcceptance, CustomerDetailsResponse, MandateAmountData, MandateData,- MandateTransactionType, MandateType, MandateValidationFields, NextActionType, OnlineMandate,- OpenBankingSessionToken, PayLaterData, PaymentIdType, PaymentListConstraints,- PaymentListFilterConstraints, PaymentListFilters, PaymentListFiltersV2, PaymentListResponse,- PaymentListResponseV2, PaymentMethodData, PaymentMethodDataRequest, PaymentMethodDataResponse,- PaymentOp, PaymentRetrieveBody, PaymentRetrieveBodyWithCredentials, PaymentsAggregateResponse,- PaymentsApproveRequest, PaymentsCancelRequest, PaymentsCaptureRequest,- PaymentsCompleteAuthorizeRequest, PaymentsDynamicTaxCalculationRequest,- PaymentsDynamicTaxCalculationResponse, PaymentsExternalAuthenticationRequest,- PaymentsIncrementalAuthorizationRequest, PaymentsManualUpdateRequest,- PaymentsPostSessionTokensRequest, PaymentsPostSessionTokensResponse, PaymentsRedirectRequest,- PaymentsRedirectionResponse, PaymentsRejectRequest, PaymentsResponse, PaymentsResponseForm,- PaymentsRetrieveRequest, PaymentsSessionRequest, PaymentsSessionResponse, PaymentsStartRequest,- PgRedirectResponse, PhoneDetails, RedirectionResponse, SessionToken, UrlDetails, VerifyRequest,- VerifyResponse, WalletData,-};#[cfg(feature = "v2")]pub use api_models::payments::{PaymentsCreateIntentRequest, PaymentsIntentResponse, PaymentsUpdateIntentRequest,};+pub use api_models::{+ feature_matrix::{+ ConnectorFeatureMatrixResponse, FeatureMatrixListResponse, FeatureMatrixRequest,+ },+ payments::{+ AcceptanceType, Address, AddressDetails, Amount, AuthenticationForStartResponse, Card,+ CryptoData, CustomerAcceptance, CustomerDetailsResponse, MandateAmountData, MandateData,+ MandateTransactionType, MandateType, MandateValidationFields, NextActionType,+ OnlineMandate, OpenBankingSessionToken, PayLaterData, PaymentIdType,+ PaymentListConstraints, PaymentListFilterConstraints, PaymentListFilters,+ PaymentListFiltersV2, PaymentListResponse, PaymentListResponseV2, PaymentMethodData,+ PaymentMethodDataRequest, PaymentMethodDataResponse, PaymentOp, PaymentRetrieveBody,+ PaymentRetrieveBodyWithCredentials, PaymentsAggregateResponse, PaymentsApproveRequest,+ PaymentsCancelRequest, PaymentsCaptureRequest, PaymentsCompleteAuthorizeRequest,+ PaymentsDynamicTaxCalculationRequest, PaymentsDynamicTaxCalculationResponse,+ PaymentsExternalAuthenticationRequest, PaymentsIncrementalAuthorizationRequest,+ PaymentsManualUpdateRequest, PaymentsPostSessionTokensRequest,+ PaymentsPostSessionTokensResponse, PaymentsRedirectRequest, PaymentsRedirectionResponse,+ PaymentsRejectRequest, PaymentsResponse, PaymentsResponseForm, PaymentsRetrieveRequest,+ PaymentsSessionRequest, PaymentsSessionResponse, PaymentsStartRequest, PgRedirectResponse,+ PhoneDetails, RedirectionResponse, SessionToken, UrlDetails, VerifyRequest, VerifyResponse,+ WalletData,+ },+};use error_stack::ResultExt;pub use hyperswitch_domain_models::router_flow_types::payments::{Approve, Authorize, AuthorizeSessionToken, Balance, CalculateTax, Capture, CompleteAuthorize,diff --git a/crates/router/src/utils/connector_onboarding/paypal.rs b/crates/router/src/utils/connector_onboarding/paypal.rsindex ebd40fb11d..33b85587b4 100644--- a/crates/router/src/utils/connector_onboarding/paypal.rs+++ b/crates/router/src/utils/connector_onboarding/paypal.rs@@ -16,10 +16,8 @@ use crate::{pub async fn generate_access_token(state: SessionState) -> RouterResult<types::AccessToken> {let connector = enums::Connector::Paypal;- let boxed_connector = types::api::ConnectorData::convert_connector(- &state.conf.connectors,- connector.to_string().as_str(),- )?;+ let boxed_connector =+ types::api::ConnectorData::convert_connector(connector.to_string().as_str())?;let connector_auth =super::get_connector_auth(connector, state.conf.connector_onboarding.get_inner())?;diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rsindex 8bcd9e4419..10183f75d5 100644--- a/crates/router_env/src/logger/types.rs+++ b/crates/router_env/src/logger/types.rs@@ -353,6 +353,8 @@ pub enum Flow {DecisionManagerRetrieveConfig,/// Manual payment fulfillment acknowledgementFrmFulfillment,+ /// Get connectors feature matrix+ FeatureMatrix,/// Change password flowChangePassword,/// Signout flowdiff --git a/cypress-tests/cypress/e2e/PaymentTest/00000-CoreFlows.cy.js b/cypress-tests/cypress/e2e/PaymentTest/00000-CoreFlows.cy.jsindex c785c1e682..a0e2ad643e 100644--- a/cypress-tests/cypress/e2e/PaymentTest/00000-CoreFlows.cy.js+++ b/cypress-tests/cypress/e2e/PaymentTest/00000-CoreFlows.cy.js@@ -184,4 +184,20 @@ describe("Core flows", () => {cy.merchantDeleteCall(globalState);});});++ context("List Connector Feature Matrix", () => {+ before("seed global state", () => {+ cy.task("getGlobalState").then((state) => {+ globalState = new State(state);+ });+ });++ after("flush global state", () => {+ cy.task("setGlobalState", globalState.data);+ });++ it("List connector feature matrix call", () => {+ cy.ListConnectorsFeatureMatrixCall(globalState);+ });+ });});diff --git a/cypress-tests/cypress/support/commands.js b/cypress-tests/cypress/support/commands.jsindex 891c659149..28590abd8b 100644--- a/cypress-tests/cypress/support/commands.js+++ b/cypress-tests/cypress/support/commands.js@@ -118,6 +118,29 @@ Cypress.Commands.add("merchantDeleteCall", (globalState) => {});});+Cypress.Commands.add("ListConnectorsFeatureMatrixCall", (globalState) => {+ const baseUrl = globalState.get("baseUrl");+ const url = `${baseUrl}/feature_matrix`;++ cy.request({+ method: "GET",+ url: url,+ headers: {+ Accept: "application/json",+ },+ }).then((response) => {+ logRequestId(response.headers["x-request-id"]);++ expect(response.body).to.have.property("connectors").and.not.empty;+ expect(response.body.connectors).to.be.an("array").and.not.empty;+ response.body.connectors.forEach((item) => {+ expect(item).to.have.property("description").and.not.empty;+ expect(item).to.have.property("category").and.not.empty;+ expect(item).to.have.property("supported_payment_methods").and.not.empty;+ });+ });+});+Cypress.Commands.add("merchantListCall", (globalState) => {const organization_id = globalState.get("organizationId");diff --git a/loadtest/config/development.toml b/loadtest/config/development.tomlindex 3320a5516d..64d0526d14 100644--- a/loadtest/config/development.toml+++ b/loadtest/config/development.toml@@ -279,6 +279,10 @@ paypal = { country = "AU,NZ,CN,JP,HK,MY,TH,KR,PH,ID,AE,KW,BR,ES,GB,SE,NO,SK,AT,Nklarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NO,PL,PT,RO,ES,SE,CH,NL,GB,US", currency = "AUD,EUR,CAD,CZK,DKK,NOK,PLN,RON,SEK,CHF,GBP,USD"}ideal = { country = "NL", currency = "EUR" }+[pm_filters.bambora]+credit = { country = "US,CA", currency = "USD" }+debit = { country = "US,CA", currency = "USD" }+[pm_filters.zen]credit = { not_available_flows = { capture_method = "manual" } }debit = { not_available_flows = { capture_method = "manual" } }