mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Narayan Bhat <narayan.bhat@juspay.in>
76 lines
2.4 KiB
Rust
76 lines
2.4 KiB
Rust
use common_enums::enums;
|
|
use common_utils::events::ApiEventMetric;
|
|
use masking::StrongSecret;
|
|
use utoipa::ToSchema;
|
|
|
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
|
|
#[serde(rename_all = "snake_case", tag = "type", content = "data")]
|
|
pub enum BlocklistRequest {
|
|
CardBin(String),
|
|
Fingerprint(String),
|
|
ExtendedCardBin(String),
|
|
}
|
|
|
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
|
|
pub struct GenerateFingerprintRequest {
|
|
pub card: Card,
|
|
pub hash_key: StrongSecret<String>,
|
|
}
|
|
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
|
|
pub struct Card {
|
|
pub card_number: StrongSecret<String>,
|
|
}
|
|
pub type AddToBlocklistRequest = BlocklistRequest;
|
|
pub type DeleteFromBlocklistRequest = BlocklistRequest;
|
|
|
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
|
|
pub struct BlocklistResponse {
|
|
pub fingerprint_id: String,
|
|
#[schema(value_type = BlocklistDataKind)]
|
|
pub data_kind: enums::BlocklistDataKind,
|
|
#[serde(with = "common_utils::custom_serde::iso8601")]
|
|
pub created_at: time::PrimitiveDateTime,
|
|
}
|
|
|
|
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub struct GenerateFingerprintResponsePayload {
|
|
pub card_fingerprint: String,
|
|
}
|
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
|
|
pub struct ToggleBlocklistResponse {
|
|
pub blocklist_guard_status: String,
|
|
}
|
|
|
|
pub type AddToBlocklistResponse = BlocklistResponse;
|
|
pub type DeleteFromBlocklistResponse = BlocklistResponse;
|
|
|
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
|
|
pub struct ListBlocklistQuery {
|
|
#[schema(value_type = BlocklistDataKind)]
|
|
pub data_kind: enums::BlocklistDataKind,
|
|
#[serde(default = "default_list_limit")]
|
|
pub limit: u16,
|
|
#[serde(default)]
|
|
pub offset: u16,
|
|
}
|
|
|
|
fn default_list_limit() -> u16 {
|
|
10
|
|
}
|
|
|
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
|
|
pub struct ToggleBlocklistQuery {
|
|
#[schema(value_type = BlocklistDataKind)]
|
|
pub status: bool,
|
|
}
|
|
|
|
impl ApiEventMetric for BlocklistRequest {}
|
|
impl ApiEventMetric for BlocklistResponse {}
|
|
impl ApiEventMetric for ToggleBlocklistResponse {}
|
|
impl ApiEventMetric for ListBlocklistQuery {}
|
|
impl ApiEventMetric for GenerateFingerprintRequest {}
|
|
impl ApiEventMetric for ToggleBlocklistQuery {}
|
|
impl ApiEventMetric for GenerateFingerprintResponsePayload {}
|
|
impl ApiEventMetric for Card {}
|