billing: Rename change_plan_at_end_of_cycle to change_plan_status.

This commit is contained in:
Vishnu KS 2020-04-23 23:32:16 +05:30 committed by Tim Abbott
parent 28d58c848d
commit aca80206df
2 changed files with 3 additions and 4 deletions

View File

@ -22,7 +22,7 @@ v1_api_and_json_patterns = [
url(r'^billing/upgrade$', rest_dispatch,
{'POST': 'corporate.views.upgrade'}),
url(r'^billing/plan/change$', rest_dispatch,
{'POST': 'corporate.views.change_plan_at_end_of_cycle'}),
{'POST': 'corporate.views.change_plan_status'}),
url(r'^billing/sources/change', rest_dispatch,
{'POST': 'corporate.views.replace_payment_source'}),
]

View File

@ -203,9 +203,8 @@ def billing_home(request: HttpRequest) -> HttpResponse:
@require_billing_access
@has_request_variables
def change_plan_at_end_of_cycle(request: HttpRequest, user: UserProfile,
status: int=REQ("status", validator=check_int)) -> HttpResponse:
assert(status in [CustomerPlan.ACTIVE, CustomerPlan.DOWNGRADE_AT_END_OF_CYCLE])
def change_plan_status(request: HttpRequest, user: UserProfile,
status: int=REQ("status", validator=check_int)) -> HttpResponse:
plan = get_current_plan_by_realm(user.realm)
assert(plan is not None) # for mypy
do_change_plan_status(plan, status)