Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
refactor(connector): [Mifinity] add a field language_preference in payment request for mifinity payment method data (#5326)
Swangi Kumarie4a0ff1c190c
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.jsonindex fe58feb053..085d699f85 100644--- a/api-reference/openapi_spec.json+++ b/api-reference/openapi_spec.json@@ -9766,6 +9766,28 @@"enum": ["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"@@ -12177,6 +12199,10 @@"date_of_birth": {"type": "string","format": "date"+ },+ "language_preference": {+ "type": "string",+ "nullable": true}}},diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rsindex 62e976b093..b36e0ffe44 100644--- a/crates/api_models/src/enums.rs+++ b/crates/api_models/src/enums.rs@@ -470,6 +470,7 @@ pub enum FieldType {DropDown { options: Vec<String> },UserDateOfBirth,UserVpaId,+ LanguagePreference { options: Vec<String> },}impl FieldType {@@ -556,6 +557,7 @@ impl PartialEq for FieldType {) => options_self.eq(options_other),(Self::UserDateOfBirth, Self::UserDateOfBirth) => true,(Self::UserVpaId, Self::UserVpaId) => true,+ (Self::LanguagePreference { .. }, Self::LanguagePreference { .. }) => true,_unused => false,}}diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex d63ac8a030..bcc67100e1 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -2785,6 +2785,7 @@ pub struct SwishQrData {}pub struct MifinityData {#[schema(value_type = Date)]pub date_of_birth: Secret<Date>,+ pub language_preference: Option<String>,}#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rsindex b4e6d2f3bc..005e21743d 100644--- a/crates/hyperswitch_domain_models/src/payment_method_data.rs+++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs@@ -120,6 +120,7 @@ pub enum WalletData {#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]pub struct MifinityData {pub date_of_birth: Secret<Date>,+ pub language_preference: Option<String>,}#[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) => {Self::Mifinity(MifinityData {date_of_birth: mifinity_data.date_of_birth,+ language_preference: mifinity_data.language_preference,})}}diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rsindex d7366a517f..8d19fe3ebc 100644--- a/crates/router/src/configs/defaults.rs+++ b/crates/router/src/configs/defaults.rs@@ -8224,6 +8224,51 @@ impl Default for super::settings::RequiredFields {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,+ }+ ),]),}),diff --git a/crates/router/src/connector/mifinity/transformers.rs b/crates/router/src/connector/mifinity/transformers.rsindex 5f0e4b9c9d..5d18834de8 100644--- a/crates/router/src/connector/mifinity/transformers.rs+++ b/crates/router/src/connector/mifinity/transformers.rs@@ -63,6 +63,8 @@ pub struct MifinityPaymentsRequest {destination_account_number: Secret<String>,brand_id: Secret<String>,return_url: String,+ #[serde(skip_serializing_if = "Option::is_none")]+ language_preference: Option<String>,}#[derive(Debug, Serialize, PartialEq)]@@ -136,6 +138,7 @@ impl TryFrom<&MifinityRouterData<&types::PaymentsAuthorizeRouterData>> for Mifinlet destination_account_number = metadata.destination_account_number;let trace_id = item.router_data.connector_request_reference_id.clone();let brand_id = metadata.brand_id;+ let language_preference = data.language_preference;Ok(Self {money,client,@@ -147,6 +150,7 @@ impl TryFrom<&MifinityRouterData<&types::PaymentsAuthorizeRouterData>> for Mifindestination_account_number,brand_id,return_url: item.router_data.request.get_router_return_url()?,+ language_preference,})}domain::WalletData::AliPayQr(_)