From 2e472e3fee0c33b3ce8affc520db7a512ed41b2f Mon Sep 17 00:00:00 2001 From: Apoorv Dixit <64925866+apoorvdixit88@users.noreply.github.com> Date: Tue, 24 Dec 2024 18:31:43 +0530 Subject: [PATCH] fix(payments_list): handle same payment/attempt ids for different merchants (#6917) --- crates/storage_impl/src/payments/payment_intent.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rs index fe64136b7431..786cbe75a43d 100644 --- a/crates/storage_impl/src/payments/payment_intent.rs +++ b/crates/storage_impl/src/payments/payment_intent.rs @@ -831,10 +831,11 @@ impl PaymentIntentInterface for crate::RouterStore { let conn = connection::pg_connection_read(self).await.switch()?; let conn = async_bb8_diesel::Connection::as_async_conn(&conn); let mut query = DieselPaymentIntent::table() + .filter(pi_dsl::merchant_id.eq(merchant_id.to_owned())) .inner_join( payment_attempt_schema::table.on(pa_dsl::attempt_id.eq(pi_dsl::active_attempt_id)), ) - .filter(pi_dsl::merchant_id.eq(merchant_id.to_owned())) + .filter(pa_dsl::merchant_id.eq(merchant_id.to_owned())) // Ensure merchant_ids match, as different merchants can share payment/attempt IDs. .into_boxed(); query = match constraints {