diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index 9991b83681a6..ec39827d052d 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -18,7 +18,7 @@ use serde::{ ser::Serializer, Deserialize, Deserializer, Serialize, }; -use time::PrimitiveDateTime; +use time::{Date, PrimitiveDateTime}; use url::Url; use utoipa::ToSchema; @@ -2513,7 +2513,7 @@ pub struct SwishQrData {} #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)] pub struct MifinityData { pub destination_account_number: Secret, - pub dob: String, + pub dob: Date, } #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)] diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml index 144d6f079885..db878f1a5a43 100644 --- a/crates/router/Cargo.toml +++ b/crates/router/Cargo.toml @@ -87,7 +87,7 @@ sqlx = { version = "0.7.3", features = ["postgres", "runtime-tokio", "runtime-to strum = { version = "0.26", features = ["derive"] } tera = "1.19.1" thiserror = "1.0.58" -time = { version = "0.3.35", features = ["serde", "serde-well-known", "std"] } +time = { version = "0.3.35", features = ["serde", "serde-well-known", "std", "parsing", "serde-human-readable"] } tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread"] } unicode-segmentation = "1.11.0" url = { version = "2.5.0", features = ["serde"] } diff --git a/crates/router/src/connector/mifinity/transformers.rs b/crates/router/src/connector/mifinity/transformers.rs index 4a33d29af4b7..41f41a05defc 100644 --- a/crates/router/src/connector/mifinity/transformers.rs +++ b/crates/router/src/connector/mifinity/transformers.rs @@ -2,6 +2,7 @@ use common_utils::pii::{self, Email}; use error_stack::ResultExt; use masking::Secret; use serde::{Deserialize, Serialize}; +use time::Date; use crate::{ connector::utils::{self, PhoneDetailsData, RouterData}, @@ -93,7 +94,7 @@ pub struct MifinityClient { dialing_code: String, nationality: api_models::enums::CountryAlpha2, email_address: Email, - dob: String, + dob: Date, } #[derive(Default, Debug, Serialize, Eq, PartialEq)] @@ -124,7 +125,7 @@ impl TryFrom<&MifinityRouterData<&types::PaymentsAuthorizeRouterData>> for Mifin dialing_code: phone_details.get_country_code()?, nationality: item.router_data.get_billing_country()?, email_address: item.router_data.get_billing_email()?, - dob: data.dob.clone(), + dob: data.dob, }; let address = MifinityAddress { address_line1: item.router_data.get_billing_line1()?, @@ -257,7 +258,7 @@ pub struct MifinityClientResponse { dialing_code: String, nationality: String, email_address: String, - dob: String, + dob: Date, } #[derive(Debug, Clone, Serialize, Deserialize)] diff --git a/crates/router/src/types/domain/payments.rs b/crates/router/src/types/domain/payments.rs index a7e0854d3181..6b276f2d7d1c 100644 --- a/crates/router/src/types/domain/payments.rs +++ b/crates/router/src/types/domain/payments.rs @@ -1,6 +1,7 @@ use common_utils::pii::{self, Email}; use masking::Secret; use serde::{Deserialize, Serialize}; +use time::Date; // We need to derive Serialize and Deserialize because some parts of payment method data are being // stored in the database as serde_json::Value @@ -111,7 +112,7 @@ pub enum WalletData { #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)] pub struct MifinityData { pub destination_account_number: Secret, - pub dob: String, + pub dob: Date, } #[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]