Adding grace period to stripe customer check.

This commit is contained in:
Samuel Clay 2018-04-27 10:26:41 -07:00
parent 38763fa2c9
commit baa3463213

View file

@ -342,9 +342,10 @@ def stripe_form(request):
user.email = zebra_form.cleaned_data['email']
user.save()
grace_period = datetime.datetime.now() - datetime.timedelta(days=30)
current_premium = (user.profile.is_premium and
user.profile.premium_expire and
user.profile.premium_expire > datetime.datetime.now())
user.profile.premium_expire > grace_period)
# Are they changing their existing card?
if user.profile.stripe_id and current_premium:
customer = stripe.Customer.retrieve(user.profile.stripe_id)