Repository: juspay/hyperswitch
File: crates/router/src/core/payments/flows/complete_authorize_flow.rs (Rust)

Code before:
                    _,
                >(
                    state,
                    post_authenticate_router_data,
                    connector,
                    gateway_context,
                ))
                .await?;
            // Convert back to CompleteAuthorize router data while preserving preprocessing response data
            let post_authenticate_response = post_authenticate_router_data.response.clone();
            if let Ok(types::PaymentsResponseData::TransactionResponse {
                connector_metadata, ..
            }) = &post_authenticate_router_data.response
            {
                connector_metadata.clone_into(&mut complete_authorize_request_data.connector_meta);
            };
            complete_authorize_request_data.authentication_data = authentication_data;
            let complete_authorize_router_data =
                helpers::router_data_type_conversion::<_, api::CompleteAuthorize, _, _, _, _>(
                    post_authenticate_router_data,
                    complete_authorize_request_data,
                    post_authenticate_response,
                );
            // check if redirection is not present in the response and attempt status is not AuthenticationFailed
            // if condition does not satisfy, then we don't need to proceed further
            let default_should_continue = matches!(
                complete_authorize_router_data.response,
                Ok(types::PaymentsResponseData::TransactionResponse {
                    ref redirection_data,
                    ..
                }) if redirection_data.is_none()
            ) && !matches!(
                complete_authorize_router_data.status,
                common_enums::AttemptStatus::AuthenticationFailed
                    | common_enums::AttemptStatus::Failure
            );
            Ok((complete_authorize_router_data, default_should_continue))
        } else {
            Ok((self, true))
        }
    }
}

fn transform_redirection_response_for_authenticate_flow(
    connector: connector_enums::Connector,
    response_data: router_response_types::RedirectForm,
) -> errors::CustomResult<
    router_response_types::RedirectForm,
    ucs_transformers::UnifiedConnectorServiceError,
> {
    match (connector, &response_data) {

Review comment (suggestion):
```suggestion
            let should_continue = matches!(
```

Code after:
                    _,
                >(
                    state,
                    post_authenticate_router_data,
                    connector,
                    gateway_context,
                ))
                .await?;
            // Convert back to CompleteAuthorize router data while preserving preprocessing response data
            let post_authenticate_response = post_authenticate_router_data.response.clone();
            if let Ok(types::PaymentsResponseData::TransactionResponse {
                connector_metadata, ..
            }) = &post_authenticate_router_data.response
            {
                connector_metadata.clone_into(&mut complete_authorize_request_data.connector_meta);
            };
            complete_authorize_request_data.authentication_data = authentication_data;
            let complete_authorize_router_data =
                helpers::router_data_type_conversion::<_, api::CompleteAuthorize, _, _, _, _>(
                    post_authenticate_router_data,
                    complete_authorize_request_data,
                    post_authenticate_response,
                );
            // check if redirection is not present in the response and attempt status is not AuthenticationFailed
            // if condition does not satisfy, then we don't need to proceed further
            let should_continue = matches!(
                complete_authorize_router_data.response,
                Ok(types::PaymentsResponseData::TransactionResponse {
                    ref redirection_data,
                    ..
                }) if redirection_data.is_none()
            ) && !matches!(
                complete_authorize_router_data.status,
                common_enums::AttemptStatus::AuthenticationFailed
                    | common_enums::AttemptStatus::Failure
            );
            Ok((complete_authorize_router_data, should_continue))
        } else {
            Ok((self, true))
        }
    }
}

fn transform_redirection_response_for_authenticate_flow(
    connector: connector_enums::Connector,
    response_data: router_response_types::RedirectForm,
) -> errors::CustomResult<
    router_response_types::RedirectForm,
    ucs_transformers::UnifiedConnectorServiceError,
> {
    match (connector, &response_data) {