-
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(router): add v2 endpoint retrieve payment aggregate based on merchant profile #7196
base: main
Are you sure you want to change the base?
Conversation
Changed Files
|
crates/hyperswitch_domain_models/src/payments/payment_intent.rs
Outdated
Show resolved
Hide resolved
crates/router/src/routes/payments.rs
Outdated
auth::auth_type( | ||
&auth::HeaderAuth(auth::ApiKeyAuth), | ||
&auth::JWTAuth { | ||
permission: Permission::MerchantPaymentRead, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have been ProfilePaymentRead
?
crates/router/src/routes/app.rs
Outdated
); | ||
|
||
route = route.service( | ||
web::resource("/aggregate").route(web::get().to(payments::get_payments_aggregates)), | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: You can combine with the previous routes being registered.
); | |
route = route.service( | |
web::resource("/aggregate").route(web::get().to(payments::get_payments_aggregates)), | |
); | |
) | |
.service( | |
web::resource("/aggregate").route(web::get().to(payments::get_payments_aggregates)), | |
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In V1 we have two routes for aggregate, one is merchant level other is at profile level, we should have in V2 as well? here
644a8e5
Type of Change
Description
Add Aggregate API which enables merchants to retrieve summarized payment data based on a specified date range at profile or merchant level. The API aggregates key payment metrics, such as total transaction count, total processed amount, and status breakdown, helping merchants analyze their payment performance effectively.
Key Changes
pub async fn get_payments_aggregates_profile
->crates/router/src/routes/payments.rs
- this implementation extracts the profile ID directly from the authentication data, ensuring profile-based filtering of payment aggregates.Additional Changes
Motivation and Context
How did you test it?
curl --location 'http://localhost:8080/v2/payments/aggregate?start_time=2025-01-05T18%3A30%3A00Z&end_time=2025-02-05T08%3A59%3A00Z' \ --header 'X-Profile-Id: pro_68rBAUSCoq91kQ870GFR' \ --header 'api-key: dev_elV1dBHRfYgbT09Q3R914ZOZzKCsJFjMJRot4TUcByFCYDseSZHTrZbCJuBX6ZHO'
Checklist
cargo +nightly fmt --all
cargo clippy