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

fix(analytics): fix authentication_type and card_last_4 fields serialization for payment_intent_filters #6595

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

tsdk02
Copy link
Contributor

@tsdk02 tsdk02 commented Nov 18, 2024

Type of Change

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

Description

There is a serialization issue for card_last_4 and authentication_type fields when filters are getting applied for PaymentIntentFilters.
card_last_4 was being processed as card_last4 .
auth_type is being used to add the filters and not serialized into Authentication_type.

Made the changes to properly serialize card_last_4 and authentication_type filters for PaymentIntentFilters now.

Additional Changes

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

Motivation and Context

Fix the filters issue for some fields for Payment Intents.

How did you test it?

authentication_type:
Hit the curl for any metric of payment_intents (sessionized metrics):

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.eyJ1c2VyX2lkIjoiNTQ5ZTNkMmItMTY5Yi00NzUzLWJmNTQtZDcxMTM2YjRiN2JkIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzI2MDQ2MzI4Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTczMjA4NzM4Miwib3JnX2lkIjoib3JnX1ZwU0hPanNZZkR2YWJWWUpnQ0FKIiwicHJvZmlsZV9pZCI6InByb192NXNGb0hlODBPZWlVbElvbm9jTSIsInRlbmFudF9pZCI6InB1YmxpYyJ9.3bV2aTF7uFAtELFBuKe-_hIZHY35Zv5ij51F-slCYIg' \
--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": {
            "auth_type": [
                "no_three_ds"
            ]
        },
        "timeSeries": {
            "granularity": "G_ONEDAY"
        },
        "mode": "ORDER",
        "source": "BATCH",
        "metrics": [
            "sessionized_payment_processed_amount"
        ]
    }
]'

You can see the authentication_type filter that is getting applied in the query.
Screenshot 2024-11-18 at 4 18 39 PM

card_last_4:
Hit the curl for any metric of payment_intents (sessionized metrics):

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.eyJ1c2VyX2lkIjoiNTQ5ZTNkMmItMTY5Yi00NzUzLWJmNTQtZDcxMTM2YjRiN2JkIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzI2MDQ2MzI4Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTczMjA4NzM4Miwib3JnX2lkIjoib3JnX1ZwU0hPanNZZkR2YWJWWUpnQ0FKIiwicHJvZmlsZV9pZCI6InByb192NXNGb0hlODBPZWlVbElvbm9jTSIsInRlbmFudF9pZCI6InB1YmxpYyJ9.3bV2aTF7uFAtELFBuKe-_hIZHY35Zv5ij51F-slCYIg' \
--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": {
            "card_last_4": [
                "4242"
            ]
        },
        "timeSeries": {
            "granularity": "G_ONEDAY"
        },
        "mode": "ORDER",
        "source": "BATCH",
        "metrics": [
            "sessionized_payment_processed_amount"
        ]
    }
]'

You can see the card_last_4 filter that is getting applied in the query.
image

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 18, 2024
@tsdk02 tsdk02 self-assigned this Nov 18, 2024
@tsdk02 tsdk02 requested a review from a team as a code owner November 18, 2024 10:46
Copy link

semanticdiff-com bot commented Nov 18, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  crates/api_models/src/analytics/payment_intents.rs  0% smaller

@SanchithHegde SanchithHegde changed the title fix(analytics): fix authentication_type and card_last_4` fields serialization for payment_intent_filters fix(analytics): fix authentication_type and card_last_4 fields serialization for payment_intent_filters Nov 18, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue Nov 19, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Nov 19, 2024
@SanchithHegde SanchithHegde added this pull request to the merge queue Nov 19, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 19, 2024
@SanchithHegde SanchithHegde added this pull request to the merge queue Nov 19, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 19, 2024
@SanchithHegde SanchithHegde added this pull request to the merge queue Nov 19, 2024
Merged via the queue into main with commit 0302c30 Nov 19, 2024
35 of 37 checks passed
@SanchithHegde SanchithHegde deleted the fix-card_last_4-payment-intent-filters branch November 19, 2024 20:39
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.

fix(analytics): fix authentication_type and card_last_4 fields serialization for payment_intent_filters
3 participants