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

Skip to content

Commit 34078b9

Browse files
authored
32962 Emailer - correction updates (#4563)
* 32962 Emailer - correction updates Signed-off-by: Kial Jinnah <[email protected]> * chore - cleanup Signed-off-by: Kial Jinnah <[email protected]> --------- Signed-off-by: Kial Jinnah <[email protected]>
1 parent 2dbd569 commit 34078b9

19 files changed

Lines changed: 385 additions & 1347 deletions

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

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -291,36 +291,16 @@ def _add_filing_document_pdf( # noqa: PLR0913
291291
token: str,
292292
business: dict,
293293
filing: Filing,
294+
file_attachment_name: str | None = None,
294295
regenerate=False
295296
):
296297
"""Add the specified filing document pdf to the pdfs list."""
297298
# File name
298-
file_name = (document_type[0].upper() + " ".join(re.findall("[a-zA-Z][^A-Z]*", document_type[1:]))).replace(" Of ", " of ")
299+
if not (file_name := file_attachment_name):
300+
file_name = (document_type[0].upper() + " ".join(re.findall("[a-zA-Z][^A-Z]*", document_type[1:]))).replace(" Of ", " of ")
301+
299302
if document_type == "annualReport" and (ar_date := filing.filing_json["filing"].get("annualReport", {}).get("annualReportDate")):
300303
file_name = f"{ar_date[:4]} {file_name}"
301-
elif document_type == "changeOfAddress":
302-
file_name = "Address Change"
303-
elif document_type == "changeOfDirectors":
304-
file_name = "Director Change"
305-
elif document_type == "registration":
306-
file_name = "Statement of Registration"
307-
elif document_type == "continuationIn":
308-
file_name = "Continuation Application"
309-
elif document_type == "amalgamationApplication":
310-
amalgamation_application_names = {
311-
Amalgamation.AmalgamationTypes.regular.name: "Amalgamation Application (Regular)",
312-
Amalgamation.AmalgamationTypes.vertical.name: "Amalgamation Application Short-form (Vertical)",
313-
Amalgamation.AmalgamationTypes.horizontal.name: "Amalgamation Application Short-form (Horizontal)"
314-
}
315-
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)
324304

325305
# Get pdf and add it to the list
326306
filing_pdf_encoded = get_filing_document(business["identifier"], filing.id, document_type, token, regenerate=regenerate)
@@ -333,7 +313,9 @@ def _add_filing_document_pdf( # noqa: PLR0913
333313
"attachOrder": str(attach_order)
334314
}
335315
)
336-
return attach_order + 1
316+
attach_order += 1
317+
318+
return attach_order
337319

338320

339321
def _add_receipt_pdf( # noqa: PLR0913
@@ -387,13 +369,14 @@ def get_pdfs( # noqa: PLR0913
387369
filing_date_time: str,
388370
effective_date: str,
389371
extra_pdf_type_list: list[str],
372+
filing_attachment_name: str | None,
390373
regenerate=False
391374
) -> list:
392375
"""Get the pdfs for the filing output."""
393376
pdfs = []
394377
attach_order = 1
395378
# add filing application document
396-
attach_order = _add_filing_document_pdf(pdfs, attach_order, filing.filing_type, token, business, filing, regenerate=regenerate)
379+
attach_order = _add_filing_document_pdf(pdfs, attach_order, filing.filing_type, token, business, filing, filing_attachment_name, regenerate=regenerate)
397380
# add extra documents
398381
for pdf_type in extra_pdf_type_list:
399382
attach_order = _add_filing_document_pdf(pdfs, attach_order, pdf_type, token, business, filing, regenerate=regenerate)

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

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

0 commit comments

Comments
 (0)