fix(router/webhooks): correct webhook error mapping and make source verification optional for all connectors (#1333)

This commit is contained in:
ItsMeShashank
2023-06-02 15:30:37 +05:30
committed by GitHub
parent b681f78d96
commit 71315097dd
23 changed files with 191 additions and 114 deletions

View File

@ -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(