Repository: fossasia/open-event-server

Issue:
Add test stripe client ID field in settings model
I was mistaken, as there is a separate client ID for testing. Please add this field in Settings Model as well


Discussion:
On It

Resolving patch:
diff --git a/app/api/schema/settings.py b/app/api/schema/settings.py
--- a/app/api/schema/settings.py
+++ b/app/api/schema/settings.py
@@ -80,12 +80,6 @@ class Meta:
 
     id = fields.Str(dump_only=True)
 
-    # Stripe Keys
-    stripe_client_id = fields.Str(allow_none=True)
-    stripe_publishable_key = fields.Str(allow_none=True)
-    stripe_test_secret_key = fields.Str(allow_none=True)
-    stripe_test_publishable_key = fields.Str(allow_none=True)
-
     #
     # Generators
     #
@@ -165,8 +159,13 @@ class Meta:
     # Payment Gateway
     #
 
-    # Stripe secret key
+    # 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)
@@ -182,7 +181,7 @@ class Meta:
     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)
 
diff --git a/app/models/setting.py b/app/models/setting.py
--- a/app/models/setting.py
+++ b/app/models/setting.py
@@ -83,6 +83,7 @@ class Setting(db.Model):
     stripe_client_id = db.Column(db.String)
     stripe_secret_key = db.Column(db.String)
     stripe_publishable_key = db.Column(db.String)
+    stripe_test_client_id = db.Column(db.String)
     stripe_test_secret_key = db.Column(db.String)
     stripe_test_publishable_key = db.Column(db.String)
 
@@ -191,7 +192,7 @@ def __init__(self,
                  is_google_recaptcha_enabled=False, google_recaptcha_secret=None, google_recaptcha_site=None,
                  google_client_id=None, google_client_secret=None,
                  fb_client_id=None, fb_client_secret=None, tw_consumer_key=None,
-                 stripe_client_id=None,
+                 stripe_client_id=None, stripe_test_client_id=None,
                  stripe_secret_key=None, stripe_publishable_key=None,
                  stripe_test_secret_key=None, stripe_test_publishable_key=None,
                  in_client_id=None, in_client_secret=None,
@@ -288,6 +289,7 @@ def __init__(self,
         self.stripe_client_id = stripe_client_id
         self.stripe_publishable_key = stripe_publishable_key
         self.stripe_secret_key = stripe_secret_key
+        self.stripe_test_client_id = stripe_test_client_id
         self.stripe_test_publishable_key = stripe_test_publishable_key
         self.stripe_test_secret_key = stripe_test_secret_key
         self.web_app_url = web_app_url
diff --git a/migrations/versions/rev-2019-08-13-16:07:52-cd3beca1951a_.py b/migrations/versions/rev-2019-08-13-16:07:52-cd3beca1951a_.py
new file mode 100644
--- /dev/null
+++ b/migrations/versions/rev-2019-08-13-16:07:52-cd3beca1951a_.py
@@ -0,0 +1,28 @@
+"""empty message
+
+Revision ID: cd3beca1951a
+Revises: d252c86d0200
+Create Date: 2019-08-13 16:07:52.020447
+
+"""
+
+from alembic import op
+import sqlalchemy as sa
+import sqlalchemy_utils
+
+
+# revision identifiers, used by Alembic.
+revision = 'cd3beca1951a'
+down_revision = 'd252c86d0200'
+
+
+def upgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.add_column('settings', sa.Column('stripe_test_client_id', sa.String(), nullable=True))
+    # ### end Alembic commands ###
+
+
+def downgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.drop_column('settings', 'stripe_test_client_id')
+    # ### end Alembic commands ###


Test patch: