mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
feat(analytics): refactor and introduce analytics APIs to accommodate OrgLevel, MerchantLevel and ProfileLevel authentication (#5729)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Sampras Lopes <sampras.lopes@juspay.in>
This commit is contained in:
@ -3,6 +3,8 @@ use std::{
|
||||
hash::{Hash, Hasher},
|
||||
};
|
||||
|
||||
use common_utils::id_type;
|
||||
|
||||
use super::{NameDescription, TimeRange};
|
||||
use crate::enums::{
|
||||
AttemptStatus, AuthenticationType, Connector, Currency, PaymentMethod, PaymentMethodType,
|
||||
@ -26,6 +28,8 @@ pub struct PaymentFilters {
|
||||
pub client_source: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub client_version: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub profile_id: Vec<id_type::ProfileId>,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
@ -59,6 +63,7 @@ pub enum PaymentDimensions {
|
||||
PaymentStatus,
|
||||
ClientSource,
|
||||
ClientVersion,
|
||||
ProfileId,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
@ -149,6 +154,7 @@ pub struct PaymentMetricsBucketIdentifier {
|
||||
pub payment_method_type: Option<String>,
|
||||
pub client_source: Option<String>,
|
||||
pub client_version: Option<String>,
|
||||
pub profile_id: Option<String>,
|
||||
#[serde(rename = "time_range")]
|
||||
pub time_bucket: TimeRange,
|
||||
// Coz FE sucks
|
||||
@ -168,6 +174,7 @@ impl PaymentMetricsBucketIdentifier {
|
||||
payment_method_type: Option<String>,
|
||||
client_source: Option<String>,
|
||||
client_version: Option<String>,
|
||||
profile_id: Option<String>,
|
||||
normalized_time_range: TimeRange,
|
||||
) -> Self {
|
||||
Self {
|
||||
@ -179,6 +186,7 @@ impl PaymentMetricsBucketIdentifier {
|
||||
payment_method_type,
|
||||
client_source,
|
||||
client_version,
|
||||
profile_id,
|
||||
time_bucket: normalized_time_range,
|
||||
start_time: normalized_time_range.start_time,
|
||||
}
|
||||
@ -195,6 +203,7 @@ impl Hash for PaymentMetricsBucketIdentifier {
|
||||
self.payment_method_type.hash(state);
|
||||
self.client_source.hash(state);
|
||||
self.client_version.hash(state);
|
||||
self.profile_id.hash(state);
|
||||
self.time_bucket.hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user