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(router): apply UCS error attempt_status on redsys pre_authenticate failure (#17027) (#12955)
10X-GRACEa23d76fbf55d
diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rsindex eb487dafbe..3258b9f345 100644--- a/crates/router/src/core/payments/flows/authorize_flow.rs+++ b/crates/router/src/core/payments/flows/authorize_flow.rs@@ -1666,15 +1666,19 @@ pub async fn call_unified_connector_service_pre_authenticate().attach_printable("Failed to deserialize UCS response")?;- let router_data_response = router_data_response.map(|(response, status)| {- router_data.status = status;- response- });let router_data_response = match router_data_response {- Ok(response) => Ok(transform_response_for_pre_authenticate_flow(- connector, response,- )?),- Err(err) => Err(err),+ Ok((response, status)) => {+ router_data.status = status;+ Ok(transform_response_for_pre_authenticate_flow(+ connector, response,+ )?)+ }+ Err(err) => {+ if let Some(attempt_status) = err.attempt_status {+ router_data.status = attempt_status;+ }+ Err(err)+ }};// Extract authentication_data from the response to store in connector_metadatarouter_data.response = router_data_response;diff --git a/crates/router/src/core/payments/flows/external_proxy_flow.rs b/crates/router/src/core/payments/flows/external_proxy_flow.rsindex 3a5f03d6dc..4bf812ca4f 100644--- a/crates/router/src/core/payments/flows/external_proxy_flow.rs+++ b/crates/router/src/core/payments/flows/external_proxy_flow.rs@@ -483,10 +483,18 @@ impl Feature<api::ExternalVaultProxy, types::ExternalVaultProxyPaymentsData>.change_context(ApiErrorResponse::InternalServerError).attach_printable("Failed to deserialize UCS response")?;- let router_data_response = ucs_data.router_data_response.map(|(response, status)| {- router_data.status = status;- response- });+ let router_data_response = match ucs_data.router_data_response {+ Ok((response, status)) => {+ router_data.status = status;+ Ok(response)+ }+ Err(err) => {+ if let Some(attempt_status) = err.attempt_status {+ router_data.status = attempt_status;+ }+ Err(err)+ }+ };router_data.response = router_data_response;router_data.raw_connector_response = payment_authorize_response.raw_connector_response@@ -591,10 +599,18 @@ impl Feature<api::ExternalVaultProxy, types::ExternalVaultProxyPaymentsData>.change_context(ApiErrorResponse::InternalServerError).attach_printable("Failed to deserialize UCS response")?;- let router_data_response = ucs_data.router_data_response.map(|(response, status)| {- router_data.status = status;- response- });+ let router_data_response = match ucs_data.router_data_response {+ Ok((response, status)) => {+ router_data.status = status;+ Ok(response)+ }+ Err(err) => {+ if let Some(attempt_status) = err.attempt_status {+ router_data.status = attempt_status;+ }+ Err(err)+ }+ };router_data.response = router_data_response;router_data.raw_connector_response = payment_authorize_response.raw_connector_response