Don't validate plan_id if it has not changed from the old value (when updating payment method).

This commit is contained in:
Pēteris Caune 2019-10-02 17:28:20 +03:00
parent f9ec5b482f
commit b0db5181d8
No known key found for this signature in database
GPG Key ID: E28D7679E9A9EDE2

View File

@ -91,9 +91,6 @@ def update(request):
plan_id = request.POST["plan_id"]
nonce = request.POST["nonce"]
if plan_id not in ("", "P20", "P80", "Y192", "Y768"):
return HttpResponseBadRequest()
sub = Subscription.objects.for_user(request.user)
# If plan_id has not changed then just update the payment method:
if plan_id == sub.plan_id:
@ -104,6 +101,9 @@ def update(request):
request.session["payment_method_status"] = "success"
return redirect("hc-billing")
if plan_id not in ("", "P20", "P80", "Y192", "Y768"):
return HttpResponseBadRequest()
# Cancel the previous plan and reset limits:
sub.cancel()