Issue:
Bug: fix: add time_range constraint to retrieve payment attempt list



Currently, to retrieve the total count for payments, we use a query that gets the total count of attempts based on the last active attempt ID. To enhance performance, we need to add a time_range to the query. This will ensure that the query is executed only for the given time constraint, improving efficiency by narrowing the search to a specific time period.

Pull request description:
## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
- Add time range to filter total count for payment attempt list.
- Move `TimeRange` type to common utils so that it can be used in diesel models and across all the other api models 

### 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
Closes #5958 

## How did you test it?
The expected behaviour is same, the query that is getting printed, is now also considering time range.
```
SELECT COUNT(*) FROM "payment_attempt" WHERE ((("payment_attempt"."merchant_id" = $1) 
AND ("payment_attempt"."attempt_id" = ANY($2))) AND ("payment_attempt"."created_at" >= $3)) 
-- binds: [MerchantId("merchant_1726040792"), [], 2024-08-19 18:30:00.0]
```

Request
```
curl --location 'http://localhost:8080/payments/list' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer JWT' \
--data '{
    "start_time": "2024-08-19T18:30:00Z"
}'
```
Response:
```
{
    "count": 0,
    "total_count": 0,
    "data": []
}
```

## 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


Testing:
The expected behaviour is same, the query that is getting printed, is now also considering time range.
```
SELECT COUNT(*) FROM "payment_attempt" WHERE ((("payment_attempt"."merchant_id" = $1) 
AND ("payment_attempt"."attempt_id" = ANY($2))) AND ("payment_attempt"."created_at" >= $3)) 
-- binds: [MerchantId("merchant_1726040792"), [], 2024-08-19 18:30:00.0]
```

Request
```
curl --location 'http://localhost:8080/payments/list' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer JWT' \
--data '{
    "start_time": "2024-08-19T18:30:00Z"
}'
```
Response:
```
{
    "count": 0,
    "total_count": 0,
    "data": []
}
```

