feat(analytics): Add processor_merchant_id to payment analytics events (#11378)

This commit is contained in:
Apoorv Dixit
2026-03-11 11:43:57 +05:30
committed by GitHub
parent 1ac0a801bb
commit 9508862ece
6 changed files with 16 additions and 0 deletions

View File

@@ -47,6 +47,7 @@ CREATE TABLE payment_attempt_queue (
`debit_routing_savings` Nullable(UInt32),
`signature_network` Nullable(String),
`is_issuer_regulated` Nullable(Bool),
`processor_merchant_id` Nullable(String),
`sign_flag` Int8
) ENGINE = Kafka SETTINGS kafka_broker_list = 'kafka0:29092',
kafka_topic_list = 'hyperswitch-payment-attempt-events',
@@ -104,6 +105,7 @@ CREATE TABLE payment_attempts (
`debit_routing_savings` Nullable(UInt32),
`signature_network` Nullable(String),
`is_issuer_regulated` Nullable(Bool),
`processor_merchant_id` Nullable(String),
`sign_flag` Int8,
INDEX connectorIndex connector TYPE bloom_filter GRANULARITY 1,
INDEX paymentMethodIndex payment_method TYPE bloom_filter GRANULARITY 1,
@@ -164,6 +166,7 @@ CREATE MATERIALIZED VIEW payment_attempt_mv TO payment_attempts (
`debit_routing_savings` Nullable(UInt32),
`signature_network` Nullable(String),
`is_issuer_regulated` Nullable(Bool),
`processor_merchant_id` Nullable(String),
`sign_flag` Int8
) AS
SELECT
@@ -216,6 +219,7 @@ SELECT
debit_routing_savings,
signature_network,
is_issuer_regulated,
processor_merchant_id,
sign_flag
FROM
payment_attempt_queue

View File

@@ -24,6 +24,7 @@ CREATE TABLE payment_intents_queue
`created_at` DateTime CODEC(T64, LZ4),
`last_synced` Nullable(DateTime) CODEC(T64, LZ4),
`organization_id` String,
`processor_merchant_id` Nullable(String),
`sign_flag` Int8
) ENGINE = Kafka SETTINGS kafka_broker_list = 'kafka0:29092',
kafka_topic_list = 'hyperswitch-payment-intent-events',
@@ -58,6 +59,7 @@ CREATE TABLE payment_intents
`last_synced` Nullable(DateTime) CODEC(T64, LZ4),
`inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),
`organization_id` String,
`processor_merchant_id` Nullable(String),
`sign_flag` Int8,
INDEX connectorIndex connector_id TYPE bloom_filter GRANULARITY 1,
INDEX currencyIndex currency TYPE bloom_filter GRANULARITY 1,
@@ -96,6 +98,7 @@ CREATE MATERIALIZED VIEW payment_intents_mv TO payment_intents
`last_synced` Nullable(DateTime64(3)),
`inserted_at` DateTime64(3),
`organization_id` String,
`processor_merchant_id` Nullable(String),
`sign_flag` Int8
) AS
SELECT
@@ -124,5 +127,6 @@ SELECT
last_synced,
now() AS inserted_at,
organization_id,
processor_merchant_id,
sign_flag
FROM payment_intents_queue;

View File

@@ -73,6 +73,7 @@ pub struct KafkaPaymentAttempt<'a> {
pub debit_routing_savings: Option<MinorUnit>,
pub signature_network: Option<common_enums::CardNetwork>,
pub is_issuer_regulated: Option<bool>,
pub processor_merchant_id: &'a id_type::MerchantId,
}
#[cfg(feature = "v1")]
@@ -143,6 +144,7 @@ impl<'a> KafkaPaymentAttempt<'a> {
.as_ref()
.and_then(|data| data.signature_network.clone()),
is_issuer_regulated: card_payment_method_data.and_then(|data| data.is_regulated),
processor_merchant_id: &attempt.processor_merchant_id,
}
}
}

View File

@@ -74,6 +74,7 @@ pub struct KafkaPaymentAttemptEvent<'a> {
pub debit_routing_savings: Option<MinorUnit>,
pub signature_network: Option<common_enums::CardNetwork>,
pub is_issuer_regulated: Option<bool>,
pub processor_merchant_id: &'a id_type::MerchantId,
}
#[cfg(feature = "v1")]
@@ -144,6 +145,7 @@ impl<'a> KafkaPaymentAttemptEvent<'a> {
.as_ref()
.and_then(|data| data.signature_network.clone()),
is_issuer_regulated: card_payment_method_data.and_then(|data| data.is_regulated),
processor_merchant_id: &attempt.processor_merchant_id,
}
}
}

View File

@@ -57,6 +57,7 @@ pub struct KafkaPaymentIntent<'a> {
pub feature_metadata: Option<&'a Value>,
pub merchant_order_reference_id: Option<&'a String>,
pub organization_id: &'a id_type::OrganizationId,
pub processor_merchant_id: &'a id_type::MerchantId,
#[serde(flatten)]
infra_values: Option<Value>,
}
@@ -103,6 +104,7 @@ impl<'a> KafkaPaymentIntent<'a> {
feature_metadata: intent.feature_metadata.as_ref(),
merchant_order_reference_id: intent.merchant_order_reference_id.as_ref(),
organization_id: &intent.organization_id,
processor_merchant_id: &intent.processor_merchant_id,
infra_values,
}
}

View File

@@ -58,6 +58,7 @@ pub struct KafkaPaymentIntentEvent<'a> {
pub feature_metadata: Option<&'a Value>,
pub merchant_order_reference_id: Option<&'a String>,
pub organization_id: &'a id_type::OrganizationId,
pub processor_merchant_id: &'a id_type::MerchantId,
#[serde(flatten)]
pub infra_values: Option<Value>,
}
@@ -194,6 +195,7 @@ impl<'a> KafkaPaymentIntentEvent<'a> {
feature_metadata: intent.feature_metadata.as_ref(),
merchant_order_reference_id: intent.merchant_order_reference_id.as_ref(),
organization_id: &intent.organization_id,
processor_merchant_id: &intent.processor_merchant_id,
infra_values: infra_values.clone(),
}
}