mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
feat(router): Add webhooks for network tokenization (#6695)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -1065,6 +1065,23 @@ pub struct Card {
|
||||
pub nick_name: Option<String>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
impl From<(Card, Option<common_enums::CardNetwork>)> for CardDetail {
|
||||
fn from((card, card_network): (Card, Option<common_enums::CardNetwork>)) -> Self {
|
||||
Self {
|
||||
card_number: card.card_number.clone(),
|
||||
card_exp_month: card.card_exp_month.clone(),
|
||||
card_exp_year: card.card_exp_year.clone(),
|
||||
card_holder_name: card.name_on_card.clone(),
|
||||
nick_name: card.nick_name.map(masking::Secret::new),
|
||||
card_issuing_country: None,
|
||||
card_network,
|
||||
card_issuer: None,
|
||||
card_type: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
|
||||
pub struct CardDetailFromLocker {
|
||||
|
||||
@ -129,6 +129,11 @@ pub enum WebhookResponseTracker {
|
||||
mandate_id: String,
|
||||
status: common_enums::MandateStatus,
|
||||
},
|
||||
#[cfg(feature = "v1")]
|
||||
PaymentMethod {
|
||||
payment_method_id: String,
|
||||
status: common_enums::PaymentMethodStatus,
|
||||
},
|
||||
NoEffect,
|
||||
Relay {
|
||||
relay_id: common_utils::id_type::RelayId,
|
||||
@ -143,13 +148,30 @@ impl WebhookResponseTracker {
|
||||
Self::Payment { payment_id, .. }
|
||||
| Self::Refund { payment_id, .. }
|
||||
| Self::Dispute { payment_id, .. } => Some(payment_id.to_owned()),
|
||||
Self::NoEffect | Self::Mandate { .. } => None,
|
||||
Self::NoEffect | Self::Mandate { .. } | Self::PaymentMethod { .. } => None,
|
||||
#[cfg(feature = "payouts")]
|
||||
Self::Payout { .. } => None,
|
||||
Self::Relay { .. } => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
pub fn get_payment_method_id(&self) -> Option<String> {
|
||||
match self {
|
||||
Self::PaymentMethod {
|
||||
payment_method_id, ..
|
||||
} => Some(payment_method_id.to_owned()),
|
||||
Self::Payment { .. }
|
||||
| Self::Refund { .. }
|
||||
| Self::Dispute { .. }
|
||||
| Self::NoEffect
|
||||
| Self::Mandate { .. }
|
||||
| Self::Relay { .. } => None,
|
||||
#[cfg(feature = "payouts")]
|
||||
Self::Payout { .. } => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v2")]
|
||||
pub fn get_payment_id(&self) -> Option<common_utils::id_type::GlobalPaymentId> {
|
||||
match self {
|
||||
|
||||
Reference in New Issue
Block a user