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(refunds): update refunds filters #4409
base: main
Are you sure you want to change the base?
Conversation
crates/router/src/routes/refunds.rs
Outdated
get, | ||
path = "/refunds/filter_v2", | ||
responses( | ||
(status = 200, description = "List of static filters", body = RefundListMetaData), |
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.
Is the response body type correct?
#[derive(Clone, Debug, serde::Serialize, ToSchema)] | ||
pub struct RefundListFilters { | ||
/// The list of available connector filters | ||
pub connector: HashMap<String, Vec<MerchantConnectorInfo>>, |
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.
What will be the key in this hashmap?
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.
Please mention it in the doc comment.
crates/router/src/core/refunds.rs
Outdated
.for_each(|(connector_name, info)| { | ||
connector_map | ||
.entry(connector_name.clone()) | ||
.or_default() | ||
.push(info); | ||
}); |
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.
fold() and collect() can be used here.
https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.fold
Type of Change
Description
The PR:
filter_v2
api to get list of available filters for refunds quickly: connector with their corresponding label with merchant_connector_ids, currency and refund status. This api is quicker than previous one and gives static and dynamic filter. In this list of available value doesn't depend on refunds that are made (present in table). But these are static and configuration dependent.Additional Changes
Motivation and Context
Closes #4408
How did you test it?
To get list of filters:
Response:
To filter refunds list by new parameters i.e., amount and merchant_connector_id
Response:
Checklist
cargo +nightly fmt --all
cargo clippy