mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 11:06:50 +08:00
fix(router): fixed integrity check failures in case of 3ds flow in sync flow (#5279)
This commit is contained in:
@ -842,7 +842,6 @@ impl
|
||||
self.amount_converter,
|
||||
response.amount,
|
||||
response.currency.clone(),
|
||||
response.amount_received,
|
||||
)?;
|
||||
|
||||
event_builder.map(|i| i.set_response_body(&response));
|
||||
|
||||
@ -2914,21 +2914,15 @@ pub fn get_sync_integrity_object<T>(
|
||||
amount_convertor: &dyn AmountConvertor<Output = T>,
|
||||
amount: T,
|
||||
currency: String,
|
||||
captured_amount: Option<T>,
|
||||
) -> Result<SyncIntegrityObject, error_stack::Report<errors::ConnectorError>> {
|
||||
let currency_enum = enums::Currency::from_str(currency.to_uppercase().as_str())
|
||||
.change_context(errors::ConnectorError::ParsingFailed)?;
|
||||
let amount_in_minor_unit =
|
||||
convert_back_amount_to_minor_units(amount_convertor, amount, currency_enum)?;
|
||||
|
||||
let capture_amount_in_minor_unit = captured_amount
|
||||
.map(|amount| convert_back_amount_to_minor_units(amount_convertor, amount, currency_enum))
|
||||
.transpose()?;
|
||||
|
||||
Ok(SyncIntegrityObject {
|
||||
amount: Some(amount_in_minor_unit),
|
||||
currency: Some(currency_enum),
|
||||
captured_amount: capture_amount_in_minor_unit,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ impl Feature<api::PSync, types::PaymentsSyncData>
|
||||
types::SyncRequestType::MultipleCaptureSync(pending_connector_capture_id_list),
|
||||
Ok(services::CaptureSyncMethod::Individual),
|
||||
) => {
|
||||
let resp = self
|
||||
let mut new_router_data = self
|
||||
.execute_connector_processing_step_for_each_capture(
|
||||
state,
|
||||
pending_connector_capture_id_list,
|
||||
@ -80,7 +80,15 @@ impl Feature<api::PSync, types::PaymentsSyncData>
|
||||
connector_integration,
|
||||
)
|
||||
.await?;
|
||||
Ok(resp)
|
||||
// Initiating Integrity checks
|
||||
let integrity_result = helpers::check_integrity_based_on_flow(
|
||||
&new_router_data.request,
|
||||
&new_router_data.response,
|
||||
);
|
||||
|
||||
new_router_data.integrity_check = integrity_result;
|
||||
|
||||
Ok(new_router_data)
|
||||
}
|
||||
(types::SyncRequestType::MultipleCaptureSync(_), Err(err)) => Err(err),
|
||||
_ => {
|
||||
|
||||
@ -1372,7 +1372,6 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsSyncData
|
||||
.as_ref()
|
||||
.map(|surcharge_details| surcharge_details.final_amount)
|
||||
.unwrap_or(payment_data.amount.into());
|
||||
let captured_amount = payment_data.payment_intent.amount_captured;
|
||||
Ok(Self {
|
||||
amount,
|
||||
integrity_object: None,
|
||||
@ -1395,7 +1394,6 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsSyncData
|
||||
payment_method_type: payment_data.payment_attempt.payment_method_type,
|
||||
currency: payment_data.currency,
|
||||
payment_experience: payment_data.payment_attempt.payment_experience,
|
||||
captured_amount,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user