From cc383f277e190b4536a35aea80b3eb3c3e5d7905 Mon Sep 17 00:00:00 2001 From: Vysakh Menon Date: Mon, 11 Mar 2024 16:50:06 -0700 Subject: [PATCH] 19895 sync admin dissolution in colin-api (#2506) --- colin-api/src/colin_api/models/business.py | 1 + colin-api/src/colin_api/models/filing.py | 11 ++++++++++- colin-api/src/colin_api/resources/filing.py | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/colin-api/src/colin_api/models/business.py b/colin-api/src/colin_api/models/business.py index 81fcbdbb7c..3be93ace81 100644 --- a/colin-api/src/colin_api/models/business.py +++ b/colin-api/src/colin_api/models/business.py @@ -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 = { diff --git a/colin-api/src/colin_api/models/filing.py b/colin-api/src/colin_api/models/filing.py index ee609a060e..6828c3fe64 100644 --- a/colin-api/src/colin_api/models/filing.py +++ b/colin-api/src/colin_api/models/filing.py @@ -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', @@ -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: diff --git a/colin-api/src/colin_api/resources/filing.py b/colin-api/src/colin_api/resources/filing.py index 15f671b95d..838723cbb1 100644 --- a/colin-api/src/colin_api/resources/filing.py +++ b/colin-api/src/colin_api/resources/filing.py @@ -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