feat(refunds): Refunds aggregate api (#5795)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Gitanjli
2024-09-12 18:59:25 +05:30
committed by GitHub
parent 1bb8f5e8eb
commit 00386f3295
14 changed files with 229 additions and 4 deletions

View File

@ -1,9 +1,9 @@
use common_utils::events::{ApiEventMetric, ApiEventsType};
use crate::refunds::{
RefundListFilters, RefundListMetaData, RefundListRequest, RefundListResponse,
RefundManualUpdateRequest, RefundRequest, RefundResponse, RefundUpdateRequest,
RefundsRetrieveRequest,
RefundAggregateResponse, RefundListFilters, RefundListMetaData, RefundListRequest,
RefundListResponse, RefundManualUpdateRequest, RefundRequest, RefundResponse,
RefundUpdateRequest, RefundsRetrieveRequest,
};
impl ApiEventMetric for RefundRequest {
@ -66,6 +66,12 @@ impl ApiEventMetric for RefundListResponse {
}
}
impl ApiEventMetric for RefundAggregateResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::ResourceListAPI)
}
}
impl ApiEventMetric for RefundListMetaData {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::ResourceListAPI)

View File

@ -234,6 +234,12 @@ pub struct RefundListFilters {
pub refund_status: Vec<enums::RefundStatus>,
}
#[derive(Clone, Debug, serde::Serialize, ToSchema)]
pub struct RefundAggregateResponse {
/// The list of refund status with their count
pub status_with_count: HashMap<enums::RefundStatus, i64>,
}
/// The status for refunds
#[derive(
Debug,