mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 12:06:56 +08:00
feat(payouts): add kafka events (#4264)
Co-authored-by: Ivor Dsouza <ivor.dsouza@juspay.in> Co-authored-by: ivor-juspay <138492857+ivor-juspay@users.noreply.github.com> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
CREATE TABLE payout_queue (
|
||||
`payout_id` String,
|
||||
`payout_attempt_id` String,
|
||||
`merchant_id` String,
|
||||
`customer_id` String,
|
||||
`address_id` String,
|
||||
`payout_type` LowCardinality(String),
|
||||
`profile_id` String,
|
||||
`payout_method_id` Nullable(String),
|
||||
`payout_type` LowCardinality(String),
|
||||
`amount` UInt64,
|
||||
`destination_currency` LowCardinality(String),
|
||||
`source_currency` LowCardinality(String),
|
||||
@ -17,8 +19,15 @@ CREATE TABLE payout_queue (
|
||||
`created_at` DateTime CODEC(T64, LZ4),
|
||||
`last_modified_at` DateTime CODEC(T64, LZ4),
|
||||
`attempt_count` UInt16,
|
||||
`profile_id` String,
|
||||
`status` LowCardinality(String),
|
||||
`connector` Nullable(String),
|
||||
`connector_payout_id` String,
|
||||
`is_eligible` Nullable(Bool),
|
||||
`error_message` Nullable(String),
|
||||
`error_code` Nullable(String),
|
||||
`business_country` Nullable(LowCardinality(String)),
|
||||
`business_label` Nullable(String),
|
||||
`merchant_connector_id` Nullable(String),
|
||||
`sign_flag` Int8
|
||||
) ENGINE = Kafka SETTINGS kafka_broker_list = 'kafka0:29092',
|
||||
kafka_topic_list = 'hyperswitch-payout-events',
|
||||
@ -28,11 +37,13 @@ kafka_handle_error_mode = 'stream';
|
||||
|
||||
CREATE TABLE payout (
|
||||
`payout_id` String,
|
||||
`payout_attempt_id` String,
|
||||
`merchant_id` String,
|
||||
`customer_id` String,
|
||||
`address_id` String,
|
||||
`profile_id` String,
|
||||
`payout_method_id` String,
|
||||
`payout_type` LowCardinality(String),
|
||||
`payout_method_id` Nullable(String),
|
||||
`amount` UInt64,
|
||||
`destination_currency` LowCardinality(String),
|
||||
`source_currency` LowCardinality(String),
|
||||
@ -45,26 +56,36 @@ CREATE TABLE payout (
|
||||
`created_at` DateTime DEFAULT now() CODEC(T64, LZ4),
|
||||
`last_modified_at` DateTime DEFAULT now() CODEC(T64, LZ4),
|
||||
`attempt_count` UInt16,
|
||||
`profile_id` String,
|
||||
`status` LowCardinality(String),
|
||||
`connector` Nullable(String),
|
||||
`connector_payout_id` String,
|
||||
`is_eligible` Nullable(Bool),
|
||||
`error_message` Nullable(String),
|
||||
`error_code` Nullable(String),
|
||||
`business_country` Nullable(LowCardinality(String)),
|
||||
`business_label` Nullable(String),
|
||||
`merchant_connector_id` Nullable(String),
|
||||
`inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),
|
||||
`sign_flag` Int8,
|
||||
INDEX payoutTypeIndex payout_type TYPE bloom_filter GRANULARITY 1,
|
||||
INDEX destinationCurrencyIndex destination_currency TYPE bloom_filter GRANULARITY 1,
|
||||
INDEX sourceCurrencyIndex source_currency TYPE bloom_filter GRANULARITY 1,
|
||||
INDEX entityTypeIndex entity_type TYPE bloom_filter GRANULARITY 1,
|
||||
INDEX statusIndex status TYPE bloom_filter GRANULARITY 1
|
||||
INDEX statusIndex status TYPE bloom_filter GRANULARITY 1,
|
||||
INDEX businessCountryIndex business_country TYPE bloom_filter GRANULARITY 1
|
||||
) ENGINE = CollapsingMergeTree(sign_flag) PARTITION BY toStartOfDay(created_at)
|
||||
ORDER BY
|
||||
(created_at, merchant_id, payout_id) TTL created_at + toIntervalMonth(6);
|
||||
|
||||
CREATE MATERIALIZED VIEW kafka_parse_payout TO payout (
|
||||
`payout_id` String,
|
||||
`payout_attempt_id` String,
|
||||
`merchant_id` String,
|
||||
`customer_id` String,
|
||||
`address_id` String,
|
||||
`profile_id` String,
|
||||
`payout_method_id` String,
|
||||
`payout_type` LowCardinality(String),
|
||||
`payout_method_id` Nullable(String),
|
||||
`amount` UInt64,
|
||||
`destination_currency` LowCardinality(String),
|
||||
`source_currency` LowCardinality(String),
|
||||
@ -77,18 +98,27 @@ CREATE MATERIALIZED VIEW kafka_parse_payout TO payout (
|
||||
`created_at` DateTime64(3),
|
||||
`last_modified_at` DateTime64(3),
|
||||
`attempt_count` UInt16,
|
||||
`profile_id` String,
|
||||
`status` LowCardinality(String),
|
||||
`connector` Nullable(String),
|
||||
`connector_payout_id` String,
|
||||
`is_eligible` Nullable(Bool),
|
||||
`error_message` Nullable(String),
|
||||
`error_code` Nullable(String),
|
||||
`business_country` Nullable(LowCardinality(String)),
|
||||
`business_label` Nullable(String),
|
||||
`merchant_connector_id` Nullable(String),
|
||||
`inserted_at` DateTime64(3),
|
||||
`sign_flag` Int8
|
||||
) AS
|
||||
SELECT
|
||||
payout_id,
|
||||
payout_attempt_id,
|
||||
merchant_id,
|
||||
customer_id,
|
||||
address_id,
|
||||
payout_type,
|
||||
profile_id,
|
||||
payout_method_id,
|
||||
payout_type,
|
||||
amount,
|
||||
destination_currency,
|
||||
source_currency,
|
||||
@ -101,8 +131,15 @@ SELECT
|
||||
created_at,
|
||||
last_modified_at,
|
||||
attempt_count,
|
||||
profile_id,
|
||||
status,
|
||||
connector,
|
||||
connector_payout_id,
|
||||
is_eligible,
|
||||
error_message,
|
||||
error_code,
|
||||
business_country,
|
||||
business_label,
|
||||
merchant_connector_id,
|
||||
now() as inserted_at,
|
||||
sign_flag
|
||||
FROM
|
||||
|
||||
Reference in New Issue
Block a user