Skip to content

Commit

Permalink
19693 continuation in corp types (#2771)
Browse files Browse the repository at this point in the history
* 19693 continuation in corp types

* no message
  • Loading branch information
vysakh-menon-aot authored Apr 24, 2024
1 parent de762f5 commit 770fe27
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 10 deletions.
39 changes: 39 additions & 0 deletions auth-api/migrations/versions/2024_04_23_51524729b99c_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""CTMP message
Revision ID: 51524729b99c
Revises: 824f5ef280c6
Create Date: 2024-04-23 14:50:24.894593
"""
from alembic import op
from sqlalchemy import Boolean, String
from sqlalchemy.sql import column, table

# revision identifiers, used by Alembic.
revision = '51524729b99c'
down_revision = '824f5ef280c6'
branch_labels = None
depends_on = None



def upgrade():
corp_type_table = table('corp_types',
column('code', String),
column('desc', String),
column('default', Boolean)
)
op.bulk_insert(
corp_type_table,
[
{'code': 'CTMP', 'description': 'Continuation In', 'default': False},
{'code': 'C', 'description': 'BC Limited Company Continuation In', 'default': False},
{'code': 'CBEN', 'description': 'BC Benefit Company Continuation In', 'default': False},
{'code': 'CUL', 'description': 'BC Unlimited Liability Company Continuation In', 'default': False}
]
)
op.execute("update corp_types set description='BC Community Contribution Company Continuation In' where code='CCC'")


def downgrade():
op.execute("delete from corp_types where code in ('CTMP','C', 'CBEN', 'CUL')")
17 changes: 13 additions & 4 deletions auth-api/src/auth_api/services/affiliation.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def find_visible_affiliations_by_org_id(org_id, environment=None):
nr_number_name_dict = {d['business_identifier']: d['name']
for d in data if d['corp_type']['code'] == CorpType.NR.value}
# Create a list of all temporary business names
temp_types = (CorpType.TMP.value, CorpType.RTMP.value)
temp_types = [CorpType.TMP.value, CorpType.ATMP.value, CorpType.CTMP.value, CorpType.RTMP.value]
tmp_business_list = [d['name'] for d in data if d['corp_type']['code'] in temp_types]

# NR Numbers
Expand Down Expand Up @@ -187,7 +187,10 @@ def create_affiliation(org_id, business_identifier, environment=None, pass_code=

if entity_type not in ['SP', 'GP']:
entity.set_pass_code_claimed(True)
if entity_type not in [CorpType.RTMP.value, CorpType.TMP.value, CorpType.ATMP.value]:
if entity_type not in [CorpType.RTMP.value,
CorpType.TMP.value,
CorpType.ATMP.value,
CorpType.CTMP.value]:
name = entity.name if len(entity.name) > 0 else entity.business_identifier
ActivityLogPublisher.publish_activity(Activity(org_id, ActivityAction.CREATE_AFFILIATION.value,
name=name, id=entity.business_identifier))
Expand Down Expand Up @@ -286,7 +289,10 @@ def create_new_business_affiliation(affiliation_data: AffiliationData, # pylint
affiliation_model = AffiliationModel(
org_id=org_id, entity_id=entity.identifier, certified_by_name=certified_by_name)

if entity.corp_type not in [CorpType.RTMP.value, CorpType.TMP.value, CorpType.ATMP.value]:
if entity.corp_type not in [CorpType.RTMP.value,
CorpType.TMP.value,
CorpType.ATMP.value,
CorpType.CTMP.value]:
ActivityLogPublisher.publish_activity(Activity(org_id, ActivityAction.CREATE_AFFILIATION.value,
name=entity.name, id=entity.business_identifier))
affiliation_model.certified_by_name = certified_by_name
Expand Down Expand Up @@ -341,7 +347,10 @@ def delete_affiliation(delete_affiliation_request: DeleteAffiliationRequest, env
affiliation.delete()
entity.set_pass_code_claimed(False)

if entity.corp_type in [CorpType.RTMP.value, CorpType.TMP.value, CorpType.ATMP.value]:
if entity.corp_type in [CorpType.RTMP.value,
CorpType.TMP.value,
CorpType.ATMP.value,
CorpType.CTMP.value]:
return

# When registering a business (also RTMP and TMP in between):
Expand Down
17 changes: 11 additions & 6 deletions auth-api/src/auth_api/utils/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,19 @@ class CorpType(Enum):
"""Corp Types."""

NR = 'NR'
CP = 'CP' # cooperative
TMP = 'TMP'
RTMP = 'RTMP'
CP = 'CP' # Coperative
TMP = 'TMP' # Incorporation Application
CTMP = 'CTMP' # Continuation In
RTMP = 'RTMP' # Registration
ATMP = 'ATMP' # Amalgamation
BC = 'BC' # bcomp
CR = 'CR' # corporation
UL = 'UL' # Unlimited Liability
BC = 'BC' # Limited Company
BEN = 'BEN' # Benefit Company
ULC = 'ULC' # Unlimited Liability
CC = 'CC' # Community Contribution
C = 'C' # Continuation In BC
CBEN = 'CBEN' # Continuation In BEN
CCC = 'CCC' # Continuation In CC
CUL = 'CUL' # Continuation In ULC
GP = 'GP' # General Partnership
SP = 'SP' # Sole Proprietorship

Expand Down

0 comments on commit 770fe27

Please sign in to comment.