Skip to content

Commit

Permalink
19895 sync admin dissolution in colin-api (#2506)
Browse files Browse the repository at this point in the history
  • Loading branch information
vysakh-menon-aot authored Mar 11, 2024
1 parent 1416f79 commit cc383f2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions colin-api/src/colin_api/models/business.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class CorpStateTypes(Enum):
"""Render an Enum of the CorpState Type Codes."""

VOLUNTARY_DISSOLUTION = 'HDV'
ADMINISTRATIVE_DISSOLUTION = 'HDA'

# temp converter because legal doesn't have codes only class (legal_type)
CORP_TYPE_CONVERSION = {
Expand Down
11 changes: 10 additions & 1 deletion colin-api/src/colin_api/models/filing.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class LearSource(Enum):
# `voluntaryDissolution filing type in place as unsure if it is being used in other places
'dissolution': {
'sub_type_property': 'dissolutionType',
'sub_type_list': ['voluntary'],
'sub_type_list': ['voluntary', 'administrative'],
'type_code_list': ['OTVDS', 'ADVD2'],
'voluntary': {
Business.TypeCodes.COOP.value: 'OTVDS',
Expand Down Expand Up @@ -920,6 +920,15 @@ def get_historic_filings(cls, business: Business) -> List:
# pass through exception to caller
raise err

@classmethod
def add_administrative_dissolution_event(cls, con, corp_num) -> int:
"""Add administrative dissolution event."""
cursor = con.cursor()
event_id = cls._get_event_id(cursor=cursor, corp_num=corp_num, event_type='SYSDA')
Business.update_corp_state(cursor, event_id, corp_num,
Business.CorpStateTypes.ADMINISTRATIVE_DISSOLUTION.value)
return event_id

# pylint: disable=too-many-locals,too-many-statements,too-many-branches,too-many-nested-blocks;
@classmethod
def add_filing(cls, con, filing: Filing) -> int:
Expand Down
14 changes: 14 additions & 0 deletions colin-api/src/colin_api/resources/filing.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,20 @@ def post(legal_type, identifier, **kwargs):
# get db connection and start a session, in case we need to roll back
con = DB.connection
con.begin()

# No filing will be created for administrative dissolution. Create an event and update corp state.
if ('dissolution' in filing_list and
Filing.get_filing_sub_type('dissolution', filing_list['dissolution']) == 'administrative'):
if legal_type == Business.LearBusinessTypes.COOP.value:
raise Exception('Not implemented!')
event_id = Filing.add_administrative_dissolution_event(con, identifier)
con.commit()
return jsonify({
'filing': {
'header': { 'colinIds' : [event_id]}
}
}), HTTPStatus.CREATED

filings_added = FilingInfo._add_filings(con, json_data, filing_list, identifier, corp_types)

# return the completed filing data
Expand Down

0 comments on commit cc383f2

Please sign in to comment.