From a9e5193b90a453f7f7b27f8a2ca108e3d42d3f99 Mon Sep 17 00:00:00 2001 From: Kartikeya Hegde Date: Wed, 18 Jan 2023 19:51:53 +0530 Subject: [PATCH] fix: don't update payment on requires_capture (#405) --- .../src/core/payments/operations/payment_update.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs index 074063a72e..2bf5f3b3b3 100644 --- a/crates/router/src/core/payments/operations/payment_update.rs +++ b/crates/router/src/core/payments/operations/payment_update.rs @@ -174,11 +174,14 @@ impl GetTracker, api::PaymentsRequest> for Pa }; match payment_intent.status { - enums::IntentStatus::Succeeded | enums::IntentStatus::Failed => { + enums::IntentStatus::Succeeded + | enums::IntentStatus::Failed + | enums::IntentStatus::RequiresCapture => { Err(report!(errors::ApiErrorResponse::PreconditionFailed { - message: - "You cannot update this Payment because it has already succeeded/failed." - .into() + message: format!( + "You cannot update this Payment because the status of this payment is {}", + payment_intent.status + ) })) } _ => Ok((