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

Code before:

async fn call_unified_connector_service_authorize(
    router_data: &mut types::RouterData<
        api::Authorize,
        types::PaymentsAuthorizeData,
        types::PaymentsResponseData,
    >,
    state: &SessionState,
    #[cfg(feature = "v1")] merchant_connector_account: helpers::MerchantConnectorAccountType,
    #[cfg(feature = "v2")] merchant_connector_account: domain::MerchantConnectorAccountTypeDetails,
    merchant_context: &domain::MerchantContext,
) -> RouterResult<()> {
    let client = state
        .grpc_client
        .unified_connector_service_client
        .clone()
        .ok_or(ApiErrorResponse::InternalServerError)
        .attach_printable("Failed to fetch Unified Connector Service client")?;

    let payment_authorize_request =
        payments_grpc::PaymentServiceAuthorizeRequest::foreign_try_from(&*router_data)
            .change_context(ApiErrorResponse::InternalServerError)
            .attach_printable("Failed to construct Payment Authorize Request")?;

    let connector_auth_metadata = build_unified_connector_service_auth_metadata(
        merchant_connector_account.clone(),
        merchant_context,
    )
    .change_context(ApiErrorResponse::InternalServerError)
    .attach_printable("Failed to construct request metadata")?;

    let payment_authorize_request_clone = payment_authorize_request.clone();
    let updated_router_data = Box::pin(ucs_logging_wrapper(
        router_data.clone(),
        state,
        &payment_authorize_request,
        |mut router_data| async move {
            let response = client
                .payment_authorize(
                    payment_authorize_request_clone,
                    connector_auth_metadata,
                    state.get_grpc_headers(),
                )
                .await
                .change_context(ApiErrorResponse::InternalServerError)
                .attach_printable("Failed to authorize payment")?;

            let payment_authorize_response = response.into_inner();

            let (status, router_data_response, status_code) =
                handle_unified_connector_service_response_for_payment_authorize(

Review comment (suggestion):

```suggestion
        merchant_connector_account
```

Code after:

async fn call_unified_connector_service_authorize(
    router_data: &mut types::RouterData<
        api::Authorize,
        types::PaymentsAuthorizeData,
        types::PaymentsResponseData,
    >,
    state: &SessionState,
    #[cfg(feature = "v1")] merchant_connector_account: helpers::MerchantConnectorAccountType,
    #[cfg(feature = "v2")] merchant_connector_account: domain::MerchantConnectorAccountTypeDetails,
    merchant_context: &domain::MerchantContext,
) -> RouterResult<()> {
    let client = state
        .grpc_client
        .unified_connector_service_client
        .clone()
        .ok_or(ApiErrorResponse::InternalServerError)
        .attach_printable("Failed to fetch Unified Connector Service client")?;

    let payment_authorize_request =
        payments_grpc::PaymentServiceAuthorizeRequest::foreign_try_from(&*router_data)
            .change_context(ApiErrorResponse::InternalServerError)
            .attach_printable("Failed to construct Payment Authorize Request")?;

    let connector_auth_metadata =
        build_unified_connector_service_auth_metadata(merchant_connector_account, merchant_context)
            .change_context(ApiErrorResponse::InternalServerError)
            .attach_printable("Failed to construct request metadata")?;

    let updated_router_data = Box::pin(ucs_logging_wrapper(
        router_data.clone(),
        state,
        payment_authorize_request,
        |mut router_data, payment_authorize_request| async move {
            let response = client
                .payment_authorize(
                    payment_authorize_request,
                    connector_auth_metadata,
                    None,
                    state.get_grpc_headers(),
                )
                .await
                .change_context(ApiErrorResponse::InternalServerError)
                .attach_printable("Failed to authorize payment")?;

            let payment_authorize_response = response.into_inner();

            let (status, router_data_response, status_code) =
                handle_unified_connector_service_response_for_payment_authorize(
                    payment_authorize_response.clone(),
                )