Bug: Add audit events for  PaymentConfirm update




diff --git a/config/development.toml b/config/development.toml
index 25fe55e6057..78b10192f1e 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -634,4 +634,4 @@ sdk_eligible_payment_methods = "card"
 enabled = false
 
 [multitenancy.tenants]
-public = { name = "hyperswitch", base_url = "http://localhost:8080", schema = "public", redis_key_prefix = ""}
\ No newline at end of file
+public = { name = "hyperswitch", base_url = "http://localhost:8080", schema = "public", redis_key_prefix = ""}
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index ea5f2c0ecb4..cff51ed8091 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -29,6 +29,7 @@ use crate::{
         utils as core_utils,
     },
     db::StorageInterface,
+    events::audit_events::{AuditEvent, AuditEventType},
     routes::{app::ReqState, SessionState},
     services,
     types::{
@@ -935,7 +936,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
     async fn update_trackers<'b>(
         &'b self,
         state: &'b SessionState,
-        _req_state: ReqState,
+        req_state: ReqState,
         mut payment_data: PaymentData<F>,
         customer: Option<domain::Customer>,
         storage_scheme: storage_enums::MerchantStorageScheme,
@@ -1294,6 +1295,19 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
         payment_data.payment_intent = payment_intent;
         payment_data.payment_attempt = payment_attempt;
 
+        let client_src = payment_data.payment_attempt.client_source.clone();
+        let client_ver = payment_data.payment_attempt.client_version.clone();
+
+        let frm_message = payment_data.frm_message.clone();
+        req_state
+            .event_context
+            .event(AuditEvent::new(AuditEventType::PaymentConfirm {
+                client_src,
+                client_ver,
+                frm_message,
+            }))
+            .with(payment_data.to_event())
+            .emit();
         Ok((Box::new(self), payment_data))
     }
 }
diff --git a/crates/router/src/events/audit_events.rs b/crates/router/src/events/audit_events.rs
index 0f186e691b9..6fc19018655 100644
--- a/crates/router/src/events/audit_events.rs
+++ b/crates/router/src/events/audit_events.rs
@@ -1,18 +1,27 @@
+use diesel_models::fraud_check::FraudCheck;
 use events::{Event, EventInfo};
 use serde::Serialize;
 use time::PrimitiveDateTime;
-
 #[derive(Debug, Clone, Serialize)]
 #[serde(tag = "event_type")]
 pub enum AuditEventType {
-    Error { error_message: String },
+    Error {
+        error_message: String,
+    },
     PaymentCreated,
     ConnectorDecided,
     ConnectorCalled,
     RefundCreated,
     RefundSuccess,
     RefundFail,
-    PaymentCancelled { cancellation_reason: Option<String> },
+    PaymentConfirm {
+        client_src: Option<String>,
+        client_ver: Option<String>,
+        frm_message: Option<FraudCheck>,
+    },
+    PaymentCancelled {
+        cancellation_reason: Option<String>,
+    },
 }
 
 #[derive(Debug, Clone, Serialize)]
@@ -43,6 +52,7 @@ impl Event for AuditEvent {
         let event_type = match &self.event_type {
             AuditEventType::Error { .. } => "error",
             AuditEventType::PaymentCreated => "payment_created",
+            AuditEventType::PaymentConfirm { .. } => "payment_confirm",
             AuditEventType::ConnectorDecided => "connector_decided",
             AuditEventType::ConnectorCalled => "connector_called",
             AuditEventType::RefundCreated => "refund_created",

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

- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
- Pass along request_state to payment_core
- Update `updatetrackers` trait to accept request state
- Update the paymentconfirm implementation of updatetracker to generate an event


### Additional Changes

- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables

<!--
Provide links to the files with corresponding changes.

Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->


## 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 it is an obvious bug or documentation fix
that will have little conversation).
-->
- Generating domain events that can be used to track the high level overview of any process

## How did you test it?
### Test Case Description
- Implemented an event trigger that activates whenever the payment confirm API is utilized. This event triggers an audit event, the details of which are subsequently reflected in the Kafka UI.
- Create a payment & then confirm it 
- Fields that need to be tested are: `client_src`, `client_ver`and `frm_message`.
```
{"topic" = "hyperswitch-audit-events"}
```

<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
![image](https://github.com/juspay/hyperswitch/assets/89402434/c24bf03b-3002-41b2-ab25-d786285ea233)


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

- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
