Skip to content

Commit

Permalink
Add can_change_subscription check to SelectPlanView
Browse files Browse the repository at this point in the history
  • Loading branch information
nospame committed Aug 27, 2024
1 parent c2ad9f5 commit 0859efb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions corehq/apps/domain/views/accounting.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,17 @@ class SelectPlanView(DomainAccountingSettings):
edition = None
lead_text = gettext_lazy("Please select a plan below that fits your organization's needs.")

def dispatch(self, request, *args, **kwargs):
if not self.can_change_subscription:
raise Http404()
return super().dispatch(request, *args, **kwargs)

@property
def can_change_subscription(self):
subscription = self.current_subscription
is_annual_plan = subscription.plan_version.plan.is_annual_plan
return not is_annual_plan

@property
@memoized
def can_domain_unpause(self):
Expand Down

0 comments on commit 0859efb

Please sign in to comment.