Skip to content

Commit

Permalink
Merge pull request #139 from bcgov/development
Browse files Browse the repository at this point in the history
Merge from development to master
  • Loading branch information
sumesh-aot authored Jan 9, 2020
2 parents 5f23be1 + b3c7324 commit 7df1b25
Show file tree
Hide file tree
Showing 49 changed files with 840 additions and 420 deletions.
15 changes: 15 additions & 0 deletions docs/docs/database/query_for_fee_schedule.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
select
fs.corp_type_code as corp_type_code,
fs.filing_type_code as filing_type_code,
ft.description as filing_type,
fc.amount as amount,
p_fc.amount as priority_fee,
fut_fc.amount as future_effective_fee
from
(
(
(fee_schedule fs left join fee_code fc on fc.code=fs.fee_code)
left join fee_code p_fc on p_fc.code=fs.priority_fee_code)
left join fee_code fut_fc on fut_fc.code=fs.future_effective_fee_code)
left join filing_type ft on ft.code=fs.filing_type_code
order by corp_type_code desc, filing_type_code asc
231 changes: 231 additions & 0 deletions pay-api/migrations/versions/00467a306afd_bcorp_filing_types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
"""bcorp_filing_types
Revision ID: 110be55ccb82
Revises: 1a4e08683cb2
Create Date: 2019-12-16 09:08:29.440422
"""
from alembic import op
import sqlalchemy as sa
from datetime import date

from alembic import op
from sqlalchemy import Date, Integer, String, Float
from sqlalchemy.sql import column, table


# revision identifiers, used by Alembic.
revision = '00467a306afd'
down_revision = '1a4e08683cb2'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('fee_schedule', sa.Column('future_effective_fee_code', sa.String(length=10), nullable=True))
op.add_column('fee_schedule', sa.Column('priority_fee_code', sa.String(length=10), nullable=True))
op.create_foreign_key(None, 'fee_schedule', 'fee_code', ['priority_fee_code'], ['code'])
op.create_foreign_key(None, 'fee_schedule', 'fee_code', ['future_effective_fee_code'], ['code'])
# ### end Alembic commands ###

# Delete existing BCORP fee codes
# op.execute('DELETE FROM fee_schedule where corp_type_code=\'BC\'')

op.execute("update corp_type set description='BC Company' where code='BC'")

fee_code_table = table("fee_code", column("code", String), column("amount", Float))

filing_type_table = table(
"filing_type", column("code", String), column("description", String)
)

fee_schedule_table = table(
"fee_schedule",
column("filing_type_code", String),
column("corp_type_code", String),
column("fee_code", String),
column("fee_start_date", Date),
column("fee_end_date", Date),
column("future_effective_fee_code", String),
column("priority_fee_code", String)
)

# Fee Codes
op.bulk_insert(
fee_code_table, [
{"code": "EN109", "amount": 350},
{"code": "FUT01", "amount": 100},
{"code": "PRI01", "amount": 100}
]
)

# Filing Types
op.bulk_insert(
filing_type_table,
[
{'code': 'BCANN', 'description': 'Annual Report'},
{'code': 'BCADD', 'description': 'Change of Registered Office Address'},
{'code': 'BCCDR', 'description': 'Change of Director'},
{'code': 'BCINC', 'description': 'Incorporation'},
{'code': 'BCCGM', 'description': 'Notice of Change'},
{'code': 'BCFDR', 'description': 'Change of Director'},
{'code': 'BCAMR', 'description': 'Amalgamation Application (Regular)'},
{'code': 'BCAMH', 'description': 'Amalgamation Application Short Form (Horizontal)'},
{'code': 'BCAMV', 'description': 'Amalgamtion Application Short Form (Vertical)'},
{'code': 'BCRSF', 'description': 'Restoration Application - Full for a BC Benefit Company'},
{'code': 'BCRSL', 'description': 'Restoration Application - Limited for a BC Benefit Company'},
{'code': 'BCRSC', 'description': 'Restoration Application (Convert Limited to Full) for a BC Benefit Company'},
{'code': 'BCRSX', 'description': 'Restoration Application (Extend time Limit) for a BC Benefit Company'},
{'code': 'BCREG', 'description': 'Registration'}

]
)


