Skip to content

Commit

Permalink
chore: nits and small code improvements found during investigation of…
Browse files Browse the repository at this point in the history
… PR#3168 (#3259)
  • Loading branch information
bkontur authored Jan 10, 2024
1 parent 612f8d9 commit fe3cf54
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
8 changes: 4 additions & 4 deletions crates/router/src/connector/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ impl CardData for api::Card {
let year = self.get_card_expiry_year_2_digit()?;
Ok(Secret::new(format!(
"{}{}{}",
self.card_exp_month.peek().clone(),
self.card_exp_month.peek(),
delimiter,
year.peek()
)))
Expand All @@ -817,14 +817,14 @@ impl CardData for api::Card {
"{}{}{}",
year.peek(),
delimiter,
self.card_exp_month.peek().clone()
self.card_exp_month.peek()
))
}
fn get_expiry_date_as_mmyyyy(&self, delimiter: &str) -> Secret<String> {
let year = self.get_expiry_year_4_digit();
Secret::new(format!(
"{}{}{}",
self.card_exp_month.peek().clone(),
self.card_exp_month.peek(),
delimiter,
year.peek()
))
Expand Down Expand Up @@ -1211,7 +1211,7 @@ where
{
let connector_meta_secret =
connector_meta.ok_or_else(missing_field_err("connector_meta_data"))?;
let json = connector_meta_secret.peek().clone();
let json = connector_meta_secret.expose();
json.parse_value(std::any::type_name::<T>()).switch()
}

Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/connector/worldline/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ fn make_card_request(
req: &PaymentsAuthorizeData,
ccard: &payments::Card,
) -> Result<CardPaymentMethod, error_stack::Report<errors::ConnectorError>> {
let expiry_year = ccard.card_exp_year.peek().clone();
let expiry_year = ccard.card_exp_year.peek();
let secret_value = format!(
"{}{}",
ccard.card_exp_month.peek(),
Expand Down
7 changes: 3 additions & 4 deletions crates/router/src/core/fraud_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::fmt::Debug;

use api_models::{admin::FrmConfigs, enums as api_enums, payments::AdditionalPaymentData};
use error_stack::ResultExt;
use masking::PeekInterface;
use masking::{ExposeInterface, PeekInterface};
use router_env::{
logger,
tracing::{self, instrument},
Expand Down Expand Up @@ -167,10 +167,9 @@ where
match frm_configs_option {
Some(frm_configs_value) => {
let frm_configs_struct: Vec<FrmConfigs> = frm_configs_value
.iter()
.into_iter()
.map(|config| { config
.peek()
.clone()
.expose()
.parse_value("FrmConfigs")
.change_context(errors::ApiErrorResponse::InvalidDataFormat {
field_name: "frm_configs".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/core/payment_methods/vault.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl Vaultable for api::Card {
exp_month: self.card_exp_month.peek().clone(),
name_on_card: self
.card_holder_name
.clone()
.as_ref()
.map(|name| name.peek().clone()),
nickname: None,
card_last_four: None,
Expand Down

0 comments on commit fe3cf54

Please sign in to comment.