-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from bcgov/development
Merge from development to master
- Loading branch information
Showing
49 changed files
with
840 additions
and
420 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
231
pay-api/migrations/versions/00467a306afd_bcorp_filing_types.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
63
pay-api/migrations/versions/7d16423bc042_priority_fees_changes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ### | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.