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(refund): mark refund as failed for connectors implementing FlowNotSupported error (#10654)

Nithin Nce5f3f3ed7d8
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index 9895121351..24ad62b2af 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -502,6 +502,22 @@ async fn execute_refund_execute_via_direct(
issuer_error_message: None,
})
}
+ errors::ConnectorError::FlowNotSupported { flow, connector } => {
+ Some(diesel_refund::RefundUpdate::ErrorUpdate {
+ refund_status: Some(enums::RefundStatus::Failure),
+ refund_error_message: Some(format!(
+ "{flow} is not supported by {connector}"
+ )),
+ refund_error_code: Some("NOT_SUPPORTED".to_string()),
+ updated_by: storage_scheme.to_string(),
+ connector_refund_id: None,
+ processor_refund_data: None,
+ unified_code: None,
+ unified_message: None,
+ issuer_error_code: None,
+ issuer_error_message: None,
+ })
+ }
errors::ConnectorError::NotSupported { message, connector } => {
Some(diesel_refund::RefundUpdate::ErrorUpdate {
refund_status: Some(enums::RefundStatus::Failure),
diff --git a/crates/router/src/core/refunds_v2.rs b/crates/router/src/core/refunds_v2.rs
index c4b9369c60..6360a7e6cd 100644
--- a/crates/router/src/core/refunds_v2.rs
+++ b/crates/router/src/core/refunds_v2.rs
@@ -578,6 +578,18 @@ impl ForeignFrom<(&errors::ConnectorError, enums::MerchantStorageScheme)>
unified_message: None,
})
}
+ errors::ConnectorError::FlowNotSupported { flow, connector } => {
+ Some(diesel_refund::RefundUpdate::ErrorUpdate {
+ refund_status: Some(enums::RefundStatus::Failure),
+ refund_error_message: Some(format!("{flow} is not supported by {connector}")),
+ refund_error_code: Some("NOT_SUPPORTED".to_string()),
+ updated_by: storage_scheme.to_string(),
+ connector_refund_id: None,
+ processor_refund_data: None,
+ unified_code: None,
+ unified_message: None,
+ })
+ }
errors::ConnectorError::NotSupported { message, connector } => {
Some(diesel_refund::RefundUpdate::ErrorUpdate {
refund_status: Some(enums::RefundStatus::Failure),