existing subscription validation 7
This commit is contained in:
@@ -353,7 +353,7 @@ class SubscriptionPageView(TemplateView):
|
||||
token = request.GET.get("token") or request.session.get("jwt")
|
||||
print("token: ", token)
|
||||
if token:
|
||||
request.session['jwt'] = token
|
||||
request.session["jwt"] = token
|
||||
print("request.session: ", request.session)
|
||||
try:
|
||||
# Decode and validate token
|
||||
@@ -429,14 +429,14 @@ def create_checkout_session(request):
|
||||
|
||||
if has_active_principal_subscription(principal_id):
|
||||
print("Active principal subscription already exists.")
|
||||
return JsonResponse({"error-message": "Active principal subscription already exists"}, status=400)
|
||||
return JsonResponse(
|
||||
{"error": "Active principal subscription already exists"}, status=400
|
||||
)
|
||||
|
||||
try:
|
||||
subscription = Subscription.objects.get(id=subscription_id)
|
||||
except Subscription.DoesNotExist:
|
||||
return ApiResponse.error(
|
||||
status=status.HTTP_404_NOT_FOUND, message="Subscription not found."
|
||||
)
|
||||
return JsonResponse({"error": "Subscription not found."}, status=404)
|
||||
|
||||
order_id = (
|
||||
"order_" + str(timezone.localtime().timestamp()) + str(request.user.email)
|
||||
|
||||
@@ -548,6 +548,7 @@
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error:", error);
|
||||
document.getElementById('error-message').innerText = "Error: " + error.message;
|
||||
button.disabled = false;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user