Repository: fossasia/open-event-server

Issue:
Add details for admin invoice billing 
**Describe the feature**
Related front-end PR:https://github.com/fossasia/open-event-frontend/pull/3152
We need model additions for admin invoice billing info in settings so that the organisers can pay their invoice to the admin.

**Additional context**
Working on it.


Discussion:

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
@@ -196,3 +196,15 @@ class Meta:
     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
+
+    # 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_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)
diff --git a/app/models/setting.py b/app/models/setting.py
--- a/app/models/setting.py
+++ b/app/models/setting.py
@@ -129,6 +129,19 @@ class Setting(db.Model):
     facebook_url = db.Column(db.String)
     youtube_url = db.Column(db.String)
 
+    #
+    # Admin Invoice Details
+    #
+    admin_billing_contact_name = db.Column(db.String)
+    admin_billing_phone = db.Column(db.String)
+    admin_billing_email = db.Column(db.String)
+    admin_billing_country = db.Column(db.String)
+    admin_billing_tax_info = db.Column(db.String)
+    admin_company = db.Column(db.String)
+    admin_billing_address = db.Column(db.String)
+    admin_billing_city = db.Column(db.String)
+    admin_billing_zip = db.Column(db.String)
+    admin_billing_additional_info = db.Column(db.String)
     #
     # Generators
     #
@@ -197,7 +210,17 @@ def __init__(self,
                  omise_live_public=None,
                  omise_live_secret=None,
                  alipay_publishable_key=None,
-                 alipay_secret_key=None):
+                 alipay_secret_key=None,
+                 admin_billing_contact_name=None,
+                 admin_billing_phone=None,
+                 admin_billing_email=None,
+                 admin_billing_country=None,
+                 admin_billing_tax_info=None,
+                 admin_company=None,
+                 admin_billing_address=None,
+                 admin_billing_city=None,
+                 admin_billing_zip=None,
+                 admin_billing_additional_info=None):
         self.app_environment = app_environment
         self.aws_key = aws_key
         self.aws_secret = aws_secret
@@ -268,6 +291,17 @@ def __init__(self,
         self.alipay_publishable_key = alipay_publishable_key
         self.alipay_secret_key = alipay_secret_key
 
+        # Admin Invoice Details
+        self.admin_billing_contact_name = admin_billing_contact_name
+        self.admin_billing_phone = admin_billing_phone
+        self.admin_billing_country = admin_billing_country
+        self.admin_billing_tax_info = admin_billing_tax_info
+        self.admin_company = admin_company
+        self.admin_billing_address = admin_billing_address
+        self.admin_billing_city = admin_billing_city
+        self.admin_billing_zip = admin_billing_zip
+        self.admin_billing_additional_info = admin_billing_additional_info
+
     @hybrid_property
     def is_paypal_activated(self):
         if self.paypal_mode == 'sandbox' and self.paypal_sandbox_client and self.paypal_sandbox_secret:
diff --git a/migrations/versions/b08a4ffff5dd_.py b/migrations/versions/b08a4ffff5dd_.py
new file mode 100644
--- /dev/null
+++ b/migrations/versions/b08a4ffff5dd_.py
@@ -0,0 +1,46 @@
+"""empty message
+
+Revision ID: b08a4ffff5dd
+Revises: 43e8c59337ae
+Create Date: 2019-06-26 18:20:41.181139
+
+"""
+
+from alembic import op
+import sqlalchemy as sa
+import sqlalchemy_utils
+
+
+# revision identifiers, used by Alembic.
+revision = 'b08a4ffff5dd'
+down_revision = '43e8c59337ae'
+
+
+def upgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.add_column('settings', sa.Column('admin_billing_additional_info', sa.String(), nullable=True))
+    op.add_column('settings', sa.Column('admin_billing_address', sa.String(), nullable=True))
+    op.add_column('settings', sa.Column('admin_billing_city', sa.String(), nullable=True))
+    op.add_column('settings', sa.Column('admin_billing_contact_name', sa.String(), nullable=True))
+    op.add_column('settings', sa.Column('admin_billing_country', sa.String(), nullable=True))
+    op.add_column('settings', sa.Column('admin_billing_email', sa.String(), nullable=True))
+    op.add_column('settings', sa.Column('admin_billing_phone', sa.String(), nullable=True))
+    op.add_column('settings', sa.Column('admin_billing_tax_info', sa.String(), nullable=True))
+    op.add_column('settings', sa.Column('admin_billing_zip', sa.String(), nullable=True))
+    op.add_column('settings', sa.Column('admin_company', sa.String(), nullable=True))
+    # ### end Alembic commands ###
+
+
+def downgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.drop_column('settings', 'admin_company')
+    op.drop_column('settings', 'admin_billing_zip')
+    op.drop_column('settings', 'admin_billing_tax_info')
+    op.drop_column('settings', 'admin_billing_phone')
+    op.drop_column('settings', 'admin_billing_email')
+    op.drop_column('settings', 'admin_billing_country')
+    op.drop_column('settings', 'admin_billing_contact_name')
+    op.drop_column('settings', 'admin_billing_city')
+    op.drop_column('settings', 'admin_billing_address')
+    op.drop_column('settings', 'admin_billing_additional_info')
+    # ### end Alembic commands ###


Test patch: