Skip to content

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

refactor: set merchant_id as `MERCHANT_ID_NOT_FOUND` for traces and metrics if not found (#2156)

Anish Rajand40fae87feb5
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index 2678c7d079..feee1db5e4 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -726,7 +726,10 @@ where
.authenticate_and_fetch(request.headers(), state)
.await
.switch()?;
- let merchant_id = auth_out.get_merchant_id().unwrap_or("").to_string();
+ let merchant_id = auth_out
+ .get_merchant_id()
+ .unwrap_or("MERCHANT_ID_NOT_FOUND")
+ .to_string();
tracing::Span::current().record("merchant_id", &merchant_id);
let output = func(state, auth_out, payload).await.switch();