mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
feat(analytics): Analytics Request Validator and config driven forex feature (#6733)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Sandeep Kumar <83278309+tsdk02@users.noreply.github.com>
This commit is contained in:
@ -3,7 +3,7 @@ use std::{
|
||||
hash::{Hash, Hasher},
|
||||
};
|
||||
|
||||
use super::{NameDescription, TimeRange};
|
||||
use super::{ForexMetric, NameDescription, TimeRange};
|
||||
use crate::enums::DisputeStage;
|
||||
|
||||
#[derive(
|
||||
@ -28,6 +28,14 @@ pub enum DisputeMetrics {
|
||||
SessionizedTotalAmountDisputed,
|
||||
SessionizedTotalDisputeLostAmount,
|
||||
}
|
||||
impl ForexMetric for DisputeMetrics {
|
||||
fn is_forex_metric(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
Self::TotalAmountDisputed | Self::TotalDisputeLostAmount
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Debug,
|
||||
|
||||
@ -5,7 +5,7 @@ use std::{
|
||||
|
||||
use common_utils::id_type;
|
||||
|
||||
use super::{NameDescription, TimeRange};
|
||||
use super::{ForexMetric, NameDescription, TimeRange};
|
||||
use crate::enums::{
|
||||
AuthenticationType, Connector, Currency, IntentStatus, PaymentMethod, PaymentMethodType,
|
||||
};
|
||||
@ -106,6 +106,17 @@ pub enum PaymentIntentMetrics {
|
||||
SessionizedPaymentProcessedAmount,
|
||||
SessionizedPaymentsDistribution,
|
||||
}
|
||||
impl ForexMetric for PaymentIntentMetrics {
|
||||
fn is_forex_metric(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
Self::PaymentProcessedAmount
|
||||
| Self::SmartRetriedAmount
|
||||
| Self::SessionizedPaymentProcessedAmount
|
||||
| Self::SessionizedSmartRetriedAmount
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, serde::Serialize)]
|
||||
pub struct ErrorResult {
|
||||
|
||||
@ -5,7 +5,7 @@ use std::{
|
||||
|
||||
use common_utils::id_type;
|
||||
|
||||
use super::{NameDescription, TimeRange};
|
||||
use super::{ForexMetric, NameDescription, TimeRange};
|
||||
use crate::enums::{
|
||||
AttemptStatus, AuthenticationType, CardNetwork, Connector, Currency, PaymentMethod,
|
||||
PaymentMethodType,
|
||||
@ -119,6 +119,17 @@ pub enum PaymentMetrics {
|
||||
FailureReasons,
|
||||
}
|
||||
|
||||
impl ForexMetric for PaymentMetrics {
|
||||
fn is_forex_metric(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
Self::PaymentProcessedAmount
|
||||
| Self::AvgTicketSize
|
||||
| Self::SessionizedPaymentProcessedAmount
|
||||
| Self::SessionizedAvgTicketSize
|
||||
)
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Default, serde::Serialize)]
|
||||
pub struct ErrorResult {
|
||||
pub reason: String,
|
||||
|
||||
@ -30,7 +30,7 @@ pub enum RefundType {
|
||||
RetryRefund,
|
||||
}
|
||||
|
||||
use super::{NameDescription, TimeRange};
|
||||
use super::{ForexMetric, NameDescription, TimeRange};
|
||||
#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)]
|
||||
pub struct RefundFilters {
|
||||
#[serde(default)]
|
||||
@ -137,6 +137,14 @@ pub enum RefundDistributions {
|
||||
#[strum(serialize = "refund_error_message")]
|
||||
SessionizedRefundErrorMessage,
|
||||
}
|
||||
impl ForexMetric for RefundMetrics {
|
||||
fn is_forex_metric(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
Self::RefundProcessedAmount | Self::SessionizedRefundProcessedAmount
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub mod metric_behaviour {
|
||||
pub struct RefundSuccessRate;
|
||||
|
||||
Reference in New Issue
Block a user