Skip to content

Commit

Permalink
time dependency added
Browse files Browse the repository at this point in the history
  • Loading branch information
KiranKBR committed May 20, 2024
1 parent e746994 commit 9b2f176
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
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: Date,
pub dob: Secret<Date>,
}

#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
Expand Down
4 changes: 3 additions & 1 deletion crates/masking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ readme = "README.md"
license.workspace = true

[features]
default = ["alloc", "serde", "diesel"]
default = ["alloc", "serde", "diesel", "time"]
alloc = ["zeroize/alloc"]
serde = ["dep:serde", "dep:serde_json"]
time = ["dep:time"]

[package.metadata.docs.rs]
all-features = true
Expand All @@ -23,6 +24,7 @@ erased-serde = "0.4.4"
serde = { version = "1", features = ["derive"], optional = true }
serde_json = { version = "1.0.115", optional = true }
subtle = "2.5.0"
time = {version = "0.3.35", optional = true }
zeroize = { version = "1.7", default-features = false }

[dev-dependencies]
Expand Down
3 changes: 3 additions & 0 deletions crates/masking/src/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ impl SerializableSecret for u16 {}
impl SerializableSecret for i8 {}
impl SerializableSecret for i32 {}

#[cfg(feature = "time")]
impl SerializableSecret for time::Date {}

impl<'de, T, I> Deserialize<'de> for Secret<T, I>
where
T: Clone + de::DeserializeOwned + Sized,
Expand Down
10 changes: 6 additions & 4 deletions crates/router/src/connector/mifinity/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub struct MifinityClient {
dialing_code: String,
nationality: api_models::enums::CountryAlpha2,
email_address: Email,
dob: Date,
dob: Secret<Date>,
}

#[derive(Default, Debug, Serialize, Eq, PartialEq)]
Expand Down Expand Up @@ -125,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,
dob: data.dob.clone(),
};
let address = MifinityAddress {
address_line1: item.router_data.get_billing_line1()?,
Expand Down Expand Up @@ -258,7 +258,7 @@ pub struct MifinityClientResponse {
dialing_code: String,
nationality: String,
email_address: String,
dob: Date,
dob: Secret<Date>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down Expand Up @@ -358,9 +358,10 @@ impl<F, T>
.iter()
.map(|payload| payload.payment_response.transaction_reference.clone())
.collect();
let status = &item.response.payload.clone().first().unwrap().status;

Ok(Self {
status: enums::AttemptStatus::Charged,
status: enums::AttemptStatus::from(&status.clone()),
response: Ok(types::PaymentsResponseData::TransactionResponse {
resource_id: types::ResponseId::ConnectorTransactionId(transaction_reference),
redirection_data: None,
Expand All @@ -375,6 +376,7 @@ impl<F, T>
}
}


//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
pub struct MifinityErrorResponse {
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/types/domain/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,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: Date,
pub dob: Secret<Date>,
}

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

0 comments on commit 9b2f176

Please sign in to comment.