|
|
@ -6,6 +6,7 @@ from fosspay.database import db |
|
|
|
from fosspay.common import * |
|
|
|
from fosspay.common import * |
|
|
|
from fosspay.config import _cfg, load_config |
|
|
|
from fosspay.config import _cfg, load_config |
|
|
|
from fosspay.email import send_thank_you, send_password_reset |
|
|
|
from fosspay.email import send_thank_you, send_password_reset |
|
|
|
|
|
|
|
from fosspay.currency import currency |
|
|
|
|
|
|
|
|
|
|
|
import os |
|
|
|
import os |
|
|
|
import locale |
|
|
|
import locale |
|
|
@ -75,7 +76,7 @@ def index(): |
|
|
|
patreon_count=patreon_count, |
|
|
|
patreon_count=patreon_count, |
|
|
|
patreon_sum=patreon_sum, |
|
|
|
patreon_sum=patreon_sum, |
|
|
|
lp_count=lp_count, |
|
|
|
lp_count=lp_count, |
|
|
|
lp_sum=lp_sum) |
|
|
|
lp_sum=lp_sum, currency=currency) |
|
|
|
|
|
|
|
|
|
|
|
@html.route("/setup", methods=["POST"]) |
|
|
|
@html.route("/setup", methods=["POST"]) |
|
|
|
def setup(): |
|
|
|
def setup(): |
|
|
@ -103,6 +104,7 @@ def admin(): |
|
|
|
first=first, |
|
|
|
first=first, |
|
|
|
projects=projects, |
|
|
|
projects=projects, |
|
|
|
donations=donations, |
|
|
|
donations=donations, |
|
|
|
|
|
|
|
currency=currency, |
|
|
|
one_times=lambda p: sum([d.amount for d in p.donations if d.type == DonationType.one_time]), |
|
|
|
one_times=lambda p: sum([d.amount for d in p.donations if d.type == DonationType.one_time]), |
|
|
|
recurring=lambda p: sum([d.amount for d in p.donations if d.type == DonationType.monthly and d.active]), |
|
|
|
recurring=lambda p: sum([d.amount for d in p.donations if d.type == DonationType.monthly and d.active]), |
|
|
|
recurring_ever=lambda p: sum([d.amount * d.payments for d in p.donations if d.type == DonationType.monthly]), |
|
|
|
recurring_ever=lambda p: sum([d.amount * d.payments for d in p.donations if d.type == DonationType.monthly]), |
|
|
@ -202,7 +204,7 @@ def donate(): |
|
|
|
try: |
|
|
|
try: |
|
|
|
charge = stripe.Charge.create( |
|
|
|
charge = stripe.Charge.create( |
|
|
|
amount=amount, |
|
|
|
amount=amount, |
|
|
|
currency="usd", |
|
|
|
currency=_cfg("currency"), |
|
|
|
customer=user.stripe_customer, |
|
|
|
customer=user.stripe_customer, |
|
|
|
description="Donation to " + _cfg("your-name") |
|
|
|
description="Donation to " + _cfg("your-name") |
|
|
|
) |
|
|
|
) |
|
|
@ -276,7 +278,8 @@ def reset_password(token): |
|
|
|
def panel(): |
|
|
|
def panel(): |
|
|
|
return render_template("panel.html", |
|
|
|
return render_template("panel.html", |
|
|
|
one_times=lambda u: [d for d in u.donations if d.type == DonationType.one_time], |
|
|
|
one_times=lambda u: [d for d in u.donations if d.type == DonationType.one_time], |
|
|
|
recurring=lambda u: [d for d in u.donations if d.type == DonationType.monthly and d.active]) |
|
|
|
recurring=lambda u: [d for d in u.donations if d.type == DonationType.monthly and d.active], |
|
|
|
|
|
|
|
currency=currency) |
|
|
|
|
|
|
|
|
|
|
|
@html.route("/cancel/<id>") |
|
|
|
@html.route("/cancel/<id>") |
|
|
|
@loginrequired |
|
|
|
@loginrequired |
|
|
|