mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
feat(analytics): remove additional filters from PaymentIntentFilters (#6403)
This commit is contained in:
@ -371,15 +371,6 @@ pub async fn get_filters(
|
|||||||
PaymentIntentDimensions::PaymentIntentStatus => fil.status.map(|i| i.as_ref().to_string()),
|
PaymentIntentDimensions::PaymentIntentStatus => fil.status.map(|i| i.as_ref().to_string()),
|
||||||
PaymentIntentDimensions::Currency => fil.currency.map(|i| i.as_ref().to_string()),
|
PaymentIntentDimensions::Currency => fil.currency.map(|i| i.as_ref().to_string()),
|
||||||
PaymentIntentDimensions::ProfileId => fil.profile_id,
|
PaymentIntentDimensions::ProfileId => fil.profile_id,
|
||||||
PaymentIntentDimensions::Connector => fil.connector,
|
|
||||||
PaymentIntentDimensions::AuthType => fil.authentication_type.map(|i| i.as_ref().to_string()),
|
|
||||||
PaymentIntentDimensions::PaymentMethod => fil.payment_method,
|
|
||||||
PaymentIntentDimensions::PaymentMethodType => fil.payment_method_type,
|
|
||||||
PaymentIntentDimensions::CardNetwork => fil.card_network,
|
|
||||||
PaymentIntentDimensions::MerchantId => fil.merchant_id,
|
|
||||||
PaymentIntentDimensions::CardLast4 => fil.card_last_4,
|
|
||||||
PaymentIntentDimensions::CardIssuer => fil.card_issuer,
|
|
||||||
PaymentIntentDimensions::ErrorReason => fil.error_reason,
|
|
||||||
})
|
})
|
||||||
.collect::<Vec<String>>();
|
.collect::<Vec<String>>();
|
||||||
res.query_data.push(PaymentIntentFilterValue {
|
res.query_data.push(PaymentIntentFilterValue {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use api_models::analytics::{payment_intents::PaymentIntentDimensions, Granularity, TimeRange};
|
use api_models::analytics::{payment_intents::PaymentIntentDimensions, Granularity, TimeRange};
|
||||||
use common_utils::errors::ReportSwitchExt;
|
use common_utils::errors::ReportSwitchExt;
|
||||||
use diesel_models::enums::{AuthenticationType, Currency, IntentStatus};
|
use diesel_models::enums::{Currency, IntentStatus};
|
||||||
use error_stack::ResultExt;
|
use error_stack::ResultExt;
|
||||||
use time::PrimitiveDateTime;
|
use time::PrimitiveDateTime;
|
||||||
|
|
||||||
@ -54,13 +54,4 @@ pub struct PaymentIntentFilterRow {
|
|||||||
pub status: Option<DBEnumWrapper<IntentStatus>>,
|
pub status: Option<DBEnumWrapper<IntentStatus>>,
|
||||||
pub currency: Option<DBEnumWrapper<Currency>>,
|
pub currency: Option<DBEnumWrapper<Currency>>,
|
||||||
pub profile_id: Option<String>,
|
pub profile_id: Option<String>,
|
||||||
pub connector: Option<String>,
|
|
||||||
pub authentication_type: Option<DBEnumWrapper<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>,
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,15 +34,6 @@ pub struct PaymentIntentMetricRow {
|
|||||||
pub status: Option<DBEnumWrapper<storage_enums::IntentStatus>>,
|
pub status: Option<DBEnumWrapper<storage_enums::IntentStatus>>,
|
||||||
pub currency: Option<DBEnumWrapper<storage_enums::Currency>>,
|
pub currency: Option<DBEnumWrapper<storage_enums::Currency>>,
|
||||||
pub profile_id: Option<String>,
|
pub profile_id: Option<String>,
|
||||||
pub connector: Option<String>,
|
|
||||||
pub authentication_type: Option<DBEnumWrapper<storage_enums::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>,
|
|
||||||
pub first_attempt: Option<i64>,
|
pub first_attempt: Option<i64>,
|
||||||
pub total: Option<bigdecimal::BigDecimal>,
|
pub total: Option<bigdecimal::BigDecimal>,
|
||||||
pub count: Option<i64>,
|
pub count: Option<i64>,
|
||||||
|
|||||||
@ -101,15 +101,6 @@ where
|
|||||||
i.status.as_ref().map(|i| i.0),
|
i.status.as_ref().map(|i| i.0),
|
||||||
i.currency.as_ref().map(|i| i.0),
|
i.currency.as_ref().map(|i| i.0),
|
||||||
i.profile_id.clone(),
|
i.profile_id.clone(),
|
||||||
i.connector.clone(),
|
|
||||||
i.authentication_type.as_ref().map(|i| i.0),
|
|
||||||
i.payment_method.clone(),
|
|
||||||
i.payment_method_type.clone(),
|
|
||||||
i.card_network.clone(),
|
|
||||||
i.merchant_id.clone(),
|
|
||||||
i.card_last_4.clone(),
|
|
||||||
i.card_issuer.clone(),
|
|
||||||
i.error_reason.clone(),
|
|
||||||
TimeRange {
|
TimeRange {
|
||||||
start_time: match (granularity, i.start_bucket) {
|
start_time: match (granularity, i.start_bucket) {
|
||||||
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
||||||
|
|||||||
@ -114,15 +114,6 @@ where
|
|||||||
None,
|
None,
|
||||||
i.currency.as_ref().map(|i| i.0),
|
i.currency.as_ref().map(|i| i.0),
|
||||||
i.profile_id.clone(),
|
i.profile_id.clone(),
|
||||||
i.connector.clone(),
|
|
||||||
i.authentication_type.as_ref().map(|i| i.0),
|
|
||||||
i.payment_method.clone(),
|
|
||||||
i.payment_method_type.clone(),
|
|
||||||
i.card_network.clone(),
|
|
||||||
i.merchant_id.clone(),
|
|
||||||
i.card_last_4.clone(),
|
|
||||||
i.card_issuer.clone(),
|
|
||||||
i.error_reason.clone(),
|
|
||||||
TimeRange {
|
TimeRange {
|
||||||
start_time: match (granularity, i.start_bucket) {
|
start_time: match (granularity, i.start_bucket) {
|
||||||
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
||||||
|
|||||||
@ -101,15 +101,6 @@ where
|
|||||||
i.status.as_ref().map(|i| i.0),
|
i.status.as_ref().map(|i| i.0),
|
||||||
i.currency.as_ref().map(|i| i.0),
|
i.currency.as_ref().map(|i| i.0),
|
||||||
i.profile_id.clone(),
|
i.profile_id.clone(),
|
||||||
i.connector.clone(),
|
|
||||||
i.authentication_type.as_ref().map(|i| i.0),
|
|
||||||
i.payment_method.clone(),
|
|
||||||
i.payment_method_type.clone(),
|
|
||||||
i.card_network.clone(),
|
|
||||||
i.merchant_id.clone(),
|
|
||||||
i.card_last_4.clone(),
|
|
||||||
i.card_issuer.clone(),
|
|
||||||
i.error_reason.clone(),
|
|
||||||
TimeRange {
|
TimeRange {
|
||||||
start_time: match (granularity, i.start_bucket) {
|
start_time: match (granularity, i.start_bucket) {
|
||||||
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
||||||
|
|||||||
@ -128,15 +128,6 @@ where
|
|||||||
None,
|
None,
|
||||||
i.currency.as_ref().map(|i| i.0),
|
i.currency.as_ref().map(|i| i.0),
|
||||||
i.profile_id.clone(),
|
i.profile_id.clone(),
|
||||||
i.connector.clone(),
|
|
||||||
i.authentication_type.as_ref().map(|i| i.0),
|
|
||||||
i.payment_method.clone(),
|
|
||||||
i.payment_method_type.clone(),
|
|
||||||
i.card_network.clone(),
|
|
||||||
i.merchant_id.clone(),
|
|
||||||
i.card_last_4.clone(),
|
|
||||||
i.card_issuer.clone(),
|
|
||||||
i.error_reason.clone(),
|
|
||||||
TimeRange {
|
TimeRange {
|
||||||
start_time: match (granularity, i.start_bucket) {
|
start_time: match (granularity, i.start_bucket) {
|
||||||
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
||||||
|
|||||||
@ -113,15 +113,6 @@ where
|
|||||||
None,
|
None,
|
||||||
i.currency.as_ref().map(|i| i.0),
|
i.currency.as_ref().map(|i| i.0),
|
||||||
i.profile_id.clone(),
|
i.profile_id.clone(),
|
||||||
i.connector.clone(),
|
|
||||||
i.authentication_type.as_ref().map(|i| i.0),
|
|
||||||
i.payment_method.clone(),
|
|
||||||
i.payment_method_type.clone(),
|
|
||||||
i.card_network.clone(),
|
|
||||||
i.merchant_id.clone(),
|
|
||||||
i.card_last_4.clone(),
|
|
||||||
i.card_issuer.clone(),
|
|
||||||
i.error_reason.clone(),
|
|
||||||
TimeRange {
|
TimeRange {
|
||||||
start_time: match (granularity, i.start_bucket) {
|
start_time: match (granularity, i.start_bucket) {
|
||||||
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
||||||
|
|||||||
@ -114,15 +114,6 @@ where
|
|||||||
None,
|
None,
|
||||||
i.currency.as_ref().map(|i| i.0),
|
i.currency.as_ref().map(|i| i.0),
|
||||||
i.profile_id.clone(),
|
i.profile_id.clone(),
|
||||||
i.connector.clone(),
|
|
||||||
i.authentication_type.as_ref().map(|i| i.0),
|
|
||||||
i.payment_method.clone(),
|
|
||||||
i.payment_method_type.clone(),
|
|
||||||
i.card_network.clone(),
|
|
||||||
i.merchant_id.clone(),
|
|
||||||
i.card_last_4.clone(),
|
|
||||||
i.card_issuer.clone(),
|
|
||||||
i.error_reason.clone(),
|
|
||||||
TimeRange {
|
TimeRange {
|
||||||
start_time: match (granularity, i.start_bucket) {
|
start_time: match (granularity, i.start_bucket) {
|
||||||
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
||||||
|
|||||||
@ -122,15 +122,6 @@ where
|
|||||||
i.status.as_ref().map(|i| i.0),
|
i.status.as_ref().map(|i| i.0),
|
||||||
i.currency.as_ref().map(|i| i.0),
|
i.currency.as_ref().map(|i| i.0),
|
||||||
i.profile_id.clone(),
|
i.profile_id.clone(),
|
||||||
i.connector.clone(),
|
|
||||||
i.authentication_type.as_ref().map(|i| i.0),
|
|
||||||
i.payment_method.clone(),
|
|
||||||
i.payment_method_type.clone(),
|
|
||||||
i.card_network.clone(),
|
|
||||||
i.merchant_id.clone(),
|
|
||||||
i.card_last_4.clone(),
|
|
||||||
i.card_issuer.clone(),
|
|
||||||
i.error_reason.clone(),
|
|
||||||
TimeRange {
|
TimeRange {
|
||||||
start_time: match (granularity, i.start_bucket) {
|
start_time: match (granularity, i.start_bucket) {
|
||||||
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
||||||
|
|||||||
@ -111,15 +111,6 @@ where
|
|||||||
i.status.as_ref().map(|i| i.0),
|
i.status.as_ref().map(|i| i.0),
|
||||||
i.currency.as_ref().map(|i| i.0),
|
i.currency.as_ref().map(|i| i.0),
|
||||||
i.profile_id.clone(),
|
i.profile_id.clone(),
|
||||||
i.connector.clone(),
|
|
||||||
i.authentication_type.as_ref().map(|i| i.0),
|
|
||||||
i.payment_method.clone(),
|
|
||||||
i.payment_method_type.clone(),
|
|
||||||
i.card_network.clone(),
|
|
||||||
i.merchant_id.clone(),
|
|
||||||
i.card_last_4.clone(),
|
|
||||||
i.card_issuer.clone(),
|
|
||||||
i.error_reason.clone(),
|
|
||||||
TimeRange {
|
TimeRange {
|
||||||
start_time: match (granularity, i.start_bucket) {
|
start_time: match (granularity, i.start_bucket) {
|
||||||
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
||||||
|
|||||||
@ -106,15 +106,6 @@ where
|
|||||||
i.status.as_ref().map(|i| i.0),
|
i.status.as_ref().map(|i| i.0),
|
||||||
i.currency.as_ref().map(|i| i.0),
|
i.currency.as_ref().map(|i| i.0),
|
||||||
i.profile_id.clone(),
|
i.profile_id.clone(),
|
||||||
i.connector.clone(),
|
|
||||||
i.authentication_type.as_ref().map(|i| i.0),
|
|
||||||
i.payment_method.clone(),
|
|
||||||
i.payment_method_type.clone(),
|
|
||||||
i.card_network.clone(),
|
|
||||||
i.merchant_id.clone(),
|
|
||||||
i.card_last_4.clone(),
|
|
||||||
i.card_issuer.clone(),
|
|
||||||
i.error_reason.clone(),
|
|
||||||
TimeRange {
|
TimeRange {
|
||||||
start_time: match (granularity, i.start_bucket) {
|
start_time: match (granularity, i.start_bucket) {
|
||||||
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
||||||
|
|||||||
@ -122,15 +122,6 @@ where
|
|||||||
i.status.as_ref().map(|i| i.0),
|
i.status.as_ref().map(|i| i.0),
|
||||||
i.currency.as_ref().map(|i| i.0),
|
i.currency.as_ref().map(|i| i.0),
|
||||||
i.profile_id.clone(),
|
i.profile_id.clone(),
|
||||||
i.connector.clone(),
|
|
||||||
i.authentication_type.as_ref().map(|i| i.0),
|
|
||||||
i.payment_method.clone(),
|
|
||||||
i.payment_method_type.clone(),
|
|
||||||
i.card_network.clone(),
|
|
||||||
i.merchant_id.clone(),
|
|
||||||
i.card_last_4.clone(),
|
|
||||||
i.card_issuer.clone(),
|
|
||||||
i.error_reason.clone(),
|
|
||||||
TimeRange {
|
TimeRange {
|
||||||
start_time: match (granularity, i.start_bucket) {
|
start_time: match (granularity, i.start_bucket) {
|
||||||
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
||||||
|
|||||||
@ -111,15 +111,6 @@ where
|
|||||||
i.status.as_ref().map(|i| i.0),
|
i.status.as_ref().map(|i| i.0),
|
||||||
i.currency.as_ref().map(|i| i.0),
|
i.currency.as_ref().map(|i| i.0),
|
||||||
i.profile_id.clone(),
|
i.profile_id.clone(),
|
||||||
i.connector.clone(),
|
|
||||||
i.authentication_type.as_ref().map(|i| i.0),
|
|
||||||
i.payment_method.clone(),
|
|
||||||
i.payment_method_type.clone(),
|
|
||||||
i.card_network.clone(),
|
|
||||||
i.merchant_id.clone(),
|
|
||||||
i.card_last_4.clone(),
|
|
||||||
i.card_issuer.clone(),
|
|
||||||
i.error_reason.clone(),
|
|
||||||
TimeRange {
|
TimeRange {
|
||||||
start_time: match (granularity, i.start_bucket) {
|
start_time: match (granularity, i.start_bucket) {
|
||||||
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
||||||
|
|||||||
@ -106,15 +106,6 @@ where
|
|||||||
i.status.as_ref().map(|i| i.0),
|
i.status.as_ref().map(|i| i.0),
|
||||||
i.currency.as_ref().map(|i| i.0),
|
i.currency.as_ref().map(|i| i.0),
|
||||||
i.profile_id.clone(),
|
i.profile_id.clone(),
|
||||||
i.connector.clone(),
|
|
||||||
i.authentication_type.as_ref().map(|i| i.0),
|
|
||||||
i.payment_method.clone(),
|
|
||||||
i.payment_method_type.clone(),
|
|
||||||
i.card_network.clone(),
|
|
||||||
i.merchant_id.clone(),
|
|
||||||
i.card_last_4.clone(),
|
|
||||||
i.card_issuer.clone(),
|
|
||||||
i.error_reason.clone(),
|
|
||||||
TimeRange {
|
TimeRange {
|
||||||
start_time: match (granularity, i.start_bucket) {
|
start_time: match (granularity, i.start_bucket) {
|
||||||
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
(Some(g), Some(st)) => g.clip_to_start(st)?,
|
||||||
|
|||||||
@ -30,63 +30,6 @@ where
|
|||||||
.add_filter_in_range_clause(PaymentIntentDimensions::ProfileId, &self.profile_id)
|
.add_filter_in_range_clause(PaymentIntentDimensions::ProfileId, &self.profile_id)
|
||||||
.attach_printable("Error adding profile id filter")?;
|
.attach_printable("Error adding profile id filter")?;
|
||||||
}
|
}
|
||||||
if !self.connector.is_empty() {
|
|
||||||
builder
|
|
||||||
.add_filter_in_range_clause(PaymentIntentDimensions::Connector, &self.connector)
|
|
||||||
.attach_printable("Error adding connector filter")?;
|
|
||||||
}
|
|
||||||
if !self.auth_type.is_empty() {
|
|
||||||
builder
|
|
||||||
.add_filter_in_range_clause(PaymentIntentDimensions::AuthType, &self.auth_type)
|
|
||||||
.attach_printable("Error adding auth type filter")?;
|
|
||||||
}
|
|
||||||
if !self.payment_method.is_empty() {
|
|
||||||
builder
|
|
||||||
.add_filter_in_range_clause(
|
|
||||||
PaymentIntentDimensions::PaymentMethod,
|
|
||||||
&self.payment_method,
|
|
||||||
)
|
|
||||||
.attach_printable("Error adding payment method filter")?;
|
|
||||||
}
|
|
||||||
if !self.payment_method_type.is_empty() {
|
|
||||||
builder
|
|
||||||
.add_filter_in_range_clause(
|
|
||||||
PaymentIntentDimensions::PaymentMethodType,
|
|
||||||
&self.payment_method_type,
|
|
||||||
)
|
|
||||||
.attach_printable("Error adding payment method type filter")?;
|
|
||||||
}
|
|
||||||
if !self.card_network.is_empty() {
|
|
||||||
builder
|
|
||||||
.add_filter_in_range_clause(
|
|
||||||
PaymentIntentDimensions::CardNetwork,
|
|
||||||
&self.card_network,
|
|
||||||
)
|
|
||||||
.attach_printable("Error adding card network filter")?;
|
|
||||||
}
|
|
||||||
if !self.merchant_id.is_empty() {
|
|
||||||
builder
|
|
||||||
.add_filter_in_range_clause(PaymentIntentDimensions::MerchantId, &self.merchant_id)
|
|
||||||
.attach_printable("Error adding merchant id filter")?;
|
|
||||||
}
|
|
||||||
if !self.card_last_4.is_empty() {
|
|
||||||
builder
|
|
||||||
.add_filter_in_range_clause(PaymentIntentDimensions::CardLast4, &self.card_last_4)
|
|
||||||
.attach_printable("Error adding card last 4 filter")?;
|
|
||||||
}
|
|
||||||
if !self.card_issuer.is_empty() {
|
|
||||||
builder
|
|
||||||
.add_filter_in_range_clause(PaymentIntentDimensions::CardIssuer, &self.card_issuer)
|
|
||||||
.attach_printable("Error adding card issuer filter")?;
|
|
||||||
}
|
|
||||||
if !self.error_reason.is_empty() {
|
|
||||||
builder
|
|
||||||
.add_filter_in_range_clause(
|
|
||||||
PaymentIntentDimensions::ErrorReason,
|
|
||||||
&self.error_reason,
|
|
||||||
)
|
|
||||||
.attach_printable("Error adding error reason filter")?;
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -604,45 +604,6 @@ impl<'a> FromRow<'a, PgRow> for super::payment_intents::metrics::PaymentIntentMe
|
|||||||
ColumnNotFound(_) => Ok(Default::default()),
|
ColumnNotFound(_) => Ok(Default::default()),
|
||||||
e => Err(e),
|
e => Err(e),
|
||||||
})?;
|
})?;
|
||||||
let connector: Option<String> = row.try_get("connector").or_else(|e| match e {
|
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
|
||||||
e => Err(e),
|
|
||||||
})?;
|
|
||||||
let authentication_type: Option<DBEnumWrapper<AuthenticationType>> =
|
|
||||||
row.try_get("authentication_type").or_else(|e| match e {
|
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
|
||||||
e => Err(e),
|
|
||||||
})?;
|
|
||||||
let payment_method: Option<String> =
|
|
||||||
row.try_get("payment_method").or_else(|e| match e {
|
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
|
||||||
e => Err(e),
|
|
||||||
})?;
|
|
||||||
let payment_method_type: Option<String> =
|
|
||||||
row.try_get("payment_method_type").or_else(|e| match e {
|
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
|
||||||
e => Err(e),
|
|
||||||
})?;
|
|
||||||
let card_network: Option<String> = row.try_get("card_network").or_else(|e| match e {
|
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
|
||||||
e => Err(e),
|
|
||||||
})?;
|
|
||||||
let merchant_id: Option<String> = row.try_get("merchant_id").or_else(|e| match e {
|
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
|
||||||
e => Err(e),
|
|
||||||
})?;
|
|
||||||
let card_last_4: Option<String> = row.try_get("card_last_4").or_else(|e| match e {
|
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
|
||||||
e => Err(e),
|
|
||||||
})?;
|
|
||||||
let card_issuer: Option<String> = row.try_get("card_issuer").or_else(|e| match e {
|
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
|
||||||
e => Err(e),
|
|
||||||
})?;
|
|
||||||
let error_reason: Option<String> = row.try_get("error_reason").or_else(|e| match e {
|
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
|
||||||
e => Err(e),
|
|
||||||
})?;
|
|
||||||
let total: Option<bigdecimal::BigDecimal> = row.try_get("total").or_else(|e| match e {
|
let total: Option<bigdecimal::BigDecimal> = row.try_get("total").or_else(|e| match e {
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
ColumnNotFound(_) => Ok(Default::default()),
|
||||||
e => Err(e),
|
e => Err(e),
|
||||||
@ -666,15 +627,6 @@ impl<'a> FromRow<'a, PgRow> for super::payment_intents::metrics::PaymentIntentMe
|
|||||||
status,
|
status,
|
||||||
currency,
|
currency,
|
||||||
profile_id,
|
profile_id,
|
||||||
connector,
|
|
||||||
authentication_type,
|
|
||||||
payment_method,
|
|
||||||
payment_method_type,
|
|
||||||
card_network,
|
|
||||||
merchant_id,
|
|
||||||
card_last_4,
|
|
||||||
card_issuer,
|
|
||||||
error_reason,
|
|
||||||
first_attempt,
|
first_attempt,
|
||||||
total,
|
total,
|
||||||
count,
|
count,
|
||||||
@ -700,58 +652,10 @@ impl<'a> FromRow<'a, PgRow> for super::payment_intents::filters::PaymentIntentFi
|
|||||||
ColumnNotFound(_) => Ok(Default::default()),
|
ColumnNotFound(_) => Ok(Default::default()),
|
||||||
e => Err(e),
|
e => Err(e),
|
||||||
})?;
|
})?;
|
||||||
let connector: Option<String> = row.try_get("connector").or_else(|e| match e {
|
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
|
||||||
e => Err(e),
|
|
||||||
})?;
|
|
||||||
let authentication_type: Option<DBEnumWrapper<AuthenticationType>> =
|
|
||||||
row.try_get("authentication_type").or_else(|e| match e {
|
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
|
||||||
e => Err(e),
|
|
||||||
})?;
|
|
||||||
let payment_method: Option<String> =
|
|
||||||
row.try_get("payment_method").or_else(|e| match e {
|
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
|
||||||
e => Err(e),
|
|
||||||
})?;
|
|
||||||
let payment_method_type: Option<String> =
|
|
||||||
row.try_get("payment_method_type").or_else(|e| match e {
|
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
|
||||||
e => Err(e),
|
|
||||||
})?;
|
|
||||||
let card_network: Option<String> = row.try_get("card_network").or_else(|e| match e {
|
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
|
||||||
e => Err(e),
|
|
||||||
})?;
|
|
||||||
let merchant_id: Option<String> = row.try_get("merchant_id").or_else(|e| match e {
|
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
|
||||||
e => Err(e),
|
|
||||||
})?;
|
|
||||||
let card_last_4: Option<String> = row.try_get("card_last_4").or_else(|e| match e {
|
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
|
||||||
e => Err(e),
|
|
||||||
})?;
|
|
||||||
let card_issuer: Option<String> = row.try_get("card_issuer").or_else(|e| match e {
|
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
|
||||||
e => Err(e),
|
|
||||||
})?;
|
|
||||||
let error_reason: Option<String> = row.try_get("error_reason").or_else(|e| match e {
|
|
||||||
ColumnNotFound(_) => Ok(Default::default()),
|
|
||||||
e => Err(e),
|
|
||||||
})?;
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
status,
|
status,
|
||||||
currency,
|
currency,
|
||||||
profile_id,
|
profile_id,
|
||||||
connector,
|
|
||||||
authentication_type,
|
|
||||||
payment_method,
|
|
||||||
payment_method_type,
|
|
||||||
card_network,
|
|
||||||
merchant_id,
|
|
||||||
card_last_4,
|
|
||||||
card_issuer,
|
|
||||||
error_reason,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,12 +35,6 @@ pub fn get_payment_intent_dimensions() -> Vec<NameDescription> {
|
|||||||
PaymentIntentDimensions::PaymentIntentStatus,
|
PaymentIntentDimensions::PaymentIntentStatus,
|
||||||
PaymentIntentDimensions::Currency,
|
PaymentIntentDimensions::Currency,
|
||||||
PaymentIntentDimensions::ProfileId,
|
PaymentIntentDimensions::ProfileId,
|
||||||
PaymentIntentDimensions::Connector,
|
|
||||||
PaymentIntentDimensions::AuthType,
|
|
||||||
PaymentIntentDimensions::PaymentMethod,
|
|
||||||
PaymentIntentDimensions::PaymentMethodType,
|
|
||||||
PaymentIntentDimensions::CardNetwork,
|
|
||||||
PaymentIntentDimensions::MerchantId,
|
|
||||||
]
|
]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(Into::into)
|
.map(Into::into)
|
||||||
|
|||||||
@ -6,9 +6,7 @@ use std::{
|
|||||||
use common_utils::id_type;
|
use common_utils::id_type;
|
||||||
|
|
||||||
use super::{NameDescription, TimeRange};
|
use super::{NameDescription, TimeRange};
|
||||||
use crate::enums::{
|
use crate::enums::{Currency, IntentStatus};
|
||||||
AuthenticationType, Connector, Currency, IntentStatus, PaymentMethod, PaymentMethodType,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)]
|
#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)]
|
||||||
pub struct PaymentIntentFilters {
|
pub struct PaymentIntentFilters {
|
||||||
@ -18,24 +16,6 @@ pub struct PaymentIntentFilters {
|
|||||||
pub currency: Vec<Currency>,
|
pub currency: Vec<Currency>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub profile_id: Vec<id_type::ProfileId>,
|
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>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
@ -60,15 +40,6 @@ pub enum PaymentIntentDimensions {
|
|||||||
PaymentIntentStatus,
|
PaymentIntentStatus,
|
||||||
Currency,
|
Currency,
|
||||||
ProfileId,
|
ProfileId,
|
||||||
Connector,
|
|
||||||
AuthType,
|
|
||||||
PaymentMethod,
|
|
||||||
PaymentMethodType,
|
|
||||||
CardNetwork,
|
|
||||||
MerchantId,
|
|
||||||
CardLast4,
|
|
||||||
CardIssuer,
|
|
||||||
ErrorReason,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
@ -138,15 +109,6 @@ pub struct PaymentIntentMetricsBucketIdentifier {
|
|||||||
pub status: Option<IntentStatus>,
|
pub status: Option<IntentStatus>,
|
||||||
pub currency: Option<Currency>,
|
pub currency: Option<Currency>,
|
||||||
pub profile_id: Option<String>,
|
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")]
|
#[serde(rename = "time_range")]
|
||||||
pub time_bucket: TimeRange,
|
pub time_bucket: TimeRange,
|
||||||
#[serde(rename = "time_bucket")]
|
#[serde(rename = "time_bucket")]
|
||||||
@ -160,30 +122,12 @@ impl PaymentIntentMetricsBucketIdentifier {
|
|||||||
status: Option<IntentStatus>,
|
status: Option<IntentStatus>,
|
||||||
currency: Option<Currency>,
|
currency: Option<Currency>,
|
||||||
profile_id: Option<String>,
|
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,
|
normalized_time_range: TimeRange,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
status,
|
status,
|
||||||
currency,
|
currency,
|
||||||
profile_id,
|
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,
|
time_bucket: normalized_time_range,
|
||||||
start_time: normalized_time_range.start_time,
|
start_time: normalized_time_range.start_time,
|
||||||
}
|
}
|
||||||
@ -195,15 +139,6 @@ impl Hash for PaymentIntentMetricsBucketIdentifier {
|
|||||||
self.status.map(|i| i.to_string()).hash(state);
|
self.status.map(|i| i.to_string()).hash(state);
|
||||||
self.currency.hash(state);
|
self.currency.hash(state);
|
||||||
self.profile_id.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);
|
self.time_bucket.hash(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user