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
fix(core): do not construct request if it is already available (#3826)
Narayan Bhat84d91a7b344d
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rsindex 738f57e9d7..bfba31c344 100644--- a/crates/router/src/services/api.rs+++ b/crates/router/src/services/api.rs@@ -338,30 +338,31 @@ where],);- let connector_request = connector_request.or(connector_integration- .build_request(req, &state.conf.connectors)- .map_err(|error| {- if matches!(- error.current_context(),- &errors::ConnectorError::RequestEncodingFailed- | &errors::ConnectorError::RequestEncodingFailedWithReason(_)- ) {- metrics::REQUEST_BUILD_FAILURE.add(- &metrics::CONTEXT,- 1,- &[metrics::request::add_attributes(- "connector",- req.connector.to_string(),- )],- )- }- error- })?);+ let connector_request = match connector_request {+ Some(connector_request) => Some(connector_request),+ None => connector_integration+ .build_request(req, &state.conf.connectors)+ .map_err(|error| {+ if matches!(+ error.current_context(),+ &errors::ConnectorError::RequestEncodingFailed+ | &errors::ConnectorError::RequestEncodingFailedWithReason(_)+ ) {+ metrics::REQUEST_BUILD_FAILURE.add(+ &metrics::CONTEXT,+ 1,+ &[metrics::request::add_attributes(+ "connector",+ req.connector.to_string(),+ )],+ )+ }+ error+ })?,+ };match connector_request {Some(request) => {- logger::debug!(connector_request=?request);-let masked_request_body = match &request.body {Some(request) => match request {RequestContent::Json(i)@@ -1828,7 +1829,7 @@ pub fn build_redirection_form(threeDSsecureInterface.on('challenge', function(e) {{console.log('Challenged');- document.getElementById('loader-wrapper').style.display = 'none';+ document.getElementById('loader-wrapper').style.display = 'none';}});threeDSsecureInterface.on('complete', function(e) {{