Skip to content

Conversation

tsdk02
Copy link
Contributor

@tsdk02 tsdk02 commented Oct 17, 2024

Type of Change

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

Description

  • Added customer_id as a filter for payment intents
  • Added payment_processed_amount metric for payment_intents table

Additional Changes

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

Motivation and Context

Filter out payments for a particular customer through the customer_id

How did you test it?

Hit the curl:
Metric data would be obtained based on the customer_id filter applied.

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.eyJ1c2VyX2lkIjoiNTQ5ZTNkMmItMTY5Yi00NzUzLWJmNTQtZDcxMTM2YjRiN2JkIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzI2MDQ2MzI4Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTcyOTI0ODM1MCwib3JnX2lkIjoib3JnX1ZwU0hPanNZZkR2YWJWWUpnQ0FKIiwicHJvZmlsZV9pZCI6InByb192NXNGb0hlODBPZWlVbElvbm9jTSJ9.TQD6wYkiTXlTvPW3-mH8FzEP1d7hXw9SmWgjVMH7flk' \
--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-09-11T00:00:00Z",
            "endTime": "2024-10-26T09:22:30Z"
        },
        "filters": {
            "customer_id": ["StripeCustomer"]
        },
        "mode": "ORDER",
        "source": "BATCH",
        "metrics": [
            "payment_processed_amount"
        ]
    }
]'

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 self-assigned this Oct 17, 2024
@tsdk02 tsdk02 requested a review from a team as a code owner October 17, 2024 06:31
Copy link

semanticdiff-com bot commented Oct 17, 2024

Review changes with SemanticDiff.

Analyzed 8 of 8 files.

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

Filename Status
✔️ crates/api_models/src/analytics/payment_intents.rs Analyzed
✔️ crates/analytics/src/query.rs Analyzed
✔️ crates/analytics/src/sqlx.rs Analyzed
✔️ crates/analytics/src/payment_intents/core.rs 82.77% smaller
✔️ crates/analytics/src/payment_intents/filters.rs Analyzed
✔️ crates/analytics/src/payment_intents/metrics.rs Analyzed
✔️ crates/analytics/src/payment_intents/types.rs Analyzed
✔️ crates/analytics/src/payment_intents/metrics/payment_processed_amount.rs Analyzed

@tsdk02 tsdk02 linked an issue Oct 17, 2024 that may be closed by this pull request
lsampras
lsampras previously approved these changes Oct 17, 2024
@tsdk02 tsdk02 dismissed stale reviews from lsampras and su-shivanshmathur via 262ab0e October 17, 2024 19:10
@su-shivanshmathur su-shivanshmathur requested a review from a team October 28, 2024 05:14
@likhinbopanna likhinbopanna added this pull request to the merge queue Oct 30, 2024
Merged via the queue into main with commit d697def Oct 30, 2024
20 of 21 checks passed
@likhinbopanna likhinbopanna deleted the add-customer-id-dimension branch October 30, 2024 10:11
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): add customer_id as filter for payment intents
4 participants