mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
feat(analytics): Add RoutingApproach filter in payment analytics (#8408)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -8,7 +8,7 @@ use common_utils::id_type;
|
||||
use super::{ForexMetric, NameDescription, TimeRange};
|
||||
use crate::enums::{
|
||||
AttemptStatus, AuthenticationType, CardNetwork, Connector, Currency, PaymentMethod,
|
||||
PaymentMethodType,
|
||||
PaymentMethodType, RoutingApproach,
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)]
|
||||
@ -43,6 +43,8 @@ pub struct PaymentFilters {
|
||||
pub error_reason: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub first_attempt: Vec<bool>,
|
||||
#[serde(default)]
|
||||
pub routing_approach: Vec<RoutingApproach>,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
@ -84,6 +86,7 @@ pub enum PaymentDimensions {
|
||||
CardLast4,
|
||||
CardIssuer,
|
||||
ErrorReason,
|
||||
RoutingApproach,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
@ -200,6 +203,7 @@ pub struct PaymentMetricsBucketIdentifier {
|
||||
pub card_last_4: Option<String>,
|
||||
pub card_issuer: Option<String>,
|
||||
pub error_reason: Option<String>,
|
||||
pub routing_approach: Option<RoutingApproach>,
|
||||
#[serde(rename = "time_range")]
|
||||
pub time_bucket: TimeRange,
|
||||
// Coz FE sucks
|
||||
@ -225,6 +229,7 @@ impl PaymentMetricsBucketIdentifier {
|
||||
card_last_4: Option<String>,
|
||||
card_issuer: Option<String>,
|
||||
error_reason: Option<String>,
|
||||
routing_approach: Option<RoutingApproach>,
|
||||
normalized_time_range: TimeRange,
|
||||
) -> Self {
|
||||
Self {
|
||||
@ -242,6 +247,7 @@ impl PaymentMetricsBucketIdentifier {
|
||||
card_last_4,
|
||||
card_issuer,
|
||||
error_reason,
|
||||
routing_approach,
|
||||
time_bucket: normalized_time_range,
|
||||
start_time: normalized_time_range.start_time,
|
||||
}
|
||||
@ -264,6 +270,7 @@ impl Hash for PaymentMetricsBucketIdentifier {
|
||||
self.card_last_4.hash(state);
|
||||
self.card_issuer.hash(state);
|
||||
self.error_reason.hash(state);
|
||||
self.routing_approach.map(|i| i.to_string()).hash(state);
|
||||
self.time_bucket.hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user