Skip to content

Commit

Permalink
refactor: add dependency to support Date
Browse files Browse the repository at this point in the history
  • Loading branch information
swangi-kumari committed May 18, 2024
1 parent 8690792 commit e746994
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use serde::{
ser::Serializer,
Deserialize, Deserializer, Serialize,
};
use time::PrimitiveDateTime;
use time::{Date, PrimitiveDateTime};
use url::Url;
use utoipa::ToSchema;

Expand Down Expand Up @@ -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<String>,
pub dob: String,
pub dob: Date,
}

#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
Expand Down
2 changes: 1 addition & 1 deletion crates/router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
7 changes: 4 additions & 3 deletions crates/router/src/connector/mifinity/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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)]
Expand Down Expand Up @@ -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()?,
Expand Down Expand Up @@ -257,7 +258,7 @@ pub struct MifinityClientResponse {
dialing_code: String,
nationality: String,
email_address: String,
dob: String,
dob: Date,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down
3 changes: 2 additions & 1 deletion crates/router/src/types/domain/payments.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -111,7 +112,7 @@ pub enum WalletData {
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct MifinityData {
pub destination_account_number: Secret<String>,
pub dob: String,
pub dob: Date,
}

#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
Expand Down

0 comments on commit e746994

Please sign in to comment.