diff --git a/crates/router/src/db/refund.rs b/crates/router/src/db/refund.rs index cb7a46dfb450..67980730f8fe 100644 --- a/crates/router/src/db/refund.rs +++ b/crates/router/src/db/refund.rs @@ -629,13 +629,9 @@ mod storage { } enums::MerchantStorageScheme::RedisKv => { let key = format!("{merchant_id}_{payment_id}"); - let lookup = self.get_lookup_by_lookup_id(&key).await?; - - let pattern = db_utils::generate_hscan_pattern_for_refund(&lookup.sk_id); - self.get_redis_conn() .map_err(Into::::into)? - .hscan_and_deserialize(&key, &pattern, None) + .hscan_and_deserialize(&key, "pa_*_ref_*", None) .await .change_context(errors::StorageError::KVError) } diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs index 84e119fd7c12..f99a23ba539b 100644 --- a/crates/storage_impl/src/payments/payment_attempt.rs +++ b/crates/storage_impl/src/payments/payment_attempt.rs @@ -29,10 +29,7 @@ use crate::{ diesel_error_to_data_error, lookup::ReverseLookupInterface, redis::kv_store::{PartitionKey, RedisConnInterface}, - utils::{ - generate_hscan_pattern_for_attempt, pg_connection_read, pg_connection_write, - try_redis_get_else_try_database_get, - }, + utils::{pg_connection_read, pg_connection_write, try_redis_get_else_try_database_get}, DataModelExt, DatabaseStore, KVRouterStore, RouterStore, }; @@ -800,16 +797,13 @@ impl PaymentAttemptInterface for KVRouterStore { } MerchantStorageScheme::RedisKv => { let key = format!("{merchant_id}_{payment_id}"); - let lookup = self.get_lookup_by_lookup_id(&key).await?; - - let pattern = generate_hscan_pattern_for_attempt(&lookup.sk_id); self.get_redis_conn() .map_err(|er| { let error = format!("{}", er); er.change_context(errors::StorageError::RedisError(error)) })? - .hscan_and_deserialize(&key, &pattern, None) + .hscan_and_deserialize(&key, "pa_*", None) .await .change_context(errors::StorageError::KVError) } diff --git a/crates/storage_impl/src/utils.rs b/crates/storage_impl/src/utils.rs index 92fd11debe8f..6d6e1cd5402b 100644 --- a/crates/storage_impl/src/utils.rs +++ b/crates/storage_impl/src/utils.rs @@ -68,13 +68,3 @@ where }, } } - -/// Generates hscan field pattern. Suppose the field is pa_1234 it will generate -/// pa_* -pub fn generate_hscan_pattern_for_attempt(sk: &str) -> String { - sk.split('_') - .take(1) - .chain(["*"]) - .collect::>() - .join("_") -}