Skip to content

Commit 2adf6c8

Browse files
Aishwariyaa-AnandAishwariyaa Anandhyperswitch-bot[bot]likhinbopanna
authored
feat(core): populate UCS status_code in response headers (#8788)
Co-authored-by: Aishwariyaa Anand <[email protected]> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: likhinbopanna <[email protected]>
1 parent 988c170 commit 2adf6c8

File tree

19 files changed

+184
-139
lines changed

19 files changed

+184
-139
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/config.example.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,3 +1170,6 @@ allow_connected_merchants = false # Enable or disable connected merchant account
11701170
[chat]
11711171
enabled = false # Enable or disable chat features
11721172
hyperswitch_ai_host = "http://0.0.0.0:8000" # Hyperswitch ai workflow host
1173+
1174+
[proxy_status_mapping]
1175+
proxy_connector_http_status_code = false # If enabled, the http status code of the connector will be proxied in the response

config/deployments/env_specific.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,3 +385,6 @@ connection_timeout = 10 # Connection Timeout Duration in Seconds
385385
[chat]
386386
enabled = false # Enable or disable chat features
387387
hyperswitch_ai_host = "http://0.0.0.0:8000" # Hyperswitch ai workflow host
388+
389+
[proxy_status_mapping]
390+
proxy_connector_http_status_code = false # If enabled, the http status code of the connector will be proxied in the response

config/development.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,3 +1269,6 @@ version = "HOSTNAME"
12691269
[chat]
12701270
enabled = false
12711271
hyperswitch_ai_host = "http://0.0.0.0:8000"
1272+
1273+
[proxy_status_mapping]
1274+
proxy_connector_http_status_code = false # If enabled, the http status code of the connector will be proxied in the response

config/docker_compose.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,3 +1160,6 @@ connector_names = "stripe, adyen" # Comma-separated list of allowe
11601160
[infra_values]
11611161
cluster = "CLUSTER" # value of CLUSTER from deployment
11621162
version = "HOSTNAME" # value of HOSTNAME from deployment which tells its version
1163+
1164+
[proxy_status_mapping]
1165+
proxy_connector_http_status_code = false # If enabled, the http status code of the connector will be proxied in the response

crates/external_services/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ reqwest = { version = "0.11.27", features = ["rustls-tls"] }
5353
http = "0.2.12"
5454
url = { version = "2.5.4", features = ["serde"] }
5555
quick-xml = { version = "0.31.0", features = ["serialize"] }
56-
unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "0409f6aa1014dd1b9827fabfa4fa424e16d07ebc", package = "rust-grpc-client" }
56+
unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "4387a6310dc9c2693b453b455a8032623f3d6a81", package = "rust-grpc-client" }
5757

5858

5959
# First party crates

crates/router/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ reqwest = { version = "0.11.27", features = ["json", "rustls-tls", "gzip", "mult
8888
ring = "0.17.14"
8989
rust_decimal = { version = "1.37.1", features = ["serde-with-float", "serde-with-str"] }
9090
rust-i18n = { git = "https://github.com/kashif-m/rust-i18n", rev = "f2d8096aaaff7a87a847c35a5394c269f75e077a" }
91-
unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "0409f6aa1014dd1b9827fabfa4fa424e16d07ebc", package = "rust-grpc-client" }
91+
unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "4387a6310dc9c2693b453b455a8032623f3d6a81", package = "rust-grpc-client" }
9292
rustc-hash = "1.1.0"
9393
rustls = "0.22"
9494
rustls-pemfile = "2"

crates/router/src/compatibility/wrap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ where
8787
let response = S::try_from(response);
8888
match response {
8989
Ok(response) => match serde_json::to_string(&response) {
90-
Ok(res) => api::http_response_json_with_headers(res, headers, None),
90+
Ok(res) => api::http_response_json_with_headers(res, headers, None, None),
9191
Err(_) => api::http_response_err(
9292
r#"{
9393
"error": {

crates/router/src/configs/secrets_transformers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,5 +548,6 @@ pub(crate) async fn fetch_raw_secrets(
548548
merchant_id_auth: conf.merchant_id_auth,
549549
infra_values: conf.infra_values,
550550
enhancement: conf.enhancement,
551+
proxy_status_mapping: conf.proxy_status_mapping,
551552
}
552553
}

crates/router/src/configs/settings.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ pub struct Settings<S: SecretState> {
164164
pub infra_values: Option<HashMap<String, String>>,
165165
#[serde(default)]
166166
pub enhancement: Option<HashMap<String, String>>,
167+
pub proxy_status_mapping: ProxyStatusMapping,
167168
}
168169

169170
#[derive(Debug, Deserialize, Clone, Default)]
@@ -844,6 +845,12 @@ pub struct MerchantIdAuthSettings {
844845
pub merchant_id_auth_enabled: bool,
845846
}
846847

848+
#[derive(Debug, Clone, Default, Deserialize)]
849+
#[serde(default)]
850+
pub struct ProxyStatusMapping {
851+
pub proxy_connector_http_status_code: bool,
852+
}
853+
847854
#[derive(Debug, Clone, Default, Deserialize)]
848855
#[serde(default)]
849856
pub struct WebhooksSettings {

0 commit comments

Comments
 (0)