fix(core): [REFUNDS] Fix Not Supported Connector Error (#4045)

This commit is contained in:
DEEPANSHU BANSAL
2024-03-12 19:03:02 +05:30
committed by GitHub
parent 7840bdb95f
commit 7513423631
2 changed files with 16 additions and 1 deletions

View File

@ -160,6 +160,12 @@ impl<T> ConnectorErrorExt<T> for error_stack::Result<T, errors::ConnectorError>
} }
.into() .into()
} }
errors::ConnectorError::NotSupported { message, connector } => {
errors::ApiErrorResponse::NotSupported {
message: format!("{message} is not supported by {connector}"),
}
.into()
}
errors::ConnectorError::FailedToObtainIntegrationUrl errors::ConnectorError::FailedToObtainIntegrationUrl
| errors::ConnectorError::RequestEncodingFailed | errors::ConnectorError::RequestEncodingFailed
| errors::ConnectorError::RequestEncodingFailedWithReason(_) | errors::ConnectorError::RequestEncodingFailedWithReason(_)
@ -178,7 +184,6 @@ impl<T> ConnectorErrorExt<T> for error_stack::Result<T, errors::ConnectorError>
| errors::ConnectorError::FailedToObtainCertificate | errors::ConnectorError::FailedToObtainCertificate
| errors::ConnectorError::NoConnectorMetaData | errors::ConnectorError::NoConnectorMetaData
| errors::ConnectorError::FailedToObtainCertificateKey | errors::ConnectorError::FailedToObtainCertificateKey
| errors::ConnectorError::NotSupported { .. }
| errors::ConnectorError::FlowNotSupported { .. } | errors::ConnectorError::FlowNotSupported { .. }
| errors::ConnectorError::CaptureMethodNotSupported | errors::ConnectorError::CaptureMethodNotSupported
| errors::ConnectorError::MissingConnectorMandateID | errors::ConnectorError::MissingConnectorMandateID

View File

@ -219,6 +219,16 @@ pub async fn trigger_refund_to_gateway(
updated_by: storage_scheme.to_string(), 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, _ => None,
}); });
// Update the refund status as failure if connector_error is NotImplemented // Update the refund status as failure if connector_error is NotImplemented