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

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Apoorv Dixit
2024-09-19 23:19:47 +05:30
committed by GitHub
parent 5942e059e9
commit 156a161f3e
40 changed files with 111 additions and 96 deletions

View File

@ -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;

View File

@ -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>>,

View File

@ -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)

View File

@ -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>,

View File

@ -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>>,

View File

@ -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,