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 Dec 27, 2024
1 parent a10e7aa commit f6503f0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
8 changes: 6 additions & 2 deletions crates/router/src/core/payments/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6298,7 +6298,11 @@ pub fn update_or_add_overcapture_details_if_required(
request_overcapture: Option<bool>,
payment_attempt: &mut PaymentAttempt,
) -> Result<(), errors::ApiErrorResponse> {
if let Some((request_overcapture, true)) = request_overcapture.zip(Some(payment_attempt.capture_method.eq(&Some(enums::CaptureMethod::Manual)))) {
if let Some((request_overcapture, true)) = request_overcapture.zip(Some(
payment_attempt
.capture_method
.eq(&Some(enums::CaptureMethod::Manual)),
)) {
match payment_attempt.overcapture_details {
Some(ref mut overcapture_data) => {
overcapture_data.request_overcapture = Some(request_overcapture);
Expand All @@ -6316,4 +6320,4 @@ pub fn update_or_add_overcapture_details_if_required(
} else {
Ok(())
}
}
}
7 changes: 5 additions & 2 deletions crates/router/src/core/payments/operations/payment_create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,10 @@ impl PaymentCreate {
.transpose()?
.flatten();

let overcapture_details = match request.capture_method.map(|capture_method| capture_method.eq(&common_enums::CaptureMethod::Manual)){
let overcapture_details = match request
.capture_method
.map(|capture_method| capture_method.eq(&common_enums::CaptureMethod::Manual))
{
Some(true) => Some(common_utils::types::OvercaptureData {
request_overcapture: request
.request_overcapture
Expand All @@ -1152,7 +1155,7 @@ impl PaymentCreate {
maximum_capturable_amount: None,
overcaptured_amount: None,
}),
Some(false) | None => None
Some(false) | None => None,
};

if additional_pm_data.is_none() {
Expand Down
8 changes: 4 additions & 4 deletions crates/router/src/core/payments/operations/payment_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,10 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
id: profile_id.get_string_repr().to_owned(),
})?;

helpers::update_or_add_overcapture_details_if_required(
request.request_overcapture,
&mut payment_attempt,
)?;
helpers::update_or_add_overcapture_details_if_required(
request.request_overcapture,
&mut payment_attempt,
)?;

let surcharge_details = request.surcharge_details.map(|request_surcharge_details| {
payments::types::SurchargeDetails::from((&request_surcharge_details, &payment_attempt))
Expand Down

0 comments on commit f6503f0

Please # to comment.