Patch:
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 5465d902388..3690bcf24db 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -18569,6 +18569,7 @@
       },
       "TimeRange": {
         "type": "object",
+        "description": "A type representing a range of time for filtering, including a mandatory start time and an optional end time.",
         "required": [
           "start_time"
         ],
diff --git a/crates/analytics/src/disputes/metrics.rs b/crates/analytics/src/disputes/metrics.rs
index 401c606ccf9..dd1aa3c1bbd 100644
--- a/crates/analytics/src/disputes/metrics.rs
+++ b/crates/analytics/src/disputes/metrics.rs
@@ -4,15 +4,11 @@ mod total_dispute_lost_amount;
 
 use std::collections::HashSet;
 
-use api_models::{
-    analytics::{
-        disputes::{
-            DisputeDimensions, DisputeFilters, DisputeMetrics, DisputeMetricsBucketIdentifier,
-        },
-        Granularity,
-    },
-    payments::TimeRange,
+use api_models::analytics::{
+    disputes::{DisputeDimensions, DisputeFilters, DisputeMetrics, DisputeMetricsBucketIdentifier},
+    Granularity,
 };
+use common_utils::types::TimeRange;
 use diesel_models::enums as storage_enums;
 use time::PrimitiveDateTime;
 
diff --git a/crates/analytics/src/opensearch.rs b/crates/analytics/src/opensearch.rs
index 7486ab50a51..e0235c67bed 100644
--- a/crates/analytics/src/opensearch.rs
+++ b/crates/analytics/src/opensearch.rs
@@ -1,10 +1,12 @@
 use api_models::{
     analytics::search::SearchIndex,
     errors::types::{ApiError, ApiErrorResponse},
-    payments::TimeRange,
 };
 use aws_config::{self, meta::region::RegionProviderChain, Region};
-use common_utils::errors::{CustomResult, ErrorSwitch};
+use common_utils::{
+    errors::{CustomResult, ErrorSwitch},
+    types::TimeRange,
+};
 use error_stack::ResultExt;
 use hyperswitch_domain_models::errors::{StorageError, StorageResult};
 use opensearch::{
diff --git a/crates/api_models/src/analytics.rs b/crates/api_models/src/analytics.rs
index 7abef472068..0379ec09547 100644
--- a/crates/api_models/src/analytics.rs
+++ b/crates/api_models/src/analytics.rs
@@ -1,5 +1,6 @@
 use std::collections::HashSet;
 
+pub use common_utils::types::TimeRange;
 use common_utils::{events::ApiEventMetric, pii::EmailStrategy, types::authentication::AuthInfo};
 use masking::Secret;
 
@@ -14,8 +15,6 @@ use self::{
     refunds::{RefundDimensions, RefundMetrics},
     sdk_events::{SdkEventDimensions, SdkEventMetrics},
 };
-pub use crate::payments::TimeRange;
-
 pub mod active_payments;
 pub mod api_event;
 pub mod auth_events;
diff --git a/crates/api_models/src/analytics/search.rs b/crates/api_models/src/analytics/search.rs
index b962f60cae0..24dd0effcbb 100644
--- a/crates/api_models/src/analytics/search.rs
+++ b/crates/api_models/src/analytics/search.rs
@@ -1,9 +1,7 @@
-use common_utils::hashing::HashedString;
+use common_utils::{hashing::HashedString, types::TimeRange};
 use masking::WithType;
 use serde_json::Value;
 
-use crate::payments::TimeRange;
-
 #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)]
 pub struct SearchFilters {
     pub payment_method: Option<Vec<String>>,
diff --git a/crates/api_models/src/events.rs b/crates/api_models/src/events.rs
index 13966c464d5..41e958cb3f4 100644
--- a/crates/api_models/src/events.rs
+++ b/crates/api_models/src/events.rs
@@ -39,8 +39,6 @@ use crate::{
     verifications::*,
 };
 
-impl ApiEventMetric for TimeRange {}
-
 impl ApiEventMetric for GetPaymentIntentFiltersRequest {
     fn get_api_event_type(&self) -> Option<ApiEventsType> {
         Some(ApiEventsType::Analytics)
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 715bf3c3544..b0866cfb265 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -4204,7 +4204,7 @@ pub struct PaymentListFilterConstraints {
     pub amount_filter: Option<AmountFilter>,
     /// The time range for which objects are needed. TimeRange has two fields start_time and end_time from which objects can be filtered as per required scenarios (created_at, time less than, greater than etc).
     #[serde(flatten)]
-    pub time_range: Option<TimeRange>,
+    pub time_range: Option<common_utils::types::TimeRange>,
     /// The list of connectors to filter payments list
     pub connector: Option<Vec<api_enums::Connector>>,
     /// The list of currencies to filter payments list
@@ -4295,20 +4295,6 @@ pub enum SortBy {
     Desc,
 }
 
-#[derive(
-    Debug, Clone, Copy, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash, ToSchema,
-)]
-pub struct TimeRange {
-    /// The start time to filter payments list or to get list of filters. To get list of filters start time is needed to be passed
-    #[serde(with = "common_utils::custom_serde::iso8601")]
-    #[serde(alias = "startTime")]
-    pub start_time: PrimitiveDateTime,
-    /// The end time to filter payments list or to get list of filters. If not passed the default time is now
-    #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
-    #[serde(alias = "endTime")]
-    pub end_time: Option<PrimitiveDateTime>,
-}
-
 #[derive(Setter, Clone, Default, Debug, PartialEq, serde::Serialize)]
 pub struct VerifyResponse {
     pub verify_id: Option<id_type::PaymentId>,
diff --git a/crates/api_models/src/payouts.rs b/crates/api_models/src/payouts.rs
index 10771df4ccd..34e1bbe5449 100644
--- a/crates/api_models/src/payouts.rs
+++ b/crates/api_models/src/payouts.rs
@@ -704,7 +704,7 @@ pub struct PayoutListConstraints {
     /// The time range for which objects are needed. TimeRange has two fields start_time and end_time from which objects can be filtered as per required scenarios (created_at, time less than, greater than etc).
     #[serde(flatten)]
     #[schema(value_type = Option<TimeRange>)]
-    pub time_range: Option<payments::TimeRange>,
+    pub time_range: Option<common_utils::types::TimeRange>,
 }
 
 #[derive(Clone, Debug, serde::Deserialize, ToSchema, serde::Serialize)]
@@ -732,7 +732,7 @@ pub struct PayoutListFilterConstraints {
     /// The time range for which objects are needed. TimeRange has two fields start_time and end_time from which objects can be filtered as per required scenarios (created_at, time less than, greater than etc).
     #[serde(flatten)]
     #[schema(value_type = Option<TimeRange>)]
-    pub time_range: Option<payments::TimeRange>,
+    pub time_range: Option<common_utils::types::TimeRange>,
     /// The list of connectors to filter payouts list
     #[schema(value_type = Option<Vec<PayoutConnectors>>, max_length = 255, example = json!(["wise", "adyen"]))]
     pub connector: Option<Vec<api_enums::PayoutConnectors>>,
diff --git a/crates/api_models/src/refunds.rs b/crates/api_models/src/refunds.rs
index edc0e75bdf2..237a903d80c 100644
--- a/crates/api_models/src/refunds.rs
+++ b/crates/api_models/src/refunds.rs
@@ -1,12 +1,12 @@
 use std::collections::HashMap;
 
-use common_utils::pii;
 pub use common_utils::types::{ChargeRefunds, MinorUnit};
+use common_utils::{pii, types::TimeRange};
 use serde::{Deserialize, Serialize};
 use time::PrimitiveDateTime;
 use utoipa::ToSchema;
 
-use super::payments::{AmountFilter, TimeRange};
+use super::payments::AmountFilter;
 use crate::{
     admin::{self, MerchantConnectorInfo},
     enums,
diff --git a/crates/common_utils/src/events.rs b/crates/common_utils/src/events.rs
index 16d0fd9b30a..2b1571617e8 100644
--- a/crates/common_utils/src/events.rs
+++ b/crates/common_utils/src/events.rs
@@ -1,7 +1,7 @@
 use common_enums::{PaymentMethod, PaymentMethodType};
 use serde::Serialize;
 
-use crate::id_type;
+use crate::{id_type, types::TimeRange};
 
 pub trait ApiEventMetric {
     fn get_api_event_type(&self) -> Option<ApiEventsType> {
@@ -139,3 +139,5 @@ impl<T: ApiEventMetric> ApiEventMetric for &T {
         T::get_api_event_type(self)
     }
 }
+
+impl ApiEventMetric for TimeRange {}
diff --git a/crates/common_utils/src/types.rs b/crates/common_utils/src/types.rs
index 6acf5000ced..2206744ef0b 100644
--- a/crates/common_utils/src/types.rs
+++ b/crates/common_utils/src/types.rs
@@ -28,6 +28,7 @@ use rust_decimal::{
 };
 use semver::Version;
 use serde::{de::Visitor, Deserialize, Deserializer, Serialize};
+use time::PrimitiveDateTime;
 use utoipa::ToSchema;
 
 use crate::{
@@ -582,6 +583,21 @@ impl StringMajorUnit {
     }
 }
 
+/// A type representing a range of time for filtering, including a mandatory start time and an optional end time.
+#[derive(
+    Debug, Clone, Copy, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash, ToSchema,
+)]
+pub struct TimeRange {
+    /// The start time to filter payments list or to get list of filters. To get list of filters start time is needed to be passed
+    #[serde(with = "crate::custom_serde::iso8601")]
+    #[serde(alias = "startTime")]
+    pub start_time: PrimitiveDateTime,
+    /// The end time to filter payments list or to get list of filters. If not passed the default time is now
+    #[serde(default, with = "crate::custom_serde::iso8601::option")]
+    #[serde(alias = "endTime")]
+    pub end_time: Option<PrimitiveDateTime>,
+}
+
 #[cfg(test)]
 mod amount_conversion_tests {
     #![allow(clippy::unwrap_used)]
diff --git a/crates/diesel_models/src/query/payment_attempt.rs b/crates/diesel_models/src/query/payment_attempt.rs
index fa80b0990d1..48941330ec6 100644
--- a/crates/diesel_models/src/query/payment_attempt.rs
+++ b/crates/diesel_models/src/query/payment_attempt.rs
@@ -351,6 +351,7 @@ impl PaymentAttempt {
         payment_method: Option<Vec<enums::PaymentMethod>>,
         payment_method_type: Option<Vec<enums::PaymentMethodType>>,
         authentication_type: Option<Vec<enums::AuthenticationType>>,
+        time_range: Option<common_utils::types::TimeRange>,
         profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
         merchant_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,
     ) -> StorageResult<i64> {
@@ -360,6 +361,14 @@ impl PaymentAttempt {
             .filter(dsl::attempt_id.eq_any(active_attempt_ids.to_owned()))
             .into_boxed();
 
+        if let Some(time_range) = time_range {
+            filter = filter.filter(dsl::created_at.ge(time_range.start_time));
+
+            if let Some(end_time) = time_range.end_time {
+                filter = filter.filter(dsl::created_at.le(end_time));
+            }
+        }
+
         if let Some(connector) = connector {
             filter = filter.filter(dsl::connector.eq_any(connector));
         }
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
index 24a79e2905e..003509b2039 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
@@ -156,6 +156,7 @@ pub trait PaymentAttemptInterface {
         payment_method_type: Option<Vec<storage_enums::PaymentMethodType>>,
         authentication_type: Option<Vec<storage_enums::AuthenticationType>>,
         merchant_connector_id: Option<Vec<id_type::MerchantConnectorAccountId>>,
+        time_range: Option<common_utils::types::TimeRange>,
         profile_id_list: Option<Vec<id_type::ProfileId>>,
         storage_scheme: storage_enums::MerchantStorageScheme,
     ) -> error_stack::Result<i64, errors::StorageError>;
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index f5b719fe370..619ebcce68a 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -94,7 +94,7 @@ pub trait PaymentIntentInterface {
         &self,
         state: &KeyManagerState,
         merchant_id: &id_type::MerchantId,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
         merchant_key_store: &MerchantKeyStore,
         storage_scheme: storage_enums::MerchantStorageScheme,
     ) -> error_stack::Result<Vec<PaymentIntent>, errors::StorageError>;
@@ -108,7 +108,7 @@ pub trait PaymentIntentInterface {
         &self,
         merchant_id: &id_type::MerchantId,
         profile_id_list: Option<Vec<id_type::ProfileId>>,
-        constraints: &api_models::payments::TimeRange,
+        constraints: &common_utils::types::TimeRange,
     ) -> error_stack::Result<Vec<(common_enums::IntentStatus, i64)>, errors::StorageError>;
 
     #[cfg(all(
@@ -1458,8 +1458,8 @@ impl From<api_models::payments::PaymentListConstraints> for PaymentIntentFetchCo
     }
 }
 
-impl From<api_models::payments::TimeRange> for PaymentIntentFetchConstraints {
-    fn from(value: api_models::payments::TimeRange) -> Self {
+impl From<common_utils::types::TimeRange> for PaymentIntentFetchConstraints {
+    fn from(value: common_utils::types::TimeRange) -> Self {
         Self::List(Box::new(PaymentIntentListParams {
             offset: 0,
             starting_at: Some(value.start_time),
diff --git a/crates/hyperswitch_domain_models/src/payouts.rs b/crates/hyperswitch_domain_models/src/payouts.rs
index 952028fab30..8c6d751ebec 100644
--- a/crates/hyperswitch_domain_models/src/payouts.rs
+++ b/crates/hyperswitch_domain_models/src/payouts.rs
@@ -52,8 +52,8 @@ impl From<api_models::payouts::PayoutListConstraints> for PayoutFetchConstraints
     }
 }
 
-impl From<api_models::payments::TimeRange> for PayoutFetchConstraints {
-    fn from(value: api_models::payments::TimeRange) -> Self {
+impl From<common_utils::types::TimeRange> for PayoutFetchConstraints {
+    fn from(value: common_utils::types::TimeRange) -> Self {
         Self::List(Box::new(PayoutListParams {
             offset: 0,
             starting_at: Some(value.start_time),
diff --git a/crates/hyperswitch_domain_models/src/payouts/payouts.rs b/crates/hyperswitch_domain_models/src/payouts/payouts.rs
index 42037c3c2d9..eb43089e448 100644
--- a/crates/hyperswitch_domain_models/src/payouts/payouts.rs
+++ b/crates/hyperswitch_domain_models/src/payouts/payouts.rs
@@ -67,7 +67,7 @@ pub trait PayoutsInterface {
     async fn filter_payouts_by_time_range_constraints(
         &self,
         _merchant_id: &id_type::MerchantId,
-        _time_range: &api_models::payments::TimeRange,
+        _time_range: &common_utils::types::TimeRange,
         _storage_scheme: MerchantStorageScheme,
     ) -> error_stack::Result<Vec<Payouts>, errors::StorageError>;
 
diff --git a/crates/hyperswitch_domain_models/src/refunds.rs b/crates/hyperswitch_domain_models/src/refunds.rs
index 3b3a79407d0..4016754510a 100644
--- a/crates/hyperswitch_domain_models/src/refunds.rs
+++ b/crates/hyperswitch_domain_models/src/refunds.rs
@@ -6,7 +6,7 @@ pub struct RefundListConstraints {
     pub profile_id: Option<Vec<common_utils::id_type::ProfileId>>,
     pub limit: Option<i64>,
     pub offset: Option<i64>,
-    pub time_range: Option<api_models::payments::TimeRange>,
+    pub time_range: Option<common_utils::types::TimeRange>,
     pub amount_filter: Option<api_models::payments::AmountFilter>,
     pub connector: Option<Vec<String>>,
     pub merchant_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index b626b7d4418..d1746a63dde 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -194,6 +194,7 @@ Never share your secret api keys. Keep them guarded and secure.
     ),
     components(schemas(
         common_utils::types::MinorUnit,
+        common_utils::types::TimeRange,
         common_utils::link_utils::GenericLinkUiConfig,
         common_utils::link_utils::EnabledPaymentMethod,
         api_models::refunds::RefundRequest,
@@ -466,7 +467,6 @@ Never share your secret api keys. Keep them guarded and secure.
         api_models::refunds::RefundListRequest,
         api_models::refunds::RefundListResponse,
         api_models::refunds::RefundAggregateResponse,
-        api_models::payments::TimeRange,
         api_models::payments::AmountFilter,
         api_models::mandates::MandateRevokedResponse,
         api_models::mandates::MandateResponse,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index f12d6a7b567..b7771dc5e0a 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -119,6 +119,7 @@ Never share your secret api keys. Keep them guarded and secure.
     ),
     components(schemas(
         common_utils::types::MinorUnit,
+        common_utils::types::TimeRange,
         common_utils::link_utils::GenericLinkUiConfig,
         common_utils::link_utils::EnabledPaymentMethod,
         api_models::refunds::RefundRequest,
@@ -392,7 +393,6 @@ Never share your secret api keys. Keep them guarded and secure.
         api_models::refunds::RefundListRequest,
         api_models::refunds::RefundListResponse,
         api_models::refunds::RefundAggregateResponse,
-        api_models::payments::TimeRange,
         api_models::payments::AmountFilter,
         api_models::mandates::MandateRevokedResponse,
         api_models::mandates::MandateResponse,
diff --git a/crates/router/src/core/disputes.rs b/crates/router/src/core/disputes.rs
index ff5936fc296..30b73eb4c6a 100644
--- a/crates/router/src/core/disputes.rs
+++ b/crates/router/src/core/disputes.rs
@@ -516,7 +516,7 @@ pub async fn get_aggregates_for_disputes(
     state: SessionState,
     merchant: domain::MerchantAccount,
     profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
-    time_range: api::TimeRange,
+    time_range: common_utils::types::TimeRange,
 ) -> RouterResponse<dispute_models::DisputesAggregateResponse> {
     let db = state.store.as_ref();
     let dispute_status_with_count = db
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 30d619efedc..b8255cfcfe5 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -3108,6 +3108,7 @@ pub async fn apply_filters_on_payments(
             constraints.payment_method_type,
             constraints.authentication_type,
             constraints.merchant_connector_id,
+            constraints.time_range,
             pi_fetch_constraints.get_profile_id_list(),
             merchant.storage_scheme,
         )
@@ -3128,7 +3129,7 @@ pub async fn get_filters_for_payments(
     state: SessionState,
     merchant: domain::MerchantAccount,
     merchant_key_store: domain::MerchantKeyStore,
-    time_range: api::TimeRange,
+    time_range: common_utils::types::TimeRange,
 ) -> RouterResponse<api::PaymentListFilters> {
     let db = state.store.as_ref();
     let pi = db
@@ -3249,7 +3250,7 @@ pub async fn get_aggregates_for_payments(
     state: SessionState,
     merchant: domain::MerchantAccount,
     profile_id_list: Option<Vec<id_type::ProfileId>>,
-    time_range: api::TimeRange,
+    time_range: common_utils::types::TimeRange,
 ) -> RouterResponse<api::PaymentsAggregateResponse> {
     let db = state.store.as_ref();
     let intent_status_with_count = db
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index d0c0b2d3cde..c160acb50c2 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -996,7 +996,7 @@ pub async fn payouts_list_available_filters_core(
     state: SessionState,
     merchant_account: domain::MerchantAccount,
     profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
-    time_range: api::TimeRange,
+    time_range: common_utils::types::TimeRange,
     _locale: &str,
 ) -> RouterResponse<api::PayoutListFilters> {
     let db = state.store.as_ref();
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index 0f7abf44b14..118f4b81766 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -904,7 +904,7 @@ pub async fn refund_list(
 pub async fn refund_filter_list(
     state: SessionState,
     merchant_account: domain::MerchantAccount,
-    req: api_models::payments::TimeRange,
+    req: common_utils::types::TimeRange,
 ) -> RouterResponse<api_models::refunds::RefundListMetaData> {
     let db = state.store;
     let filter_list = db
@@ -1098,7 +1098,7 @@ pub async fn get_filters_for_refunds(
 pub async fn get_aggregates_for_refunds(
     state: SessionState,
     merchant: domain::MerchantAccount,
-    time_range: api::TimeRange,
+    time_range: common_utils::types::TimeRange,
 ) -> RouterResponse<api_models::refunds::RefundAggregateResponse> {
     let db = state.store.as_ref();
     let refund_status_with_count = db
diff --git a/crates/router/src/db/dispute.rs b/crates/router/src/db/dispute.rs
index 1d45cfd405f..a44528fde43 100644
--- a/crates/router/src/db/dispute.rs
+++ b/crates/router/src/db/dispute.rs
@@ -52,7 +52,7 @@ pub trait DisputeInterface {
         &self,
         merchant_id: &common_utils::id_type::MerchantId,
         profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
     ) -> CustomResult<Vec<(common_enums::enums::DisputeStatus, i64)>, errors::StorageError>;
 }
 
@@ -141,7 +141,7 @@ impl DisputeInterface for Store {
         &self,
         merchant_id: &common_utils::id_type::MerchantId,
         profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
     ) -> CustomResult<Vec<(common_enums::DisputeStatus, i64)>, errors::StorageError> {
         let conn = connection::pg_connection_read(self).await?;
         storage::Dispute::get_dispute_status_with_count(
@@ -390,7 +390,7 @@ impl DisputeInterface for MockDb {
         &self,
         merchant_id: &common_utils::id_type::MerchantId,
         profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
     ) -> CustomResult<Vec<(common_enums::DisputeStatus, i64)>, errors::StorageError> {
         let locked_disputes = self.disputes.lock().await;
 
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index 394c48c1cd8..9b51946c5c4 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -634,7 +634,7 @@ impl DisputeInterface for KafkaStore {
         &self,
         merchant_id: &id_type::MerchantId,
         profile_id_list: Option<Vec<id_type::ProfileId>>,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
     ) -> CustomResult<Vec<(common_enums::DisputeStatus, i64)>, errors::StorageError> {
         self.diesel_store
             .get_dispute_status_with_count(merchant_id, profile_id_list, time_range)
@@ -1605,6 +1605,7 @@ impl PaymentAttemptInterface for KafkaStore {
         payment_method_type: Option<Vec<common_enums::PaymentMethodType>>,
         authentication_type: Option<Vec<common_enums::AuthenticationType>>,
         merchant_connector_id: Option<Vec<id_type::MerchantConnectorAccountId>>,
+        time_range: Option<common_utils::types::TimeRange>,
         profile_id_list: Option<Vec<id_type::ProfileId>>,
         storage_scheme: MerchantStorageScheme,
     ) -> CustomResult<i64, errors::DataStorageError> {
@@ -1617,6 +1618,7 @@ impl PaymentAttemptInterface for KafkaStore {
                 payment_method_type,
                 authentication_type,
                 merchant_connector_id,
+                time_range,
                 profile_id_list,
                 storage_scheme,
             )
@@ -1750,7 +1752,7 @@ impl PaymentIntentInterface for KafkaStore {
         &self,
         state: &KeyManagerState,
         merchant_id: &id_type::MerchantId,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
         key_store: &domain::MerchantKeyStore,
         storage_scheme: MerchantStorageScheme,
     ) -> CustomResult<Vec<storage::PaymentIntent>, errors::DataStorageError> {
@@ -1770,7 +1772,7 @@ impl PaymentIntentInterface for KafkaStore {
         &self,
         merchant_id: &id_type::MerchantId,
         profile_id_list: Option<Vec<id_type::ProfileId>>,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
     ) -> error_stack::Result<Vec<(common_enums::IntentStatus, i64)>, errors::DataStorageError> {
         self.diesel_store
             .get_intent_status_with_count(merchant_id, profile_id_list, time_range)
@@ -2233,7 +2235,7 @@ impl PayoutsInterface for KafkaStore {
     async fn filter_payouts_by_time_range_constraints(
         &self,
         merchant_id: &id_type::MerchantId,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
         storage_scheme: MerchantStorageScheme,
     ) -> CustomResult<Vec<storage::Payouts>, errors::DataStorageError> {
         self.diesel_store
@@ -2532,7 +2534,7 @@ impl RefundInterface for KafkaStore {
     async fn filter_refund_by_meta_constraints(
         &self,
         merchant_id: &id_type::MerchantId,
-        refund_details: &api_models::payments::TimeRange,
+        refund_details: &common_utils::types::TimeRange,
         storage_scheme: MerchantStorageScheme,
     ) -> CustomResult<api_models::refunds::RefundListMetaData, errors::StorageError> {
         self.diesel_store
@@ -2544,7 +2546,7 @@ impl RefundInterface for KafkaStore {
     async fn get_refund_status_with_count(
         &self,
         merchant_id: &id_type::MerchantId,
-        constraints: &api_models::payments::TimeRange,
+        constraints: &common_utils::types::TimeRange,
         storage_scheme: MerchantStorageScheme,
     ) -> CustomResult<Vec<(common_enums::RefundStatus, i64)>, errors::StorageError> {
         self.diesel_store
diff --git a/crates/router/src/db/refund.rs b/crates/router/src/db/refund.rs
index 808f82b00a4..dbe7534ee28 100644
--- a/crates/router/src/db/refund.rs
+++ b/crates/router/src/db/refund.rs
@@ -80,7 +80,7 @@ pub trait RefundInterface {
     async fn filter_refund_by_meta_constraints(
         &self,
         merchant_id: &common_utils::id_type::MerchantId,
-        refund_details: &api_models::payments::TimeRange,
+        refund_details: &common_utils::types::TimeRange,
         storage_scheme: enums::MerchantStorageScheme,
     ) -> CustomResult<api_models::refunds::RefundListMetaData, errors::StorageError>;
 
@@ -88,7 +88,7 @@ pub trait RefundInterface {
     async fn get_refund_status_with_count(
         &self,
         merchant_id: &common_utils::id_type::MerchantId,
-        constraints: &api_models::payments::TimeRange,
+        constraints: &common_utils::types::TimeRange,
         storage_scheme: enums::MerchantStorageScheme,
     ) -> CustomResult<Vec<(common_enums::RefundStatus, i64)>, errors::StorageError>;
 
@@ -817,7 +817,7 @@ mod storage {
         async fn filter_refund_by_meta_constraints(
             &self,
             merchant_id: &common_utils::id_type::MerchantId,
-            refund_details: &api_models::payments::TimeRange,
+            refund_details: &common_utils::types::TimeRange,
             _storage_scheme: enums::MerchantStorageScheme,
         ) -> CustomResult<api_models::refunds::RefundListMetaData, errors::StorageError> {
             let conn = connection::pg_connection_read(self).await?;
@@ -831,7 +831,7 @@ mod storage {
         async fn get_refund_status_with_count(
             &self,
             merchant_id: &common_utils::id_type::MerchantId,
-            constraints: &api_models::payments::TimeRange,
+            constraints: &common_utils::types::TimeRange,
             _storage_scheme: enums::MerchantStorageScheme,
         ) -> CustomResult<Vec<(common_enums::RefundStatus, i64)>, errors::StorageError> {
             let conn = connection::pg_connection_read(self).await?;
@@ -1135,7 +1135,7 @@ impl RefundInterface for MockDb {
     async fn filter_refund_by_meta_constraints(
         &self,
         _merchant_id: &common_utils::id_type::MerchantId,
-        refund_details: &api_models::payments::TimeRange,
+        refund_details: &common_utils::types::TimeRange,
         _storage_scheme: enums::MerchantStorageScheme,
     ) -> CustomResult<api_models::refunds::RefundListMetaData, errors::StorageError> {
         let refunds = self.refunds.lock().await;
@@ -1182,7 +1182,7 @@ impl RefundInterface for MockDb {
     async fn get_refund_status_with_count(
         &self,
         _merchant_id: &common_utils::id_type::MerchantId,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
         _storage_scheme: enums::MerchantStorageScheme,
     ) -> CustomResult<Vec<(api_models::enums::RefundStatus, i64)>, errors::StorageError> {
         let refunds = self.refunds.lock().await;
diff --git a/crates/router/src/routes/disputes.rs b/crates/router/src/routes/disputes.rs
index 5d8f7120f40..50a26ceae89 100644
--- a/crates/router/src/routes/disputes.rs
+++ b/crates/router/src/routes/disputes.rs
@@ -11,7 +11,7 @@ use super::app::AppState;
 use crate::{
     core::disputes,
     services::{api, authentication as auth},
-    types::api::{disputes as dispute_types, payments::TimeRange},
+    types::api::disputes as dispute_types,
 };
 
 /// Disputes - Retrieve Dispute
@@ -413,7 +413,7 @@ pub async fn delete_dispute_evidence(
 pub async fn get_disputes_aggregate(
     state: web::Data<AppState>,
     req: HttpRequest,
-    query_param: web::Query<TimeRange>,
+    query_param: web::Query<common_utils::types::TimeRange>,
 ) -> HttpResponse {
     let flow = Flow::DisputesAggregate;
     let query_param = query_param.into_inner();
@@ -443,7 +443,7 @@ pub async fn get_disputes_aggregate(
 pub async fn get_disputes_aggregate_profile(
     state: web::Data<AppState>,
     req: HttpRequest,
-    query_param: web::Query<TimeRange>,
+    query_param: web::Query<common_utils::types::TimeRange>,
 ) -> HttpResponse {
     let flow = Flow::DisputesAggregate;
     let query_param = query_param.into_inner();
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index 82407976c6e..c8f4f5e4dd0 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -987,7 +987,7 @@ pub async fn profile_payments_list_by_filter(
 pub async fn get_filters_for_payments(
     state: web::Data<app::AppState>,
     req: actix_web::HttpRequest,
-    payload: web::Json<payment_types::TimeRange>,
+    payload: web::Json<common_utils::types::TimeRange>,
 ) -> impl Responder {
     let flow = Flow::PaymentsList;
     let payload = payload.into_inner();
@@ -1065,7 +1065,7 @@ pub async fn get_payment_filters_profile(
 pub async fn get_payments_aggregates(
     state: web::Data<app::AppState>,
     req: actix_web::HttpRequest,
-    payload: web::Query<payment_types::TimeRange>,
+    payload: web::Query<common_utils::types::TimeRange>,
 ) -> impl Responder {
     let flow = Flow::PaymentsAggregate;
     let payload = payload.into_inner();
@@ -1780,7 +1780,7 @@ impl GetLockingInput for payment_types::PaymentsManualUpdateRequest {
 pub async fn get_payments_aggregates_profile(
     state: web::Data<app::AppState>,
     req: actix_web::HttpRequest,
-    payload: web::Query<payment_types::TimeRange>,
+    payload: web::Query<common_utils::types::TimeRange>,
 ) -> impl Responder {
     let flow = Flow::PaymentsAggregate;
     let payload = payload.into_inner();
diff --git a/crates/router/src/routes/payouts.rs b/crates/router/src/routes/payouts.rs
index 1b614330ebd..28b2afe2bee 100644
--- a/crates/router/src/routes/payouts.rs
+++ b/crates/router/src/routes/payouts.rs
@@ -8,8 +8,6 @@ use common_utils::consts;
 use router_env::{instrument, tracing, Flow};
 
 use super::app::AppState;
-#[cfg(feature = "olap")]
-use crate::types::api::payments as payment_types;
 use crate::{
     core::{api_locking, payouts::*},
     headers::ACCEPT_LANGUAGE,
@@ -375,7 +373,7 @@ pub async fn payouts_list_by_filter_profile(
 pub async fn payouts_list_available_filters_for_merchant(
     state: web::Data<AppState>,
     req: HttpRequest,
-    json_payload: web::Json<payment_types::TimeRange>,
+    json_payload: web::Json<common_utils::types::TimeRange>,
 ) -> HttpResponse {
     let flow = Flow::PayoutsFilter;
     let payload = json_payload.into_inner();
@@ -408,7 +406,7 @@ pub async fn payouts_list_available_filters_for_merchant(
 pub async fn payouts_list_available_filters_for_profile(
     state: web::Data<AppState>,
     req: HttpRequest,
-    json_payload: web::Json<payment_types::TimeRange>,
+    json_payload: web::Json<common_utils::types::TimeRange>,
 ) -> HttpResponse {
     let flow = Flow::PayoutsFilter;
     let payload = json_payload.into_inner();
diff --git a/crates/router/src/routes/refunds.rs b/crates/router/src/routes/refunds.rs
index d21c351a927..40184c5fcfa 100644
--- a/crates/router/src/routes/refunds.rs
+++ b/crates/router/src/routes/refunds.rs
@@ -318,7 +318,7 @@ pub async fn refunds_list_profile(
 pub async fn refunds_filter_list(
     state: web::Data<AppState>,
     req: HttpRequest,
-    payload: web::Json<api_models::payments::TimeRange>,
+    payload: web::Json<common_utils::types::TimeRange>,
 ) -> HttpResponse {
     let flow = Flow::RefundsList;
     Box::pin(api::server_wrap(
@@ -426,7 +426,7 @@ pub async fn get_refunds_filters_profile(
 pub async fn get_refunds_aggregates(
     state: web::Data<AppState>,
     req: HttpRequest,
-    query_params: web::Query<api_models::payments::TimeRange>,
+    query_params: web::Query<common_utils::types::TimeRange>,
 ) -> HttpResponse {
     let flow = Flow::RefundsAggregate;
     let query_params = query_params.into_inner();
diff --git a/crates/router/src/types/api/payments.rs b/crates/router/src/types/api/payments.rs
index 449d1c725c5..575725d4874 100644
--- a/crates/router/src/types/api/payments.rs
+++ b/crates/router/src/types/api/payments.rs
@@ -13,7 +13,7 @@ pub use api_models::payments::{
     PaymentsRedirectionResponse, PaymentsRejectRequest, PaymentsRequest, PaymentsResponse,
     PaymentsResponseForm, PaymentsRetrieveRequest, PaymentsSessionRequest, PaymentsSessionResponse,
     PaymentsStartRequest, PgRedirectResponse, PhoneDetails, RedirectionResponse, SessionToken,
-    TimeRange, UrlDetails, VerifyRequest, VerifyResponse, WalletData,
+    UrlDetails, VerifyRequest, VerifyResponse, WalletData,
 };
 use error_stack::ResultExt;
 pub use hyperswitch_domain_models::router_flow_types::payments::{
diff --git a/crates/router/src/types/storage/dispute.rs b/crates/router/src/types/storage/dispute.rs
index 79b9a90343e..45f2073708b 100644
--- a/crates/router/src/types/storage/dispute.rs
+++ b/crates/router/src/types/storage/dispute.rs
@@ -19,7 +19,7 @@ pub trait DisputeDbExt: Sized {
         conn: &PgPooledConn,
         merchant_id: &common_utils::id_type::MerchantId,
         profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
     ) -> CustomResult<Vec<(common_enums::enums::DisputeStatus, i64)>, errors::DatabaseError>;
 }
 
@@ -84,7 +84,7 @@ impl DisputeDbExt for Dispute {
         conn: &PgPooledConn,
         merchant_id: &common_utils::id_type::MerchantId,
         profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
     ) -> CustomResult<Vec<(common_enums::DisputeStatus, i64)>, errors::DatabaseError> {
         let mut query = <Self as HasTable>::table()
             .group_by(dsl::dispute_status)
diff --git a/crates/router/src/types/storage/refund.rs b/crates/router/src/types/storage/refund.rs
index 8e0040abfae..350c1032261 100644
--- a/crates/router/src/types/storage/refund.rs
+++ b/crates/router/src/types/storage/refund.rs
@@ -29,7 +29,7 @@ pub trait RefundDbExt: Sized {
     async fn filter_by_meta_constraints(
         conn: &PgPooledConn,
         merchant_id: &common_utils::id_type::MerchantId,
-        refund_list_details: &api_models::payments::TimeRange,
+        refund_list_details: &common_utils::types::TimeRange,
     ) -> CustomResult<api_models::refunds::RefundListMetaData, errors::DatabaseError>;
 
     async fn get_refunds_count(
@@ -41,7 +41,7 @@ pub trait RefundDbExt: Sized {
     async fn get_refund_status_with_count(
         conn: &PgPooledConn,
         merchant_id: &common_utils::id_type::MerchantId,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
     ) -> CustomResult<Vec<(RefundStatus, i64)>, errors::DatabaseError>;
 }
 
@@ -158,7 +158,7 @@ impl RefundDbExt for Refund {
     async fn filter_by_meta_constraints(
         conn: &PgPooledConn,
         merchant_id: &common_utils::id_type::MerchantId,
-        refund_list_details: &api_models::payments::TimeRange,
+        refund_list_details: &common_utils::types::TimeRange,
     ) -> CustomResult<api_models::refunds::RefundListMetaData, errors::DatabaseError> {
         let start_time = refund_list_details.start_time;
 
@@ -299,7 +299,7 @@ impl RefundDbExt for Refund {
     async fn get_refund_status_with_count(
         conn: &PgPooledConn,
         merchant_id: &common_utils::id_type::MerchantId,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
     ) -> CustomResult<Vec<(RefundStatus, i64)>, errors::DatabaseError> {
         let mut query = <Self as HasTable>::table()
             .group_by(dsl::refund_status)
diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs
index 1a4595bdbbe..7abde140991 100644
--- a/crates/storage_impl/src/mock_db/payment_attempt.rs
+++ b/crates/storage_impl/src/mock_db/payment_attempt.rs
@@ -52,6 +52,7 @@ impl PaymentAttemptInterface for MockDb {
         _payment_method_type: Option<Vec<PaymentMethodType>>,
         _authentication_type: Option<Vec<AuthenticationType>>,
         _merchanat_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,
+        _time_range: Option<common_utils::types::TimeRange>,
         _profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
         _storage_scheme: storage_enums::MerchantStorageScheme,
     ) -> CustomResult<i64, StorageError> {
diff --git a/crates/storage_impl/src/mock_db/payment_intent.rs b/crates/storage_impl/src/mock_db/payment_intent.rs
index 4cf8272650a..e0328871e33 100644
--- a/crates/storage_impl/src/mock_db/payment_intent.rs
+++ b/crates/storage_impl/src/mock_db/payment_intent.rs
@@ -41,7 +41,7 @@ impl PaymentIntentInterface for MockDb {
         &self,
         _state: &KeyManagerState,
         _merchant_id: &common_utils::id_type::MerchantId,
-        _time_range: &api_models::payments::TimeRange,
+        _time_range: &common_utils::types::TimeRange,
         _key_store: &MerchantKeyStore,
         _storage_scheme: storage_enums::MerchantStorageScheme,
     ) -> CustomResult<Vec<PaymentIntent>, StorageError> {
@@ -57,7 +57,7 @@ impl PaymentIntentInterface for MockDb {
         &self,
         _merchant_id: &common_utils::id_type::MerchantId,
         _profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
-        _time_range: &api_models::payments::TimeRange,
+        _time_range: &common_utils::types::TimeRange,
     ) -> CustomResult<Vec<(common_enums::IntentStatus, i64)>, StorageError> {
         // [#172]: Implement function for `MockDb`
         Err(StorageError::MockDbError)?
diff --git a/crates/storage_impl/src/mock_db/payouts.rs b/crates/storage_impl/src/mock_db/payouts.rs
index 5f2cc8824e5..c72a08a1823 100644
--- a/crates/storage_impl/src/mock_db/payouts.rs
+++ b/crates/storage_impl/src/mock_db/payouts.rs
@@ -86,7 +86,7 @@ impl PayoutsInterface for MockDb {
     async fn filter_payouts_by_time_range_constraints(
         &self,
         _merchant_id: &common_utils::id_type::MerchantId,
-        _time_range: &api_models::payments::TimeRange,
+        _time_range: &common_utils::types::TimeRange,
         _storage_scheme: storage_enums::MerchantStorageScheme,
     ) -> CustomResult<Vec<Payouts>, StorageError> {
         // TODO: Implement function for `MockDb`
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index d1df6861657..9974393e100 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -403,6 +403,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
         payment_method_type: Option<Vec<PaymentMethodType>>,
         authentication_type: Option<Vec<AuthenticationType>>,
         merchant_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,
+        time_range: Option<common_utils::types::TimeRange>,
         profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
         _storage_scheme: MerchantStorageScheme,
     ) -> CustomResult<i64, errors::StorageError> {
@@ -426,6 +427,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
             payment_method,
             payment_method_type,
             authentication_type,
+            time_range,
             profile_id_list,
             merchant_connector_id,
         )
@@ -1289,6 +1291,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
         payment_method_type: Option<Vec<PaymentMethodType>>,
         authentication_type: Option<Vec<AuthenticationType>>,
         merchant_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,
+        time_range: Option<common_utils::types::TimeRange>,
         profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
         storage_scheme: MerchantStorageScheme,
     ) -> CustomResult<i64, errors::StorageError> {
@@ -1301,6 +1304,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
                 payment_method_type,
                 authentication_type,
                 merchant_connector_id,
+                time_range,
                 profile_id_list,
                 storage_scheme,
             )
diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rs
index cb58eac4b61..97fa5873cae 100644
--- a/crates/storage_impl/src/payments/payment_intent.rs
+++ b/crates/storage_impl/src/payments/payment_intent.rs
@@ -378,7 +378,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
         &self,
         state: &KeyManagerState,
         merchant_id: &common_utils::id_type::MerchantId,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
         merchant_key_store: &MerchantKeyStore,
         storage_scheme: MerchantStorageScheme,
     ) -> error_stack::Result<Vec<PaymentIntent>, StorageError> {
@@ -402,7 +402,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
         &self,
         merchant_id: &common_utils::id_type::MerchantId,
         profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
     ) -> error_stack::Result<Vec<(common_enums::IntentStatus, i64)>, StorageError> {
         self.router_store
             .get_intent_status_with_count(merchant_id, profile_id_list, time_range)
@@ -747,7 +747,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
         &self,
         state: &KeyManagerState,
         merchant_id: &common_utils::id_type::MerchantId,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
         merchant_key_store: &MerchantKeyStore,
         storage_scheme: MerchantStorageScheme,
     ) -> error_stack::Result<Vec<PaymentIntent>, StorageError> {
@@ -773,7 +773,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
         &self,
         merchant_id: &common_utils::id_type::MerchantId,
         profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
     ) -> error_stack::Result<Vec<(common_enums::IntentStatus, i64)>, StorageError> {
         let conn = connection::pg_connection_read(self).await.switch()?;
         let conn = async_bb8_diesel::Connection::as_async_conn(&conn);
diff --git a/crates/storage_impl/src/payouts/payouts.rs b/crates/storage_impl/src/payouts/payouts.rs
index b6e1c1ac35f..2a49b01458f 100644
--- a/crates/storage_impl/src/payouts/payouts.rs
+++ b/crates/storage_impl/src/payouts/payouts.rs
@@ -368,7 +368,7 @@ impl<T: DatabaseStore> PayoutsInterface for KVRouterStore<T> {
     async fn filter_payouts_by_time_range_constraints(
         &self,
         merchant_id: &common_utils::id_type::MerchantId,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
         storage_scheme: MerchantStorageScheme,
     ) -> error_stack::Result<Vec<Payouts>, StorageError> {
         self.router_store
@@ -772,7 +772,7 @@ impl<T: DatabaseStore> PayoutsInterface for crate::RouterStore<T> {
     async fn filter_payouts_by_time_range_constraints(
         &self,
         merchant_id: &common_utils::id_type::MerchantId,
-        time_range: &api_models::payments::TimeRange,
+        time_range: &common_utils::types::TimeRange,
         storage_scheme: MerchantStorageScheme,
     ) -> error_stack::Result<Vec<Payouts>, StorageError> {
         let payout_filters = (*time_range).into();