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
fix(router): limit webhook_setup_capabilities to payment_processor type connectors (#11099)
AkshayaFoigerfc1f95d63ec1
diff --git a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs b/crates/hyperswitch_domain_models/src/merchant_connector_account.rsindex c5dfd38f08..d0a70e914d 100644--- a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs+++ b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs@@ -117,6 +117,10 @@ impl MerchantConnectorAccount {Ok(Some(provider))}++ pub fn should_construct_webhook_setup_capability(&self) -> bool {+ matches!(self.connector_type, enums::ConnectorType::PaymentProcessor)+ }}#[cfg(feature = "v2")]diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rsindex f1700dd9b6..97475f8c6d 100644--- a/crates/router/src/types/transformers.rs+++ b/crates/router/src/types/transformers.rs@@ -1066,9 +1066,11 @@ impl ForeignTryFrom<domain::MerchantConnectorAccount>.transpose()?,};- let webhook_setup_details =- api_types::ConnectorData::convert_connector(item.connector_name.as_str())?- .get_api_webhook_config();+ let webhook_setup_capabilities = item+ .should_construct_webhook_setup_capability()+ .then(|| api_types::ConnectorData::convert_connector(item.connector_name.as_str()))+ .transpose()?+ .map(|connector_enum| connector_enum.get_api_webhook_config().clone());#[cfg(feature = "v1")]let response = Self {@@ -1125,7 +1127,7 @@ impl ForeignTryFrom<domain::MerchantConnectorAccount>.change_context(errors::ApiErrorResponse::InternalServerError)}).transpose()?,- webhook_setup_capabilities: Some(webhook_setup_details.clone()),+ webhook_setup_capabilities,};Ok(response)}