Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
chore: nits and small code improvements found during investigation of PR#3168 (#3259)
Branislav Konturfe3cf5478130
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rsindex 886de4174d..39b404d0f5 100644--- a/crates/router/src/connector/utils.rs+++ b/crates/router/src/connector/utils.rs@@ -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())))@@ -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()))@@ -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()}diff --git a/crates/router/src/connector/worldline/transformers.rs b/crates/router/src/connector/worldline/transformers.rsindex c00913aa57..c55663d59f 100644--- a/crates/router/src/connector/worldline/transformers.rs+++ b/crates/router/src/connector/worldline/transformers.rs@@ -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(),diff --git a/crates/router/src/core/fraud_check.rs b/crates/router/src/core/fraud_check.rsindex 8be1876aed..ad3a763877 100644--- a/crates/router/src/core/fraud_check.rs+++ b/crates/router/src/core/fraud_check.rs@@ -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},@@ -167,10 +167,9 @@ wherematch 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(),diff --git a/crates/router/src/core/payment_methods/vault.rs b/crates/router/src/core/payment_methods/vault.rsindex c25b024158..070bca234c 100644--- a/crates/router/src/core/payment_methods/vault.rs+++ b/crates/router/src/core/payment_methods/vault.rs@@ -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,