mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 21:37:41 +08:00
feat(revenue_recovery): Add token active status filtering and account update history tracking (#10056)
Co-authored-by: sagarnaikjuspay <sagar.naik@juspay.net>
This commit is contained in:
@ -9,6 +9,8 @@ use masking::Secret;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use time::{Date, PrimitiveDateTime};
|
||||
|
||||
use crate::payments;
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct RevenueRecoveryBackfillRequest {
|
||||
pub bin_number: Option<Secret<String>>,
|
||||
@ -21,6 +23,30 @@ pub struct RevenueRecoveryBackfillRequest {
|
||||
pub clean_bank_name: Option<String>,
|
||||
pub country_name: Option<String>,
|
||||
pub daily_retry_history: Option<String>,
|
||||
pub is_active: Option<bool>,
|
||||
#[serde(
|
||||
default,
|
||||
deserialize_with = "RevenueRecoveryBackfillRequest::deserialize_history_vec_opt"
|
||||
)]
|
||||
pub account_update_history: Option<Vec<AccountUpdateHistoryRecord>>,
|
||||
}
|
||||
|
||||
impl RevenueRecoveryBackfillRequest {
|
||||
pub fn deserialize_history_vec_opt<'de, D>(
|
||||
deserializer: D,
|
||||
) -> Result<Option<Vec<AccountUpdateHistoryRecord>>, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
use serde::Deserialize;
|
||||
let val = Option::<String>::deserialize(deserializer)?;
|
||||
match val.as_deref().map(str::trim) {
|
||||
None | Some("") => Ok(None),
|
||||
Some(s) => serde_json::from_str::<Vec<AccountUpdateHistoryRecord>>(s)
|
||||
.map(Some)
|
||||
.map_err(serde::de::Error::custom),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
@ -46,6 +72,16 @@ pub struct CsvParsingError {
|
||||
pub error: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AccountUpdateHistoryRecord {
|
||||
pub old_token: String,
|
||||
pub new_token: String,
|
||||
#[serde(with = "common_utils::custom_serde::iso8601")]
|
||||
pub updated_at: PrimitiveDateTime,
|
||||
pub old_token_info: Option<payments::AdditionalCardInfo>,
|
||||
pub new_token_info: Option<payments::AdditionalCardInfo>,
|
||||
}
|
||||
|
||||
/// Comprehensive card
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ComprehensiveCardData {
|
||||
@ -56,6 +92,8 @@ pub struct ComprehensiveCardData {
|
||||
pub card_issuer: Option<String>,
|
||||
pub card_issuing_country: Option<String>,
|
||||
pub daily_retry_history: Option<HashMap<Date, i32>>,
|
||||
pub is_active: Option<bool>,
|
||||
pub account_update_history: Option<Vec<AccountUpdateHistoryRecord>>,
|
||||
}
|
||||
|
||||
impl ApiEventMetric for RevenueRecoveryDataBackfillResponse {
|
||||
|
||||
Reference in New Issue
Block a user