mirror of
https://github.com/juspay/hyperswitch.git
synced 2026-03-13 09:02:06 +08:00
fix(connector): [ADYEN] Pass through split refund data when payment charges are unavailable (#11473)
This commit is contained in:
@@ -743,7 +743,21 @@ pub fn get_split_refunds(
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
_ => Ok(None),
|
||||
// If charges data is unavailable, pass through merchant-provided split refund data without validation
|
||||
_ => {
|
||||
if let Some(common_types::refunds::SplitRefund::AdyenSplitRefund(
|
||||
split_refund_request,
|
||||
)) = split_refund_input.refund_request.clone()
|
||||
{
|
||||
Ok(Some(
|
||||
router_request_types::SplitRefundsRequest::AdyenSplitRefund(
|
||||
split_refund_request,
|
||||
),
|
||||
))
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(common_types::payments::SplitPaymentsRequest::XenditSplitPayment(_)) => {
|
||||
|
||||
@@ -237,19 +237,6 @@ pub fn validate_adyen_charge_refund(
|
||||
.find(|payment_split_item| refund_split_reference == payment_split_item.reference);
|
||||
|
||||
if let Some(payment_split_item) = matching_payment_split_item {
|
||||
if let Some((refund_amount, payment_amount)) =
|
||||
refund_split_item.amount.zip(payment_split_item.amount)
|
||||
{
|
||||
if refund_amount > payment_amount {
|
||||
return Err(report!(errors::ApiErrorResponse::InvalidRequestData {
|
||||
message: format!(
|
||||
"Invalid refund amount for split item, reference: {refund_split_reference}",
|
||||
|
||||
),
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
if let Some((refund_account, payment_account)) = refund_split_item
|
||||
.account
|
||||
.as_ref()
|
||||
|
||||
Reference in New Issue
Block a user