Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: nits and small code improvements found during investigation of PR#3168 #3259

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crates/router/src/connector/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,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 @@ -800,14 +800,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 @@ -1194,7 +1194,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 @@ -53,7 +53,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
Loading