mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-31 01:57:45 +08:00
chore: nits and small code improvements found during investigation of PR#3168 (#3259)
This commit is contained in:
@ -806,7 +806,7 @@ impl CardData for api::Card {
|
|||||||
let year = self.get_card_expiry_year_2_digit()?;
|
let year = self.get_card_expiry_year_2_digit()?;
|
||||||
Ok(Secret::new(format!(
|
Ok(Secret::new(format!(
|
||||||
"{}{}{}",
|
"{}{}{}",
|
||||||
self.card_exp_month.peek().clone(),
|
self.card_exp_month.peek(),
|
||||||
delimiter,
|
delimiter,
|
||||||
year.peek()
|
year.peek()
|
||||||
)))
|
)))
|
||||||
@ -817,14 +817,14 @@ impl CardData for api::Card {
|
|||||||
"{}{}{}",
|
"{}{}{}",
|
||||||
year.peek(),
|
year.peek(),
|
||||||
delimiter,
|
delimiter,
|
||||||
self.card_exp_month.peek().clone()
|
self.card_exp_month.peek()
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
fn get_expiry_date_as_mmyyyy(&self, delimiter: &str) -> Secret<String> {
|
fn get_expiry_date_as_mmyyyy(&self, delimiter: &str) -> Secret<String> {
|
||||||
let year = self.get_expiry_year_4_digit();
|
let year = self.get_expiry_year_4_digit();
|
||||||
Secret::new(format!(
|
Secret::new(format!(
|
||||||
"{}{}{}",
|
"{}{}{}",
|
||||||
self.card_exp_month.peek().clone(),
|
self.card_exp_month.peek(),
|
||||||
delimiter,
|
delimiter,
|
||||||
year.peek()
|
year.peek()
|
||||||
))
|
))
|
||||||
@ -1211,7 +1211,7 @@ where
|
|||||||
{
|
{
|
||||||
let connector_meta_secret =
|
let connector_meta_secret =
|
||||||
connector_meta.ok_or_else(missing_field_err("connector_meta_data"))?;
|
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()
|
json.parse_value(std::any::type_name::<T>()).switch()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -342,7 +342,7 @@ fn make_card_request(
|
|||||||
req: &PaymentsAuthorizeData,
|
req: &PaymentsAuthorizeData,
|
||||||
ccard: &payments::Card,
|
ccard: &payments::Card,
|
||||||
) -> Result<CardPaymentMethod, error_stack::Report<errors::ConnectorError>> {
|
) -> 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!(
|
let secret_value = format!(
|
||||||
"{}{}",
|
"{}{}",
|
||||||
ccard.card_exp_month.peek(),
|
ccard.card_exp_month.peek(),
|
||||||
|
|||||||
@ -2,7 +2,7 @@ use std::fmt::Debug;
|
|||||||
|
|
||||||
use api_models::{admin::FrmConfigs, enums as api_enums, payments::AdditionalPaymentData};
|
use api_models::{admin::FrmConfigs, enums as api_enums, payments::AdditionalPaymentData};
|
||||||
use error_stack::ResultExt;
|
use error_stack::ResultExt;
|
||||||
use masking::PeekInterface;
|
use masking::{ExposeInterface, PeekInterface};
|
||||||
use router_env::{
|
use router_env::{
|
||||||
logger,
|
logger,
|
||||||
tracing::{self, instrument},
|
tracing::{self, instrument},
|
||||||
@ -167,10 +167,9 @@ where
|
|||||||
match frm_configs_option {
|
match frm_configs_option {
|
||||||
Some(frm_configs_value) => {
|
Some(frm_configs_value) => {
|
||||||
let frm_configs_struct: Vec<FrmConfigs> = frm_configs_value
|
let frm_configs_struct: Vec<FrmConfigs> = frm_configs_value
|
||||||
.iter()
|
.into_iter()
|
||||||
.map(|config| { config
|
.map(|config| { config
|
||||||
.peek()
|
.expose()
|
||||||
.clone()
|
|
||||||
.parse_value("FrmConfigs")
|
.parse_value("FrmConfigs")
|
||||||
.change_context(errors::ApiErrorResponse::InvalidDataFormat {
|
.change_context(errors::ApiErrorResponse::InvalidDataFormat {
|
||||||
field_name: "frm_configs".to_string(),
|
field_name: "frm_configs".to_string(),
|
||||||
|
|||||||
@ -47,7 +47,7 @@ impl Vaultable for api::Card {
|
|||||||
exp_month: self.card_exp_month.peek().clone(),
|
exp_month: self.card_exp_month.peek().clone(),
|
||||||
name_on_card: self
|
name_on_card: self
|
||||||
.card_holder_name
|
.card_holder_name
|
||||||
.clone()
|
.as_ref()
|
||||||
.map(|name| name.peek().clone()),
|
.map(|name| name.peek().clone()),
|
||||||
nickname: None,
|
nickname: None,
|
||||||
card_last_four: None,
|
card_last_four: None,
|
||||||
|
|||||||
Reference in New Issue
Block a user