Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d216916

Browse files
authored
32961 emailer - update restoration emails (#4560)
* 32961 emailer - update restoration emails Signed-off-by: Kial Jinnah <[email protected]> * chore: remove unused restoration templates Signed-off-by: Kial Jinnah <[email protected]> --------- Signed-off-by: Kial Jinnah <[email protected]>
1 parent 124611d commit d216916

19 files changed

Lines changed: 250 additions & 601 deletions

queue_services/business-emailer/src/business_emailer/email_processors/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,14 @@ def _add_filing_document_pdf( # noqa: PLR0913
313313
Amalgamation.AmalgamationTypes.horizontal.name: "Amalgamation Application Short-form (Horizontal)"
314314
}
315315
file_name = amalgamation_application_names.get(filing.filing_sub_type, file_name)
316+
elif document_type == "restoration":
317+
restoration_application_names = {
318+
"fullRestoration": "Full Restoration Application",
319+
"limitedRestoration": "Limited Restoration Application",
320+
"limitedRestorationExtension": "Limited Restoration Extension Application",
321+
"limitedRestorationToFull": "Conversion to Full Restoration Application",
322+
}
323+
file_name = restoration_application_names.get(filing.filing_sub_type, file_name)
316324

317325
# Get pdf and add it to the list
318326
filing_pdf_encoded = get_filing_document(business["identifier"], filing.id, document_type, token, regenerate=regenerate)

queue_services/business-emailer/src/business_emailer/email_processors/filing_notification.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ def _get_additional_recipients(filing: Filing, token: str) -> str | None:
5959
if filing.submitter_roles and UserRoles.staff in filing.submitter_roles:
6060
# when staff do filing documentOptionalEmail may contain completing party email
6161
return filing.filing_json["filing"]["header"].get("documentOptionalEmail")
62-
else:
63-
return get_user_email_from_auth(filing.filing_submitter.username, token)
62+
return get_user_email_from_auth(filing.filing_submitter.username, token)
6463

6564

6665
def _get_attachments_and_extra_pdf_types(status: str, filing_type: str, filing: Filing, legal_type_key: str) -> tuple[list[str], list[str]]:
@@ -111,9 +110,8 @@ def process(email_info: dict, token: str) -> dict | None:
111110
# get template vars from filing
112111
filing, business, leg_tmz_filing_date, leg_tmz_effective_date = get_filing_info(email_info["filingId"])
113112

114-
new_business_filings = ["amalgamationApplication", "continuationIn", "incorporationApplication", "registration"]
115113
filing_data = filing.json.get("filing", {}).get(filing_type, {})
116-
if filing_type in new_business_filings and not business:
114+
if filing_type in Filing.TempCorpFilingType and not business:
117115
# For new business filings, the nameRequest contains relevant business details.
118116
# We overwrite the business info from the nameRequest and then set the identifier back to the temp reg id.
119117
name_request = filing_data.get("nameRequest")
@@ -130,7 +128,7 @@ def process(email_info: dict, token: str) -> dict | None:
130128
dashboard_url = current_app.config.get("DASHBOARD_URL") + business_identifier
131129

132130
is_future_effective_paid = filing.is_future_effective and status == Filing.Status.PAID.value
133-
if filing_type in new_business_filings and is_future_effective_paid:
131+
if filing_type in Filing.TempCorpFilingType and is_future_effective_paid:
134132
business_identifier = NOT_AVAILABLE
135133

136134
show_effective_date = filing.is_future_effective
@@ -165,6 +163,7 @@ def process(email_info: dict, token: str) -> dict | None:
165163
filing_date_time=leg_tmz_filing_date,
166164
effective_date_time=leg_tmz_effective_date,
167165
entity_dashboard_url=dashboard_url,
166+
filing_sub_type=filing.filing_sub_type,
168167
filing_type=filing_type,
169168
attachments_list=attachments_list,
170169
business_description=business_description,
@@ -181,7 +180,7 @@ def process(email_info: dict, token: str) -> dict | None:
181180

182181
# get recipients
183182
recipient_filing_type = None
184-
if filing_type in new_business_filings or filing_type == "changeOfRegistration":
183+
if filing_type in Filing.TempCorpFilingType or filing_type == "changeOfRegistration":
185184
recipient_filing_type = filing_type
186185

187186
recipients = get_recipients(status, filing.filing_json, token, recipient_filing_type)
@@ -195,6 +194,10 @@ def process(email_info: dict, token: str) -> dict | None:
195194

196195
# assign subject
197196
short_filing_name = FILING_TITLE_SHORT.get(filing_type) or filing_name
197+
if filing.filing_sub_type and isinstance(short_filing_name, dict):
198+
# This filing has different subjects based on the filing sub type
199+
short_filing_name = short_filing_name.get(filing.filing_sub_type) or filing_name
200+
198201
subject = get_subject(is_future_effective_paid, business_name, legal_type, filing_name, short_filing_name)
199202

200203
return {

queue_services/business-emailer/src/business_emailer/email_processors/restoration_notification.py

Lines changed: 0 additions & 210 deletions
This file was deleted.

queue_services/business-emailer/src/business_emailer/email_processors/util.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,20 @@
3737
"continuationIn": "Continuation Application",
3838
"incorporationApplication": "Incorporation Application",
3939
"registration": "Registration",
40-
"specialResolution": "Special Resolution"
40+
"specialResolution": "Special Resolution",
41+
"restoration": "Restoration"
4142
}
4243

4344
FILING_TITLE_SHORT = {
4445
"amalgamationApplication": "Amalgamation",
4546
"continuationIn": "Continuation In",
46-
"incorporationApplication": "Incorporation"
47+
"incorporationApplication": "Incorporation",
48+
"restoration": {
49+
"fullRestoration": "Restoration",
50+
"limitedRestoration": "Restoration",
51+
"limitedRestorationExtension": "Extension of Limited Restoration",
52+
"limitedRestorationToFull": "Conversion to Full Restoration",
53+
}
4754
}
4855

4956
FILING_ATTACHMENTS = {
@@ -105,6 +112,22 @@
105112
"incorporationApplication": {
106113
"attachments": ["Incorporation Application","Notice of Articles","Certificate of Incorporation","Receipt"],
107114
"extraPdfTypes": ["noticeOfArticles","certificateOfIncorporation"],
115+
},
116+
"restoration-fullRestoration": {
117+
"attachments": ["Full Restoration Application","Notice of Articles","Certificate of Restoration","Receipt"],
118+
"extraPdfTypes": ["noticeOfArticles","certificateOfRestoration"],
119+
},
120+
"restoration-limitedRestoration": {
121+
"attachments": ["Limited Restoration Application","Notice of Articles","Certificate of Restoration","Receipt"],
122+
"extraPdfTypes": ["noticeOfArticles","certificateOfRestoration"],
123+
},
124+
"restoration-limitedRestorationExtension": {
125+
"attachments": ["Limited Restoration Extension Application","Notice of Articles","Certificate of Restoration","Receipt"],
126+
"extraPdfTypes": ["noticeOfArticles","certificateOfRestoration"],
127+
},
128+
"restoration-limitedRestorationToFull": {
129+
"attachments": ["Conversion to Full Restoration Application","Notice of Articles","Certificate of Restoration","Receipt"],
130+
"extraPdfTypes": ["noticeOfArticles","certificateOfRestoration"],
108131
}
109132
},
110133
"FIRM": {

queue_services/business-emailer/src/business_emailer/email_templates/RES-COMPLETED.jinja2

Lines changed: 0 additions & 15 deletions
This file was deleted.

queue_services/business-emailer/src/business_emailer/email_templates/RES-PAID.jinja2

Lines changed: 0 additions & 17 deletions
This file was deleted.

queue_services/business-emailer/src/business_emailer/email_templates/RES-common.jinja2

Lines changed: 0 additions & 15 deletions
This file was deleted.

queue_services/business-emailer/src/business_emailer/email_templates/RES-fullRestoration-PAID.jinja2

Lines changed: 0 additions & 8 deletions
This file was deleted.

queue_services/business-emailer/src/business_emailer/email_templates/RES-limitedRestoration-PAID.jinja2

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)