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

Code before:
                    != api_models::enums::AuthenticationStatus::Success
                {
                    *should_continue_confirm_transaction = false;
                }
                Some(authentication_store)
            }
            None => None,
        };
        Ok(())
    }

    async fn apply_three_ds_authentication_strategy<'a>(
        &'a self,
        state: &SessionState,
        payment_data: &mut PaymentData<F>,
        business_profile: &domain::Profile,
    ) -> CustomResult<(), errors::ApiErrorResponse> {
        // If the business profile has a three_ds_decision_rule_algorithm, we will use it to determine the 3DS strategy (authentication_type, exemption_type and force_three_ds_challenge)
        if let Some(three_ds_decision_rule) =
            business_profile.three_ds_decision_rule_algorithm.clone()
        {
            // Parse the three_ds_decision_rule to get the algorithm_id
            let algorithm_id = three_ds_decision_rule
                .parse_value::<api::routing::RoutingAlgorithmRef>("RoutingAlgorithmRef")
                .change_context(errors::ApiErrorResponse::InternalServerError)
                .attach_printable("Could not decode merchant routing algorithm ref")?
                .algorithm_id
                .ok_or(errors::ApiErrorResponse::InternalServerError)
                .attach_printable("No algorithm_id found in three_ds_decision_rule_algorithm")?;
            // get additional card info from payment data
            let additional_card_info = payment_data
                .payment_attempt
                .payment_method_data
                .as_ref()
                .map(|payment_method_data| {
                    payment_method_data
                        .clone()
                        .parse_value::<api_models::payments::AdditionalPaymentData>(
                            "additional_payment_method_data",
                        )
                })
                .transpose()
                .change_context(errors::ApiErrorResponse::InternalServerError)
                .attach_printable("unable to parse value into additional_payment_method_data")?
                .and_then(|additional_payment_method_data| {
                    additional_payment_method_data.get_additional_card_info()
                });
            // get acquirer details from business profile based on card network
            let acquirer_config = additional_card_info.as_ref().and_then(|card_info| {
                card_info
                    .card_network

Review comment (suggestion):
Nit: Should it be profile instead of merchant?

```suggestion
                .attach_printable("Could not decode profile routing algorithm ref")?
```

Code after:
                    != api_models::enums::AuthenticationStatus::Success
                {
                    *should_continue_confirm_transaction = false;
                }
                Some(authentication_store)
            }
            None => None,
        };
        Ok(())
    }

    async fn apply_three_ds_authentication_strategy<'a>(
        &'a self,
        state: &SessionState,
        payment_data: &mut PaymentData<F>,
        business_profile: &domain::Profile,
    ) -> CustomResult<(), errors::ApiErrorResponse> {
        // If the business profile has a three_ds_decision_rule_algorithm, we will use it to determine the 3DS strategy (authentication_type, exemption_type and force_three_ds_challenge)
        if let Some(three_ds_decision_rule) =
            business_profile.three_ds_decision_rule_algorithm.clone()
        {
            // Parse the three_ds_decision_rule to get the algorithm_id
            let algorithm_id = three_ds_decision_rule
                .parse_value::<api::routing::RoutingAlgorithmRef>("RoutingAlgorithmRef")
                .change_context(errors::ApiErrorResponse::InternalServerError)
                .attach_printable("Could not decode profile routing algorithm ref")?
                .algorithm_id
                .ok_or(errors::ApiErrorResponse::InternalServerError)
                .attach_printable("No algorithm_id found in three_ds_decision_rule_algorithm")?;
            // get additional card info from payment data
            let additional_card_info = payment_data
                .payment_attempt
                .payment_method_data
                .as_ref()
                .map(|payment_method_data| {
                    payment_method_data
                        .clone()
                        .parse_value::<api_models::payments::AdditionalPaymentData>(
                            "additional_payment_method_data",
                        )
                })
                .transpose()
                .change_context(errors::ApiErrorResponse::InternalServerError)
                .attach_printable("unable to parse value into additional_payment_method_data")?
                .and_then(|additional_payment_method_data| {
                    additional_payment_method_data.get_additional_card_info()
                });
            // get acquirer details from business profile based on card network
            let acquirer_config = additional_card_info.as_ref().and_then(|card_info| {
                card_info
                    .card_network