Repository: juspay/hyperswitch
File: crates/api_models/src/payments.rs (Rust)

Code before:
impl AdditionalPaymentData {
    pub fn get_additional_card_info(&self) -> Option<AdditionalCardInfo> {
        match self {
            Self::Card(additional_card_info) => Some(*additional_card_info.clone()),
            _ => None,
        }
    }
}

#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct KlarnaSdkPaymentMethod {
    pub payment_type: Option<String>,
}

#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct InteracPaymentMethod {
    #[schema(value_type = Option<Object>)]
    pub customer_info: Option<InteracCustomerInfoDetails>,
}

#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct InteracCustomerInfoDetails {
    #[schema(value_type = Option<String>)]
    pub customer_name: Option<Secret<String>>,
    #[schema(value_type = Option<String>)]
    pub customer_email: Option<Secret<String>>,
    #[schema(value_type = Option<String>)]
    pub customer_phone_number: Option<Secret<String>>,
    #[schema(value_type = Option<String>)]
    pub customer_bank_id: Option<Secret<String>>,
    #[schema(value_type = Option<String>)]
    pub customer_bank_name: Option<Secret<String>>,
}

#[derive(
    Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema, SmithyModel,
)]
#[serde(rename_all = "snake_case")]
#[smithy(namespace = "com.hyperswitch.smithy.types")]
pub enum BankRedirectData {
    #[smithy(nested_value_type)]
    BancontactCard {
        /// The card number
        #[schema(value_type = String, example = "4242424242424242")]
        #[smithy(value_type = "Option<String>")]
        card_number: Option<CardNumber>,
        /// The card's expiry month
        #[schema(value_type = String, example = "24")]
        #[smithy(value_type = "Option<String>")]
        card_exp_month: Option<Secret<String>>,


Review comment (security):
```suggestion
    pub customer_email: Option<Secret<Email>>,
```

Code after:
impl AdditionalPaymentData {
    pub fn get_additional_card_info(&self) -> Option<AdditionalCardInfo> {
        match self {
            Self::Card(additional_card_info) => Some(*additional_card_info.clone()),
            _ => None,
        }
    }
}

#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct KlarnaSdkPaymentMethod {
    pub payment_type: Option<String>,
}

#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct InteracPaymentMethod {
    #[schema(value_type = Option<Object>)]
    pub customer_info: Option<common_types::payments::InteracCustomerInfoDetails>,
}

#[derive(
    Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema, SmithyModel,
)]
#[serde(rename_all = "snake_case")]
#[smithy(namespace = "com.hyperswitch.smithy.types")]
pub enum BankRedirectData {
    #[smithy(nested_value_type)]
    BancontactCard {
        /// The card number
        #[schema(value_type = String, example = "4242424242424242")]
        #[smithy(value_type = "Option<String>")]
        card_number: Option<CardNumber>,
        /// The card's expiry month
        #[schema(value_type = String, example = "24")]
        #[smithy(value_type = "Option<String>")]
        card_exp_month: Option<Secret<String>>,

        /// The card's expiry year
        #[schema(value_type = String, example = "24")]
        #[smithy(value_type = "Option<String>")]
        card_exp_year: Option<Secret<String>>,

        /// The card holder's name
        #[schema(value_type = String, example = "John Test")]
        #[smithy(value_type = "Option<String>")]
        card_holder_name: Option<Secret<String>>,

        //Required by Stripes
        #[smithy(value_type = "Option<BankRedirectBilling>")]
        billing_details: Option<BankRedirectBilling>,
    },