Add function to check the billing status

This commit is contained in:
Alexandre de Souza 2025-08-20 14:14:30 -03:00
parent 033e24f7f0
commit 8887ded506
No known key found for this signature in database
GPG key ID: E39228FFBA346545

View file

@ -172,6 +172,14 @@ defmodule Livebook.Hubs.TeamClient do
GenServer.call(registry_name(id), {:user_can_deploy?, user_id, deployment_group_id})
end
@doc """
Returns if the Livebook Teams organization billing status is in good standing.
"""
@spec billing_good_standing?(String.t()) :: boolean()
def billing_good_standing?(id) do
GenServer.call(registry_name(id), :billing_good_standing?)
end
@doc """
Returns if the Team client is connected.
"""
@ -370,6 +378,10 @@ defmodule Livebook.Hubs.TeamClient do
end
end
def handle_call(:billing_good_standing?, _caller, state) do
{:reply, not state.hub.billing_status.disabled, state}
end
@impl true
def handle_info(:connected, state) do
Hubs.Broadcasts.hub_connected(state.hub.id)