Skip to content

Commit

Permalink
chore: run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperswitch-bot[bot] committed Jan 7, 2025
1 parent 1fdff4f commit bac2bad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<ConnectorMandateReferenceId>,
/// Whether to request for overcapture
/// Whether to request for overcapture
pub request_overcapture: Option<storage_enums::OverCaptureRequest>,
/// Whether overcapture was applied
pub overcapture_applied: Option<storage_enums::OverCaptureApplied>,
Expand Down
25 changes: 15 additions & 10 deletions crates/router/src/connector/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down

0 comments on commit bac2bad

Please sign in to comment.