Skip to content

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

fix(connector): make webhook source verification mandatory for adyen (#2360)

Hrithikesh3d7e22a4f106
diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs
index 82fa35ceb6..bc6930891b 100644
--- a/crates/router/src/connector/adyen.rs
+++ b/crates/router/src/connector/adyen.rs
@@ -104,6 +104,9 @@ impl ConnectorValidation for Adyen {
}
.into())
}
+ fn is_webhook_source_verification_mandatory(&self) -> bool {
+ true
+ }
}
impl api::Payment for Adyen {}
diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rs
index ed7ba920b7..c365e3e6bf 100644
--- a/crates/router/src/core/webhooks.rs
+++ b/crates/router/src/core/webhooks.rs
@@ -895,6 +895,10 @@ pub async fn webhooks_core<W: types::OutgoingWebhookType>(
merchant_account.merchant_id.clone(),
)],
);
+ } else if connector.is_webhook_source_verification_mandatory() {
+ // if webhook consumption is mandatory for connector, fail webhook
+ // so that merchant can retrigger it after updating merchant_secret
+ return Err(errors::ApiErrorResponse::WebhookAuthenticationFailed.into());
}
logger::info!(source_verified=?source_verified);
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index 432844afbe..ec358e357f 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -88,6 +88,10 @@ pub trait ConnectorValidation: ConnectorCommon {
.change_context(errors::ConnectorError::MissingConnectorTransactionID)
.map(|_| ())
}
+
+ fn is_webhook_source_verification_mandatory(&self) -> bool {
+ false
+ }
}
#[async_trait::async_trait]