mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
refactor(compatibility): remove specific imports (#181)
This commit is contained in:
committed by
GitHub
parent
cb28355459
commit
08e9c079ce
@ -8,7 +8,7 @@ use serde::Serialize;
|
||||
use crate::{
|
||||
core::errors::{self, RouterResult},
|
||||
routes,
|
||||
services::{api, build_redirection_form, logger, BachResponse},
|
||||
services::{api, logger},
|
||||
types::storage,
|
||||
};
|
||||
|
||||
@ -23,7 +23,7 @@ pub(crate) async fn compatibility_api_wrap<'a, 'b, A, T, Q, F, Fut, S, E>(
|
||||
where
|
||||
A: Into<api::ApiAuthentication<'a>> + std::fmt::Debug,
|
||||
F: Fn(&'b routes::AppState, storage::MerchantAccount, T) -> Fut,
|
||||
Fut: Future<Output = RouterResult<BachResponse<Q>>>,
|
||||
Fut: Future<Output = RouterResult<api::BachResponse<Q>>>,
|
||||
Q: Serialize + std::fmt::Debug + 'a,
|
||||
S: From<Q> + Serialize,
|
||||
E: From<errors::ApiErrorResponse> + Serialize + error_stack::Context + actix_web::ResponseError,
|
||||
@ -32,7 +32,7 @@ where
|
||||
let api_authentication = api_authentication.into();
|
||||
let resp = api::server_wrap_util(state, request, payload, func, api_authentication).await;
|
||||
match resp {
|
||||
Ok(BachResponse::Json(router_resp)) => {
|
||||
Ok(api::BachResponse::Json(router_resp)) => {
|
||||
let pg_resp = S::try_from(router_resp);
|
||||
match pg_resp {
|
||||
Ok(pg_resp) => match serde_json::to_string(&pg_resp) {
|
||||
@ -54,19 +54,21 @@ where
|
||||
),
|
||||
}
|
||||
}
|
||||
Ok(BachResponse::StatusOk) => api::http_response_ok(),
|
||||
Ok(BachResponse::TextPlain(text)) => api::http_response_plaintext(text),
|
||||
Ok(BachResponse::JsonForRedirection(response)) => match serde_json::to_string(&response) {
|
||||
Ok(res) => api::http_redirect_response(res, response),
|
||||
Err(_) => api::http_response_err(
|
||||
r#"{
|
||||
Ok(api::BachResponse::StatusOk) => api::http_response_ok(),
|
||||
Ok(api::BachResponse::TextPlain(text)) => api::http_response_plaintext(text),
|
||||
Ok(api::BachResponse::JsonForRedirection(response)) => {
|
||||
match serde_json::to_string(&response) {
|
||||
Ok(res) => api::http_redirect_response(res, response),
|
||||
Err(_) => api::http_response_err(
|
||||
r#"{
|
||||
"error": {
|
||||
"message": "Error serializing response from connector"
|
||||
}
|
||||
}"#,
|
||||
),
|
||||
},
|
||||
Ok(BachResponse::Form(form_data)) => build_redirection_form(&form_data)
|
||||
),
|
||||
}
|
||||
}
|
||||
Ok(api::BachResponse::Form(form_data)) => api::build_redirection_form(&form_data)
|
||||
.respond_to(request)
|
||||
.map_into_boxed_body(),
|
||||
Err(error) => {
|
||||
|
||||
Reference in New Issue
Block a user