feat(refunds): update refunds filters (#4409)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Apoorv Dixit
2024-05-13 18:47:29 +05:30
committed by GitHub
parent 1602eb541d
commit cfab2af7d4
14 changed files with 254 additions and 12 deletions

View File

@ -1,10 +1,15 @@
use std::collections::HashMap;
use common_utils::pii;
use serde::{Deserialize, Serialize};
use time::PrimitiveDateTime;
use utoipa::ToSchema;
use super::payments::TimeRange;
use crate::{admin, enums};
use super::payments::{AmountFilter, TimeRange};
use crate::{
admin::{self, MerchantConnectorInfo},
enums,
};
#[derive(Default, Debug, ToSchema, Clone, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
@ -146,11 +151,15 @@ pub struct RefundListRequest {
pub limit: Option<i64>,
/// The starting point within a list of objects
pub offset: Option<i64>,
/// The time range for which objects are needed. TimeRange has two fields start_time and end_time from which objects can be filtered as per required scenarios (created_at, time less than, greater than etc).
/// The time range for which objects are needed. TimeRange has two fields start_time and end_time from which objects can be filtered as per required scenarios (created_at, time less than, greater than etc)
#[serde(flatten)]
pub time_range: Option<TimeRange>,
/// The amount to filter reufnds list. Amount takes two option fields start_amount and end_amount from which objects can be filtered as per required scenarios (less_than, greater_than, equal_to and range)
pub amount_filter: Option<AmountFilter>,
/// The list of connectors to filter refunds list
pub connector: Option<Vec<String>>,
/// The list of merchant connector ids to filter the refunds list for selected label
pub merchant_connector_id: Option<Vec<String>>,
/// The list of currencies to filter refunds list
#[schema(value_type = Option<Vec<Currency>>)]
pub currency: Option<Vec<enums::Currency>>,
@ -181,6 +190,18 @@ pub struct RefundListMetaData {
pub refund_status: Vec<enums::RefundStatus>,
}
#[derive(Clone, Debug, serde::Serialize, ToSchema)]
pub struct RefundListFilters {
/// The map of available connector filters, where the key is the connector name and the value is a list of MerchantConnectorInfo instances
pub connector: HashMap<String, Vec<MerchantConnectorInfo>>,
/// The list of available currency filters
#[schema(value_type = Vec<Currency>)]
pub currency: Vec<enums::Currency>,
/// The list of available refund status filters
#[schema(value_type = Vec<RefundStatus>)]
pub refund_status: Vec<enums::RefundStatus>,
}
/// The status for refunds
#[derive(
Debug,