fix(merchant_connector_account): add validation for the disabled flag (#1141)

This commit is contained in:
Nishant Joshi
2023-05-17 02:54:10 +05:30
committed by GitHub
parent 95c7ca99d1
commit 600dc33867
4 changed files with 27 additions and 0 deletions

View File

@ -91,6 +91,9 @@ pub enum StripeErrorCode {
#[error(error_type = StripeErrorType::InvalidRequestError, code = "resource_missing", message = "Merchant connector account with id '{id}' does not exist in our records")]
MerchantConnectorAccountNotFound { id: String },
#[error(error_type = StripeErrorType::InvalidRequestError, code = "invalid_request", message = "The merchant connector account is disabled")]
MerchantConnectorAccountDisabled,
#[error(error_type = StripeErrorType::InvalidRequestError, code = "resource_missing", message = "No such mandate")]
MandateNotFound,
@ -491,6 +494,9 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode {
errors::ApiErrorResponse::MissingDisputeId => Self::MissingDisputeId,
errors::ApiErrorResponse::FileNotFound => Self::FileNotFound,
errors::ApiErrorResponse::FileNotAvailable => Self::FileNotAvailable,
errors::ApiErrorResponse::MerchantConnectorAccountDisabled => {
Self::MerchantConnectorAccountDisabled
}
errors::ApiErrorResponse::NotSupported { .. } => Self::InternalServerError,
}
}
@ -519,6 +525,7 @@ impl actix_web::ResponseError for StripeErrorCode {
| Self::PaymentMethodNotFound
| Self::MerchantAccountNotFound
| Self::MerchantConnectorAccountNotFound { .. }
| Self::MerchantConnectorAccountDisabled
| Self::MandateNotFound
| Self::ApiKeyNotFound
| Self::DuplicateMerchantAccount