From 7513423631ddf0fe86ef656ec6cad76d82c807bc Mon Sep 17 00:00:00 2001 From: DEEPANSHU BANSAL <41580413+deepanshu-iiitu@users.noreply.github.com> Date: Tue, 12 Mar 2024 19:03:02 +0530 Subject: [PATCH] fix(core): [REFUNDS] Fix Not Supported Connector Error (#4045) --- crates/router/src/core/errors/utils.rs | 7 ++++++- crates/router/src/core/refunds.rs | 10 ++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/router/src/core/errors/utils.rs b/crates/router/src/core/errors/utils.rs index 1f82132a45..d9b4e19013 100644 --- a/crates/router/src/core/errors/utils.rs +++ b/crates/router/src/core/errors/utils.rs @@ -160,6 +160,12 @@ impl ConnectorErrorExt for error_stack::Result } .into() } + errors::ConnectorError::NotSupported { message, connector } => { + errors::ApiErrorResponse::NotSupported { + message: format!("{message} is not supported by {connector}"), + } + .into() + } errors::ConnectorError::FailedToObtainIntegrationUrl | errors::ConnectorError::RequestEncodingFailed | errors::ConnectorError::RequestEncodingFailedWithReason(_) @@ -178,7 +184,6 @@ impl ConnectorErrorExt for error_stack::Result | errors::ConnectorError::FailedToObtainCertificate | errors::ConnectorError::NoConnectorMetaData | errors::ConnectorError::FailedToObtainCertificateKey - | errors::ConnectorError::NotSupported { .. } | errors::ConnectorError::FlowNotSupported { .. } | errors::ConnectorError::CaptureMethodNotSupported | errors::ConnectorError::MissingConnectorMandateID diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs index 62d34b1306..06af7773f6 100644 --- a/crates/router/src/core/refunds.rs +++ b/crates/router/src/core/refunds.rs @@ -219,6 +219,16 @@ pub async fn trigger_refund_to_gateway( updated_by: storage_scheme.to_string(), }) } + errors::ConnectorError::NotSupported { message, connector } => { + Some(storage::RefundUpdate::ErrorUpdate { + refund_status: Some(enums::RefundStatus::Failure), + refund_error_message: Some(format!( + "{message} is not supported by {connector}" + )), + refund_error_code: Some("NOT_SUPPORTED".to_string()), + updated_by: storage_scheme.to_string(), + }) + } _ => None, }); // Update the refund status as failure if connector_error is NotImplemented