Bug: [REFACTOR] add `payment_id` and `merchant_id` to logs



The `server_wrap_util()` function will have to record the `merchant_id` as the authentication will happen inside `server_wrap()` function, so that the `payment_id` and `merchant_id` fields are available in the logs.
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index c8d69d7d51c..353d508c285 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -581,7 +581,7 @@ pub enum AuthFlow {
     Merchant,
 }
 
-#[instrument(skip(request, payload, state, func, api_auth))]
+#[instrument(skip(request, payload, state, func, api_auth), fields(merchant_id))]
 pub async fn server_wrap_util<'a, 'b, A, U, T, Q, F, Fut, E, OErr>(
     flow: &'a impl router_env::types::FlowMetric,
     state: &'b A,
@@ -606,7 +606,8 @@ where
         .authenticate_and_fetch(request.headers(), state)
         .await
         .switch()?;
-    let metric_merchant_id = auth_out.get_merchant_id().unwrap_or("").to_string();
+    let merchant_id = auth_out.get_merchant_id().unwrap_or("").to_string();
+    tracing::Span::current().record("merchant_id", &merchant_id);
 
     let output = func(state, auth_out, payload).await.switch();
 
@@ -615,11 +616,7 @@ where
         Err(err) => err.current_context().status_code().as_u16().into(),
     };
 
-    metrics::request::status_code_metrics(
-        status_code,
-        flow.to_string(),
-        metric_merchant_id.to_string(),
-    );
+    metrics::request::status_code_metrics(status_code, flow.to_string(), merchant_id.to_string());
 
     output
 }
diff --git a/crates/router/src/types/api/payments.rs b/crates/router/src/types/api/payments.rs
index 7cccae18e13..743dda74e76 100644
--- a/crates/router/src/types/api/payments.rs
+++ b/crates/router/src/types/api/payments.rs
@@ -93,7 +93,7 @@ pub struct Verify;
 #[derive(Debug, Clone)]
 pub struct PreProcessing;
 
-pub(crate) trait PaymentIdTypeExt {
+pub trait PaymentIdTypeExt {
     fn get_payment_intent_id(&self) -> errors::CustomResult<String, errors::ValidationError>;
 }
 

## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [x] Refactoring

## Description
<!-- Describe your changes in detail -->
- This PR includes minor changes to support adding payment id in the `Payments` flow logs. These changes will be used in other crates.
- Record `merchant_id` field in `server_wrap_util` where authentication happens.


## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.

If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless its an obvious bug or documentation fix
that will have little conversation).
-->
This change allows to query for logs using the payment id. 

## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
The change is not complete yet, will test once this will be integrated in other crate. The project compiles.

## Checklist
<!-- Put an `x` in the boxes that apply -->

- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed submitted code
