Repository: juspay/hyperswitch
File: crates/external_services/src/grpc_client/unified_connector_service.rs (Rust)

Code before:
                match (payment_client_result, refund_client_result) {
                    (Ok(Ok(client)), Ok(Ok(refund_client))) => {
                        logger::info!("Successfully connected to Unified Connector Service");
                        Some(Self {
                            client,
                            refund_client,
                        })
                    }
                    (Ok(Err(err)), _) | (_, Ok(Err(err))) => {
                        logger::error!(error = ?err, "Failed to connect to Unified Connector Service");
                        None
                    }
                    (Err(err), _) | (_, Err(err)) => {
                        logger::error!(error = ?err, "Connection to Unified Connector Service timed out");
                        None
                    }
                }
            }
            None => {
                router_env::logger::error!(?config.unified_connector_service, "Unified Connector Service config is missing");
                None
            }
        }
    }

    /// Performs Payment Granular Authorize
    pub async fn payment_method_token_create(
        &self,
        pm_token_create_request: payments_grpc::PaymentServiceCreatePaymentMethodTokenRequest,
        connector_auth_metadata: ConnectorAuthMetadata,
        grpc_headers: GrpcHeadersUcs,
    ) -> UnifiedConnectorServiceResult<
        tonic::Response<payments_grpc::PaymentServiceCreatePaymentMethodTokenResponse>,
    > {
        let mut request = tonic::Request::new(pm_token_create_request);

        let connector_name = connector_auth_metadata.connector_name.clone();
        let metadata =
            build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
        *request.metadata_mut() = metadata;

        self.client
            .clone()
            .create_payment_method_token(request)
            .await
            .change_context(UnifiedConnectorServiceError::PaymentMethodTokenCreateFailure)
            .inspect_err(|error| {
                logger::error!(
                    grpc_error=?error,
                    method="create_payment_method_token",
                    connector_name=?connector_name,

Review comment (suggestion):
```suggestion
    /// Performs Payment Method Token create
```

Code after:
                match (payment_client_result, refund_client_result) {
                    (Ok(Ok(client)), Ok(Ok(refund_client))) => {
                        logger::info!("Successfully connected to Unified Connector Service");
                        Some(Self {
                            client,
                            refund_client,
                        })
                    }
                    (Ok(Err(err)), _) | (_, Ok(Err(err))) => {
                        logger::error!(error = ?err, "Failed to connect to Unified Connector Service");
                        None
                    }
                    (Err(err), _) | (_, Err(err)) => {
                        logger::error!(error = ?err, "Connection to Unified Connector Service timed out");
                        None
                    }
                }
            }
            None => {
                router_env::logger::error!(?config.unified_connector_service, "Unified Connector Service config is missing");
                None
            }
        }
    }

    /// Performs Payment Method Token Create
    pub async fn payment_method_token_create(
        &self,
        pm_token_create_request: payments_grpc::PaymentServiceCreatePaymentMethodTokenRequest,
        connector_auth_metadata: ConnectorAuthMetadata,
        grpc_headers: GrpcHeadersUcs,
    ) -> UnifiedConnectorServiceResult<
        tonic::Response<payments_grpc::PaymentServiceCreatePaymentMethodTokenResponse>,
    > {
        let mut request = tonic::Request::new(pm_token_create_request);

        let connector_name = connector_auth_metadata.connector_name.clone();
        let metadata =
            build_unified_connector_service_grpc_headers(connector_auth_metadata, grpc_headers)?;
        *request.metadata_mut() = metadata;

        self.client
            .clone()
            .create_payment_method_token(request)
            .await
            .change_context(UnifiedConnectorServiceError::PaymentMethodTokenCreateFailure)
            .inspect_err(|error| {
                logger::error!(
                    grpc_error=?error,
                    method="create_payment_method_token",
                    connector_name=?connector_name,