mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 05:17:02 +08:00
fix(router/webhooks): correct webhook error mapping and make source verification optional for all connectors (#1333)
This commit is contained in:
@ -10,6 +10,7 @@ use transformers as trustpay;
|
||||
use super::utils::collect_and_sort_values_by_removing_signature;
|
||||
use crate::{
|
||||
configs::settings,
|
||||
connector::utils as conn_utils,
|
||||
consts,
|
||||
core::{
|
||||
errors::{self, CustomResult},
|
||||
@ -729,12 +730,17 @@ impl api::IncomingWebhook for Trustpay {
|
||||
db: &dyn crate::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_dispute_details(
|
||||
|
||||
Reference in New Issue
Block a user