mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 17:47:54 +08:00
fix(disputes): update 4xx error for Files - Delete endpoint (#1531)
This commit is contained in:
@ -202,6 +202,8 @@ pub enum StripeErrorCode {
|
|||||||
FileNotFound,
|
FileNotFound,
|
||||||
#[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "File not available")]
|
#[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "File not available")]
|
||||||
FileNotAvailable,
|
FileNotAvailable,
|
||||||
|
#[error(error_type = StripeErrorType::InvalidRequestError, code = "", message = "Not Supported because provider is not Router")]
|
||||||
|
FileProviderNotSupported,
|
||||||
#[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "There was an issue with processing webhooks")]
|
#[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "There was an issue with processing webhooks")]
|
||||||
WebhookProcessingError,
|
WebhookProcessingError,
|
||||||
#[error(error_type = StripeErrorType::InvalidRequestError, code = "payment_method_unactivated", message = "The operation cannot be performed as the payment method used has not been activated. Activate the payment method in the Dashboard, then try again.")]
|
#[error(error_type = StripeErrorType::InvalidRequestError, code = "payment_method_unactivated", message = "The operation cannot be performed as the payment method used has not been activated. Activate the payment method in the Dashboard, then try again.")]
|
||||||
@ -523,6 +525,9 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode {
|
|||||||
Self::MerchantConnectorAccountDisabled
|
Self::MerchantConnectorAccountDisabled
|
||||||
}
|
}
|
||||||
errors::ApiErrorResponse::NotSupported { .. } => Self::InternalServerError,
|
errors::ApiErrorResponse::NotSupported { .. } => Self::InternalServerError,
|
||||||
|
errors::ApiErrorResponse::FileProviderNotSupported { .. } => {
|
||||||
|
Self::FileProviderNotSupported
|
||||||
|
}
|
||||||
errors::ApiErrorResponse::WebhookBadRequest
|
errors::ApiErrorResponse::WebhookBadRequest
|
||||||
| errors::ApiErrorResponse::WebhookResourceNotFound
|
| errors::ApiErrorResponse::WebhookResourceNotFound
|
||||||
| errors::ApiErrorResponse::WebhookProcessingFailure
|
| errors::ApiErrorResponse::WebhookProcessingFailure
|
||||||
@ -590,6 +595,7 @@ impl actix_web::ResponseError for StripeErrorCode {
|
|||||||
| Self::MissingDisputeId
|
| Self::MissingDisputeId
|
||||||
| Self::FileNotFound
|
| Self::FileNotFound
|
||||||
| Self::FileNotAvailable
|
| Self::FileNotAvailable
|
||||||
|
| Self::FileProviderNotSupported
|
||||||
| Self::PaymentMethodUnactivated => StatusCode::BAD_REQUEST,
|
| Self::PaymentMethodUnactivated => StatusCode::BAD_REQUEST,
|
||||||
Self::RefundFailed
|
Self::RefundFailed
|
||||||
| Self::InternalServerError
|
| Self::InternalServerError
|
||||||
|
|||||||
@ -91,6 +91,8 @@ pub enum ApiErrorResponse {
|
|||||||
MissingRequiredFields { field_names: Vec<&'static str> },
|
MissingRequiredFields { field_names: Vec<&'static str> },
|
||||||
#[error(error_type = ErrorType::InvalidRequestError, code = "IR_22", message = "Access forbidden. Not authorized to access this resource")]
|
#[error(error_type = ErrorType::InvalidRequestError, code = "IR_22", message = "Access forbidden. Not authorized to access this resource")]
|
||||||
AccessForbidden,
|
AccessForbidden,
|
||||||
|
#[error(error_type = ErrorType::InvalidRequestError, code = "IR_23", message = "{message}")]
|
||||||
|
FileProviderNotSupported { message: String },
|
||||||
#[error(error_type = ErrorType::InvalidRequestError, code = "IR_23", message = "{entity} expired or invalid")]
|
#[error(error_type = ErrorType::InvalidRequestError, code = "IR_23", message = "{entity} expired or invalid")]
|
||||||
UnprocessableEntity { entity: String },
|
UnprocessableEntity { entity: String },
|
||||||
#[error(error_type = ErrorType::ConnectorError, code = "CE_00", message = "{code}: {message}", ignore = "status_code")]
|
#[error(error_type = ErrorType::ConnectorError, code = "CE_00", message = "{code}: {message}", ignore = "status_code")]
|
||||||
@ -349,6 +351,9 @@ impl common_utils::errors::ErrorSwitch<api_models::errors::types::ApiErrorRespon
|
|||||||
ApiError::new("IR", 21, "Missing required params".to_string(), Some(Extra {data: Some(serde_json::json!(field_names)), ..Default::default() })),
|
ApiError::new("IR", 21, "Missing required params".to_string(), Some(Extra {data: Some(serde_json::json!(field_names)), ..Default::default() })),
|
||||||
),
|
),
|
||||||
Self::AccessForbidden => AER::ForbiddenCommonResource(ApiError::new("IR", 22, "Access forbidden. Not authorized to access this resource", None)),
|
Self::AccessForbidden => AER::ForbiddenCommonResource(ApiError::new("IR", 22, "Access forbidden. Not authorized to access this resource", None)),
|
||||||
|
Self::FileProviderNotSupported { message } => {
|
||||||
|
AER::BadRequest(ApiError::new("IR", 23, message.to_string(), None))
|
||||||
|
},
|
||||||
Self::UnprocessableEntity {entity} => AER::Unprocessable(ApiError::new("IR", 23, format!("{entity} expired or invalid"), None)),
|
Self::UnprocessableEntity {entity} => AER::Unprocessable(ApiError::new("IR", 23, format!("{entity} expired or invalid"), None)),
|
||||||
Self::ExternalConnectorError {
|
Self::ExternalConnectorError {
|
||||||
code,
|
code,
|
||||||
|
|||||||
@ -143,8 +143,8 @@ pub async fn delete_file_using_file_id(
|
|||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
_ => Err(errors::ApiErrorResponse::NotSupported {
|
_ => Err(errors::ApiErrorResponse::FileProviderNotSupported {
|
||||||
message: "Not Supported if provider is not Router".to_owned(),
|
message: "Not Supported because provider is not Router".to_string(),
|
||||||
}
|
}
|
||||||
.into()),
|
.into()),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user