mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 13:30:39 +08:00
feat(core): Added integrity framework for Authorize and Sync flow with connector as Stripe (#5109)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Hrithikesh <61539176+hrithikesh026@users.noreply.github.com> Co-authored-by: Narayan Bhat <narayan.bhat@juspay.in>
This commit is contained in:
@ -271,6 +271,12 @@ pub enum ApiErrorResponse {
|
||||
InvalidCookie,
|
||||
#[error(error_type = ErrorType::InvalidRequestError, code = "IR_27", message = "Extended card info does not exist")]
|
||||
ExtendedCardInfoNotFound,
|
||||
#[error(error_type = ErrorType::ServerNotAvailable, code = "IE", message = "{reason} as data mismatched for {field_names}", ignore = "status_code")]
|
||||
IntegrityCheckFailed {
|
||||
reason: String,
|
||||
field_names: String,
|
||||
connector_transaction_id: Option<String>,
|
||||
},
|
||||
#[error(error_type = ErrorType::ProcessingError, code = "HE_06", message = "Missing tenant id")]
|
||||
MissingTenantId,
|
||||
#[error(error_type = ErrorType::ProcessingError, code = "HE_06", message = "Invalid tenant id: {tenant_id}")]
|
||||
@ -609,6 +615,19 @@ impl ErrorSwitch<api_models::errors::types::ApiErrorResponse> for ApiErrorRespon
|
||||
Self::ExtendedCardInfoNotFound => {
|
||||
AER::NotFound(ApiError::new("IR", 27, "Extended card info does not exist", None))
|
||||
}
|
||||
Self::IntegrityCheckFailed {
|
||||
reason,
|
||||
field_names,
|
||||
connector_transaction_id
|
||||
} => AER::InternalServerError(ApiError::new(
|
||||
"IE",
|
||||
0,
|
||||
format!("{} as data mismatched for {}", reason, field_names),
|
||||
Some(Extra {
|
||||
connector_transaction_id: connector_transaction_id.to_owned(),
|
||||
..Default::default()
|
||||
})
|
||||
)),
|
||||
Self::MissingTenantId => {
|
||||
AER::InternalServerError(ApiError::new("HE", 6, "Missing Tenant ID in the request".to_string(), None))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user