feat(analytics): added filter api for dispute analytics (#3724)

This commit is contained in:
harsh-sharma-juspay
2024-02-20 20:47:02 +05:30
committed by GitHub
parent 49c71d093e
commit 6aeb44091b
12 changed files with 255 additions and 1 deletions

View File

@ -88,6 +88,10 @@ pub mod routes {
web::resource("metrics/api_events")
.route(web::post().to(get_api_events_metrics)),
)
.service(
web::resource("filters/disputes")
.route(web::post().to(get_dispute_filters)),
)
}
route
}
@ -582,4 +586,30 @@ pub mod routes {
))
.await
}
pub async fn get_dispute_filters(
state: web::Data<AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<api_models::analytics::GetDisputeFilterRequest>,
) -> impl Responder {
let flow = AnalyticsFlow::GetDisputeFilters;
Box::pin(api::server_wrap(
flow,
state,
&req,
json_payload.into_inner(),
|state, auth: AuthenticationData, req| async move {
analytics::disputes::get_filters(
&state.pool,
req,
&auth.merchant_account.merchant_id,
)
.await
.map(ApplicationResponse::Json)
},
&auth::JWTAuth(Permission::Analytics),
api_locking::LockAction::NotApplicable,
))
.await
}
}