Skip to content

Commit 2fdef14

Browse files
catInOrbitnorbusan
andauthored
Issue 8649 stripe payment backend (#8904)
* fixed stripe payment issue, ensure keys retrieval * Update __init__.py remove strip * formated code * recorrect sqlalchemy query * Update __init__.py remove strip circleci doesn't like it --------- Co-authored-by: Norbert Preining <[email protected]>
1 parent eb1ae93 commit 2fdef14

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

app/api/helpers/payment.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ def get_credentials(event=None):
3939
:return: Stripe secret and publishable keys.
4040
"""
4141
if not event:
42-
settings = get_settings()
42+
# Perform refresh from db to make sure Stripe keys are retrieved
43+
settings = get_settings(from_db=True)
4344
if (
4445
settings['app_environment'] == 'development'
4546
and settings['stripe_test_secret_key']

app/settings/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ def get_settings(from_db=False):
1111
"""
1212
if not from_db and 'custom_settings' in current_app.config:
1313
return current_app.config['custom_settings']
14-
s = Setting.query.order_by(desc(Setting.id)).first()
14+
1515
app_environment = current_app.config.get('ENV', 'production')
16+
# query environment based on initial config applied at start for Flask app
17+
s = Setting.query.filter(Setting.app_environment == app_environment).first()
18+
1619
if s is None:
1720
set_settings(app_name='Open Event', app_environment=app_environment)
1821
else:

0 commit comments

Comments
 (0)