mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 12:06:56 +08:00
fix(router/webhooks): correct webhook error mapping and make source verification optional for all connectors (#1333)
This commit is contained in:
@ -9,6 +9,7 @@ use transformers as opennode;
|
||||
use self::opennode::OpennodeWebhookDetails;
|
||||
use crate::{
|
||||
configs::settings,
|
||||
connector::utils as conn_utils,
|
||||
core::errors::{self, CustomResult},
|
||||
db, headers,
|
||||
services::{self, ConnectorIntegration},
|
||||
@ -527,13 +528,17 @@ impl api::IncomingWebhook for Opennode {
|
||||
db: &dyn db::StorageInterface,
|
||||
merchant_id: &str,
|
||||
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
|
||||
let key = format!("whsec_verification_{}_{}", self.id(), merchant_id);
|
||||
let secret = db
|
||||
.get_key(&key)
|
||||
.await
|
||||
.change_context(errors::ConnectorError::WebhookVerificationSecretNotFound)?;
|
||||
|
||||
Ok(secret)
|
||||
let key = conn_utils::get_webhook_merchant_secret_key(self.id(), merchant_id);
|
||||
let secret = match db.find_config_by_key(&key).await {
|
||||
Ok(config) => Some(config),
|
||||
Err(e) => {
|
||||
crate::logger::warn!("Unable to fetch merchant webhook secret from DB: {:#?}", e);
|
||||
None
|
||||
}
|
||||
};
|
||||
Ok(secret
|
||||
.map(|conf| conf.config.into_bytes())
|
||||
.unwrap_or_default())
|
||||
}
|
||||
|
||||
fn get_webhook_object_reference_id(
|
||||
|
||||
Reference in New Issue
Block a user