Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(analytics): adding kafka dispute analytic events #3549

Merged
merged 13 commits into from
Feb 16, 2024

Conversation

harsh-sharma-juspay
Copy link
Contributor

@harsh-sharma-juspay harsh-sharma-juspay commented Feb 5, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

adding dispute events to kafka

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

How did you test it?

Create a payment curl commented below, I used checkout connector to create dispute
and check on grafana in explore section, select loki and query as {app="bach"} |= dispute_id
I added SS of local console log in the comment below

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

@harsh-sharma-juspay harsh-sharma-juspay linked an issue Feb 5, 2024 that may be closed by this pull request
crates/router/src/db/kafka_store.rs Outdated Show resolved Hide resolved
crates/router/src/db/kafka_store.rs Outdated Show resolved Hide resolved
Copy link
Member

@lsampras lsampras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add changes in docker_compose.toml & config.example.toml as well,

Also add the dispute table script in crates/analytics/src/docs

ivor11
ivor11 previously approved these changes Feb 6, 2024
crates/analytics/docs/clickhouse/scripts/disputes.sql Outdated Show resolved Hide resolved
`merchant_connector_id` Nullable(String),
`inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),
`sign_flag` Int8
INDEX connectorIndex connector TYPE bloom_filter GRANULARITY 1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would fail since there is no field connector...

Co-authored-by: Sampras Lopes <lsampras@pm.me>
@harsh-sharma-juspay
Copy link
Contributor Author

Screenshot 2024-02-16 at 2 41 44 PM

@harsh-sharma-juspay
Copy link
Contributor Author

Payment curl:

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-hs-latency: false' \
--header 'api-key: dev_3zzBfYMeIRdI90XIxxIGSiY5U2vvAsEmkeKiZJOxFOiw1LnH91g8SdO8rQcsU6UW' \
--data-raw '{
    "amount": 1040,
    "currency": "GBP",
    "profile_id": "pro_rKH2x26LNSNDUTBjIAU9",
    "customer_id": "hyperswitch_sdk_demo_id",
    "description": "Default value",
    "capture_method": "automatic",
    "amount_to_capture": 1040,
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "authentication_type": "no_three_ds",
    "capture_on": "2024-02-10T10:11:12Z",
    "confirm": true,"payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_cvc": "100",
            "card_exp_month": "01",
            "card_exp_year": "2099",
            "card_holder_name": "John Doe",
            "card_number": "4242424242424242"
        }
    },
    "payment_method_type": "credit",
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "1234567890",
            "country_code": "+1"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": {
            "number": "1234567890",
            "country_code": "+1"
        }
    },
    "metadata": {
        "order_details": {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 10000
        }
    },
    "return_url": "http://localhost:9000/sdk",
    "payment_type": null,
    "setup_future_usage": null,
    "mandate_data": null
}'

@harsh-sharma-juspay
Copy link
Contributor Author

Screenshot 2024-02-16 at 3 49 19 PM

@harsh-sharma-juspay
Copy link
Contributor Author

Screenshot 2024-02-16 at 3 52 25 PM

@likhinbopanna likhinbopanna added this pull request to the merge queue Feb 16, 2024
Merged via the queue into main with commit 39e2233 Feb 16, 2024
10 of 12 checks passed
@likhinbopanna likhinbopanna deleted the adding_dispute_events branch February 16, 2024 12:49
@harsh-sharma-juspay
Copy link
Contributor Author

Screenshot 2024-02-20 at 10 37 04 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(analytics): adding kafka dispute events
5 participants