feat: store payment check codes and authentication data from processors (#3958)

Co-authored-by: AkshayaFoiger <akshaya.shankar@juspay.in>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Narayan Bhat
2024-03-20 13:26:20 +05:30
committed by GitHub
parent f3141ecbf9
commit 7afc44e835
39 changed files with 1065 additions and 16 deletions

View File

@ -1240,6 +1240,7 @@ impl PaymentMethodData {
self.to_owned()
}
}
pub fn get_payment_method(&self) -> Option<api_enums::PaymentMethod> {
match self {
Self::Card(_) => Some(api_enums::PaymentMethod::Card),
@ -1443,17 +1444,40 @@ pub struct GiftCardDetails {
#[derive(Default, Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub struct AdditionalCardInfo {
/// The name of issuer of the card
pub card_issuer: Option<String>,
/// Card network of the card
pub card_network: Option<api_enums::CardNetwork>,
/// Card type, can be either `credit` or `debit`
pub card_type: Option<String>,
pub card_issuing_country: Option<String>,
pub bank_code: Option<String>,
/// Last 4 digits of the card number
pub last4: Option<String>,
/// The ISIN of the card
pub card_isin: Option<String>,
/// Extended bin of card, contains the first 8 digits of card number
pub card_extended_bin: Option<String>,
pub card_exp_month: Option<Secret<String>>,
pub card_exp_year: Option<Secret<String>>,
pub card_holder_name: Option<Secret<String>>,
/// Additional payment checks done on the cvv and billing address by the processors.
/// This is a free form field and the structure varies from processor to processor
pub payment_checks: Option<serde_json::Value>,
/// Details about the threeds environment.
/// This is a free form field and the structure varies from processor to processor
pub authentication_data: Option<serde_json::Value>,
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
@ -2001,6 +2025,8 @@ pub struct CardResponse {
pub card_exp_month: Option<Secret<String>>,
pub card_exp_year: Option<Secret<String>>,
pub card_holder_name: Option<Secret<String>>,
pub payment_checks: Option<serde_json::Value>,
pub authentication_data: Option<serde_json::Value>,
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
@ -3003,6 +3029,8 @@ impl From<AdditionalCardInfo> for CardResponse {
card_exp_month: card.card_exp_month,
card_exp_year: card.card_exp_year,
card_holder_name: card.card_holder_name,
payment_checks: card.payment_checks,
authentication_data: card.authentication_data,
}
}
}