mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 05:17:02 +08:00
refactor(payment_methods): prevent deletion of default payment method for a customer (#3964)
This commit is contained in:
@ -251,6 +251,8 @@ pub enum StripeErrorCode {
|
||||
InvalidConnectorConfiguration { config: String },
|
||||
#[error(error_type = StripeErrorType::HyperswitchError, code = "HE_01", message = "Failed to convert currency to minor unit")]
|
||||
CurrencyConversionFailed,
|
||||
#[error(error_type = StripeErrorType::InvalidRequestError, code = "IR_25", message = "Cannot delete the default payment method")]
|
||||
PaymentMethodDeleteFailed,
|
||||
// [#216]: https://github.com/juspay/hyperswitch/issues/216
|
||||
// Implement the remaining stripe error codes
|
||||
|
||||
@ -618,6 +620,7 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode {
|
||||
Self::InvalidConnectorConfiguration { config }
|
||||
}
|
||||
errors::ApiErrorResponse::CurrencyConversionFailed => Self::CurrencyConversionFailed,
|
||||
errors::ApiErrorResponse::PaymentMethodDeleteFailed => Self::PaymentMethodDeleteFailed,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -686,7 +689,8 @@ impl actix_web::ResponseError for StripeErrorCode {
|
||||
| Self::DuplicateCustomer
|
||||
| Self::PaymentMethodUnactivated
|
||||
| Self::InvalidConnectorConfiguration { .. }
|
||||
| Self::CurrencyConversionFailed => StatusCode::BAD_REQUEST,
|
||||
| Self::CurrencyConversionFailed
|
||||
| Self::PaymentMethodDeleteFailed => StatusCode::BAD_REQUEST,
|
||||
Self::RefundFailed
|
||||
| Self::PayoutFailed
|
||||
| Self::PaymentLinkNotFound
|
||||
|
||||
Reference in New Issue
Block a user