op.bulk_insert(
fee_schedule_table,
[
{
"filing_type_code": "BCANN",
"corp_type_code": "BC",
"fee_code": "EN108",
"fee_start_date": date.today(),
"fee_end_date": None,
"future_effective_fee_code": None,
"priority_fee_code": None,
},
{
"filing_type_code": "BCADD",
"corp_type_code": "BC",
"fee_code": "EN101",
"fee_start_date": date.today(),
"fee_end_date": None,
"future_effective_fee_code": None,
"priority_fee_code": None,
},
{
"filing_type_code": "BCCDR",
"corp_type_code": "BC",
"fee_code": "EN101",
"fee_start_date": date.today(),
"fee_end_date": None,
"future_effective_fee_code": None,
"priority_fee_code": None,
},
{
"filing_type_code": "BCINC",
"corp_type_code": "BC",
"fee_code": "EN109",
"fee_start_date": date.today(),
"fee_end_date": None,
"future_effective_fee_code": "FUT01",
"priority_fee_code": None,
},
{
"filing_type_code": "BCREG",
"corp_type_code": "BC",
"fee_code": "EN109",
"fee_start_date": date.today(),
"fee_end_date": None,
"future_effective_fee_code": None,
"priority_fee_code": None,
},
{
"filing_type_code": "BCCGM",
"corp_type_code": "BC",
"fee_code": "EN107",
"fee_start_date": date.today(),
"fee_end_date": None,
"future_effective_fee_code": None,
"priority_fee_code": None,
},
{
"filing_type_code": "BCRSC",
"corp_type_code": "BC",
"fee_code": "EN101",
"fee_start_date": date.today(),
"fee_end_date": None,
"future_effective_fee_code": None,
"priority_fee_code": "PRI01",
},
{
"filing_type_code": "BCFDR",
"corp_type_code": "BC",
"fee_code": "EN107",
"fee_start_date": date.today(),
"fee_end_date": None,
"future_effective_fee_code": None,
"priority_fee_code": None,
},
{
"filing_type_code": "BCAMR",
"corp_type_code": "BC",
"fee_code": "EN109",
"fee_start_date": date.today(),
"fee_end_date": None,
"future_effective_fee_code": "FUT01",
"priority_fee_code": "PRI01",
},
{
"filing_type_code": "BCAMH",
"corp_type_code": "BC",
"fee_code": "EN109",
"fee_start_date": date.today(),
"fee_end_date": None,
"future_effective_fee_code": "FUT01",
"priority_fee_code": "PRI01",
},
{
"filing_type_code": "BCAMV",
"corp_type_code": "BC",
"fee_code": "EN109",
"fee_start_date": date.today(),
"fee_end_date": None,
"future_effective_fee_code": "FUT01",
"priority_fee_code": "PRI01",
},
{
"filing_type_code": "BCRSF",
"corp_type_code": "BC",
"fee_code": "EN109",
"fee_start_date": date.today(),
"fee_end_date": None,
"future_effective_fee_code": None,
"priority_fee_code": "PRI01",
},
{
"filing_type_code": "BCRSL",
"corp_type_code": "BC",
"fee_code": "EN109",
"fee_start_date": date.today(),
"fee_end_date": None,
"future_effective_fee_code": None,
"priority_fee_code": "PRI01",
},
{
"filing_type_code": "BCRSX",
"corp_type_code": "BC",
"fee_code": "EN109",
"fee_start_date": date.today(),
"fee_end_date": None,
"future_effective_fee_code": None,
"priority_fee_code": "PRI01",
}
],
)


