Repository: fossasia/open-event-server

Issue:
Adding fields for organizer billing info
**Describe the feature**
Related Frontend Issue:https://github.com/fossasia/open-event-frontend/issues/3117
There is a requirement to submit the billing info so that the organiser can pay the invoice. For this, additional fields need to be added in the user model.

(Add fields for the following information: Contact Name*, Phone, Email (Use account email here), Country*, Tax ID, Registered Entity or Company, Business Address*, City*, ZIP Code*, Additional Info)

**Additional context**
Working on this


Discussion:

Resolving patch:
diff --git a/app/api/schema/users.py b/app/api/schema/users.py
--- a/app/api/schema/users.py
+++ b/app/api/schema/users.py
@@ -69,6 +69,15 @@ class Meta:
     deleted_at = fields.DateTime(dump_only=True)
     details = fields.Str(allow_none=True)
     contact = fields.Str(allow_none=True)
+    billing_contact_name = fields.Str(allow_none=True)
+    billing_phone = fields.Str(allow_none=True)
+    billing_country = fields.Str(allow_none=True)
+    billing_tax_info = fields.Str(allow_none=True)
+    company = fields.Str(allow_none=True)
+    billing_address = fields.Str(allow_none=True)
+    billing_city = fields.Str(allow_none=True)
+    billing_zip_code = fields.Str(allow_none=True)
+    billing_additional_info = fields.Str(allow_none=True)
     notifications = Relationship(
         attribute='notifications',
         self_view='v1.user_notification',
diff --git a/app/models/user.py b/app/models/user.py
--- a/app/models/user.py
+++ b/app/models/user.py
@@ -79,6 +79,18 @@ class User(SoftDeletionModel):
     was_registered_with_order = db.Column(db.Boolean, default=False)
     last_accessed_at = db.Column(db.DateTime(timezone=True))
     created_at = db.Column(db.DateTime(timezone=True), default=func.now())
+    # Event Invoice Details
+    billing_contact_name = db.Column(db.String)
+    billing_phone = db.Column(db.String)
+    billing_country = db.Column(db.String)
+    billing_tax_info = db.Column(db.String)
+    company = db.Column(db.String)
+    billing_address = db.Column(db.String)
+    billing_city = db.Column(db.String)
+    billing_zip_code = db.Column(db.String)
+    billing_additional_info = db.Column(db.String)
+
+    # relationships
     speaker = db.relationship('Speaker', backref="user")
     favourite_events = db.relationship('UserFavouriteEvent', backref="user")
     session = db.relationship('Session', backref="user")
diff --git a/migrations/versions/4279c2ac565b_.py b/migrations/versions/4279c2ac565b_.py
new file mode 100644
--- /dev/null
+++ b/migrations/versions/4279c2ac565b_.py
@@ -0,0 +1,44 @@
+"""empty message
+
+Revision ID: 4279c2ac565b
+Revises: 2c7ff9781032
+Create Date: 2019-06-28 09:37:30.961354
+
+"""
+
+from alembic import op
+import sqlalchemy as sa
+import sqlalchemy_utils
+
+
+# revision identifiers, used by Alembic.
+revision = '4279c2ac565b'
+down_revision = '2c7ff9781032'
+
+
+def upgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.add_column('users', sa.Column('billing_additional_info', sa.String(), nullable=True))
+    op.add_column('users', sa.Column('billing_address', sa.String(), nullable=True))
+    op.add_column('users', sa.Column('billing_city', sa.String(), nullable=True))
+    op.add_column('users', sa.Column('billing_contact_name', sa.String(), nullable=True))
+    op.add_column('users', sa.Column('billing_country', sa.String(), nullable=True))
+    op.add_column('users', sa.Column('billing_phone', sa.String(), nullable=True))
+    op.add_column('users', sa.Column('billing_tax_info', sa.String(), nullable=True))
+    op.add_column('users', sa.Column('billing_zip_code', sa.String(), nullable=True))
+    op.add_column('users', sa.Column('company', sa.String(), nullable=True))
+    # ### end Alembic commands ###
+
+
+def downgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.drop_column('users', 'company')
+    op.drop_column('users', 'billing_zip_code')
+    op.drop_column('users', 'billing_tax_info')
+    op.drop_column('users', 'billing_phone')
+    op.drop_column('users', 'billing_country')
+    op.drop_column('users', 'billing_contact_name')
+    op.drop_column('users', 'billing_city')
+    op.drop_column('users', 'billing_address')
+    op.drop_column('users', 'billing_additional_info')
+    # ### end Alembic commands ###


Test patch: