Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

feat(analytics): support custom column selection in payment reports (#13393)

Venu Madhav Bandarupallia597057bf043
diff --git a/crates/api_models/src/analytics.rs b/crates/api_models/src/analytics.rs
index a7226164bb..8a2d494f7d 100644
--- a/crates/api_models/src/analytics.rs
+++ b/crates/api_models/src/analytics.rs
@@ -10,7 +10,7 @@ use self::{
disputes::{DisputeDimensions, DisputeMetrics},
frm::{FrmDimensions, FrmMetrics},
payment_intents::{PaymentIntentDimensions, PaymentIntentMetrics},
- payments::{PaymentDimensions, PaymentDistributions, PaymentMetrics},
+ payments::{PaymentDimensions, PaymentDistributions, PaymentMetrics, PaymentReportColumn},
refunds::{RefundDimensions, RefundDistributions, RefundMetrics},
sdk_events::{SdkEventDimensions, SdkEventMetrics},
};
@@ -154,6 +154,14 @@ pub struct ReportRequest {
#[cfg(feature = "v2")]
#[serde(default)]
pub report_type: ReportType,
+ #[serde(default)]
+ pub columns: Option<ReportColumns>,
+}
+
+#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
+#[serde(rename_all = "snake_case")]
+pub enum ReportColumns {
+ Payment(Vec<PaymentReportColumn>),
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
diff --git a/crates/api_models/src/analytics/payments.rs b/crates/api_models/src/analytics/payments.rs
index 9c53002a92..595b6ef919 100644
--- a/crates/api_models/src/analytics/payments.rs
+++ b/crates/api_models/src/analytics/payments.rs
@@ -98,6 +98,59 @@ pub enum PaymentDimensions {
IsDebitRouted,
}
+#[derive(
+ Debug,
+ serde::Serialize,
+ serde::Deserialize,
+ strum::AsRefStr,
+ strum::Display,
+ strum::EnumIter,
+ PartialEq,
+ Eq,
+ Hash,
+ Clone,
+ Copy,
+)]
+#[serde(rename_all = "snake_case")]
+#[strum(serialize_all = "snake_case")]
+pub enum PaymentReportColumn {
+ PaymentId,
+ AttemptId,
+ Status,
+ Amount,
+ Currency,
+ Connector,
+ ConnectorTransactionId,
+ AmountToCapture,
+ CustomerId,
+ CreatedAt,
+ OrderDetails,
+ ErrorMessage,
+ CaptureMethod,
+ AuthenticationType,
+ MandateId,
+ PaymentMethod,
+ PaymentMethodType,
+ Metadata,
+ SetupFutureUsage,
+ StatementDescriptorName,
+ Description,
+ OffSession,
+ BusinessCountry,
+ BusinessLabel,
+ BusinessSubLabel,
+ AllowedPaymentMethodTypes,
+ PaymentMethodData,
+ CardNetwork,
+ FingerprintId,
+ ModifiedAt,
+ ErrorCode,
+ PaymentMethodId,
+ CardHolderName,
+ MerchantOrderReferenceId,
+ ProfileId,
+}
+
#[derive(
Clone,
Debug,