Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(connector): [ADYEN] Pass through split refund data when payment charges are unavailable (#11473)

DEEPANSHU BANSAL1ac0a801bb70
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index c3f6ea641d..155cf5dc14 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -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(_)) => {
diff --git a/crates/router/src/core/utils/refunds_validator.rs b/crates/router/src/core/utils/refunds_validator.rs
index 47236cea1c..29f97d1065 100644
--- a/crates/router/src/core/utils/refunds_validator.rs
+++ b/crates/router/src/core/utils/refunds_validator.rs
@@ -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()