Skip to content

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

fix(router): apply UCS error attempt_status on redsys authenticate failure (#17016) (#12948)

10X-GRACEf89f62e4b1c8
diff --git a/crates/router/src/core/payments/flows/complete_authorize_flow.rs b/crates/router/src/core/payments/flows/complete_authorize_flow.rs
index 2f1230eec1..426a556d53 100644
--- a/crates/router/src/core/payments/flows/complete_authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/complete_authorize_flow.rs
@@ -834,15 +834,19 @@ pub async fn call_unified_connector_service_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_authenticate_flow(
- connector, response,
- )?),
- Err(err) => Err(err),
+ Ok((response, status)) => {
+ router_data.status = status;
+ Ok(transform_response_for_authenticate_flow(
+ connector, response,
+ )?)
+ }
+ Err(err) => {
+ if let Some(attempt_status) = err.attempt_status {
+ router_data.status = attempt_status;
+ }
+ Err(err)
+ }
};
router_data.response = router_data_response;
@@ -947,10 +951,18 @@ pub async fn call_unified_connector_service_post_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, 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_post_authenticate_response
.raw_connector_response