Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit a114d31

Browse files
committed
update with logic to default to new free plan
1 parent 7e5a947 commit a114d31

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

api/internal/owner/views.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from services.billing import BillingService
1616
from services.decorators import stripe_safe
1717
from services.task import TaskService
18+
from shared.plan.constants import DEFAULT_FREE_PLAN
1819

1920
from .serializers import (
2021
AccountDetailsSerializer,
@@ -46,6 +47,9 @@ def retrieve(self, *args, **kwargs):
4647

4748
@stripe_safe
4849
def update(self, *args, **kwargs):
50+
# Delete once gazebo uses the new free plan
51+
if "plan" in args[0].data and args[0].data["plan"]["value"] == "users-basic":
52+
args[0].data["plan"]["value"] = DEFAULT_FREE_PLAN
4953
return super().update(*args, **kwargs)
5054

5155
def destroy(self, request, *args, **kwargs):

billing/helpers.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from django.db.models import QuerySet
33
from shared.django_apps.codecov_auth.models import BillingRate
44
from shared.django_apps.codecov_auth.tests.factories import PlanFactory, TierFactory
5-
from shared.plan.constants import PlanName, PlanPrice, TierName
5+
from shared.plan.constants import DEFAULT_FREE_PLAN, PlanName, PlanPrice, TierName
66

77
from codecov_auth.models import Owner, Plan
88

@@ -187,3 +187,18 @@ def mock_all_plans_and_tiers():
187187
"Priority Support",
188188
],
189189
)
190+
191+
PlanFactory(
192+
name=DEFAULT_FREE_PLAN,
193+
tier=team_tier,
194+
marketing_name="Developer",
195+
billing_rate=None,
196+
base_unit_price=0,
197+
paid_plan=False,
198+
monthly_uploads_limit=250,
199+
benefits=[
200+
"Up to 1 user",
201+
"Unlimited public repositories",
202+
"Unlimited private repositories",
203+
],
204+
)

0 commit comments

Comments
 (0)