mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
fix(refund_list): updated refund list response status code when no refunds found. (#974)
Co-authored-by: hrithikesh vm <hrithikesh.vm@hrithikesh.vm-MacBookPro>
This commit is contained in:
@ -146,7 +146,9 @@ pub struct RefundListRequest {
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize, ToSchema)]
|
||||
pub struct RefundListResponse {
|
||||
/// The list of refund response
|
||||
/// The number of refunds included in the list
|
||||
pub size: usize,
|
||||
/// The List of refund response object
|
||||
pub data: Vec<RefundResponse>,
|
||||
}
|
||||
|
||||
|
||||
@ -626,11 +626,11 @@ pub async fn refund_list(
|
||||
.into_iter()
|
||||
.map(ForeignInto::foreign_into)
|
||||
.collect();
|
||||
utils::when(data.is_empty(), || {
|
||||
Err(errors::ApiErrorResponse::RefundNotFound)
|
||||
})?;
|
||||
Ok(services::ApplicationResponse::Json(
|
||||
api_models::refunds::RefundListResponse { data },
|
||||
api_models::refunds::RefundListResponse {
|
||||
size: data.len(),
|
||||
data,
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
@ -183,7 +183,6 @@ pub async fn refunds_update(
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "List of refunds", body = RefundListResponse),
|
||||
(status = 404, description = "Refund does not exist in our records")
|
||||
),
|
||||
tag = "Refunds",
|
||||
operation_id = "List all Refunds",
|
||||
|
||||
Reference in New Issue
Block a user