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): revert remove additional filters from PaymentIntentFilters #6492

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

tsdk02
Copy link
Contributor

@tsdk02 tsdk02 commented Nov 6, 2024

Type of Change

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

Description

Reverts #6403

When global filters are applied on the dashboard, these filters are being sent to both Payment Attempt and Payment Intent related metrics.
Initially backend support was not present for capturing these filters and adding to the queries, for Payment Intent related metrics, but for the new Analytics V2 dashboard, since the Sessionizer Tables are being used, all these filter fields are supported in the Sessionizer Payment Intents table.

When backend support was added to apply these filters for the new dashboard, the old dashboard started breaking, as the filter fields are not present in the existing Payment Intents table.

FE stopped sending these filters to Payment Intent metrics on the old dashboard, and so adding these filters back to PaymentIntentFilters to support the filters on the new Analytics V2 dashboard.

The additional filters added:

  • connector
  • authentication_type
  • payment_method
  • payment_method_type
  • card_network
  • merchant_id
  • card_last_4
  • card_issuer
  • error_reason

Additional Changes

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

Motivation and Context

Enable filters for Payment Intent related metrics on the new Analytics V2 dashboard.

How did you test it?

Hit the curl:

curl --location 'http://localhost:8080/analytics/v2/org/metrics/payments' \
--header 'Accept: */*' \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'Origin: http://localhost:9000' \
--header 'QueryType: SingleStatTimeseries' \
--header 'Referer: http://localhost:9000/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-site' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' \
--header 'api-key: dev_LZcIA7XeMpnK5satp4CDvjcnHCaeKTBcosyuBBJaknZu1odhFo96cwS0nSdfzuJF' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNTQ5ZTNkMmItMTY5Yi00NzUzLWJmNTQtZDcxMTM2YjRiN2JkIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzI2MDQ2MzI4Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTczMDkxNDM0Mywib3JnX2lkIjoib3JnX1ZwU0hPanNZZkR2YWJWWUpnQ0FKIiwicHJvZmlsZV9pZCI6InByb19BN1F4SjN6TG05Z1NmYkZqUTNpNSJ9.Y7RdCF52kfFCUld587axdN5d4Xl7SGK4wv7C-bdDI0M' \
--header 'sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--data '[
    {
        "timeRange": {
            "startTime": "2024-10-14T18:30:00Z",
            "endTime": "2024-10-22T15:24:00Z"
        },
        "groupByNames": [
            "currency"
        ],
        "filters": {
            "connector": [
                "stripe_test"
            ]
        },
        "timeSeries": {
            "granularity": "G_ONEDAY"
        },
        "mode": "ORDER",
        "source": "BATCH",
        "metrics": [
            "sessionized_total_smart_retries"
        ]
    }
]'

We should be able to extract the results based on the additional filters that are applied:

  • connector
  • authentication_type
  • payment_method
  • payment_method_type
  • card_network
  • merchant_id
  • card_last_4
  • card_issuer
  • error_reason

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

@tsdk02 tsdk02 added C-bug Category: Bug A-Analytics labels Nov 6, 2024
@tsdk02 tsdk02 self-assigned this Nov 6, 2024
@tsdk02 tsdk02 requested a review from a team as a code owner November 6, 2024 11:07
Copy link

semanticdiff-com bot commented Nov 6, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  crates/api_models/src/analytics/payment_intents.rs  5% smaller
  crates/analytics/src/payment_intents/filters.rs  1% smaller
  crates/analytics/src/payment_intents/core.rs  0% smaller
  crates/analytics/src/payment_intents/metrics.rs  0% smaller
  crates/analytics/src/payment_intents/metrics/payment_intent_count.rs  0% smaller
  crates/analytics/src/payment_intents/metrics/payment_processed_amount.rs  0% smaller
  crates/analytics/src/payment_intents/metrics/payments_success_rate.rs  0% smaller
  crates/analytics/src/payment_intents/metrics/sessionized_metrics/payment_intent_count.rs  0% smaller
  crates/analytics/src/payment_intents/metrics/sessionized_metrics/payment_processed_amount.rs  0% smaller
  crates/analytics/src/payment_intents/metrics/sessionized_metrics/payments_distribution.rs  0% smaller
  crates/analytics/src/payment_intents/metrics/sessionized_metrics/payments_success_rate.rs  0% smaller
  crates/analytics/src/payment_intents/metrics/sessionized_metrics/smart_retried_amount.rs  0% smaller
  crates/analytics/src/payment_intents/metrics/sessionized_metrics/successful_smart_retries.rs  0% smaller
  crates/analytics/src/payment_intents/metrics/sessionized_metrics/total_smart_retries.rs  0% smaller
  crates/analytics/src/payment_intents/metrics/smart_retried_amount.rs  0% smaller
  crates/analytics/src/payment_intents/metrics/successful_smart_retries.rs  0% smaller
  crates/analytics/src/payment_intents/metrics/total_smart_retries.rs  0% smaller
  crates/analytics/src/payment_intents/types.rs  0% smaller
  crates/analytics/src/sqlx.rs  0% smaller
  crates/analytics/src/utils.rs  0% smaller

@likhinbopanna likhinbopanna added this pull request to the merge queue Nov 8, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 8, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue Nov 8, 2024
Merged via the queue into main with commit ce95b65 Nov 8, 2024
31 of 33 checks passed
@likhinbopanna likhinbopanna deleted the revert-remove-additional-filters-intents branch November 8, 2024 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(analytics): revert remove additional filters from PaymentIntentFilters
4 participants