forked from fossasia/open-event-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.py
More file actions
273 lines (222 loc) · 8.09 KB
/
settings.py
File metadata and controls
273 lines (222 loc) · 8.09 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
from marshmallow_jsonapi import fields
from marshmallow_jsonapi.flask import Schema
from app.api.helpers.utilities import dasherize
from app.settings import Environment
from utils.common import use_defaults
class SettingSchemaPublic(Schema):
"""
Public Api schema for settings Model
"""
class Meta:
"""
Meta class for setting Api Schema
"""
type_ = 'setting'
self_view = 'v1.setting_detail'
self_view_kwargs = {'id': '<id>'}
inflect = dasherize
id = fields.Str(dump_only=True)
# Name of the application. (Eg. Event Yay!, Open Event)
app_name = fields.Str(allow_none=True)
# Tagline for the application. (Eg. Event Management and Ticketing, Home)
tagline = fields.Str(allow_none=True)
# Order Expiry Time
order_expiry_time = fields.Integer(
allow_none=False, default=15, validate=lambda n: 1 <= n <= 60
)
# Maximum number of complex custom fields allowed for a given form
max_complex_custom_fields = fields.Integer(
allow_none=False, default=30, validate=lambda n: 1 <= n <= 30
)
# Google Analytics
analytics_key = fields.Str(allow_none=True)
# FB
fb_client_id = fields.Str(allow_none=True)
#
# Social links
#
google_url = fields.Str(allow_none=True)
github_url = fields.Str(allow_none=True)
twitter_url = fields.Str(allow_none=True)
support_url = fields.Str(allow_none=True)
facebook_url = fields.Str(allow_none=True)
instagram_url = fields.Str(allow_none=True)
patreon_url = fields.Str(allow_none=True)
gitter_url = fields.Str(allow_none=True)
telegram_url = fields.Str(allow_none=True)
youtube_url = fields.Str(allow_none=True)
# Url of Frontend
frontend_url = fields.Url(allow_none=True)
#
# Cookie Policy
#
cookie_policy = fields.Str(allow_none=True)
cookie_policy_link = fields.Str(allow_none=True)
#
# Online Payment Flags
#
is_paytm_activated = fields.Bool(default=False)
is_paypal_activated = fields.Bool(dump_only=True)
is_stripe_activated = fields.Bool(dump_only=True)
is_omise_activated = fields.Bool(dump_only=True)
is_alipay_activated = fields.Bool(dump_only=True)
is_billing_paypal_activated = fields.Bool(dump_only=True)
#
# Payment Gateways
#
# Stripe Credantials
stripe_client_id = fields.Str(dump_only=True)
stripe_publishable_key = fields.Str(dump_only=True)
stripe_test_client_id = fields.Str(dump_only=True)
stripe_test_publishable_key = fields.Str(dump_only=True)
# PayPal Credentials
paypal_mode = fields.Str(dump_only=True)
paypal_client = fields.Str(dump_only=True)
paypal_sandbox_client = fields.Str(dump_only=True)
# Omise Credentials
omise_mode = fields.Str(dump_only=True)
omise_test_public = fields.Str(dump_only=True)
omise_live_public = fields.Str(dump_only=True)
# Alipay Credentials
alipay_publishable_key = fields.Str(dump_only=True)
# payTM credentials
paytm_mode = fields.Str(dump_only=True)
paytm_live_merchant = fields.Str(dump_only=True)
paytm_sandbox_merchant = fields.Str(dump_only=True)
# Admin Invoice Details
admin_billing_contact_name = fields.Str(allow_none=True)
admin_billing_phone = fields.Str(allow_none=True)
admin_billing_email = fields.Email(allow_none=True)
admin_billing_state = fields.Str(allow_none=True)
admin_billing_country = fields.Str(allow_none=True)
admin_billing_tax_info = fields.Str(allow_none=True)
admin_company = fields.Str(allow_none=True)
admin_billing_address = fields.Str(allow_none=True)
admin_billing_city = fields.Str(allow_none=True)
admin_billing_zip = fields.Str(allow_none=True)
admin_billing_additional_info = fields.Str(allow_none=True)
class SettingSchemaNonAdmin(SettingSchemaPublic):
"""
Non Admin Api schema for settings Model
"""
class Meta:
"""
Meta class for setting Api Schema
"""
type_ = 'setting'
self_view = 'v1.setting_detail'
self_view_kwargs = {'id': '<id>'}
inflect = dasherize
id = fields.Str(dump_only=True)
#
# Generators
#
android_app_url = fields.Str(allow_none=True)
web_app_url = fields.Str(allow_none=True)
@use_defaults()
class SettingSchemaAdmin(SettingSchemaNonAdmin):
"""
Admin Api schema for settings Model
"""
class Meta:
"""
Meta class for setting Api Schema
"""
type_ = 'setting'
self_view = 'v1.setting_detail'
self_view_kwargs = {'id': '<id>'}
inflect = dasherize
id = fields.Str(dump_only=True)
#
# General
#
app_environment = fields.Str(default=Environment.PRODUCTION)
# Static domain
static_domain = fields.Str(allow_none=True)
#
# STORAGE
#
# storage place, local, s3, .. can be more in future
storage_place = fields.Str(allow_none=True)
# S3
aws_key = fields.Str(allow_none=True)
aws_secret = fields.Str(allow_none=True)
aws_bucket_name = fields.Str(allow_none=True)
aws_region = fields.Str(allow_none=True)
# Google Storage
gs_key = fields.Str(allow_none=True)
gs_secret = fields.Str(allow_none=True)
gs_bucket_name = fields.Str(allow_none=True)
#
# CAPTCHA
#
# Google reCAPTCHA
is_google_recaptcha_enabled = fields.Bool(allow_none=False, default=False)
google_recaptcha_site = fields.Str(allow_none=True)
google_recaptcha_secret = fields.Str(allow_none=True)
#
# Social Login
#
# Google Auth
google_client_id = fields.Str(allow_none=True)
google_client_secret = fields.Str(allow_none=True)
# FB
fb_client_id = fields.Str(allow_none=True)
fb_client_secret = fields.Str(allow_none=True)
# Twitter
tw_consumer_key = fields.Str(allow_none=True)
tw_consumer_secret = fields.Str(allow_none=True)
# Instagram
in_client_id = fields.Str(allow_none=True)
in_client_secret = fields.Str(allow_none=True)
#
# Payment Gateways
#
# Stripe Credantials
stripe_client_id = fields.Str(allow_none=True)
stripe_publishable_key = fields.Str(allow_none=True)
stripe_secret_key = fields.Str(allow_none=True)
stripe_test_client_id = fields.Str(allow_none=True)
stripe_test_secret_key = fields.Str(allow_none=True)
stripe_test_publishable_key = fields.Str(allow_none=True)
# PayPal Credentials
paypal_mode = fields.Str(allow_none=True)
paypal_client = fields.Str(allow_none=True)
paypal_secret = fields.Str(allow_none=True)
paypal_sandbox_client = fields.Str(allow_none=True)
paypal_sandbox_secret = fields.Str(allow_none=True)
# Omise Credentials
omise_mode = fields.Str(allow_none=True)
omise_test_public = fields.Str(allow_none=True)
omise_test_secret = fields.Str(allow_none=True)
omise_live_public = fields.Str(allow_none=True)
omise_live_secret = fields.Str(allow_none=True)
# Alipay Credentials
alipay_publishable_key = fields.Str(allow_none=True)
alipay_secret_key = fields.Str(allow_none=True)
# payTM credentials
paytm_mode = fields.Str(allow_none=True)
paytm_live_merchant = fields.Str(allow_none=True)
paytm_live_secret = fields.Str(allow_none=True)
paytm_sandbox_merchant = fields.Str(allow_none=True)
paytm_sandbox_secret = fields.Str(allow_none=True)
#
# EMAIL
#
# Email service. (sendgrid,smtp)
email_service = fields.Str(allow_none=True)
email_from = fields.Str(allow_none=True)
email_from_name = fields.Str(allow_none=True)
# Sendgrid
sendgrid_key = fields.Str(allow_none=True)
# SMTP
smtp_host = fields.Str(allow_none=True)
smtp_username = fields.Str(allow_none=True)
smtp_password = fields.Str(allow_none=True)
smtp_port = fields.Integer(allow_none=True)
smtp_encryption = fields.Str(allow_none=True) # Can be tls, ssl, none
# Event Invoices settings
invoice_sending_day = fields.Integer(allow_none=False, default=1)
invoice_sending_timezone = fields.Str(allow_none=False, default="UTC")
# Admin Invoice Details
admin_billing_paypal_email = fields.Email(allow_none=True)