diff --git a/.env.example b/.env.example index 4c6ddd0f..ce63e729 100644 --- a/.env.example +++ b/.env.example @@ -33,7 +33,6 @@ CLOUDWATCH_LOG_STREAM=local # Stripe STRIPE_YEARLY_PLAN=to_fill -STRIPE_MONTHLY_PLAN=to_fill STRIPE_API=to_fill STRIPE_SECRET_KEY=to_fill diff --git a/app/config.py b/app/config.py index 90d932a8..4e4d7f2f 100644 --- a/app/config.py +++ b/app/config.py @@ -64,7 +64,6 @@ CLOUDWATCH_LOG_STREAM = os.environ["CLOUDWATCH_LOG_STREAM"] STRIPE_API = os.environ["STRIPE_API"] # Stripe public key STRIPE_SECRET_KEY = os.environ["STRIPE_SECRET_KEY"] STRIPE_YEARLY_PLAN = os.environ["STRIPE_YEARLY_PLAN"] -STRIPE_MONTHLY_PLAN = os.environ["STRIPE_MONTHLY_PLAN"] # OpenID keys, used to sign id_token OPENID_PRIVATE_KEY_PATH = get_abs_path(os.environ["OPENID_PRIVATE_KEY_PATH"]) diff --git a/app/dashboard/templates/dashboard/pricing.html b/app/dashboard/templates/dashboard/pricing.html index 37d4259e..9eebfe33 100644 --- a/app/dashboard/templates/dashboard/pricing.html +++ b/app/dashboard/templates/dashboard/pricing.html @@ -50,9 +50,7 @@
Premium
-
$10/year
-
or
-
$1/month
+
$20/year
diff --git a/app/dashboard/views/pricing.py b/app/dashboard/views/pricing.py index 4075a5c7..40a95f1e 100644 --- a/app/dashboard/views/pricing.py +++ b/app/dashboard/views/pricing.py @@ -3,7 +3,7 @@ from flask import render_template, request, flash, redirect, url_for from flask_login import login_required, current_user from stripe.error import CardError -from app.config import STRIPE_API, STRIPE_MONTHLY_PLAN, STRIPE_YEARLY_PLAN +from app.config import STRIPE_API, STRIPE_YEARLY_PLAN from app.dashboard.base import dashboard_bp from app.email_utils import notify_admin from app.extensions import db @@ -31,10 +31,8 @@ def pricing(): raise Exception("user email is already used on stripe!") if request.method == "POST": - plan_str = request.form.get("plan") # either monthly or yearly - if plan_str == "monthly": - plan = PlanEnum.monthly - elif plan_str == "yearly": + plan_str = request.form.get("plan") # yearly + if plan_str == "yearly": plan = PlanEnum.yearly else: raise Exception("Plan must be either yearly or monthly") @@ -60,9 +58,7 @@ def pricing(): LOG.d("stripe customer %s", customer) current_user.stripe_customer_id = customer.id - stripe_plan = ( - STRIPE_MONTHLY_PLAN if plan == PlanEnum.monthly else STRIPE_YEARLY_PLAN - ) + stripe_plan = STRIPE_YEARLY_PLAN subscription = stripe.Subscription.create( customer=current_user.stripe_customer_id, items=[{"plan": stripe_plan}], diff --git a/app/models.py b/app/models.py index ad0bf4f3..93fbbc8a 100644 --- a/app/models.py +++ b/app/models.py @@ -82,7 +82,6 @@ class File(db.Model, ModelMixin): class PlanEnum(enum.Enum): free = 0 trial = 1 - monthly = 2 yearly = 3 @@ -149,7 +148,7 @@ class User(db.Model, ModelMixin, UserMixin): return False def is_premium(self): - return self.plan in (PlanEnum.monthly, PlanEnum.yearly) + return self.plan == PlanEnum.yearly def can_create_custom_email(self): if self.is_premium(): diff --git a/tests/env.test b/tests/env.test index 528d42b5..e3260538 100644 --- a/tests/env.test +++ b/tests/env.test @@ -33,7 +33,6 @@ CLOUDWATCH_LOG_STREAM=local # Stripe STRIPE_YEARLY_PLAN=to_fill -STRIPE_MONTHLY_PLAN=to_fill STRIPE_API=to_fill STRIPE_SECRET_KEY=to_fill