remove monthly pricing, display 20$ for monthly pricing

This commit is contained in:
Son NK 2019-08-19 21:28:17 +02:00
parent f03fb6edcb
commit 5ff317538c
6 changed files with 6 additions and 20 deletions

View File

@ -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

View File

@ -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"])

View File

@ -50,9 +50,7 @@
<div class="card">
<div class="card-body text-center">
<div class="card-category">Premium</div>
<div class="display-4 my-6">$10/year</div>
<div class="display-5 my-6">or</div>
<div class="display-4 my-6">$1/month</div>
<div class="display-4 my-6">$20/year</div>
<ul class="list-unstyled leading-loose">
<li><i class="fe fe-check text-success mr-2" aria-hidden="true"></i> Infinite Emails</li>
<li><i class="fe fe-check text-success mr-2" aria-hidden="true"></i> Custom Alias</li>
@ -94,10 +92,6 @@
<input type="radio" class="custom-control-input" name="plan" value="yearly" checked>
<span class="custom-control-label">Yearly</span>
</label>
<label class="custom-control custom-radio custom-control-inline">
<input type="radio" class="custom-control-input" name="plan" value="monthly">
<span class="custom-control-label">Monthly</span>
</label>
</div>
</div>

View File

@ -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}],

View File

@ -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():

View File

@ -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