feat: add error type for empty connector list (#1363)

Co-authored-by: ItsMeShashank <shashank.attarde@juspay.in>
This commit is contained in:
Narayan Bhat
2023-06-08 12:03:52 +05:30
committed by GitHub
parent b3b16fcf95
commit b2da920280
2 changed files with 17 additions and 6 deletions

View File

@ -198,6 +198,8 @@ pub enum StripeErrorCode {
FileNotAvailable,
#[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "There was an issue with processing webhooks")]
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.")]
PaymentMethodUnactivated,
// [#216]: https://github.com/juspay/hyperswitch/issues/216
// Implement the remaining stripe error codes
@ -298,7 +300,6 @@ pub enum StripeErrorCode {
PaymentMethodMicrodepositVerificationTimeout,
PaymentMethodProviderDecline,
PaymentMethodProviderTimeout,
PaymentMethodUnactivated,
PaymentMethodUnexpectedState,
PaymentMethodUnsupportedType,
PayoutsNotAllowed,
@ -509,6 +510,9 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode {
| errors::ApiErrorResponse::WebhookProcessingFailure
| errors::ApiErrorResponse::WebhookAuthenticationFailed
| errors::ApiErrorResponse::WebhookUnprocessableEntity => Self::WebhookProcessingError,
errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration => {
Self::PaymentMethodUnactivated
}
}
}
}
@ -564,7 +568,8 @@ impl actix_web::ResponseError for StripeErrorCode {
| Self::MissingFilePurpose
| Self::MissingDisputeId
| Self::FileNotFound
| Self::FileNotAvailable => StatusCode::BAD_REQUEST,
| Self::FileNotAvailable
| Self::PaymentMethodUnactivated => StatusCode::BAD_REQUEST,
Self::RefundFailed
| Self::InternalServerError
| Self::MandateActive