Skip to content

Commit

Permalink
fix(router): fail refund with bad request error for duplicate refund_…
Browse files Browse the repository at this point in the history
…id in refunds create flow (#5282)
  • Loading branch information
sai-harsha-vardhan authored Jul 11, 2024
1 parent 68adda0 commit f63a678
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions crates/router/src/core/refunds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f63a678

Please sign in to comment.