feat(router): add webhook source verification support for multiple mca of the same connector (#1897)

This commit is contained in:
Sai Harsha Vardhan
2023-08-10 15:24:17 +05:30
committed by GitHub
parent 29f068b205
commit 3554fec1c1
10 changed files with 230 additions and 30 deletions

View File

@ -751,13 +751,19 @@ pub async fn webhooks_core<W: types::OutgoingWebhookType>(
let flow_type: api::WebhookFlow = event_type.to_owned().into();
if process_webhook_further && !matches!(flow_type, api::WebhookFlow::ReturnResponse) {
let object_ref_id = connector
.get_webhook_object_reference_id(&request_details)
.switch()
.attach_printable("Could not find object reference id in incoming webhook body")?;
let source_verified = connector
.verify_webhook_source(
&*state.store,
&request_details,
&merchant_account.merchant_id,
&merchant_account,
connector_name,
&key_store,
object_ref_id.clone(),
)
.await
.switch()
@ -775,10 +781,6 @@ pub async fn webhooks_core<W: types::OutgoingWebhookType>(
}
logger::info!(source_verified=?source_verified);
let object_ref_id = connector
.get_webhook_object_reference_id(&request_details)
.switch()
.attach_printable("Could not find object reference id in incoming webhook body")?;
let event_object = connector
.get_webhook_resource_object(&request_details)