refactor(connector): [Mifinity] add a field language_preference in payment request for mifinity payment method data (#5326)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Swangi Kumari
2024-07-15 21:40:58 +05:30
committed by GitHub
parent 0f70473a3a
commit e4a0ff1c19
6 changed files with 80 additions and 0 deletions

View File

@ -9766,6 +9766,28 @@
"enum": [ "enum": [
"user_vpa_id" "user_vpa_id"
] ]
},
{
"type": "object",
"required": [
"language_preference"
],
"properties": {
"language_preference": {
"type": "object",
"required": [
"options"
],
"properties": {
"options": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
} }
], ],
"description": "Possible field type of required fields in payment_method_data" "description": "Possible field type of required fields in payment_method_data"
@ -12177,6 +12199,10 @@
"date_of_birth": { "date_of_birth": {
"type": "string", "type": "string",
"format": "date" "format": "date"
},
"language_preference": {
"type": "string",
"nullable": true
} }
} }
}, },

View File

@ -470,6 +470,7 @@ pub enum FieldType {
DropDown { options: Vec<String> }, DropDown { options: Vec<String> },
UserDateOfBirth, UserDateOfBirth,
UserVpaId, UserVpaId,
LanguagePreference { options: Vec<String> },
} }
impl FieldType { impl FieldType {
@ -556,6 +557,7 @@ impl PartialEq for FieldType {
) => options_self.eq(options_other), ) => options_self.eq(options_other),
(Self::UserDateOfBirth, Self::UserDateOfBirth) => true, (Self::UserDateOfBirth, Self::UserDateOfBirth) => true,
(Self::UserVpaId, Self::UserVpaId) => true, (Self::UserVpaId, Self::UserVpaId) => true,
(Self::LanguagePreference { .. }, Self::LanguagePreference { .. }) => true,
_unused => false, _unused => false,
} }
} }

View File

@ -2785,6 +2785,7 @@ pub struct SwishQrData {}
pub struct MifinityData { pub struct MifinityData {
#[schema(value_type = Date)] #[schema(value_type = Date)]
pub date_of_birth: Secret<Date>, pub date_of_birth: Secret<Date>,
pub language_preference: Option<String>,
} }
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)] #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]

View File

@ -120,6 +120,7 @@ pub enum WalletData {
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct MifinityData { pub struct MifinityData {
pub date_of_birth: Secret<Date>, pub date_of_birth: Secret<Date>,
pub language_preference: Option<String>,
} }
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
@ -620,6 +621,7 @@ impl From<api_models::payments::WalletData> for WalletData {
api_models::payments::WalletData::Mifinity(mifinity_data) => { api_models::payments::WalletData::Mifinity(mifinity_data) => {
Self::Mifinity(MifinityData { Self::Mifinity(MifinityData {
date_of_birth: mifinity_data.date_of_birth, date_of_birth: mifinity_data.date_of_birth,
language_preference: mifinity_data.language_preference,
}) })
} }
} }

View File

@ -8224,6 +8224,51 @@ impl Default for super::settings::RequiredFields {
value: None, value: None,
} }
), ),
(
"payment_method_data.wallet.mifinity.language_preference".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.wallet.mifinity.language_preference".to_string(),
display_name: "language_preference".to_string(),
field_type: enums::FieldType::LanguagePreference{
options: vec![
"BR".to_string(),
"PT_BR".to_string(),
"CN".to_string(),
"ZH_CN".to_string(),
"DE".to_string(),
"DK".to_string(),
"DA".to_string(),
"DA_DK".to_string(),
"EN".to_string(),
"ES".to_string(),
"FI".to_string(),
"FR".to_string(),
"GR".to_string(),
"EL".to_string(),
"EL_GR".to_string(),
"HR".to_string(),
"IT".to_string(),
"JP".to_string(),
"JA".to_string(),
"JA_JP".to_string(),
"LA".to_string(),
"ES_LA".to_string(),
"NL".to_string(),
"NO".to_string(),
"PL".to_string(),
"PT".to_string(),
"RU".to_string(),
"SV".to_string(),
"SE".to_string(),
"SV_SE".to_string(),
"ZH".to_string(),
"TW".to_string(),
"ZH_TW".to_string(),
]
},
value: None,
}
),
]), ]),
} }
), ),

View File

@ -63,6 +63,8 @@ pub struct MifinityPaymentsRequest {
destination_account_number: Secret<String>, destination_account_number: Secret<String>,
brand_id: Secret<String>, brand_id: Secret<String>,
return_url: String, return_url: String,
#[serde(skip_serializing_if = "Option::is_none")]
language_preference: Option<String>,
} }
#[derive(Debug, Serialize, PartialEq)] #[derive(Debug, Serialize, PartialEq)]
@ -136,6 +138,7 @@ impl TryFrom<&MifinityRouterData<&types::PaymentsAuthorizeRouterData>> for Mifin
let destination_account_number = metadata.destination_account_number; let destination_account_number = metadata.destination_account_number;
let trace_id = item.router_data.connector_request_reference_id.clone(); let trace_id = item.router_data.connector_request_reference_id.clone();
let brand_id = metadata.brand_id; let brand_id = metadata.brand_id;
let language_preference = data.language_preference;
Ok(Self { Ok(Self {
money, money,
client, client,
@ -147,6 +150,7 @@ impl TryFrom<&MifinityRouterData<&types::PaymentsAuthorizeRouterData>> for Mifin
destination_account_number, destination_account_number,
brand_id, brand_id,
return_url: item.router_data.request.get_router_return_url()?, return_url: item.router_data.request.get_router_return_url()?,
language_preference,
}) })
} }
domain::WalletData::AliPayQr(_) domain::WalletData::AliPayQr(_)