Bug: [FEATURE] [FISERV] Move connector code for fiserv to crate hyperswitch_connectors



### Feature Description

Connector code for `fiserv` needs to be moved from crate router to new crate hyperswitch_connectors

### Possible Implementation

Connector code for `fiserv` needs to be moved from crate router to new crate hyperswitch_connectors

### Have you spent some time checking if this feature request has been raised before?

- [X] I checked and didn't find a similar issue

### Have you read the Contributing Guidelines?

- [X] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)

### Are you willing to submit a PR?

Yes, I am willing to submit a PR!
diff --git a/Cargo.lock b/Cargo.lock
index c5eac1ef868..45556ef401e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3836,6 +3836,7 @@ version = "0.1.0"
 dependencies = [
  "api_models",
  "async-trait",
+ "base64 0.22.0",
  "cards",
  "common_enums",
  "common_utils",
@@ -3843,10 +3844,13 @@ dependencies = [
  "hyperswitch_domain_models",
  "hyperswitch_interfaces",
  "masking",
+ "ring 0.17.8",
  "router_env",
  "serde",
  "serde_json",
  "strum 0.26.2",
+ "time",
+ "uuid",
 ]
 
 [[package]]
diff --git a/crates/hyperswitch_connectors/Cargo.toml b/crates/hyperswitch_connectors/Cargo.toml
index 0e620c6b9f0..30671d43bd9 100644
--- a/crates/hyperswitch_connectors/Cargo.toml
+++ b/crates/hyperswitch_connectors/Cargo.toml
@@ -11,10 +11,14 @@ payouts = ["hyperswitch_domain_models/payouts", "api_models/payouts", "hyperswit
 
 [dependencies]
 async-trait = "0.1.79"
+base64 = "0.22.0"
 error-stack = "0.4.1"
+ring = "0.17.8"
 serde = { version = "1.0.197", features = ["derive"] }
 serde_json = "1.0.115"
 strum = { version = "0.26", features = ["derive"] }
+time = "0.3.35"
+uuid = { version = "1.8.0", features = ["v4"] }
 
 # First party crates
 api_models = { version = "0.1.0", path = "../api_models", features = ["errors"] , default-features = false}
diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs
index a2d78ede2b9..0481939feb4 100644
--- a/crates/hyperswitch_connectors/src/connectors.rs
+++ b/crates/hyperswitch_connectors/src/connectors.rs
@@ -1,2 +1,4 @@
+pub mod fiserv;
 pub mod helcim;
-pub use self::helcim::Helcim;
+
+pub use self::{fiserv::Fiserv, helcim::Helcim};
diff --git a/crates/router/src/connector/fiserv.rs b/crates/hyperswitch_connectors/src/connectors/fiserv.rs
similarity index 67%
rename from crates/router/src/connector/fiserv.rs
rename to crates/hyperswitch_connectors/src/connectors/fiserv.rs
index 75147fe780c..fc67cd2fde7 100644
--- a/crates/router/src/connector/fiserv.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiserv.rs
@@ -3,34 +3,45 @@ pub mod transformers;
 use std::fmt::Debug;
 
 use base64::Engine;
-use common_utils::request::RequestContent;
-use diesel_models::enums;
+use common_enums::enums;
+use common_utils::{
+    errors::CustomResult,
+    ext_traits::BytesExt,
+    request::{Method, Request, RequestBuilder, RequestContent},
+};
 use error_stack::{report, ResultExt};
-use masking::{ExposeInterface, PeekInterface};
+use hyperswitch_domain_models::{
+    router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
+    router_flow_types::{
+        access_token_auth::AccessTokenAuth,
+        payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
+        refunds::{Execute, RSync},
+    },
+    router_request_types::{
+        AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
+        PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
+        RefundsData, SetupMandateRequestData,
+    },
+    router_response_types::{PaymentsResponseData, RefundsResponseData},
+    types::{
+        PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
+        PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
+    },
+};
+use hyperswitch_interfaces::{
+    api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},
+    configs::Connectors,
+    consts, errors,
+    events::connector_api_logs::ConnectorEvent,
+    types, webhooks,
+};
+use masking::{ExposeInterface, Mask, PeekInterface};
 use ring::hmac;
 use time::OffsetDateTime;
 use transformers as fiserv;
 use uuid::Uuid;
 
-use crate::{
-    configs::settings,
-    connector::utils as connector_utils,
-    consts,
-    core::errors::{self, CustomResult},
-    events::connector_api_logs::ConnectorEvent,
-    headers, logger,
-    services::{
-        self,
-        api::ConnectorIntegration,
-        request::{self, Mask},
-        ConnectorValidation,
-    },
-    types::{
-        self,
-        api::{self, ConnectorCommon, ConnectorCommonExt},
-    },
-    utils::BytesExt,
-};
+use crate::{constants::headers, types::ResponseRouterData, utils};
 
 #[derive(Debug, Clone)]
 pub struct Fiserv;
@@ -51,8 +62,8 @@ impl Fiserv {
         let raw_signature = format!("{}{request_id}{timestamp}{payload}", api_key.peek());
 
         let key = hmac::Key::new(hmac::HMAC_SHA256, api_secret.expose().as_bytes());
-        let signature_value =
-            consts::BASE64_ENGINE.encode(hmac::sign(&key, raw_signature.as_bytes()).as_ref());
+        let signature_value = common_utils::consts::BASE64_ENGINE
+            .encode(hmac::sign(&key, raw_signature.as_bytes()).as_ref());
         Ok(signature_value)
     }
 }
