forked from dj-stripe/dj-stripe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
safe_settings.py
47 lines (35 loc) · 1.33 KB
/
safe_settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
try:
# For Python 2.7 and Python 3.x users
from collections import OrderedDict
except ImportError:
# For Python 2.6 users
from ordereddict import OrderedDict
from django.conf import settings
STRIPE_PUBLIC_KEY = settings.STRIPE_PUBLIC_KEY
INVOICE_FROM_EMAIL = getattr(
settings,
"DJSTRIPE_INVOICE_FROM_EMAIL",
)
# Get the PAYMENTS_PLANS dictionary
PAYMENTS_PLANS = getattr(settings, "DJSTRIPE_PLANS", {})
# Sort the PAYMENT_PLANS dictionary ascending by price.
PAYMENT_PLANS = OrderedDict(sorted(PAYMENTS_PLANS.items(), key=lambda t: t[1]['price']))
PLAN_CHOICES = [
(plan, PAYMENTS_PLANS[plan].get("name", plan))
for plan in PAYMENTS_PLANS
]
PASSWORD_INPUT_RENDER_VALUE = getattr(
settings, 'DJSTRIPE_PASSWORD_INPUT_RENDER_VALUE', False)
PASSWORD_MIN_LENGTH = getattr(
settings, 'DJSTRIPE_PASSWORD_MIN_LENGTH', 6)
PRORATION_POLICY = getattr(
settings, 'DJSTRIPE_PRORATION_POLICY', False)
PRORATION_POLICY_FOR_UPGRADES = getattr(
settings, 'DJSTRIPE_PRORATION_POLICY_FOR_UPGRADES', False)
# TODO - need to find a better way to do this
CANCELLATION_AT_PERIOD_END = not PRORATION_POLICY
# Manages sending of receipt emails
SEND_INVOICE_RECEIPT_EMAILS = getattr(settings, "DJSTRIPE_SEND_INVOICE_RECEIPT_EMAILS", True)