diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs index 8d90466711af..f22c187173b0 100644 --- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs +++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs @@ -402,7 +402,7 @@ pub struct PaymentAttempt { pub id: id_type::GlobalAttemptId, /// The connector mandate details which are stored temporarily pub connector_mandate_detail: Option, - /// Whether to request for overcapture + /// Whether to request for overcapture pub request_overcapture: Option, /// Whether overcapture was applied pub overcapture_applied: Option, diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs index c84781431572..e3e9248b648d 100644 --- a/crates/router/src/connector/utils.rs +++ b/crates/router/src/connector/utils.rs @@ -177,16 +177,21 @@ where enums::AttemptStatus::Charged => { let total_capturable_amount = payment_data.payment_attempt.get_total_amount(); let is_overcapture_applied = payment_data.payment_attempt.is_overcapture_applied(); - types::Capturable::get_captured_amount(&self.request, payment_data).map(MinorUnit::new).map(|captured_amount| - if total_capturable_amount == captured_amount || - (is_overcapture_applied == Some(true) && captured_amount > total_capturable_amount) { - enums::AttemptStatus::Charged - } else if captured_amount < total_capturable_amount{ - enums::AttemptStatus::PartialCharged - } else { - self.status - } - ).unwrap_or(self.status) + types::Capturable::get_captured_amount(&self.request, payment_data) + .map(MinorUnit::new) + .map(|captured_amount| { + if total_capturable_amount == captured_amount + || (is_overcapture_applied == Some(true) + && captured_amount > total_capturable_amount) + { + enums::AttemptStatus::Charged + } else if captured_amount < total_capturable_amount { + enums::AttemptStatus::PartialCharged + } else { + self.status + } + }) + .unwrap_or(self.status) } _ => self.status, }