@@ -63,9 +74,9 @@ where
 {
     fn build_headers(
         &self,
-        req: &types::RouterData<Flow, Request, Response>,
-        connectors: &settings::Connectors,
-    ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+        req: &RouterData<Flow, Request, Response>,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
         let timestamp = OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000_000;
         let auth: fiserv::FiservAuthType =
             fiserv::FiservAuthType::try_from(&req.connector_auth_type)?;
@@ -112,13 +123,13 @@ impl ConnectorCommon for Fiserv {
         "application/json"
     }
 
-    fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str {
+    fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
         connectors.fiserv.base_url.as_ref()
     }
     fn get_auth_header(
         &self,
-        auth_type: &types::ConnectorAuthType,
-    ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+        auth_type: &ConnectorAuthType,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
         let auth = fiserv::FiservAuthType::try_from(auth_type)
             .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
         Ok(vec![(
@@ -130,7 +141,7 @@ impl ConnectorCommon for Fiserv {
         &self,
         res: types::Response,
         event_builder: Option<&mut ConnectorEvent>,
-    ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
         let response: fiserv::ErrorResponse = res
             .response
             .parse_struct("Fiserv ErrorResponse")
@@ -144,21 +155,19 @@ impl ConnectorCommon for Fiserv {
         Ok(error
             .or(details)
             .and_then(|error_details| {
-                error_details
-                    .first()
-                    .map(|first_error| types::ErrorResponse {
-                        code: first_error
-                            .code
-                            .to_owned()
-                            .unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
-                        message: first_error.message.to_owned(),
-                        reason: first_error.field.to_owned(),
-                        status_code: res.status_code,
-                        attempt_status: None,
-                        connector_transaction_id: None,
-                    })
+                error_details.first().map(|first_error| ErrorResponse {
+                    code: first_error
+                        .code
+                        .to_owned()
+                        .unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
+                    message: first_error.message.to_owned(),
+                    reason: first_error.field.to_owned(),
+                    status_code: res.status_code,
+                    attempt_status: None,
+                    connector_transaction_id: None,
+                })
             })
-            .unwrap_or(types::ErrorResponse {
+            .unwrap_or(ErrorResponse {
                 code: consts::NO_ERROR_CODE.to_string(),
                 message: consts::NO_ERROR_MESSAGE.to_string(),
                 reason: None,
@@ -179,7 +188,7 @@ impl ConnectorValidation for Fiserv {
         match capture_method {
             enums::CaptureMethod::Automatic | enums::CaptureMethod::Manual => Ok(()),
             enums::CaptureMethod::ManualMultiple | enums::CaptureMethod::Scheduled => Err(
-                connector_utils::construct_not_implemented_error_report(capture_method, self.id()),
+                utils::construct_not_implemented_error_report(capture_method, self.id()),
             ),
         }
     }
@@ -187,9 +196,7 @@ impl ConnectorValidation for Fiserv {
 
 impl api::ConnectorAccessToken for Fiserv {}
 
-impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, types::AccessToken>
-    for Fiserv
-{
+impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Fiserv {
     // Not Implemented (R)
 }
 
@@ -197,12 +204,8 @@ impl api::Payment for Fiserv {}
 
 impl api::PaymentToken for Fiserv {}
 
-impl
-    ConnectorIntegration<
-        api::PaymentMethodToken,
-        types::PaymentMethodTokenizationData,
-        types::PaymentsResponseData,
-    > for Fiserv
+impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
+    for Fiserv
 {
     // Not Implemented (R)
 }
@@ -210,22 +213,12 @@ impl
 impl api::MandateSetup for Fiserv {}
 
 #[allow(dead_code)]
-impl
-    ConnectorIntegration<
-        api::SetupMandate,
-        types::SetupMandateRequestData,
-        types::PaymentsResponseData,
-    > for Fiserv
-{
+impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Fiserv {
     fn build_request(
         &self,
-        _req: &types::RouterData<
-            api::SetupMandate,
-            types::SetupMandateRequestData,
-            types::PaymentsResponseData,
-        >,
-        _connectors: &settings::Connectors,
-    ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+        _req: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
+        _connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
         Err(
             errors::ConnectorError::NotImplemented("Setup Mandate flow for Fiserv".to_string())
                 .into(),
@@ -236,14 +229,12 @@ impl
 impl api::PaymentVoid for Fiserv {}
 
 #[allow(dead_code)]
-impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsResponseData>
-    for Fiserv
-{
+impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Fiserv {
     fn get_headers(
         &self,
-        req: &types::PaymentsCancelRouterData,
-        connectors: &settings::Connectors,
-    ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+        req: &PaymentsCancelRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
         self.build_headers(req, connectors)
     }
 
@@ -253,8 +244,8 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
 
     fn get_url(
         &self,
-        _req: &types::PaymentsCancelRouterData,
-        connectors: &settings::Connectors,
+        _req: &PaymentsCancelRouterData,
+        connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
         Ok(format!(
             //The docs has this url wrong, cancels is the working endpoint
@@ -265,8 +256,8 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
 
     fn get_request_body(
         &self,
-        req: &types::PaymentsCancelRouterData,
-        _connectors: &settings::Connectors,
+        req: &PaymentsCancelRouterData,
+        _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
         let connector_req = fiserv::FiservCancelRequest::try_from(req)?;
         Ok(RequestContent::Json(Box::new(connector_req)))
@@ -274,12 +265,12 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
 
     fn build_request(
         &self,
-        req: &types::PaymentsCancelRouterData,
-        connectors: &settings::Connectors,
-    ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+        req: &PaymentsCancelRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
         let request = Some(
-            services::RequestBuilder::new()
-                .method(services::Method::Post)
+            RequestBuilder::new()
+                .method(Method::Post)
                 .url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
                 .attach_default_headers()
                 .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?)
@@ -294,17 +285,17 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
 
     fn handle_response(
         &self,
-        data: &types::PaymentsCancelRouterData,
+        data: &PaymentsCancelRouterData,
         event_builder: Option<&mut ConnectorEvent>,
         res: types::Response,
-    ) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {
+    ) -> CustomResult<PaymentsCancelRouterData, errors::ConnectorError> {
         let response: fiserv::FiservPaymentsResponse = res
             .response
             .parse_struct("Fiserv PaymentResponse")
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
-        types::RouterData::try_from(types::ResponseRouterData {
+        RouterData::try_from(ResponseRouterData {
             response,
             data: data.clone(),
             http_code: res.status_code,
@@ -316,7 +307,7 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
         &self,
         res: types::Response,
         event_builder: Option<&mut ConnectorEvent>,
-    ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
         self.build_error_response(res, event_builder)
     }
 }
@@ -324,14 +315,12 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
 impl api::PaymentSync for Fiserv {}
 
 #[allow(dead_code)]
-impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsResponseData>
-    for Fiserv
-{
+impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Fiserv {
     fn get_headers(
         &self,
-        req: &types::PaymentsSyncRouterData,
-        connectors: &settings::Connectors,
-    ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+        req: &PaymentsSyncRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
         self.build_headers(req, connectors)
     }
 
@@ -341,8 +330,8 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
 
     fn get_url(
         &self,
-        _req: &types::PaymentsSyncRouterData,
-        connectors: &settings::Connectors,
+        _req: &PaymentsSyncRouterData,
+        connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
         Ok(format!(
             "{}ch/payments/v1/transaction-inquiry",
@@ -352,8 +341,8 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
 
     fn get_request_body(
         &self,
-        req: &types::PaymentsSyncRouterData,
-        _connectors: &settings::Connectors,
+        req: &PaymentsSyncRouterData,
+        _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
         let connector_req = fiserv::FiservSyncRequest::try_from(req)?;
         Ok(RequestContent::Json(Box::new(connector_req)))
@@ -361,12 +350,12 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
 
     fn build_request(
         &self,
-        req: &types::PaymentsSyncRouterData,
-        connectors: &settings::Connectors,
-    ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+        req: &PaymentsSyncRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
         let request = Some(
-            services::RequestBuilder::new()
-                .method(services::Method::Post)
+            RequestBuilder::new()
+                .method(Method::Post)
                 .url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
                 .attach_default_headers()
                 .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
@@ -380,17 +369,17 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
 
     fn handle_response(
         &self,
-        data: &types::PaymentsSyncRouterData,
+        data: &PaymentsSyncRouterData,
         event_builder: Option<&mut ConnectorEvent>,
         res: types::Response,
-    ) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {
+    ) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
         let response: fiserv::FiservSyncResponse = res
             .response
             .parse_struct("Fiserv PaymentSyncResponse")
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
-        types::RouterData::try_from(types::ResponseRouterData {
+        RouterData::try_from(ResponseRouterData {
             response,
             data: data.clone(),
             http_code: res.status_code,
@@ -402,20 +391,18 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
         &self,
         res: types::Response,
         event_builder: Option<&mut ConnectorEvent>,
-    ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
         self.build_error_response(res, event_builder)
     }
 }
 
 impl api::PaymentCapture for Fiserv {}
-impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::PaymentsResponseData>
-    for Fiserv
-{
+impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Fiserv {
     fn get_headers(
         &self,
-        req: &types::PaymentsCaptureRouterData,
-        connectors: &settings::Connectors,
-    ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+        req: &PaymentsCaptureRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
         self.build_headers(req, connectors)
     }
 
@@ -425,8 +412,8 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
 
     fn get_request_body(
         &self,
-        req: &types::PaymentsCaptureRouterData,
-        _connectors: &settings::Connectors,
+        req: &PaymentsCaptureRouterData,
+        _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
         let router_obj = fiserv::FiservRouterData::try_from((
             &self.get_currency_unit(),
@@ -440,12 +427,12 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
 
     fn build_request(
         &self,
-        req: &types::PaymentsCaptureRouterData,
-        connectors: &settings::Connectors,
-    ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+        req: &PaymentsCaptureRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
         let request = Some(
-            services::RequestBuilder::new()
-                .method(services::Method::Post)
+            RequestBuilder::new()
+                .method(Method::Post)
                 .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
                 .attach_default_headers()
                 .headers(types::PaymentsCaptureType::get_headers(
@@ -461,10 +448,10 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
 
     fn handle_response(
         &self,
-        data: &types::PaymentsCaptureRouterData,
+        data: &PaymentsCaptureRouterData,
         event_builder: Option<&mut ConnectorEvent>,
         res: types::Response,
-    ) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {
+    ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
         let response: fiserv::FiservPaymentsResponse = res
             .response
             .parse_struct("Fiserv Payment Response")
@@ -473,7 +460,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
 
-        types::RouterData::try_from(types::ResponseRouterData {
+        RouterData::try_from(ResponseRouterData {
             response,
             data: data.clone(),
             http_code: res.status_code,
@@ -483,8 +470,8 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
 
     fn get_url(
         &self,
-        _req: &types::PaymentsCaptureRouterData,
-        connectors: &settings::Connectors,
+        _req: &PaymentsCaptureRouterData,
+        connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
         Ok(format!(
             "{}ch/payments/v1/charges",
@@ -496,7 +483,7 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
         &self,
         res: types::Response,
         event_builder: Option<&mut ConnectorEvent>,
-    ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
         self.build_error_response(res, event_builder)
     }
 }
@@ -504,21 +491,16 @@ impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::Payme
 impl api::PaymentSession for Fiserv {}
 
 #[allow(dead_code)]
-impl ConnectorIntegration<api::Session, types::PaymentsSessionData, types::PaymentsResponseData>
-    for Fiserv
-{
-}
+impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Fiserv {}
 
 impl api::PaymentAuthorize for Fiserv {}
 
-impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::PaymentsResponseData>
-    for Fiserv
-{
+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Fiserv {
     fn get_headers(
         &self,
-        req: &types::PaymentsAuthorizeRouterData,
-        connectors: &settings::Connectors,
-    ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+        req: &PaymentsAuthorizeRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
         self.build_headers(req, connectors)
     }
 
@@ -528,8 +510,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
 
     fn get_url(
         &self,
-        _req: &types::PaymentsAuthorizeRouterData,
-        connectors: &settings::Connectors,
+        _req: &PaymentsAuthorizeRouterData,
+        connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
         Ok(format!(
             "{}ch/payments/v1/charges",
@@ -539,8 +521,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
 
     fn get_request_body(
         &self,
-        req: &types::PaymentsAuthorizeRouterData,
-        _connectors: &settings::Connectors,
+        req: &PaymentsAuthorizeRouterData,
+        _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
         let router_obj = fiserv::FiservRouterData::try_from((
             &self.get_currency_unit(),
@@ -554,12 +536,12 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
 
     fn build_request(
         &self,
-        req: &types::PaymentsAuthorizeRouterData,
-        connectors: &settings::Connectors,
-    ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+        req: &PaymentsAuthorizeRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
         let request = Some(
-            services::RequestBuilder::new()
-                .method(services::Method::Post)
+            RequestBuilder::new()
+                .method(Method::Post)
                 .url(&types::PaymentsAuthorizeType::get_url(
                     self, req, connectors,
                 )?)
@@ -578,17 +560,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
 
     fn handle_response(
         &self,
-        data: &types::PaymentsAuthorizeRouterData,
+        data: &PaymentsAuthorizeRouterData,
         event_builder: Option<&mut ConnectorEvent>,
         res: types::Response,
-    ) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
+    ) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
         let response: fiserv::FiservPaymentsResponse = res
             .response
             .parse_struct("Fiserv PaymentResponse")
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
-        types::RouterData::try_from(types::ResponseRouterData {
+        RouterData::try_from(ResponseRouterData {
             response,
             data: data.clone(),
             http_code: res.status_code,
@@ -600,7 +582,7 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
         &self,
         res: types::Response,
         event_builder: Option<&mut ConnectorEvent>,
-    ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
         self.build_error_response(res, event_builder)
     }
 }
@@ -610,12 +592,12 @@ impl api::RefundExecute for Fiserv {}
 impl api::RefundSync for Fiserv {}
 
 #[allow(dead_code)]
-impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponseData> for Fiserv {
+impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Fiserv {
     fn get_headers(
         &self,
-        req: &types::RefundsRouterData<api::Execute>,
-        connectors: &settings::Connectors,
-    ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+        req: &RefundsRouterData<Execute>,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
         self.build_headers(req, connectors)
     }
     fn get_content_type(&self) -> &'static str {
@@ -623,8 +605,8 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
     }
     fn get_url(
         &self,
-        _req: &types::RefundsRouterData<api::Execute>,
-        connectors: &settings::Connectors,
+        _req: &RefundsRouterData<Execute>,
+        connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
         Ok(format!(
             "{}ch/payments/v1/refunds",
@@ -633,8 +615,8 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
     }
     fn get_request_body(
         &self,
-        req: &types::RefundsRouterData<api::Execute>,
-        _connectors: &settings::Connectors,
+        req: &RefundsRouterData<Execute>,
+        _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
         let router_obj = fiserv::FiservRouterData::try_from((
             &self.get_currency_unit(),
@@ -647,11 +629,11 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
     }
     fn build_request(
         &self,
-        req: &types::RefundsRouterData<api::Execute>,
-        connectors: &settings::Connectors,
-    ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
-        let request = services::RequestBuilder::new()
-            .method(services::Method::Post)
+        req: &RefundsRouterData<Execute>,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+        let request = RequestBuilder::new()
+            .method(Method::Post)
             .url(&types::RefundExecuteType::get_url(self, req, connectors)?)
             .attach_default_headers()
             .headers(types::RefundExecuteType::get_headers(
@@ -666,18 +648,18 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
 
     fn handle_response(
         &self,
-        data: &types::RefundsRouterData<api::Execute>,
+        data: &RefundsRouterData<Execute>,
         event_builder: Option<&mut ConnectorEvent>,
         res: types::Response,
-    ) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {
-        logger::debug!(target: "router::connector::fiserv", response=?res);
+    ) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
+        router_env::logger::debug!(target: "router::connector::fiserv", response=?res);
         let response: fiserv::RefundResponse =
             res.response
                 .parse_struct("fiserv RefundResponse")
                 .change_context(errors::ConnectorError::RequestEncodingFailed)?;
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
-        types::RouterData::try_from(types::ResponseRouterData {
+        RouterData::try_from(ResponseRouterData {
             response,
             data: data.clone(),
             http_code: res.status_code,
@@ -688,18 +670,18 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
         &self,
         res: types::Response,
         event_builder: Option<&mut ConnectorEvent>,
-    ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
         self.build_error_response(res, event_builder)
     }
 }
 
 #[allow(dead_code)]
-impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponseData> for Fiserv {
+impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Fiserv {
     fn get_headers(
         &self,
-        req: &types::RefundSyncRouterData,
-        connectors: &settings::Connectors,
-    ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+        req: &RefundSyncRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
         self.build_headers(req, connectors)
     }
 
@@ -709,8 +691,8 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
 
     fn get_url(
         &self,
-        _req: &types::RefundSyncRouterData,
-        connectors: &settings::Connectors,
+        _req: &RefundSyncRouterData,
+        connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
         Ok(format!(
             "{}ch/payments/v1/transaction-inquiry",
@@ -720,8 +702,8 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
 
     fn get_request_body(
         &self,
-        req: &types::RefundSyncRouterData,
-        _connectors: &settings::Connectors,
+        req: &RefundSyncRouterData,
+        _connectors: &Connectors,
     ) -> CustomResult<RequestContent, errors::ConnectorError> {
         let connector_req = fiserv::FiservSyncRequest::try_from(req)?;
         Ok(RequestContent::Json(Box::new(connector_req)))
@@ -729,12 +711,12 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
 
     fn build_request(
         &self,
-        req: &types::RefundSyncRouterData,
-        connectors: &settings::Connectors,
-    ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+        req: &RefundSyncRouterData,
+        connectors: &Connectors,
+    ) -> CustomResult<Option<Request>, errors::ConnectorError> {
         let request = Some(
-            services::RequestBuilder::new()
-                .method(services::Method::Post)
+            RequestBuilder::new()
+                .method(Method::Post)
                 .url(&types::RefundSyncType::get_url(self, req, connectors)?)
                 .attach_default_headers()
                 .headers(types::RefundSyncType::get_headers(self, req, connectors)?)
@@ -748,11 +730,11 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
 
     fn handle_response(
         &self,
-        data: &types::RefundSyncRouterData,
+        data: &RefundSyncRouterData,
         event_builder: Option<&mut ConnectorEvent>,
         res: types::Response,
-    ) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {
-        logger::debug!(target: "router::connector::fiserv", response=?res);
+    ) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
+        router_env::logger::debug!(target: "router::connector::fiserv", response=?res);
 
         let response: fiserv::FiservSyncResponse = res
             .response
@@ -760,7 +742,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
         event_builder.map(|i| i.set_response_body(&response));
         router_env::logger::info!(connector_response=?response);
-        types::RouterData::try_from(types::ResponseRouterData {
+        RouterData::try_from(ResponseRouterData {
             response,
             data: data.clone(),
             http_code: res.status_code,
@@ -772,30 +754,30 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
         &self,
         res: types::Response,
         event_builder: Option<&mut ConnectorEvent>,
-    ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+    ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
         self.build_error_response(res, event_builder)
     }
 }
 
 #[async_trait::async_trait]
-impl api::IncomingWebhook for Fiserv {
+impl webhooks::IncomingWebhook for Fiserv {
     fn get_webhook_object_reference_id(
         &self,
-        _request: &api::IncomingWebhookRequestDetails<'_>,
+        _request: &webhooks::IncomingWebhookRequestDetails<'_>,
     ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
         Err(report!(errors::ConnectorError::WebhooksNotImplemented))
     }
 
     fn get_webhook_event_type(
         &self,
-        _request: &api::IncomingWebhookRequestDetails<'_>,
-    ) -> CustomResult<api::IncomingWebhookEvent, errors::ConnectorError> {
-        Ok(api::IncomingWebhookEvent::EventNotSupported)
+        _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+    ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
+        Ok(api_models::webhooks::IncomingWebhookEvent::EventNotSupported)
     }
 
     fn get_webhook_resource_object(
         &self,
-        _request: &api::IncomingWebhookRequestDetails<'_>,
+        _request: &webhooks::IncomingWebhookRequestDetails<'_>,
     ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
         Err(report!(errors::ConnectorError::WebhooksNotImplemented))
     }
diff --git a/crates/router/src/connector/fiserv/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
similarity index 88%
rename from crates/router/src/connector/fiserv/transformers.rs
rename to crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
index 1a149c6af78..0ae59d4526e 100644
--- a/crates/router/src/connector/fiserv/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
@@ -1,15 +1,24 @@
+use common_enums::enums;
 use common_utils::{ext_traits::ValueExt, pii};
 use error_stack::ResultExt;
+use hyperswitch_domain_models::{
+    payment_method_data::PaymentMethodData,
+    router_data::{ConnectorAuthType, RouterData},
+    router_flow_types::refunds::{Execute, RSync},
+    router_request_types::ResponseId,
+    router_response_types::{PaymentsResponseData, RefundsResponseData},
+    types,
+};
+use hyperswitch_interfaces::{api, errors};
+use masking::Secret;
 use serde::{Deserialize, Serialize};
 
 use crate::{
-    connector::utils::{
+    types::{RefundsResponseRouterData, ResponseRouterData},
+    utils::{
         self, CardData as CardDataUtil, PaymentsCancelRequestData, PaymentsSyncRequestData,
-        RouterData,
+        RouterData as _,
     },
-    core::errors,
-    pii::Secret,
-    types::{self, api, domain, storage::enums},
 };
 
 #[derive(Debug, Serialize)]
@@ -166,7 +175,7 @@ impl TryFrom<&FiservRouterData<&types::PaymentsAuthorizeRouterData>> for FiservP
             pos_condition_code: TransactionInteractionPosConditionCode::CardNotPresentEcom,
         };
         let source = match item.router_data.request.payment_method_data.clone() {
-            domain::PaymentMethodData::Card(ref ccard) => {
+            PaymentMethodData::Card(ref ccard) => {
                 let card = CardData {
                     card_data: ccard.card_number.clone(),
                     expiration_month: ccard.card_exp_month.clone(),
@@ -175,21 +184,21 @@ impl TryFrom<&FiservRouterData<&types::PaymentsAuthorizeRouterData>> for FiservP
                 };
                 Source::PaymentCard { card }
             }
-            domain::PaymentMethodData::Wallet(_)
-            | domain::PaymentMethodData::PayLater(_)
-            | domain::PaymentMethodData::BankRedirect(_)
-            | domain::PaymentMethodData::BankDebit(_)
-            | domain::PaymentMethodData::CardRedirect(_)
-            | domain::PaymentMethodData::BankTransfer(_)
-            | domain::PaymentMethodData::Crypto(_)
-            | domain::PaymentMethodData::MandatePayment
-            | domain::PaymentMethodData::Reward
-            | domain::PaymentMethodData::RealTimePayment(_)
-            | domain::PaymentMethodData::Upi(_)
-            | domain::PaymentMethodData::Voucher(_)
-            | domain::PaymentMethodData::GiftCard(_)
-            | domain::PaymentMethodData::OpenBanking(_)
-            | domain::PaymentMethodData::CardToken(_) => {
+            PaymentMethodData::Wallet(_)
+            | PaymentMethodData::PayLater(_)
+            | PaymentMethodData::BankRedirect(_)
+            | PaymentMethodData::BankDebit(_)
+            | PaymentMethodData::CardRedirect(_)
+            | PaymentMethodData::BankTransfer(_)
+            | PaymentMethodData::Crypto(_)
+            | PaymentMethodData::MandatePayment
+            | PaymentMethodData::Reward
+            | PaymentMethodData::RealTimePayment(_)
+            | PaymentMethodData::Upi(_)
+            | PaymentMethodData::Voucher(_)
+            | PaymentMethodData::GiftCard(_)
+            | PaymentMethodData::OpenBanking(_)
+            | PaymentMethodData::CardToken(_) => {
                 Err(errors::ConnectorError::NotImplemented(
                     utils::get_unimplemented_payment_method_error_message("fiserv"),
                 ))
@@ -211,10 +220,10 @@ pub struct FiservAuthType {
     pub(super) api_secret: Secret<String>,
 }
 
-impl TryFrom<&types::ConnectorAuthType> for FiservAuthType {
+impl TryFrom<&ConnectorAuthType> for FiservAuthType {
     type Error = error_stack::Report<errors::ConnectorError>;
-    fn try_from(auth_type: &types::ConnectorAuthType) -> Result<Self, Self::Error> {
-        if let types::ConnectorAuthType::SignatureKey {
+    fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
+        if let ConnectorAuthType::SignatureKey {
             api_key,
             key1,
             api_secret,
@@ -348,20 +357,19 @@ pub struct TransactionProcessingDetails {
     transaction_id: String,
 }
 
-impl<F, T>
-    TryFrom<types::ResponseRouterData<F, FiservPaymentsResponse, T, types::PaymentsResponseData>>
-    for types::RouterData<F, T, types::PaymentsResponseData>
+impl<F, T> TryFrom<ResponseRouterData<F, FiservPaymentsResponse, T, PaymentsResponseData>>
+    for RouterData<F, T, PaymentsResponseData>
 {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
-        item: types::ResponseRouterData<F, FiservPaymentsResponse, T, types::PaymentsResponseData>,
+        item: ResponseRouterData<F, FiservPaymentsResponse, T, PaymentsResponseData>,
     ) -> Result<Self, Self::Error> {
         let gateway_resp = item.response.gateway_response;
 
         Ok(Self {
             status: enums::AttemptStatus::from(gateway_resp.transaction_state),
-            response: Ok(types::PaymentsResponseData::TransactionResponse {
-                resource_id: types::ResponseId::ConnectorTransactionId(
+            response: Ok(PaymentsResponseData::TransactionResponse {
+                resource_id: ResponseId::ConnectorTransactionId(
                     gateway_resp.transaction_processing_details.transaction_id,
                 ),
                 redirection_data: None,
@@ -379,12 +387,12 @@ impl<F, T>
     }
 }
 
-impl<F, T> TryFrom<types::ResponseRouterData<F, FiservSyncResponse, T, types::PaymentsResponseData>>
-    for types::RouterData<F, T, types::PaymentsResponseData>
+impl<F, T> TryFrom<ResponseRouterData<F, FiservSyncResponse, T, PaymentsResponseData>>
+    for RouterData<F, T, PaymentsResponseData>
 {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
-        item: types::ResponseRouterData<F, FiservSyncResponse, T, types::PaymentsResponseData>,
+        item: ResponseRouterData<F, FiservSyncResponse, T, PaymentsResponseData>,
     ) -> Result<Self, Self::Error> {
         let gateway_resp = match item.response.sync_responses.first() {
             Some(gateway_response) => gateway_response,
@@ -395,8 +403,8 @@ impl<F, T> TryFrom<types::ResponseRouterData<F, FiservSyncResponse, T, types::Pa
             status: enums::AttemptStatus::from(
                 gateway_resp.gateway_response.transaction_state.clone(),
             ),
-            response: Ok(types::PaymentsResponseData::TransactionResponse {
-                resource_id: types::ResponseId::ConnectorTransactionId(
+            response: Ok(PaymentsResponseData::TransactionResponse {
+                resource_id: ResponseId::ConnectorTransactionId(
                     gateway_resp
                         .gateway_response
                         .transaction_processing_details
@@ -590,15 +598,15 @@ pub struct RefundResponse {
     gateway_response: GatewayResponse,
 }
 
-impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>
-    for types::RefundsRouterData<api::Execute>
+impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>>
+    for types::RefundsRouterData<Execute>
 {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
-        item: types::RefundsResponseRouterData<api::Execute, RefundResponse>,
+        item: RefundsResponseRouterData<Execute, RefundResponse>,
     ) -> Result<Self, Self::Error> {
         Ok(Self {
-            response: Ok(types::RefundsResponseData {
+            response: Ok(RefundsResponseData {
                 connector_refund_id: item
                     .response
                     .gateway_response
@@ -613,12 +621,12 @@ impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>
     }
 }
 
-impl TryFrom<types::RefundsResponseRouterData<api::RSync, FiservSyncResponse>>
-    for types::RefundsRouterData<api::RSync>
+impl TryFrom<RefundsResponseRouterData<RSync, FiservSyncResponse>>
+    for types::RefundsRouterData<RSync>
 {
     type Error = error_stack::Report<errors::ConnectorError>;
     fn try_from(
-        item: types::RefundsResponseRouterData<api::RSync, FiservSyncResponse>,
+        item: RefundsResponseRouterData<RSync, FiservSyncResponse>,
     ) -> Result<Self, Self::Error> {
         let gateway_resp = item
             .response
@@ -626,7 +634,7 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, FiservSyncResponse>>
             .first()
             .ok_or(errors::ConnectorError::ResponseHandlingFailed)?;
         Ok(Self {
-            response: Ok(types::RefundsResponseData {
+            response: Ok(RefundsResponseData {
                 connector_refund_id: gateway_resp
                     .gateway_response
                     .transaction_processing_details
diff --git a/crates/hyperswitch_connectors/src/constants.rs b/crates/hyperswitch_connectors/src/constants.rs
index 9f5285bd2e1..8a5a2ff543a 100644
--- a/crates/hyperswitch_connectors/src/constants.rs
+++ b/crates/hyperswitch_connectors/src/constants.rs
@@ -1,6 +1,9 @@
 /// Header Constants
 pub(crate) mod headers {
+    pub(crate) const API_KEY: &str = "API-KEY";
     pub(crate) const API_TOKEN: &str = "Api-Token";
+    pub(crate) const AUTHORIZATION: &str = "Authorization";
     pub(crate) const CONTENT_TYPE: &str = "Content-Type";
     pub(crate) const IDEMPOTENCY_KEY: &str = "Idempotency-Key";
+    pub(crate) const TIMESTAMP: &str = "Timestamp";
 }
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index 2273b8c31da..d8e2e121318 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -81,7 +81,7 @@ macro_rules! default_imp_for_authorize_session_token {
     };
 }
 
-default_imp_for_authorize_session_token!(connectors::Helcim);
+default_imp_for_authorize_session_token!(connectors::Fiserv, connectors::Helcim);
 
 use crate::connectors;
 macro_rules! default_imp_for_complete_authorize {
@@ -99,7 +99,7 @@ macro_rules! default_imp_for_complete_authorize {
     };
 }
 
-default_imp_for_complete_authorize!(connectors::Helcim);
+default_imp_for_complete_authorize!(connectors::Fiserv, connectors::Helcim);
 
 macro_rules! default_imp_for_incremental_authorization {
     ($($path:ident::$connector:ident),*) => {
@@ -116,7 +116,7 @@ macro_rules! default_imp_for_incremental_authorization {
     };
 }
 
-default_imp_for_incremental_authorization!(connectors::Helcim);
+default_imp_for_incremental_authorization!(connectors::Fiserv, connectors::Helcim);
 
 macro_rules! default_imp_for_create_customer {
     ($($path:ident::$connector:ident),*) => {
@@ -133,7 +133,7 @@ macro_rules! default_imp_for_create_customer {
     };
 }
 
-default_imp_for_create_customer!(connectors::Helcim);
+default_imp_for_create_customer!(connectors::Fiserv, connectors::Helcim);
 
 macro_rules! default_imp_for_pre_processing_steps{
     ($($path:ident::$connector:ident),*)=> {
@@ -150,7 +150,7 @@ macro_rules! default_imp_for_pre_processing_steps{
     };
 }
 
-default_imp_for_pre_processing_steps!(connectors::Helcim);
+default_imp_for_pre_processing_steps!(connectors::Fiserv, connectors::Helcim);
 
 macro_rules! default_imp_for_post_processing_steps{
     ($($path:ident::$connector:ident),*)=> {
@@ -167,7 +167,7 @@ macro_rules! default_imp_for_post_processing_steps{
     };
 }
 
-default_imp_for_post_processing_steps!(connectors::Helcim);
+default_imp_for_post_processing_steps!(connectors::Fiserv, connectors::Helcim);
 
 macro_rules! default_imp_for_approve {
     ($($path:ident::$connector:ident),*) => {
@@ -184,7 +184,7 @@ macro_rules! default_imp_for_approve {
     };
 }
 
-default_imp_for_approve!(connectors::Helcim);
+default_imp_for_approve!(connectors::Fiserv, connectors::Helcim);
 
 macro_rules! default_imp_for_reject {
     ($($path:ident::$connector:ident),*) => {
@@ -201,7 +201,7 @@ macro_rules! default_imp_for_reject {
     };
 }
 
-default_imp_for_reject!(connectors::Helcim);
+default_imp_for_reject!(connectors::Fiserv, connectors::Helcim);
 
 macro_rules! default_imp_for_webhook_source_verification {
     ($($path:ident::$connector:ident),*) => {
@@ -218,7 +218,7 @@ macro_rules! default_imp_for_webhook_source_verification {
     };
 }
 
-default_imp_for_webhook_source_verification!(connectors::Helcim);
+default_imp_for_webhook_source_verification!(connectors::Fiserv, connectors::Helcim);
 
 macro_rules! default_imp_for_accept_dispute {
     ($($path:ident::$connector:ident),*) => {
@@ -236,7 +236,7 @@ macro_rules! default_imp_for_accept_dispute {
     };
 }
 
-default_imp_for_accept_dispute!(connectors::Helcim);
+default_imp_for_accept_dispute!(connectors::Fiserv, connectors::Helcim);
 
 macro_rules! default_imp_for_submit_evidence {
     ($($path:ident::$connector:ident),*) => {
@@ -253,7 +253,7 @@ macro_rules! default_imp_for_submit_evidence {
     };
 }
 
-default_imp_for_submit_evidence!(connectors::Helcim);
+default_imp_for_submit_evidence!(connectors::Fiserv, connectors::Helcim);
 
 macro_rules! default_imp_for_defend_dispute {
     ($($path:ident::$connector:ident),*) => {
@@ -270,7 +270,7 @@ macro_rules! default_imp_for_defend_dispute {
     };
 }
 
-default_imp_for_defend_dispute!(connectors::Helcim);
+default_imp_for_defend_dispute!(connectors::Fiserv, connectors::Helcim);
 
 macro_rules! default_imp_for_file_upload {
     ($($path:ident::$connector:ident),*) => {
@@ -296,7 +296,7 @@ macro_rules! default_imp_for_file_upload {
     };
 }
 
-default_imp_for_file_upload!(connectors::Helcim);
+default_imp_for_file_upload!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "payouts")]
 macro_rules! default_imp_for_payouts_create {
@@ -315,7 +315,7 @@ macro_rules! default_imp_for_payouts_create {
 }
 
 #[cfg(feature = "payouts")]
-default_imp_for_payouts_create!(connectors::Helcim);
+default_imp_for_payouts_create!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "payouts")]
 macro_rules! default_imp_for_payouts_retrieve {
@@ -334,7 +334,7 @@ macro_rules! default_imp_for_payouts_retrieve {
 }
 
 #[cfg(feature = "payouts")]
-default_imp_for_payouts_retrieve!(connectors::Helcim);
+default_imp_for_payouts_retrieve!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "payouts")]
 macro_rules! default_imp_for_payouts_eligibility {
@@ -353,7 +353,7 @@ macro_rules! default_imp_for_payouts_eligibility {
 }
 
 #[cfg(feature = "payouts")]
-default_imp_for_payouts_eligibility!(connectors::Helcim);
+default_imp_for_payouts_eligibility!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "payouts")]
 macro_rules! default_imp_for_payouts_fulfill {
@@ -372,7 +372,7 @@ macro_rules! default_imp_for_payouts_fulfill {
 }
 
 #[cfg(feature = "payouts")]
-default_imp_for_payouts_fulfill!(connectors::Helcim);
+default_imp_for_payouts_fulfill!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "payouts")]
 macro_rules! default_imp_for_payouts_cancel {
@@ -391,7 +391,7 @@ macro_rules! default_imp_for_payouts_cancel {
 }
 
 #[cfg(feature = "payouts")]
-default_imp_for_payouts_cancel!(connectors::Helcim);
+default_imp_for_payouts_cancel!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "payouts")]
 macro_rules! default_imp_for_payouts_quote {
@@ -410,7 +410,7 @@ macro_rules! default_imp_for_payouts_quote {
 }
 
 #[cfg(feature = "payouts")]
-default_imp_for_payouts_quote!(connectors::Helcim);
+default_imp_for_payouts_quote!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "payouts")]
 macro_rules! default_imp_for_payouts_recipient {
@@ -429,7 +429,7 @@ macro_rules! default_imp_for_payouts_recipient {
 }
 
 #[cfg(feature = "payouts")]
-default_imp_for_payouts_recipient!(connectors::Helcim);
+default_imp_for_payouts_recipient!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "payouts")]
 macro_rules! default_imp_for_payouts_recipient_account {
@@ -448,7 +448,7 @@ macro_rules! default_imp_for_payouts_recipient_account {
 }
 
 #[cfg(feature = "payouts")]
-default_imp_for_payouts_recipient_account!(connectors::Helcim);
+default_imp_for_payouts_recipient_account!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "frm")]
 macro_rules! default_imp_for_frm_sale {
@@ -467,7 +467,7 @@ macro_rules! default_imp_for_frm_sale {
 }
 
 #[cfg(feature = "frm")]
-default_imp_for_frm_sale!(connectors::Helcim);
+default_imp_for_frm_sale!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "frm")]
 macro_rules! default_imp_for_frm_checkout {
@@ -486,7 +486,7 @@ macro_rules! default_imp_for_frm_checkout {
 }
 
 #[cfg(feature = "frm")]
-default_imp_for_frm_checkout!(connectors::Helcim);
+default_imp_for_frm_checkout!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "frm")]
 macro_rules! default_imp_for_frm_transaction {
@@ -505,7 +505,7 @@ macro_rules! default_imp_for_frm_transaction {
 }
 
 #[cfg(feature = "frm")]
-default_imp_for_frm_transaction!(connectors::Helcim);
+default_imp_for_frm_transaction!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "frm")]
 macro_rules! default_imp_for_frm_fulfillment {
@@ -524,7 +524,7 @@ macro_rules! default_imp_for_frm_fulfillment {
 }
 
 #[cfg(feature = "frm")]
-default_imp_for_frm_fulfillment!(connectors::Helcim);
+default_imp_for_frm_fulfillment!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "frm")]
 macro_rules! default_imp_for_frm_record_return {
@@ -543,7 +543,7 @@ macro_rules! default_imp_for_frm_record_return {
 }
 
 #[cfg(feature = "frm")]
-default_imp_for_frm_record_return!(connectors::Helcim);
+default_imp_for_frm_record_return!(connectors::Fiserv, connectors::Helcim);
 
 macro_rules! default_imp_for_revoking_mandates {
     ($($path:ident::$connector:ident),*) => {
@@ -559,4 +559,4 @@ macro_rules! default_imp_for_revoking_mandates {
     };
 }
 
-default_imp_for_revoking_mandates!(connectors::Helcim);
+default_imp_for_revoking_mandates!(connectors::Fiserv, connectors::Helcim);
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index df72d3d9c48..f420447fd74 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -180,7 +180,7 @@ macro_rules! default_imp_for_new_connector_integration_payment {
     };
 }
 
-default_imp_for_new_connector_integration_payment!(connectors::Helcim);
+default_imp_for_new_connector_integration_payment!(connectors::Fiserv, connectors::Helcim);
 
 macro_rules! default_imp_for_new_connector_integration_refund {
     ($($path:ident::$connector:ident),*) => {
@@ -198,7 +198,7 @@ macro_rules! default_imp_for_new_connector_integration_refund {
     };
 }
 
-default_imp_for_new_connector_integration_refund!(connectors::Helcim);
+default_imp_for_new_connector_integration_refund!(connectors::Fiserv, connectors::Helcim);
 
 macro_rules! default_imp_for_new_connector_integration_connector_access_token {
     ($($path:ident::$connector:ident),*) => {
@@ -211,7 +211,10 @@ macro_rules! default_imp_for_new_connector_integration_connector_access_token {
     };
 }
 
-default_imp_for_new_connector_integration_connector_access_token!(connectors::Helcim);
+default_imp_for_new_connector_integration_connector_access_token!(
+    connectors::Fiserv,
+    connectors::Helcim
+);
 
 macro_rules! default_imp_for_new_connector_integration_accept_dispute {
     ($($path:ident::$connector:ident),*) => {
@@ -230,7 +233,7 @@ macro_rules! default_imp_for_new_connector_integration_accept_dispute {
     };
 }
 
-default_imp_for_new_connector_integration_accept_dispute!(connectors::Helcim);
+default_imp_for_new_connector_integration_accept_dispute!(connectors::Fiserv, connectors::Helcim);
 
 macro_rules! default_imp_for_new_connector_integration_submit_evidence {
     ($($path:ident::$connector:ident),*) => {
@@ -248,7 +251,7 @@ macro_rules! default_imp_for_new_connector_integration_submit_evidence {
     };
 }
 
-default_imp_for_new_connector_integration_submit_evidence!(connectors::Helcim);
+default_imp_for_new_connector_integration_submit_evidence!(connectors::Fiserv, connectors::Helcim);
 
 macro_rules! default_imp_for_new_connector_integration_defend_dispute {
     ($($path:ident::$connector:ident),*) => {
@@ -266,7 +269,7 @@ macro_rules! default_imp_for_new_connector_integration_defend_dispute {
     };
 }
 
-default_imp_for_new_connector_integration_defend_dispute!(connectors::Helcim);
+default_imp_for_new_connector_integration_defend_dispute!(connectors::Fiserv, connectors::Helcim);
 
 macro_rules! default_imp_for_new_connector_integration_file_upload {
     ($($path:ident::$connector:ident),*) => {
@@ -294,7 +297,7 @@ macro_rules! default_imp_for_new_connector_integration_file_upload {
     };
 }
 
-default_imp_for_new_connector_integration_file_upload!(connectors::Helcim);
+default_imp_for_new_connector_integration_file_upload!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "payouts")]
 macro_rules! default_imp_for_new_connector_integration_payouts_create {
@@ -314,7 +317,7 @@ macro_rules! default_imp_for_new_connector_integration_payouts_create {
 }
 
 #[cfg(feature = "payouts")]
-default_imp_for_new_connector_integration_payouts_create!(connectors::Helcim);
+default_imp_for_new_connector_integration_payouts_create!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "payouts")]
 macro_rules! default_imp_for_new_connector_integration_payouts_eligibility {
@@ -334,7 +337,10 @@ macro_rules! default_imp_for_new_connector_integration_payouts_eligibility {
 }
 
 #[cfg(feature = "payouts")]
-default_imp_for_new_connector_integration_payouts_eligibility!(connectors::Helcim);
+default_imp_for_new_connector_integration_payouts_eligibility!(
+    connectors::Fiserv,
+    connectors::Helcim
+);
 
 #[cfg(feature = "payouts")]
 macro_rules! default_imp_for_new_connector_integration_payouts_fulfill {
@@ -354,7 +360,7 @@ macro_rules! default_imp_for_new_connector_integration_payouts_fulfill {
 }
 
 #[cfg(feature = "payouts")]
-default_imp_for_new_connector_integration_payouts_fulfill!(connectors::Helcim);
+default_imp_for_new_connector_integration_payouts_fulfill!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "payouts")]
 macro_rules! default_imp_for_new_connector_integration_payouts_cancel {
@@ -374,7 +380,7 @@ macro_rules! default_imp_for_new_connector_integration_payouts_cancel {
 }
 
 #[cfg(feature = "payouts")]
-default_imp_for_new_connector_integration_payouts_cancel!(connectors::Helcim);
+default_imp_for_new_connector_integration_payouts_cancel!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "payouts")]
 macro_rules! default_imp_for_new_connector_integration_payouts_quote {
@@ -394,7 +400,7 @@ macro_rules! default_imp_for_new_connector_integration_payouts_quote {
 }
 
 #[cfg(feature = "payouts")]
-default_imp_for_new_connector_integration_payouts_quote!(connectors::Helcim);
+default_imp_for_new_connector_integration_payouts_quote!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "payouts")]
 macro_rules! default_imp_for_new_connector_integration_payouts_recipient {
@@ -414,7 +420,10 @@ macro_rules! default_imp_for_new_connector_integration_payouts_recipient {
 }
 
 #[cfg(feature = "payouts")]
-default_imp_for_new_connector_integration_payouts_recipient!(connectors::Helcim);
+default_imp_for_new_connector_integration_payouts_recipient!(
+    connectors::Fiserv,
+    connectors::Helcim
+);
 
 #[cfg(feature = "payouts")]
 macro_rules! default_imp_for_new_connector_integration_payouts_sync {
@@ -434,7 +443,7 @@ macro_rules! default_imp_for_new_connector_integration_payouts_sync {
 }
 
 #[cfg(feature = "payouts")]
-default_imp_for_new_connector_integration_payouts_sync!(connectors::Helcim);
+default_imp_for_new_connector_integration_payouts_sync!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "payouts")]
 macro_rules! default_imp_for_new_connector_integration_payouts_recipient_account {
@@ -454,7 +463,10 @@ macro_rules! default_imp_for_new_connector_integration_payouts_recipient_account
 }
 
 #[cfg(feature = "payouts")]
-default_imp_for_new_connector_integration_payouts_recipient_account!(connectors::Helcim);
+default_imp_for_new_connector_integration_payouts_recipient_account!(
+    connectors::Fiserv,
+    connectors::Helcim
+);
 
 macro_rules! default_imp_for_new_connector_integration_webhook_source_verification {
     ($($path:ident::$connector:ident),*) => {
@@ -472,7 +484,10 @@ macro_rules! default_imp_for_new_connector_integration_webhook_source_verificati
     };
 }
 
-default_imp_for_new_connector_integration_webhook_source_verification!(connectors::Helcim);
+default_imp_for_new_connector_integration_webhook_source_verification!(
+    connectors::Fiserv,
+    connectors::Helcim
+);
 
 #[cfg(feature = "frm")]
 macro_rules! default_imp_for_new_connector_integration_frm_sale {
@@ -492,7 +507,7 @@ macro_rules! default_imp_for_new_connector_integration_frm_sale {
 }
 
 #[cfg(feature = "frm")]
-default_imp_for_new_connector_integration_frm_sale!(connectors::Helcim);
+default_imp_for_new_connector_integration_frm_sale!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "frm")]
 macro_rules! default_imp_for_new_connector_integration_frm_checkout {
@@ -512,7 +527,7 @@ macro_rules! default_imp_for_new_connector_integration_frm_checkout {
 }
 
 #[cfg(feature = "frm")]
-default_imp_for_new_connector_integration_frm_checkout!(connectors::Helcim);
+default_imp_for_new_connector_integration_frm_checkout!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "frm")]
 macro_rules! default_imp_for_new_connector_integration_frm_transaction {
@@ -532,7 +547,7 @@ macro_rules! default_imp_for_new_connector_integration_frm_transaction {
 }
 
 #[cfg(feature = "frm")]
-default_imp_for_new_connector_integration_frm_transaction!(connectors::Helcim);
+default_imp_for_new_connector_integration_frm_transaction!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "frm")]
 macro_rules! default_imp_for_new_connector_integration_frm_fulfillment {
@@ -552,7 +567,7 @@ macro_rules! default_imp_for_new_connector_integration_frm_fulfillment {
 }
 
 #[cfg(feature = "frm")]
-default_imp_for_new_connector_integration_frm_fulfillment!(connectors::Helcim);
+default_imp_for_new_connector_integration_frm_fulfillment!(connectors::Fiserv, connectors::Helcim);
 
 #[cfg(feature = "frm")]
 macro_rules! default_imp_for_new_connector_integration_frm_record_return {
@@ -572,7 +587,10 @@ macro_rules! default_imp_for_new_connector_integration_frm_record_return {
 }
 
 #[cfg(feature = "frm")]
-default_imp_for_new_connector_integration_frm_record_return!(connectors::Helcim);
+default_imp_for_new_connector_integration_frm_record_return!(
+    connectors::Fiserv,
+    connectors::Helcim
+);
 
 macro_rules! default_imp_for_new_connector_integration_revoking_mandates {
     ($($path:ident::$connector:ident),*) => {
@@ -589,4 +607,7 @@ macro_rules! default_imp_for_new_connector_integration_revoking_mandates {
     };
 }
 
-default_imp_for_new_connector_integration_revoking_mandates!(connectors::Helcim);
+default_imp_for_new_connector_integration_revoking_mandates!(
+    connectors::Fiserv,
+    connectors::Helcim
+);
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index 0b8ecac9b07..40f98b6efdb 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -1,7 +1,7 @@
 use api_models::payments::{self, Address, AddressDetails, OrderDetailsWithAmount, PhoneDetails};
 use common_enums::{enums, enums::FutureUsage};
 use common_utils::{
-    errors::ReportSwitchExt,
+    errors::{CustomResult, ReportSwitchExt},
     ext_traits::{OptionExt, ValueExt},
     id_type,
     pii::{self, Email, IpAddress},
@@ -12,11 +12,12 @@ use hyperswitch_domain_models::{
     router_data::{PaymentMethodToken, RecurringMandatePaymentData},
     router_request_types::{
         AuthenticationData, BrowserInformation, PaymentsAuthorizeData, PaymentsCancelData,
-        PaymentsCaptureData, RefundsData, SetupMandateRequestData,
+        PaymentsCaptureData, PaymentsSyncData, RefundsData, ResponseId, SetupMandateRequestData,
     },
 };
 use hyperswitch_interfaces::{api, errors};
 use masking::{ExposeInterface, PeekInterface, Secret};
+use serde::Serializer;
 
 type Error = error_stack::Report<errors::ConnectorError>;
 
@@ -31,6 +32,27 @@ pub(crate) fn construct_not_supported_error_report(
     .into()
 }
 
+pub(crate) fn get_amount_as_string(
+    currency_unit: &api::CurrencyUnit,
+    amount: i64,
+    currency: enums::Currency,
+) -> Result<String, error_stack::Report<errors::ConnectorError>> {
+    let amount = match currency_unit {
+        api::CurrencyUnit::Minor => amount.to_string(),
+        api::CurrencyUnit::Base => to_currency_base_unit(amount, currency)?,
+    };
+    Ok(amount)
+}
+
+pub(crate) fn to_currency_base_unit(
+    amount: i64,
+    currency: enums::Currency,
+) -> Result<String, error_stack::Report<errors::ConnectorError>> {
+    currency
+        .to_currency_base_unit(amount)
+        .change_context(errors::ConnectorError::ParsingFailed)
+}
+
 pub(crate) fn get_amount_as_f64(
     currency_unit: &api::CurrencyUnit,
     amount: i64,
@@ -54,6 +76,18 @@ pub(crate) fn to_currency_base_unit_asf64(
         .change_context(errors::ConnectorError::ParsingFailed)
 }
 
+pub(crate) fn to_connector_meta_from_secret<T>(
+    connector_meta: Option<Secret<serde_json::Value>>,
+) -> Result<T, Error>
+where
+    T: serde::de::DeserializeOwned,
+{
+    let connector_meta_secret =
+        connector_meta.ok_or_else(missing_field_err("connector_meta_data"))?;
+    let json = connector_meta_secret.expose();
+    json.parse_value(std::any::type_name::<T>()).switch()
+}
+
 pub(crate) fn missing_field_err(
     message: &'static str,
 ) -> Box<dyn Fn() -> error_stack::Report<errors::ConnectorError> + '_> {
@@ -65,6 +99,24 @@ pub(crate) fn missing_field_err(
     })
 }
 
+pub(crate) fn construct_not_implemented_error_report(
+    capture_method: enums::CaptureMethod,
+    connector_name: &str,
+) -> error_stack::Report<errors::ConnectorError> {
+    errors::ConnectorError::NotImplemented(format!("{} for {}", capture_method, connector_name))
+        .into()
+}
+
+pub(crate) fn str_to_f32<S>(value: &str, serializer: S) -> Result<S::Ok, S::Error>
+where
+    S: Serializer,
+{
+    let float_value = value.parse::<f64>().map_err(|_| {
+        serde::ser::Error::custom("Invalid string, cannot be converted to float value")
+    })?;
+    serializer.serialize_f64(float_value)
+}
+
 pub(crate) const SELECTED_PAYMENT_METHOD: &str = "Selected payment method";
 
 pub(crate) fn get_unimplemented_payment_method_error_message(connector: &str) -> String {
@@ -943,6 +995,33 @@ impl PaymentsCaptureRequestData for PaymentsCaptureData {
     }
 }
 
+pub trait PaymentsSyncRequestData {
+    fn is_auto_capture(&self) -> Result<bool, Error>;
+    fn get_connector_transaction_id(&self) -> CustomResult<String, errors::ConnectorError>;
+}
+
+impl PaymentsSyncRequestData for PaymentsSyncData {
+    fn is_auto_capture(&self) -> Result<bool, Error> {
+        match self.capture_method {
+            Some(enums::CaptureMethod::Automatic) | None => Ok(true),
+            Some(enums::CaptureMethod::Manual) => Ok(false),
+            Some(_) => Err(errors::ConnectorError::CaptureMethodNotSupported.into()),
+        }
+    }
+    fn get_connector_transaction_id(&self) -> CustomResult<String, errors::ConnectorError> {
+        match self.connector_transaction_id.clone() {
+            ResponseId::ConnectorTransactionId(txn_id) => Ok(txn_id),
+            _ => Err(
+                common_utils::errors::ValidationError::IncorrectValueProvided {
+                    field_name: "connector_transaction_id",
+                },
+            )
+            .attach_printable("Expected connector transaction ID not found")
+            .change_context(errors::ConnectorError::MissingConnectorTransactionID)?,
+        }
+    }
+}
+
 pub trait PaymentsCancelRequestData {
     fn get_amount(&self) -> Result<i64, Error>;
     fn get_currency(&self) -> Result<enums::Currency, Error>;
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index 365b0ca87a6..a421c931203 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -21,7 +21,6 @@ pub mod dlocal;
 #[cfg(feature = "dummy_connector")]
 pub mod dummyconnector;
 pub mod ebanx;
-pub mod fiserv;
 pub mod forte;
 pub mod globalpay;
 pub mod globepay;
@@ -69,7 +68,7 @@ pub mod worldpay;
 pub mod zen;
 pub mod zsl;
 
-pub use hyperswitch_connectors::connectors::{helcim, helcim::Helcim};
+pub use hyperswitch_connectors::connectors::{fiserv, fiserv::Fiserv, helcim, helcim::Helcim};
 
 #[cfg(feature = "dummy_connector")]
 pub use self::dummyconnector::DummyConnector;
@@ -79,14 +78,14 @@ pub use self::{
     bankofamerica::Bankofamerica, billwerk::Billwerk, bitpay::Bitpay, bluesnap::Bluesnap,
     boku::Boku, braintree::Braintree, cashtocode::Cashtocode, checkout::Checkout,
     coinbase::Coinbase, cryptopay::Cryptopay, cybersource::Cybersource, datatrans::Datatrans,
-    dlocal::Dlocal, ebanx::Ebanx, fiserv::Fiserv, forte::Forte, globalpay::Globalpay,
-    globepay::Globepay, gocardless::Gocardless, gpayments::Gpayments, iatapay::Iatapay,
-    itaubank::Itaubank, klarna::Klarna, mifinity::Mifinity, mollie::Mollie,
-    multisafepay::Multisafepay, netcetera::Netcetera, nexinets::Nexinets, nmi::Nmi, noon::Noon,
-    nuvei::Nuvei, opayo::Opayo, opennode::Opennode, payeezy::Payeezy, payme::Payme, payone::Payone,
-    paypal::Paypal, payu::Payu, placetopay::Placetopay, plaid::Plaid, powertranz::Powertranz,
-    prophetpay::Prophetpay, rapyd::Rapyd, razorpay::Razorpay, riskified::Riskified, shift4::Shift4,
-    signifyd::Signifyd, square::Square, stax::Stax, stripe::Stripe, threedsecureio::Threedsecureio,
-    trustpay::Trustpay, tsys::Tsys, volt::Volt, wellsfargo::Wellsfargo, wise::Wise,
-    worldline::Worldline, worldpay::Worldpay, zen::Zen, zsl::Zsl,
+    dlocal::Dlocal, ebanx::Ebanx, forte::Forte, globalpay::Globalpay, globepay::Globepay,
+    gocardless::Gocardless, gpayments::Gpayments, iatapay::Iatapay, itaubank::Itaubank,
+    klarna::Klarna, mifinity::Mifinity, mollie::Mollie, multisafepay::Multisafepay,
+    netcetera::Netcetera, nexinets::Nexinets, nmi::Nmi, noon::Noon, nuvei::Nuvei, opayo::Opayo,
+    opennode::Opennode, payeezy::Payeezy, payme::Payme, payone::Payone, paypal::Paypal, payu::Payu,
+    placetopay::Placetopay, plaid::Plaid, powertranz::Powertranz, prophetpay::Prophetpay,
+    rapyd::Rapyd, razorpay::Razorpay, riskified::Riskified, shift4::Shift4, signifyd::Signifyd,
+    square::Square, stax::Stax, stripe::Stripe, threedsecureio::Threedsecureio, trustpay::Trustpay,
+    tsys::Tsys, volt::Volt, wellsfargo::Wellsfargo, wise::Wise, worldline::Worldline,
+    worldpay::Worldpay, zen::Zen, zsl::Zsl,
 };
diff --git a/crates/router/src/core/payments/connector_integration_v2_impls.rs b/crates/router/src/core/payments/connector_integration_v2_impls.rs
index dbb50b18032..019020b0b52 100644
--- a/crates/router/src/core/payments/connector_integration_v2_impls.rs
+++ b/crates/router/src/core/payments/connector_integration_v2_impls.rs
@@ -655,7 +655,6 @@ default_imp_for_new_connector_integration_payment!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -741,7 +740,6 @@ default_imp_for_new_connector_integration_refund!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -822,7 +820,6 @@ default_imp_for_new_connector_integration_connector_access_token!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -925,7 +922,6 @@ default_imp_for_new_connector_integration_accept_dispute!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1010,7 +1006,6 @@ default_imp_for_new_connector_integration_defend_dispute!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1079,7 +1074,6 @@ default_imp_for_new_connector_integration_submit_evidence!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1175,7 +1169,6 @@ default_imp_for_new_connector_integration_file_upload!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1342,7 +1335,6 @@ default_imp_for_new_connector_integration_payouts_create!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1430,7 +1422,6 @@ default_imp_for_new_connector_integration_payouts_eligibility!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1518,7 +1509,6 @@ default_imp_for_new_connector_integration_payouts_fulfill!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1606,7 +1596,6 @@ default_imp_for_new_connector_integration_payouts_cancel!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1694,7 +1683,6 @@ default_imp_for_new_connector_integration_payouts_quote!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1782,7 +1770,6 @@ default_imp_for_new_connector_integration_payouts_recipient!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1870,7 +1857,6 @@ default_imp_for_new_connector_integration_payouts_sync!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1958,7 +1944,6 @@ default_imp_for_new_connector_integration_payouts_recipient_account!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -2044,7 +2029,6 @@ default_imp_for_new_connector_integration_webhook_source_verification!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -2211,7 +2195,6 @@ default_imp_for_new_connector_integration_frm_sale!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -2299,7 +2282,6 @@ default_imp_for_new_connector_integration_frm_checkout!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -2387,7 +2369,6 @@ default_imp_for_new_connector_integration_frm_transaction!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -2475,7 +2456,6 @@ default_imp_for_new_connector_integration_frm_fulfillment!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -2563,7 +2543,6 @@ default_imp_for_new_connector_integration_frm_record_return!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -2648,7 +2627,6 @@ default_imp_for_new_connector_integration_revoking_mandates!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index 32d739bcf9f..6756b9ff5dc 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -201,7 +201,6 @@ default_imp_for_complete_authorize!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globepay,
     connector::Gocardless,
@@ -287,7 +286,6 @@ default_imp_for_webhook_source_verification!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -383,7 +381,6 @@ default_imp_for_create_customer!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -643,7 +640,6 @@ default_imp_for_accept_dispute!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -761,7 +757,6 @@ default_imp_for_file_upload!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -856,7 +851,6 @@ default_imp_for_submit_evidence!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -951,7 +945,6 @@ default_imp_for_defend_dispute!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Globepay,
     connector::Forte,
     connector::Globalpay,
@@ -1062,7 +1055,6 @@ default_imp_for_pre_processing_steps!(
     connector::Ebanx,
     connector::Iatapay,
     connector::Itaubank,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1144,7 +1136,6 @@ default_imp_for_post_processing_steps!(
     connector::Ebanx,
     connector::Iatapay,
     connector::Itaubank,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1303,7 +1294,6 @@ default_imp_for_payouts_create!(
     connector::Coinbase,
     connector::Datatrans,
     connector::Dlocal,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1398,7 +1388,6 @@ default_imp_for_payouts_retrieve!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1496,7 +1485,6 @@ default_imp_for_payouts_eligibility!(
     connector::Coinbase,
     connector::Datatrans,
     connector::Dlocal,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1589,7 +1577,6 @@ default_imp_for_payouts_fulfill!(
     connector::Coinbase,
     connector::Datatrans,
     connector::Dlocal,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1681,7 +1668,6 @@ default_imp_for_payouts_cancel!(
     connector::Coinbase,
     connector::Datatrans,
     connector::Dlocal,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1776,7 +1762,6 @@ default_imp_for_payouts_quote!(
     connector::Coinbase,
     connector::Datatrans,
     connector::Dlocal,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1872,7 +1857,6 @@ default_imp_for_payouts_recipient!(
     connector::Coinbase,
     connector::Datatrans,
     connector::Dlocal,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -1971,7 +1955,6 @@ default_imp_for_payouts_recipient_account!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -2067,7 +2050,6 @@ default_imp_for_approve!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -2164,7 +2146,6 @@ default_imp_for_reject!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -2343,7 +2324,6 @@ default_imp_for_frm_sale!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -2440,7 +2420,6 @@ default_imp_for_frm_checkout!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -2537,7 +2516,6 @@ default_imp_for_frm_transaction!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -2634,7 +2612,6 @@ default_imp_for_frm_fulfillment!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -2731,7 +2708,6 @@ default_imp_for_frm_record_return!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -2825,7 +2801,6 @@ default_imp_for_incremental_authorization!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -2919,7 +2894,6 @@ default_imp_for_revoking_mandates!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,
@@ -3166,7 +3140,6 @@ default_imp_for_authorize_session_token!(
     connector::Datatrans,
     connector::Dlocal,
     connector::Ebanx,
-    connector::Fiserv,
     connector::Forte,
     connector::Globalpay,
     connector::Globepay,

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

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

## Description
<!-- Describe your changes in detail -->
Move connector code for `fiserv` from crate `router` to crate `hyperswitch_connectors`.

### 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).
-->
https://github.com/juspay/hyperswitch/issues/5440

## 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 following flows need to be tested for connector `Fiserv`:

- Authorize:

Request:
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_xo3RNH4SJGVUfv9B27JQjb6PAN9jmHcJqE4LQjPkLEjvfeFt9MGPENcooNOOEj92' \
--data-raw '{
    "amount": 1234,
    "currency": "USD",
    "confirm": true,
    "profile_id": null,
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "no_three_ds",
    "setup_future_usage": "on_session", 
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "customer_id": "customer123",
    "phone_country_code": "+1",
    "routing": { 
        "type": "single",
        "data": "stripe"
    },
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": { 
        "card": {
            "card_number": "4761739001010010",
            "card_exp_month": "10",
            "card_exp_year": "24",
            "card_holder_name": "joseph Doe",
            "card_cvc": "002"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 6540,
            "account_name": "transaction_processing"
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "128.0.0.1"
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    
    "connector_metadata": {
        "noon": {
            "order_category": "pay"
        }
    },
    "payment_link": false,
    "payment_link_config": {
        "theme": "",
        "logo": "",
        "seller_name": "",
        "sdk_layout": "",
        "display_sdk_only": false,
        "enabled_saved_payment_method": false
    },
    "payment_type": "normal", 
    "request_incremental_authorization": false,
    "merchant_order_reference_id": "test_ord",
    "session_expiry": 900 
}'
```

Response:
```
{
    "payment_id": "pay_FQo68sYrGp2PMAtWbcsV",
    "merchant_id": "merchant_1721912543",
    "status": "succeeded",
    "amount": 1234,
    "net_amount": 1234,
    "amount_capturable": 0,
    "amount_received": 1234,
    "connector": "fiserv",
    "client_secret": "pay_FQo68sYrGp2PMAtWbcsV_secret_SlOkENIz0C98x01CtlUt",
    "created": "2024-07-25T13:02:28.674Z",
    "currency": "USD",
    "customer_id": "customer123",
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": null,
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0010",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "476173",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "24",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "order_details": [
        {
            "brand": null,
            "amount": 6540,
            "category": null,
            "quantity": 1,
            "product_id": null,
            "product_name": "Apple iphone 15",
            "product_type": null,
            "sub_category": null,
            "product_img_link": null,
            "requires_shipping": null
        }
    ],
    "email": "customer@gmail.com",
    "name": "John Doe",
    "phone": "9999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "customer123",
        "created_at": 1721912548,
        "expires": 1721916148,
        "secret": "epk_fc69bafa3d934476a530ddb4381048a9"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "93e099f7bea84ead817b8cd9acd602c3",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": {
        "apple_pay": null,
        "airwallex": null,
        "noon": {
            "order_category": "pay"
        }
    },
    "feature_metadata": null,
    "reference_id": "CHG01ad814ffc7b1515d4bcfd70acac2bf3dc",
    "payment_link": null,
    "profile_id": "pro_V2NRX76RhIrMwvvIR0Nm",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_Kt2D5qGfkiYgqdacoKDh",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-07-25T13:17:28.674Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-07-25T13:02:30.109Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": "test_ord"
}
```

- Capture:

Request:
```
curl --location 'http://localhost:8080/payments/pay_dJgBr13y9CERMpHskTPQ/capture' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_xo3RNH4SJGVUfv9B27JQjb6PAN9jmHcJqE4LQjPkLEjvfeFt9MGPENcooNOOEj92' \
--data '{
}'
```

Response:
```
{
    "payment_id": "pay_dJgBr13y9CERMpHskTPQ",
    "merchant_id": "merchant_1721912543",
    "status": "succeeded",
    "amount": 1122,
    "net_amount": 1122,
    "amount_capturable": 0,
    "amount_received": 1122,
    "connector": "fiserv",
    "client_secret": "pay_dJgBr13y9CERMpHskTPQ_secret_cgu5pDtquNjRf8XHjtKQ",
    "created": "2024-07-25T13:03:44.641Z",
    "currency": "USD",
    "customer_id": "customer123",
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "customer@gmail.com",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0010",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "476173",
            "card_extended_bin": null,
            "card_exp_month": "10",
            "card_exp_year": "24",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": "guest@example.com"
    },
    "order_details": [
        {
            "brand": null,
            "amount": 6540,
            "category": null,
            "quantity": 1,
            "product_id": null,
            "product_name": "Apple iphone 15",
            "product_type": null,
            "sub_category": null,
            "product_img_link": null,
            "requires_shipping": null
        }
    ],
    "email": "customer@gmail.com",
    "name": "John Doe",
    "phone": "9999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "001c2342e963418ba6542b75cf9d0d83",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": {
        "apple_pay": null,
        "airwallex": null,
        "noon": {
            "order_category": "pay"
        }
    },
    "feature_metadata": null,
    "reference_id": "CHG01cc9131f876fc42eff0c26fdf01ffa8d3",
    "payment_link": null,
    "profile_id": "pro_V2NRX76RhIrMwvvIR0Nm",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_Kt2D5qGfkiYgqdacoKDh",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-07-25T13:18:44.641Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": "pm_MbbhL5b2ZolS8jlPLkx7",
    "payment_method_status": null,
    "updated": "2024-07-25T13:03:54.219Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": "test_ord"
}
```

- Refund:

Request:
```
curl --location 'http://localhost:8080/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_xo3RNH4SJGVUfv9B27JQjb6PAN9jmHcJqE4LQjPkLEjvfeFt9MGPENcooNOOEj92' \
--data '{
    "payment_id": "pay_FQo68sYrGp2PMAtWbcsV",
    "reason": "Customer returned product",
    "refund_type": "instant",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
```

Response:
```
{
    "refund_id": "ref_7LNld1IUNJQDf3y3jjlo",
    "payment_id": "pay_FQo68sYrGp2PMAtWbcsV",
    "amount": 1234,
    "currency": "USD",
    "status": "succeeded",
    "reason": "Customer returned product",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "error_message": null,
    "error_code": null,
    "created_at": "2024-07-25T13:03:09.268Z",
    "updated_at": "2024-07-25T13:03:10.669Z",
    "connector": "fiserv",
    "profile_id": "pro_V2NRX76RhIrMwvvIR0Nm",
    "merchant_connector_id": "mca_Kt2D5qGfkiYgqdacoKDh",
    "charges": null
}
```


## 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 the submitted code
- [ ] I added unit tests for my changes where possible
