feat(router): send 2xx payments response for all the connector http responses (2xx, 4xx etc.) (#1924)

This commit is contained in:
Sai Harsha Vardhan
2023-08-17 15:26:07 +05:30
committed by GitHub
parent 35963e279a
commit 0ab6827f6c
18 changed files with 314 additions and 223 deletions

View File

@ -71,6 +71,28 @@ where
),
}
}
Ok(api::ApplicationResponse::JsonWithHeaders((response, headers))) => {
let response = S::try_from(response);
match response {
Ok(response) => match serde_json::to_string(&response) {
Ok(res) => api::http_response_json_with_headers(res, headers),
Err(_) => api::http_response_err(
r#"{
"error": {
"message": "Error serializing response from connector"
}
}"#,
),
},
Err(_) => api::http_response_err(
r#"{
"error": {
"message": "Error converting juspay response to stripe response"
}
}"#,
),
}
}
Ok(api::ApplicationResponse::StatusOk) => api::http_response_ok(),
Ok(api::ApplicationResponse::TextPlain(text)) => api::http_response_plaintext(text),
Ok(api::ApplicationResponse::FileData((file_data, content_type))) => {