Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(payments): add time range in list payment attempts query (#5959)

Apoorv Dixit156a161f3eb0
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 5465d90238..3690bcf24d 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/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index ff1a93454c..2d0a714757 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -22888,6 +22888,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 401c606ccf..dd1aa3c1bb 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 7486ab50a5..e0235c67be 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 7abef47206..0379ec0954 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 b962f60cae..24dd0effcb 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 13966c464d..41e958cb3f 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 715bf3c354..b0866cfb26 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 10771df4cc..34e1bbe544 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 edc0e75bdf..237a903d80 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 16d0fd9b30..2b1571617e 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 6acf5000ce..2206744ef0 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 fa80b0990d..48941330ec 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 24a79e2905..003509b203 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 f5b719fe37..619ebcce68 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 952028fab3..8c6d751ebe 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 42037c3c2d..eb43089e44 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 3b3a79407d..4016754510 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 b626b7d441..d1746a63dd 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 f12d6a7b56..b7771dc5e0 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 ff5936fc29..30b73eb4c6 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 30d619efed..b8255cfcfe 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 d0c0b2d3cd..c160acb50c 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 0f7abf44b1..118f4b8176 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 1d45cfd405..a44528fde4 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 394c48c1cd..9b51946c5c 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 808f82b00a..dbe7534ee2 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 5d8f7120f4..50a26ceae8 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 82407976c6..c8f4f5e4dd 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 1b614330eb..28b2afe2be 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 d21c351a92..40184c5fcf 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 449d1c725c..575725d487 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 79b9a90343..45f2073708 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 8e0040abfa..350c103226 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 1a4595bdbb..7abde14099 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 4cf8272650..e0328871e3 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 5f2cc8824e..c72a08a182 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 d1df686165..9974393e10 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 cb58eac4b6..97fa5873ca 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 b6e1c1ac35..2a49b01458 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();