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): added client columns in payments analytics #4658

Merged
merged 16 commits into from
May 23, 2024

Conversation

vsrivatsa-juspay
Copy link
Contributor

@vsrivatsa-juspay vsrivatsa-juspay commented May 15, 2024

Type of Change

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

Description

Added client columns in payments analytics
ClientSource, ClientVersion
Depends on #4657
closes #4656

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?

curl --location 'localhost:8080/analytics/v1/metrics/payments' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'Authorization: Bearer' \ --data '[ { "timeRange": { "startTime": "2024-01-13T18:30:00Z", "endTime": "2024-06-16T18:30:00Z" }, "metrics": [ "payment_success_rate", "payment_count", "payment_success_count", "payment_processed_amount", "avg_ticket_size" ], "groupByNames": [ "connector", "payment_method", "payment_method_type", "currency", "authentication_type", "status", "client_source", "client_version" ] } ]'

{ "queryData": [ { "payment_success_rate": null, "payment_count": 1, "payment_success_count": null, "payment_processed_amount": 0, "avg_ticket_size": null, "payment_error_message": null, "retries_count": null, "retries_amount_processed": 0, "connector_success_rate": null, "currency": "USD", "status": "failure", "connector": "stripe", "authentication_type": "no_three_ds", "payment_method": "card", "payment_method_type": "credit", "client_source": null, "client_version": null, "time_range": { "start_time": "2024-01-13T18:30:00.000Z", "end_time": "2024-06-16T18:30:00.000Z" }, "time_bucket": "2024-01-13 18:30:00" }, { "payment_success_rate": null, "payment_count": 1, "payment_success_count": null, "payment_processed_amount": 0, "avg_ticket_size": null, "payment_error_message": null, "retries_count": null, "retries_amount_processed": 0, "connector_success_rate": null, "currency": "USD", "status": "failure", "connector": "stripe", "authentication_type": "no_three_ds", "payment_method": "card", "payment_method_type": null, "client_source": "test", "client_version": "test2", "time_range": { "start_time": "2024-01-13T18:30:00.000Z", "end_time": "2024-06-16T18:30:00.000Z" }, "time_bucket": "2024-01-13 18:30:00" }, { "payment_success_rate": 0.0, "payment_count": null, "payment_success_count": null, "payment_processed_amount": 0, "avg_ticket_size": null, "payment_error_message": null, "retries_count": null, "retries_amount_processed": 0, "connector_success_rate": null, "currency": "USD", "status": null, "connector": "stripe", "authentication_type": "no_three_ds", "payment_method": "card", "payment_method_type": "credit", "client_source": null, "client_version": null, "time_range": { "start_time": "2024-01-13T18:30:00.000Z", "end_time": "2024-06-16T18:30:00.000Z" }, "time_bucket": "2024-01-13 18:30:00" }, { "payment_success_rate": 0.0, "payment_count": null, "payment_success_count": null, "payment_processed_amount": 0, "avg_ticket_size": null, "payment_error_message": null, "retries_count": null, "retries_amount_processed": 0, "connector_success_rate": null, "currency": "USD", "status": null, "connector": "stripe", "authentication_type": "no_three_ds", "payment_method": "card", "payment_method_type": null, "client_source": null, "client_version": null, "time_range": { "start_time": "2024-01-13T18:30:00.000Z", "end_time": "2024-06-16T18:30:00.000Z" }, "time_bucket": "2024-01-13 18:30:00" }, { "payment_success_rate": null, "payment_count": 1, "payment_success_count": null, "payment_processed_amount": 0, "avg_ticket_size": null, "payment_error_message": null, "retries_count": null, "retries_amount_processed": 0, "connector_success_rate": null, "currency": "USD", "status": "confirmation_awaited", "connector": null, "authentication_type": "no_three_ds", "payment_method": "card", "payment_method_type": "credit", "client_source": null, "client_version": null, "time_range": { "start_time": "2024-01-13T18:30:00.000Z", "end_time": "2024-06-16T18:30:00.000Z" }, "time_bucket": "2024-01-13 18:30:00" }, { "payment_success_rate": 0.0, "payment_count": null, "payment_success_count": null, "payment_processed_amount": 0, "avg_ticket_size": null, "payment_error_message": null, "retries_count": null, "retries_amount_processed": 0, "connector_success_rate": null, "currency": "USD", "status": null, "connector": "stripe", "authentication_type": "no_three_ds", "payment_method": "card", "payment_method_type": null, "client_source": "test", "client_version": "test2", "time_range": { "start_time": "2024-01-13T18:30:00.000Z", "end_time": "2024-06-16T18:30:00.000Z" }, "time_bucket": "2024-01-13 18:30:00" }, { "payment_success_rate": 0.0, "payment_count": null, "payment_success_count": null, "payment_processed_amount": 0, "avg_ticket_size": null, "payment_error_message": null, "retries_count": null, "retries_amount_processed": 0, "connector_success_rate": null, "currency": "USD", "status": null, "connector": null, "authentication_type": "no_three_ds", "payment_method": "card", "payment_method_type": "credit", "client_source": null, "client_version": null, "time_range": { "start_time": "2024-01-13T18:30:00.000Z", "end_time": "2024-06-16T18:30:00.000Z" }, "time_bucket": "2024-01-13 18:30:00" }, { "payment_success_rate": null, "payment_count": 4, "payment_success_count": null, "payment_processed_amount": 0, "avg_ticket_size": null, "payment_error_message": null, "retries_count": null, "retries_amount_processed": 0, "connector_success_rate": null, "currency": "USD", "status": "failure", "connector": "stripe", "authentication_type": "no_three_ds", "payment_method": "card", "payment_method_type": null, "client_source": null, "client_version": null, "time_range": { "start_time": "2024-01-13T18:30:00.000Z", "end_time": "2024-06-16T18:30:00.000Z" }, "time_bucket": "2024-01-13 18:30:00" } ], "metaData": [ { "current_time_range": { "start_time": "2024-01-13T18:30:00.000Z", "end_time": "2024-06-16T18:30:00.000Z" } } ] }
Screenshot 2024-05-22 at 5 44 17 PM

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

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.

Can you also update the clickhouse scripts in crates/analytics/docs/clickhouse/scripts ?

crates/analytics/src/payments/distribution.rs Show resolved Hide resolved
@likhinbopanna likhinbopanna added this pull request to the merge queue May 23, 2024
Merged via the queue into main with commit 0b415dc May 23, 2024
16 checks passed
@likhinbopanna likhinbopanna deleted the feat/payment_analytics_sdk_columns branch May 23, 2024 10:12
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.

[FEATURE] Include client source and client version to identify where a payment attempt originated from
4 participants