-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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): implement currency conversion to power multi-currency aggregation #6418
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- create get_conversion_rates() function - change get_metrics() to accept ExchangeRates hashmap
…lyticsMetadata and PaymentAnalyticsBucketValue
…ep and rust_decimal as 3rd party dep
…ts and payment_intents amount metrics
…tors for both payments and payment_intents
…or payments and payments_intents
tsdk02
previously approved these changes
Oct 25, 2024
- fallback api doesnt return a USD factor of 1 inside the rates field like the primary api's response, which was causing different response when using fall_back api for fetching exchange rates.
SanchithHegde
approved these changes
Nov 3, 2024
tsdk02
approved these changes
Nov 4, 2024
Chethan-rao
approved these changes
Nov 4, 2024
14 tasks
bsayak03
pushed a commit
that referenced
this pull request
Nov 26, 2024
…y aggregation (#6418) Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-Analytics
C-feature
Category: Feature request or enhancement
Rust
Pull requests that update Rust code
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
INR
) toUSD
and store it in a separate field variant I created<fieldname>_in_usd
Fixes #6416
Additional Changes
Motivation and Context
The total amount calculated for all payment analytics buckets related to amounts is incorrect because currency conversion is not being applied before summing the values. As a result, amounts in different currencies are being added together, leading to an inaccurate total.
Dependency
This functionality depends on
currency_conversion
crate directly to fetch exchange rates.How did you test it?
API request for metrics
API response
Testing for various other scenarios
by tweaking
development.toml
we can create these scenariosby setting
call_delay
to 30s we can check for the fetch cycle and redis updates.API response : 200
API response : 500
Checklist
cargo +nightly fmt --all
cargo clippy