Skip to content

Commit

Permalink
feat(api_models): address review comments + linters
Browse files Browse the repository at this point in the history
  • Loading branch information
wowinter13 committed Feb 10, 2024
1 parent 9f9007b commit 1ed2cd7
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::num::NonZeroI64;
use std::{fmt, num::NonZeroI64};

use cards::CardNumber;
use common_utils::{
Expand All @@ -8,9 +8,10 @@ use common_utils::{
};
use masking::Secret;
use router_derive::Setter;
use serde::de::{self, Unexpected, Visitor};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::fmt;
use serde::{
de::{self, Unexpected, Visitor},
Deserialize, Deserializer, Serialize, Serializer,
};
use time::PrimitiveDateTime;
use url::Url;
use utoipa::ToSchema;
Expand Down Expand Up @@ -71,8 +72,7 @@ impl<'de> Deserialize<'de> for ClientSecret {
type Value = ClientSecret;

fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str("a string in the format 'payment_id_secret_secret'")
// Note sure if this is the right format
formatter.write_str("a string in the format '{payment_id}_secret_{secret}'")
}

fn visit_str<E>(self, value: &str) -> Result<ClientSecret, E>
Expand Down Expand Up @@ -106,9 +106,10 @@ impl Serialize for ClientSecret {

#[cfg(test)]
mod client_secret_tests {
use super::*;
use serde_json;

use super::*;

#[test]
fn test_serialize_client_secret() {
let client_secret1 = ClientSecret {
Expand Down

0 comments on commit 1ed2cd7

Please sign in to comment.