feat(analytics): revert remove additional filters from PaymentIntentFilters (#6492)

This commit is contained in:
Sandeep Kumar
2024-11-08 21:03:57 +05:30
committed by GitHub
parent 5af532a121
commit ce95b6538d
20 changed files with 370 additions and 2 deletions

View File

@ -6,7 +6,9 @@ use std::{
use common_utils::id_type;
use super::{NameDescription, TimeRange};
use crate::enums::{Currency, IntentStatus};
use crate::enums::{
AuthenticationType, Connector, Currency, IntentStatus, PaymentMethod, PaymentMethodType,
};
#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)]
pub struct PaymentIntentFilters {
@ -17,6 +19,24 @@ pub struct PaymentIntentFilters {
#[serde(default)]
pub profile_id: Vec<id_type::ProfileId>,
#[serde(default)]
pub connector: Vec<Connector>,
#[serde(default)]
pub auth_type: Vec<AuthenticationType>,
#[serde(default)]
pub payment_method: Vec<PaymentMethod>,
#[serde(default)]
pub payment_method_type: Vec<PaymentMethodType>,
#[serde(default)]
pub card_network: Vec<String>,
#[serde(default)]
pub merchant_id: Vec<id_type::MerchantId>,
#[serde(default)]
pub card_last_4: Vec<String>,
#[serde(default)]
pub card_issuer: Vec<String>,
#[serde(default)]
pub error_reason: Vec<String>,
#[serde(default)]
pub customer_id: Vec<id_type::CustomerId>,
}
@ -42,6 +62,15 @@ pub enum PaymentIntentDimensions {
PaymentIntentStatus,
Currency,
ProfileId,
Connector,
AuthType,
PaymentMethod,
PaymentMethodType,
CardNetwork,
MerchantId,
CardLast4,
CardIssuer,
ErrorReason,
}
#[derive(
@ -112,6 +141,15 @@ pub struct PaymentIntentMetricsBucketIdentifier {
pub status: Option<IntentStatus>,
pub currency: Option<Currency>,
pub profile_id: Option<String>,
pub connector: Option<String>,
pub auth_type: Option<AuthenticationType>,
pub payment_method: Option<String>,
pub payment_method_type: Option<String>,
pub card_network: Option<String>,
pub merchant_id: Option<String>,
pub card_last_4: Option<String>,
pub card_issuer: Option<String>,
pub error_reason: Option<String>,
#[serde(rename = "time_range")]
pub time_bucket: TimeRange,
#[serde(rename = "time_bucket")]
@ -125,12 +163,30 @@ impl PaymentIntentMetricsBucketIdentifier {
status: Option<IntentStatus>,
currency: Option<Currency>,
profile_id: Option<String>,
connector: Option<String>,
auth_type: Option<AuthenticationType>,
payment_method: Option<String>,
payment_method_type: Option<String>,
card_network: Option<String>,
merchant_id: Option<String>,
card_last_4: Option<String>,
card_issuer: Option<String>,
error_reason: Option<String>,
normalized_time_range: TimeRange,
) -> Self {
Self {
status,
currency,
profile_id,
connector,
auth_type,
payment_method,
payment_method_type,
card_network,
merchant_id,
card_last_4,
card_issuer,
error_reason,
time_bucket: normalized_time_range,
start_time: normalized_time_range.start_time,
}
@ -142,6 +198,15 @@ impl Hash for PaymentIntentMetricsBucketIdentifier {
self.status.map(|i| i.to_string()).hash(state);
self.currency.hash(state);
self.profile_id.hash(state);
self.connector.hash(state);
self.auth_type.map(|i| i.to_string()).hash(state);
self.payment_method.hash(state);
self.payment_method_type.hash(state);
self.card_network.hash(state);
self.merchant_id.hash(state);
self.card_last_4.hash(state);
self.card_issuer.hash(state);
self.error_reason.hash(state);
self.time_bucket.hash(state);
}
}