mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
billing: Create get_current_plan_by_realm helper function.
This commit is contained in:
@@ -65,6 +65,12 @@ def get_current_plan_by_customer(customer: Customer) -> Optional[CustomerPlan]:
|
||||
return CustomerPlan.objects.filter(
|
||||
customer=customer, status__lt=CustomerPlan.LIVE_STATUS_THRESHOLD).first()
|
||||
|
||||
def get_current_plan_by_realm(realm: Realm) -> Optional[CustomerPlan]:
|
||||
customer = get_customer_by_realm(realm)
|
||||
if customer is None:
|
||||
return None
|
||||
return get_current_plan_by_customer(customer)
|
||||
|
||||
class LicenseLedger(models.Model):
|
||||
plan = models.ForeignKey(CustomerPlan, on_delete=CASCADE) # type: CustomerPlan
|
||||
# Also True for the initial upgrade.
|
||||
|
||||
Reference in New Issue
Block a user