@@ -112,7 +112,7 @@ def validate_resolution_date_in_share_structure(filing_json, filing_type, busine
112112
113113 Rules:
114114 - If hasRightsOrRestrictions is true in any share class or series, resolution date is required.
115- - Only one resolution date is permitted.
115+ - Only one resolution date is permitted (alteration and old correction) .
116116 - Resolution date cannot be in the future.
117117 - Resolution date cannot be before the business founding date.
118118 """
@@ -121,7 +121,7 @@ def validate_resolution_date_in_share_structure(filing_json, filing_type, busine
121121 resolution_dates = share_structure .get ("resolutionDates" , [])
122122
123123 err_path = f"/filing/{ filing_type } /shareStructure/resolutionDates"
124-
124+
125125 msg = []
126126 if (
127127 (
@@ -135,29 +135,57 @@ def validate_resolution_date_in_share_structure(filing_json, filing_type, busine
135135 "path" : err_path
136136 })
137137
138+ if not resolution_dates :
139+ return msg
140+
141+ if isinstance (resolution_dates [0 ], str ):
142+ # Kept for backward compatibility (existing alteration and correction filings)
143+ msg .extend (_validate_resolution_dates_old_format (resolution_dates , business , err_path ))
144+ else :
145+ # Did not include "Only one resolution date is permitted.", not required for correction
146+ # If its required for alteration add while updating alteration filing
147+ existing_ids = {resolution .id for resolution in business .resolutions .all ()}
148+ for idx , resolution_date in enumerate (resolution_dates ):
149+ if (resolution_id := resolution_date .get ("id" )) and (resolution_id not in existing_ids ):
150+ msg .append ({
151+ "error" : "Not a valid Resolution Id for this business." ,
152+ "path" : f"{ err_path } /{ idx } "
153+ })
154+ else :
155+ msg .extend (_validate_resolution_date (resolution_date ["date" ], business , f"{ err_path } /{ idx } " ))
156+
157+ return msg
158+
159+ def _validate_resolution_dates_old_format (resolution_dates , business , err_path ):
160+ msg = []
138161 if len (resolution_dates ) > 1 :
139162 msg .append ({
140163 "error" : "Only one resolution date is permitted." ,
141164 "path" : err_path
142165 })
143166
144167 elif len (resolution_dates ) == 1 :
145- resolution_date_leg = date .fromisoformat (resolution_dates [0 ])
146- founding_date_leg = LegislationDatetime .as_legislation_timezone (business .founding_date ).date ()
147- today_leg = LegislationDatetime .datenow ()
168+ msg .extend (_validate_resolution_date (resolution_dates [0 ], business , err_path ))
148169
149- if resolution_date_leg > today_leg :
150- msg .append ({
151- "error" : "Resolution date cannot be in the future." ,
152- "path" : err_path
153- })
170+ return msg
154171
155- if resolution_date_leg < founding_date_leg :
156- msg .append ({
157- "error" : "Resolution date cannot be before the business founding date." ,
158- "path" : err_path
159- })
172+ def _validate_resolution_date (resolution_date_str : str , business , err_path : str ) -> list [dict ]:
173+ resolution_date = date .fromisoformat (resolution_date_str )
174+ founding_date = LegislationDatetime .as_legislation_timezone (business .founding_date ).date ()
175+ today = LegislationDatetime .datenow ()
176+
177+ msg = []
178+ if resolution_date > today :
179+ msg .append ({
180+ "error" : "Resolution date cannot be in the future." ,
181+ "path" : err_path
182+ })
160183
184+ if resolution_date < founding_date :
185+ msg .append ({
186+ "error" : "Resolution date cannot be before the business founding date." ,
187+ "path" : err_path
188+ })
161189 return msg
162190
163191
0 commit comments