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
feat(core): Revert Added profileId to payments client secret (#12424)
Sahkal Poddard9eb6089f55e
diff --git a/crates/common_utils/src/id_type/payment.rs b/crates/common_utils/src/id_type/payment.rsindex 35db95a37f..33cd41102c 100644--- a/crates/common_utils/src/id_type/payment.rs+++ b/crates/common_utils/src/id_type/payment.rs@@ -1,6 +1,6 @@use crate::{errors::{CustomResult, ValidationError},- generate_id_with_default_len, generate_id_with_default_len_with_profile_id,+ generate_id_with_default_len,id_type::{AlphaNumericId, LengthId},};@@ -40,11 +40,8 @@ impl PaymentId {}/// Generate a client id for the payment id- pub fn generate_client_secret(&self, profile_id: &str) -> String {- generate_id_with_default_len_with_profile_id(- &format!("{}_secret", self.get_string_repr()),- profile_id,- )+ pub fn generate_client_secret(&self) -> String {+ generate_id_with_default_len(&format!("{}_secret", self.get_string_repr()))}/// Generate a key for pm_authdiff --git a/crates/common_utils/src/lib.rs b/crates/common_utils/src/lib.rsindex d442f6745e..dc71867ccf 100644--- a/crates/common_utils/src/lib.rs+++ b/crates/common_utils/src/lib.rs@@ -284,18 +284,6 @@ pub fn generate_id_with_default_len(prefix: &str) -> String {format!("{}_{}", prefix, nanoid::nanoid!(len, &consts::ALPHABETS))}-/// Generate a nanoid with the given prefix and a default length with profileId-#[inline]-pub fn generate_id_with_default_len_with_profile_id(prefix: &str, profile_id: &str) -> String {- let len: usize = consts::ID_LENGTH;- format!(- "{}_{},profile={}",- prefix,- nanoid::nanoid!(len, &consts::ALPHABETS),- profile_id- )-}-/// Generate a time-ordered (time-sortable) unique identifier using the current time#[inline]pub fn generate_time_ordered_id(prefix: &str) -> String {diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rsindex 9820dcc59d..e7e84bf0db 100644--- a/crates/router/src/core/payments/operations/payment_create.rs+++ b/crates/router/src/core/payments/operations/payment_create.rs@@ -1747,7 +1747,7 @@ impl PaymentCreate {}),request.confirm,);- let client_secret = payment_id.generate_client_secret(profile_id.get_string_repr());+ let client_secret = payment_id.generate_client_secret();let (amount, currency) = (money.0, Some(money.1));let order_details = requestdiff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rsindex 67e5d4577c..e4595120a5 100644--- a/crates/router/src/utils/user/sample_data.rs+++ b/crates/router/src/utils/user/sample_data.rs@@ -198,7 +198,7 @@ pub async fn generate_sample_data(for num in 1..=sample_data_size {let payment_id = id_type::PaymentId::generate_test_payment_id_for_sample_data();let attempt_id = payment_id.get_attempt_id(1);- let client_secret = payment_id.generate_client_secret(profile_id.get_string_repr());+ let client_secret = payment_id.generate_client_secret();let amount = thread_rng().gen_range(min_amount..=max_amount);let created_at @ modified_at @ last_synced =