Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(core): add referer field to browser_info (#9474)
Aishwariyaa Anand46d483d87cf6
diff --git a/Cargo.lock b/Cargo.lockindex 2304b8ab83..0e955b9f8d 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -3553,14 +3553,14 @@ dependencies = [[[package]]name = "grpc-api-types"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=142cb5a23d302e5d39c4da8d280edababe0691fe#142cb5a23d302e5d39c4da8d280edababe0691fe"+source = "git+https://github.com/juspay/connector-service?rev=f719688943adf7bc17bb93dcb43f27485c17a96e#f719688943adf7bc17bb93dcb43f27485c17a96e"dependencies = ["axum 0.8.4","error-stack 0.5.0","g2h","heck 0.5.0","http 1.3.1",- "masking 0.1.0 (git+https://github.com/juspay/hyperswitch?tag=v1.116.0)",+ "masking 0.1.0 (git+https://github.com/juspay/hyperswitch?tag=2025.09.17.0)","prost","prost-build","prost-types",@@ -4865,7 +4865,7 @@ dependencies = [[[package]]name = "masking"version = "0.1.0"-source = "git+https://github.com/juspay/hyperswitch?tag=v1.116.0#672d749e20bec7800613878e36a0ab3885177326"+source = "git+https://github.com/juspay/hyperswitch?tag=2025.09.17.0#15406557c11041bab6358f2b4b916d7333fc0a0f"dependencies = ["bytes 1.10.1","diesel",@@ -6988,7 +6988,7 @@ dependencies = [[[package]]name = "rust-grpc-client"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=142cb5a23d302e5d39c4da8d280edababe0691fe#142cb5a23d302e5d39c4da8d280edababe0691fe"+source = "git+https://github.com/juspay/connector-service?rev=f719688943adf7bc17bb93dcb43f27485c17a96e#f719688943adf7bc17bb93dcb43f27485c17a96e"dependencies = ["grpc-api-types",]@@ -9395,11 +9395,11 @@ checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"[[package]]name = "ucs_cards"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=142cb5a23d302e5d39c4da8d280edababe0691fe#142cb5a23d302e5d39c4da8d280edababe0691fe"+source = "git+https://github.com/juspay/connector-service?rev=f719688943adf7bc17bb93dcb43f27485c17a96e#f719688943adf7bc17bb93dcb43f27485c17a96e"dependencies = ["bytes 1.10.1","error-stack 0.4.1",- "masking 0.1.0 (git+https://github.com/juspay/hyperswitch?tag=v1.116.0)",+ "masking 0.1.0 (git+https://github.com/juspay/hyperswitch?tag=2025.09.17.0)","prost","regex","serde",@@ -9411,7 +9411,7 @@ dependencies = [[[package]]name = "ucs_common_enums"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=142cb5a23d302e5d39c4da8d280edababe0691fe#142cb5a23d302e5d39c4da8d280edababe0691fe"+source = "git+https://github.com/juspay/connector-service?rev=f719688943adf7bc17bb93dcb43f27485c17a96e#f719688943adf7bc17bb93dcb43f27485c17a96e"dependencies = ["serde","strum 0.26.3",@@ -9422,7 +9422,7 @@ dependencies = [[[package]]name = "ucs_common_utils"version = "0.1.0"-source = "git+https://github.com/juspay/connector-service?rev=142cb5a23d302e5d39c4da8d280edababe0691fe#142cb5a23d302e5d39c4da8d280edababe0691fe"+source = "git+https://github.com/juspay/connector-service?rev=f719688943adf7bc17bb93dcb43f27485c17a96e#f719688943adf7bc17bb93dcb43f27485c17a96e"dependencies = ["anyhow","blake3",@@ -9431,7 +9431,7 @@ dependencies = ["error-stack 0.4.1","hex","http 1.3.1",- "masking 0.1.0 (git+https://github.com/juspay/hyperswitch?tag=v1.116.0)",+ "masking 0.1.0 (git+https://github.com/juspay/hyperswitch?tag=2025.09.17.0)","md5","nanoid","once_cell",diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.jsonindex 3ca393170c..7412733306 100644--- a/api-reference/v2/openapi_spec_v2.json+++ b/api-reference/v2/openapi_spec_v2.json@@ -7522,6 +7522,11 @@"type": "string","description": "Accept-language of the browser","nullable": true+ },+ "referer": {+ "type": "string",+ "description": "Identifier of the source that initiated the request.",+ "nullable": true}}},diff --git a/crates/common_utils/src/types.rs b/crates/common_utils/src/types.rsindex cb7f61ca7a..70109c5972 100644--- a/crates/common_utils/src/types.rs+++ b/crates/common_utils/src/types.rs@@ -1232,6 +1232,9 @@ pub struct BrowserInformation {/// Accept-language of the browserpub accept_language: Option<String>,++ /// Identifier of the source that initiated the request.+ pub referer: Option<String>,}#[cfg(feature = "v2")]diff --git a/crates/external_services/Cargo.toml b/crates/external_services/Cargo.tomlindex eb9fcd61d9..288b9d9141 100644--- a/crates/external_services/Cargo.toml+++ b/crates/external_services/Cargo.toml@@ -68,7 +68,7 @@ reqwest = { version = "0.11.27", features = ["rustls-tls"] }http = "0.2.12"url = { version = "2.5.4", features = ["serde"] }quick-xml = { version = "0.31.0", features = ["serialize"] }-unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "142cb5a23d302e5d39c4da8d280edababe0691fe", package = "rust-grpc-client" }+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "f719688943adf7bc17bb93dcb43f27485c17a96e", package = "rust-grpc-client" }# First party cratesdiff --git a/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rsindex d75fabe1c6..3fda5a2460 100644--- a/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs@@ -529,6 +529,7 @@ impl TryFrom<&TrustpayRouterData<&PaymentsAuthorizeRouterData>> for TrustpayPaymos_version: None,device_model: None,accept_language: Some(browser_info.accept_language.unwrap_or("en".to_string())),+ referer: None,};let params = get_mandatory_fields(item.router_data)?;let amount = item.amount.to_owned();diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rsindex 3753b0a0d6..3f9d4f333c 100644--- a/crates/hyperswitch_domain_models/src/router_request_types.rs+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs@@ -906,6 +906,7 @@ pub struct BrowserInformation {pub os_version: Option<String>,pub device_model: Option<String>,pub accept_language: Option<String>,+ pub referer: Option<String>,}#[cfg(feature = "v2")]@@ -926,6 +927,7 @@ impl From<common_utils::types::BrowserInformation> for BrowserInformation {os_version: value.os_version,device_model: value.device_model,accept_language: value.accept_language,+ referer: value.referer,}}}diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.tomlindex 2190ebae52..9c52f1d709 100644--- a/crates/router/Cargo.toml+++ b/crates/router/Cargo.toml@@ -89,8 +89,8 @@ reqwest = { version = "0.11.27", features = ["json", "rustls-tls", "gzip", "multring = "0.17.14"rust_decimal = { version = "1.37.1", features = ["serde-with-float", "serde-with-str"] }rust-i18n = { git = "https://github.com/kashif-m/rust-i18n", rev = "f2d8096aaaff7a87a847c35a5394c269f75e077a" }-unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "142cb5a23d302e5d39c4da8d280edababe0691fe", package = "rust-grpc-client" }-unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "142cb5a23d302e5d39c4da8d280edababe0691fe", package = "ucs_cards" }+unified-connector-service-client = { git = "https://github.com/juspay/connector-service", rev = "f719688943adf7bc17bb93dcb43f27485c17a96e", package = "rust-grpc-client" }+unified-connector-service-cards = { git = "https://github.com/juspay/connector-service", rev = "f719688943adf7bc17bb93dcb43f27485c17a96e", package = "ucs_cards" }rustc-hash = "1.1.0"rustls = "0.22"rustls-pemfile = "2"diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rsindex 70d0ee40bd..58bfaa2d84 100644--- a/crates/router/src/core/unified_connector_service/transformers.rs+++ b/crates/router/src/core/unified_connector_service/transformers.rs@@ -76,6 +76,9 @@ impl ForeignTryFrom<&RouterData<PSync, PaymentsSyncData, PaymentsResponseData>>Ok(Self {transaction_id: connector_transaction_id.or(encoded_data),request_ref_id: connector_ref_id,+ access_token: None,+ capture_method: None,+ handle_response: None,})}}@@ -507,6 +510,7 @@ impl ForeignTryFrom<&RouterData<Authorize, PaymentsAuthorizeData, PaymentsResponbrowser_info,test_mode: None,payment_method_type: None,+ access_token: None,})}}@@ -1040,6 +1044,7 @@ impl ForeignTryFrom<hyperswitch_domain_models::router_request_types::BrowserInfodevice_model: browser_info.device_model,accept_language: browser_info.accept_language,time_zone_offset_minutes: browser_info.time_zone,+ referer: browser_info.referer,})}}@@ -1305,6 +1310,7 @@ pub fn build_webhook_transform_request(}),request_details: Some(request_details_grpc),webhook_secrets,+ access_token: None,})}diff --git a/crates/router/src/routes/payments/helpers.rs b/crates/router/src/routes/payments/helpers.rsindex 39a836a838..1185b20d17 100644--- a/crates/router/src/routes/payments/helpers.rs+++ b/crates/router/src/routes/payments/helpers.rs@@ -36,6 +36,7 @@ pub fn populate_browser_info(os_version: None,device_model: None,accept_language: None,+ referer: None,});let ip_address = reqdiff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rsindex d627a3c04c..0908f52af0 100644--- a/crates/router/src/services/api.rs+++ b/crates/router/src/services/api.rs@@ -164,6 +164,9 @@ whereSome(unified_connector_service_client::payments::webhook_response_content::Content::DisputesResponse(_)) => {Err(errors::ConnectorError::ProcessingStepFailed(Some("UCS webhook contains dispute response but payment processing was expected".to_string().into())).into())},+ Some(unified_connector_service_client::payments::webhook_response_content::Content::IncompleteTransformation(_)) => {+ Err(errors::ConnectorError::ProcessingStepFailed(Some("UCS webhook contains incomplete transformation but payment processing was expected".to_string().into())).into())+ },None => {Err(errors::ConnectorError::ResponseDeserializationFailed).attach_printable("UCS webhook content missing payments_response")diff --git a/crates/router/tests/connectors/trustpay.rs b/crates/router/tests/connectors/trustpay.rsindex a5eb08c67e..bb635996ad 100644--- a/crates/router/tests/connectors/trustpay.rs+++ b/crates/router/tests/connectors/trustpay.rs@@ -53,6 +53,7 @@ fn get_default_browser_info() -> BrowserInformation {os_version: None,device_model: None,accept_language: Some("en".to_string()),+ referer: None,}}diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rsindex 9394752fb9..d8f5f1a3a3 100644--- a/crates/router/tests/connectors/utils.rs+++ b/crates/router/tests/connectors/utils.rs@@ -1048,6 +1048,7 @@ impl Default for BrowserInfoType {os_type: Some("IOS or ANDROID".to_string()),os_version: Some("IOS 14.5".to_string()),accept_language: Some("en".to_string()),+ referer: None,};Self(data)}