From 84d34e291ab573f2198e3d8734156bdc10df8887 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sat, 5 Sep 2015 21:58:52 -0400 Subject: [PATCH] Set up stripe API key on application start --- fosspay/app.py | 5 +++-- fosspay/objects.py | 1 + templates/admin.html | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fosspay/app.py b/fosspay/app.py index e8cc6a9..3ea8680 100644 --- a/fosspay/app.py +++ b/fosspay/app.py @@ -5,6 +5,7 @@ from jinja2 import FileSystemLoader, ChoiceLoader import sys import os import locale +import stripe from fosspay.config import _cfg, _cfgi from fosspay.database import db, init_db @@ -12,8 +13,6 @@ from fosspay.objects import User from fosspay.common import * from fosspay.network import * -import fosspay.stripe - from fosspay.blueprints.html import html app = Flask(__name__) @@ -28,6 +27,8 @@ app.jinja_loader = ChoiceLoader([ FileSystemLoader("templates"), ]) +stripe.api_key = _cfg("stripe-secret") + @login_manager.user_loader def load_user(email): return User.query.filter(User.email == email).first() diff --git a/fosspay/objects.py b/fosspay/objects.py index 366df5e..4bb6365 100644 --- a/fosspay/objects.py +++ b/fosspay/objects.py @@ -24,6 +24,7 @@ class User(Base): created = Column(DateTime) password_reset = Column(String(128)) password_reset_expires = Column(DateTime) + stripe_customer = Column(String(256)) def set_password(self, password): self.password = bcrypt.hashpw(password.encode("utf-8"), bcrypt.gensalt()).decode("utf-8") diff --git a/templates/admin.html b/templates/admin.html index 3f0a3fa..b7d25ce 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -12,6 +12,9 @@ Yeah, it's not pretty. Next steps:

    +
  1. + Set up a cron job to handle monthly donations. Relevant documentation. +
  2. Add some projects. Donors can tell you which project they want to support when they donate. @@ -22,10 +25,10 @@ overrides directory and change it to suit your needs.
  3. - Donate to fosspay upstream? + Donate to fosspay upstream?
  4. - Contribute code to fosspay upstream? + Contribute code to fosspay upstream?