Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix: merchant webhook config should be looked up in config table instead of redis (#1241)
Hrithikesh48e537568deb
diff --git a/crates/router/src/core/webhooks.rs b/crates/router/src/core/webhooks.rsindex ae697c7eb1..cd09fa6831 100644--- a/crates/router/src/core/webhooks.rs+++ b/crates/router/src/core/webhooks.rs@@ -535,6 +535,8 @@ pub async fn trigger_webhook_to_merchant<W: api::OutgoingWebhookType>(let response =services::api::send_request(state, request, Some(OUTGOING_WEBHOOK_TIMEOUT_SECS)).await;+ logger::debug!(outgoing_webhook_response=?response);+match response {Err(e) => {// [#217]: Schedule webhook for retry.diff --git a/crates/router/src/core/webhooks/utils.rs b/crates/router/src/core/webhooks/utils.rsindex b41055dcc5..5826216b16 100644--- a/crates/router/src/core/webhooks/utils.rs+++ b/crates/router/src/core/webhooks/utils.rs@@ -20,11 +20,28 @@ pub async fn lookup_webhook_event(event: &api::IncomingWebhookEvent,) -> bool {let redis_key = format!("whconf_{merchant_id}_{connector_id}");- let webhook_config: api::MerchantWebhookConfig =+ let merchant_webhook_config_result =get_and_deserialize_key(db, &redis_key, "MerchantWebhookConfig").await- .map(|h| &h | &default_webhook_config())- .unwrap_or_else(|_| default_webhook_config());+ .map(|h| &h | &default_webhook_config());- webhook_config.contains(event)+ match merchant_webhook_config_result {+ Ok(merchant_webhook_config) => merchant_webhook_config.contains(event),+ Err(..) => {+ //if failed to fetch from redis. fetch from db and populate redis+ db.find_config_by_key_cached(&redis_key)+ .await+ .map(|config| {+ if let Ok(set) =+ serde_json::from_str::<api::MerchantWebhookConfig>(&config.config)+ {+ &set | &default_webhook_config()+ } else {+ default_webhook_config()+ }+ })+ .unwrap_or_else(|_| default_webhook_config())+ .contains(event)+ }+ }}