Skip to content

Commit

Permalink
fix(connector): make webhook source verification mandatory for adyen (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hrithikesh026 authored Sep 26, 2023
1 parent d8c3845 commit 3d7e22a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/router/src/connector/adyen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ impl ConnectorValidation for Adyen {
}
.into())
}
fn is_webhook_source_verification_mandatory(&self) -> bool {
true
}
}

impl api::Payment for Adyen {}
Expand Down
4 changes: 4 additions & 0 deletions crates/router/src/core/webhooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions crates/router/src/services/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 3d7e22a

Please sign in to comment.