Repository: fossasia/open-event-server

Issue:
Give event organizer the ability to decide if billing info is mandatory
Introduce a field in the event model for this purpose.


Discussion:
Issue-Label Bot is automatically applying the label `feature` to this issue, with a confidence of 0.99. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback! 

 Links: [app homepage](https://github.com/marketplace/issue-label-bot), [dashboard](https://mlbot.net/data/fossasia/open-event-server) and [code](https://github.com/hamelsmu/MLapp) for this bot.

Resolving patch:
diff --git a/app/api/schema/events.py b/app/api/schema/events.py
--- a/app/api/schema/events.py
+++ b/app/api/schema/events.py
@@ -82,6 +82,7 @@ def validate_timezone(self, data, original_data):
     revenue = fields.Float(dump_only=True)
     paypal_email = fields.Str(allow_none=True)
     is_tax_enabled = fields.Bool(default=False)
+    is_billing_info_mandatory = fields.Bool(default=False)
     is_donation_enabled = fields.Bool(default=False)
     can_pay_by_paypal = fields.Bool(default=False)
     can_pay_by_stripe = fields.Bool(default=False)
diff --git a/app/models/event.py b/app/models/event.py
--- a/app/models/event.py
+++ b/app/models/event.py
@@ -98,6 +98,7 @@ class Event(SoftDeletionModel):
     payment_currency = db.Column(db.String)
     paypal_email = db.Column(db.String)
     is_tax_enabled = db.Column(db.Boolean, default=False)
+    is_billing_info_mandatory = db.Column(db.Boolean, default=False)
     can_pay_by_paypal = db.Column(db.Boolean, default=False)
     can_pay_by_stripe = db.Column(db.Boolean, default=False)
     can_pay_by_cheque = db.Column(db.Boolean, default=False)
@@ -235,6 +236,7 @@ def __init__(self,
                  discount_code_id=None,
                  onsite_details=None,
                  is_tax_enabled=None,
+                 is_billing_info_mandatory=False,
                  is_sponsors_enabled=None,
                  stripe_authorization=None,
                  tax=None,
@@ -301,6 +303,7 @@ def __init__(self,
         self.discount_code_id = discount_code_id
         self.created_at = datetime.now(pytz.utc)
         self.is_tax_enabled = is_tax_enabled
+        self.is_billing_info_mandatory = is_billing_info_mandatory
         self.is_sponsors_enabled = is_sponsors_enabled
         self.stripe_authorization = stripe_authorization
         self.tax = tax
diff --git a/migrations/versions/2504915ffd08_.py b/migrations/versions/2504915ffd08_.py
new file mode 100644
--- /dev/null
+++ b/migrations/versions/2504915ffd08_.py
@@ -0,0 +1,31 @@
+"""empty message
+
+Revision ID: 2504915ffd08
+Revises: 96bca587b3ca
+Create Date: 2019-07-30 08:48:30.947153
+
+"""
+
+from alembic import op
+import sqlalchemy as sa
+import sqlalchemy_utils
+
+
+# revision identifiers, used by Alembic.
+revision = '2504915ffd08'
+down_revision = '96bca587b3ca'
+
+
+def upgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.add_column('events', sa.Column('is_billing_info_mandatory', sa.Boolean(), server_default='False'
+                                      , nullable=False))
+    op.add_column('events_version', sa.Column('is_billing_info_mandatory', sa.Boolean(), server_default='False',
+                                              autoincrement=False, nullable=False))
+
+
+def downgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.drop_column('events_version', 'is_billing_info_mandatory')
+    op.drop_column('events', 'is_billing_info_mandatory')
+    # ### end Alembic commands ###


Test patch: