From f63a678d71ee1cc55aa3569a52d6e6541ba65c44 Mon Sep 17 00:00:00 2001 From: Sai Harsha Vardhan <56996463+sai-harsha-vardhan@users.noreply.github.com> Date: Thu, 11 Jul 2024 20:29:55 +0530 Subject: [PATCH] fix(router): fail refund with bad request error for duplicate refund_id in refunds create flow (#5282) --- crates/router/src/core/refunds.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs index c547e9d1f6..4c748ce96f 100644 --- a/crates/router/src/core/refunds.rs +++ b/crates/router/src/core/refunds.rs @@ -836,13 +836,7 @@ pub async fn validate_and_create_refund( } Err(err) => { if err.current_context().is_db_unique_violation() { - db.find_refund_by_merchant_id_refund_id( - merchant_account.merchant_id.as_str(), - refund_id.as_str(), - merchant_account.storage_scheme, - ) - .await - .to_not_found_response(errors::ApiErrorResponse::RefundNotFound)? + Err(errors::ApiErrorResponse::DuplicateRefundRequest)? } else { return Err(err) .change_context(errors::ApiErrorResponse::RefundNotFound)