Skip to content
New issue

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

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

Already on GitHub? # to your account

fix(analytics): fix refund status filter on dashboard #6431

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

tsdk02
Copy link
Contributor

@tsdk02 tsdk02 commented Oct 24, 2024

Type of Change

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

Description

  • Whenever Refund Status filter is applied on the analytics section on dashboard, errors are being generated.
  • The wrong RefundStatus enum has been imported for the RefundStatus filter in RefundFilters struct in this PR: feat(analytics): Add Clickhouse based analytics #2988.
  • Updated the code to use the correct RefundStatus import.

Additional Changes

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

Motivation and Context

To fix the issue on dashboard whenever refund status filter is applied.

How did you test it?

  • Apply the refund status filter on the dashboard

  • Hit the curl:

curl --location 'http://localhost:8080/analytics/v1/org/metrics/refunds' \
--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/129.0.0.0 Safari/537.36' \
--header 'api-key: dev_LZcIA7XeMpnK5satp4CDvjcnHCaeKTBcosyuBBJaknZu1odhFo96cwS0nSdfzuJF' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNTQ5ZTNkMmItMTY5Yi00NzUzLWJmNTQtZDcxMTM2YjRiN2JkIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzI2MDQ2MzI4Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTcyOTkyOTAwOCwib3JnX2lkIjoib3JnX1ZwU0hPanNZZkR2YWJWWUpnQ0FKIiwicHJvZmlsZV9pZCI6InByb192NXNGb0hlODBPZWlVbElvbm9jTSJ9.B7sxut7HMs1C7QDRJWqOhQXHbugw4Ev3w8EAzskmzeo' \
--header 'sec-ch-ua: "Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--data '[
    {
        "timeRange": {
            "startTime": "2024-10-16T18:30:00Z",
            "endTime": "2024-10-24T13:17:00Z"
        },
        "timeSeries": {
            "granularity": "G_ONEDAY"
        },
        "filters": {
            "refund_status": ["success"]
        },
        "mode": "ORDER",
        "source": "BATCH",
        "metrics": [
            "refund_success_rate",
            "refund_count",
            "refund_success_count",
            "refund_processed_amount"
        ]
    }
]'

Respoonse:

{
    "queryData": [
        {
            "refund_success_rate": 100.0,
            "refund_count": 1,
            "refund_success_count": 1,
            "refund_processed_amount": 600,
            "currency": null,
            "refund_status": null,
            "connector": null,
            "refund_type": null,
            "profile_id": null,
            "time_range": {
                "start_time": "2024-10-24T00:00:00.000Z",
                "end_time": "2024-10-24T23:00:00.000Z"
            },
            "time_bucket": "2024-10-24 00:00:00"
        }
    ],
    "metaData": [
        {
            "current_time_range": {
                "start_time": "2024-10-16T18:30:00.000Z",
                "end_time": "2024-10-24T13:17:00.000Z"
            }
        }
    ]
}
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 the C-bug Category: Bug label Oct 24, 2024
@tsdk02 tsdk02 self-assigned this Oct 24, 2024
@tsdk02 tsdk02 requested a review from a team as a code owner October 24, 2024 13:21
Copy link

semanticdiff-com bot commented Oct 24, 2024

Review changes with SemanticDiff.

Analyzed 1 of 1 files.

Overall, the semantic diff is 50% smaller than the GitHub diff.

Filename Status
✔️ crates/api_models/src/analytics/refunds.rs 49.83% smaller

@tsdk02 tsdk02 linked an issue Oct 24, 2024 that may be closed by this pull request
@likhinbopanna likhinbopanna added this pull request to the merge queue Oct 25, 2024
Merged via the queue into main with commit d58f706 Oct 25, 2024
16 of 17 checks passed
@likhinbopanna likhinbopanna deleted the fix-refunds-status branch October 25, 2024 13:30
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix(analytics): fix refund status filter on dashboard
4 participants