def downgrade():
#Delete fee related master data
op.execute('DELETE FROM fee_schedule where corp_type_code=\'BC\'')
op.execute("DELETE FROM filing_type where code in ('BCANN','BCADD','BCCDR', 'BCINC', 'BCCGM', 'BCFDR', 'BCAMR', 'BCAMH', 'BCAMV', 'BCRSF', 'BCRSL', 'BCRSC', 'BCRSX', 'BCREG')")
op.execute("DELETE FROM fee_code where code in ('EN109','FUT01','PRI01')")
# ###Delete End

# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('fee_schedule', 'priority_fee_code')
op.drop_column('fee_schedule', 'future_effective_fee_code')
# ### end Alembic commands ###


63 changes: 63 additions & 0 deletions pay-api/migrations/versions/7d16423bc042_priority_fees_changes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
"""priority_fees_changes
Revision ID: 7d16423bc042
Revises: 00467a306afd
Create Date: 2019-12-23 10:55:10.959439
"""
from alembic import op
import sqlalchemy as sa
from datetime import date

from alembic import op
from sqlalchemy import Date, Integer, String, Float
from sqlalchemy.sql import column, table
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = '7d16423bc042'
down_revision = '00467a306afd'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('corp_type', sa.Column('transaction_fee_code', sa.String(length=10), nullable=True))
op.create_foreign_key(None, 'corp_type', 'fee_code', ['transaction_fee_code'], ['code'])
op.add_column('invoice', sa.Column('transaction_fees', sa.Float(), nullable=True))
op.drop_column('payment_line_item', 'service_fees')
op.drop_column('payment_line_item', 'processing_fees')

op.add_column('payment_line_item', sa.Column('future_effective_fees', sa.Float(), nullable=True))
op.add_column('payment_line_item', sa.Column('priority_fees', sa.Float(), nullable=True))


#Insert transaction fee code to fee_code
fee_code_table = table("fee_code", column("code", String), column("amount", Float))
# Fee Codes
op.bulk_insert(
fee_code_table, [
{"code": "TRF01", "amount": 1.50}
]
)

# Insert transaction fee to corp type table - May need to change later
op.execute("update corp_type set transaction_fee_code='TRF01' where code in ('BC', 'CP')")
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('payment_line_item', 'priority_fees')
op.drop_column('payment_line_item', 'future_effective_fees')

op.add_column('payment_line_item', sa.Column('processing_fees', postgresql.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True))
op.add_column('payment_line_item', sa.Column('service_fees', postgresql.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True))
op.drop_column('invoice', 'transaction_fees')
op.drop_constraint(None, 'corp_type', type_='foreignkey')
op.drop_column('corp_type', 'transaction_fee_code')
# ### end Alembic commands ###



17 changes: 8 additions & 9 deletions pay-api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,33 @@ asyncio-nats-client==0.10.0
asyncio-nats-streaming==0.4.0
attrs==19.1.0
blinker==1.4
certifi==2019.9.11
certifi==2019.11.28
chardet==3.0.4
croniter==0.3.30
ecdsa==0.14.1
flask-jwt-oidc==0.1.5
flask-marshmallow==0.10.1
flask-restplus==0.13.0
future==0.18.2
gunicorn==20.0.3
gunicorn==20.0.4
idna==2.8
importlib-metadata==0.23
importlib-metadata==1.3.0
itsdangerous==1.1.0
jsonschema==3.2.0
marshmallow-sqlalchemy==0.19.0
marshmallow-sqlalchemy==0.21.0
marshmallow==3.0.0rc7
more-itertools==7.2.0
protobuf==3.10.0
more-itertools==8.0.2
protobuf==3.11.1
psycopg2-binary==2.8.4
pyasn1==0.4.8
pyrsistent==0.15.6
python-dateutil==2.8.1
python-dotenv==0.10.3
python-editor==1.0.4
python-jose==3.0.1
python-jose==3.1.0
pytz==2019.3
requests==2.22.0
rsa==4.0
sentry-sdk==0.13.3
sentry-sdk==0.13.5
six==1.13.0
urllib3==1.25.7
zipp==0.6.0
Expand Down
Loading

0 comments on commit 7df1b25

Please sign in to comment.