mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 12:06:56 +08:00
refactor(blocklist): separate utility function & kill switch for validating data in blocklist (#3360)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -207,6 +207,14 @@ pub enum StripeErrorCode {
|
||||
status_code: u16,
|
||||
},
|
||||
|
||||
#[error(error_type = StripeErrorType::CardError, code = "", message = "{code}: {message}")]
|
||||
PaymentBlockedError {
|
||||
code: u16,
|
||||
message: String,
|
||||
status: String,
|
||||
reason: String,
|
||||
},
|
||||
|
||||
#[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "The connector provided in the request is incorrect or not available")]
|
||||
IncorrectConnectorNameGiven,
|
||||
#[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "No such {object}: '{id}'")]
|
||||
@ -521,7 +529,17 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode {
|
||||
connector_name,
|
||||
},
|
||||
errors::ApiErrorResponse::DuplicatePaymentMethod => Self::DuplicatePaymentMethod,
|
||||
errors::ApiErrorResponse::PaymentBlocked => Self::PaymentFailed,
|
||||
errors::ApiErrorResponse::PaymentBlockedError {
|
||||
code,
|
||||
message,
|
||||
status,
|
||||
reason,
|
||||
} => Self::PaymentBlockedError {
|
||||
code,
|
||||
message,
|
||||
status,
|
||||
reason,
|
||||
},
|
||||
errors::ApiErrorResponse::ClientSecretInvalid => Self::PaymentIntentInvalidParameter {
|
||||
param: "client_secret".to_owned(),
|
||||
},
|
||||
@ -680,6 +698,9 @@ impl actix_web::ResponseError for StripeErrorCode {
|
||||
Self::ExternalConnectorError { status_code, .. } => {
|
||||
StatusCode::from_u16(*status_code).unwrap_or(StatusCode::INTERNAL_SERVER_ERROR)
|
||||
}
|
||||
Self::PaymentBlockedError { code, .. } => {
|
||||
StatusCode::from_u16(*code).unwrap_or(StatusCode::OK)
|
||||
}
|
||||
Self::LockTimeout => StatusCode::LOCKED,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user