diff --git a/queue_services/entity-emailer/src/entity_emailer/email_processors/continuation_in_notification.py b/queue_services/entity-emailer/src/entity_emailer/email_processors/continuation_in_notification.py
index db09add5e..149d3660e 100644
--- a/queue_services/entity-emailer/src/entity_emailer/email_processors/continuation_in_notification.py
+++ b/queue_services/entity-emailer/src/entity_emailer/email_processors/continuation_in_notification.py
@@ -24,7 +24,7 @@
from entity_queue_common.service_utils import logger
from flask import current_app
from jinja2 import Template
-from legal_api.models import Business, Filing
+from legal_api.models import Business, Filing, ReviewResult
from entity_emailer.email_processors import (
get_entity_dashboard_url,
@@ -66,6 +66,7 @@ def _get_pdfs(
)
attach_order += 1
+ # add receipt
corp_name = business.get('legalName')
receipt = requests.post(
f'{current_app.config.get("PAY_API_URL")}/{filing.payment_token}/receipts',
@@ -91,6 +92,22 @@ def _get_pdfs(
}
)
attach_order += 1
+
+ elif status == 'RESUBMITTED':
+ # add filing pdf
+ filing_pdf_type = 'continuationIn'
+ filing_pdf_encoded = get_filing_document(business['identifier'], filing.id, filing_pdf_type, token)
+ if filing_pdf_encoded:
+ pdfs.append(
+ {
+ 'fileName': 'Continuation Application - Resubmitted.pdf',
+ 'fileBytes': filing_pdf_encoded.decode('utf-8'),
+ 'fileUrl': '',
+ 'attachOrder': str(attach_order)
+ }
+ )
+ attach_order += 1
+
elif status == Filing.Status.COMPLETED.value:
# add certificate of continuation
certificate_pdf_type = 'certificateOfContinuation'
@@ -105,6 +122,7 @@ def _get_pdfs(
}
)
attach_order += 1
+
# add notice of articles
noa_pdf_type = 'noticeOfArticles'
noa_encoded = get_filing_document(business['identifier'], filing.id, noa_pdf_type, token)
@@ -118,14 +136,17 @@ def _get_pdfs(
}
)
attach_order += 1
+
return pdfs
def process(email_info: dict, token: str) -> dict: # pylint: disable=too-many-locals, , too-many-branches
"""Build the email for Continuation notification."""
logger.debug('filing_notification: %s', email_info)
- # get template and fill in parts
+
+ # get template vars from email info
filing_type, status = email_info['type'], email_info['option']
+
# get template vars from filing
filing, business, leg_tmz_filing_date, leg_tmz_effective_date = get_filing_info(email_info['filingId'])
filing_name = filing.filing_type[0].upper() + ' '.join(re.findall('[a-zA-Z][^A-Z]*', filing.filing_type[1:]))
@@ -133,13 +154,11 @@ def process(email_info: dict, token: str) -> dict: # pylint: disable=too-many-l
if status == Filing.Status.PAID.value:
business = filing_data['nameRequest']
business['identifier'] = filing.temp_reg
-
- template = Path(f'{current_app.config.get("TEMPLATE_PATH")}/CONT-IN-{status}.html').read_text()
- filled_template = substitute_template_parts(template)
- # render template with vars
legal_type = business.get('legalType')
numbered_description = Business.BUSINESSES.get(legal_type, {}).get('numberedDescription')
- jnja_template = Template(filled_template, autoescape=True)
+ review_result = ReviewResult.get_last_review_result(filing.id)
+ # encode newlines in review comment only
+ latest_review_comment = review_result.comments.replace('\n', '\\n') if review_result else None
# compute Foreign Jurisdiction string as in report.py and business_document.py
country_code = filing_data['foreignJurisdiction']['country']
@@ -150,6 +169,12 @@ def process(email_info: dict, token: str) -> dict: # pylint: disable=too-many-l
region = pycountry.subdivisions.get(code=f'{country_code}-{region_code}')
foreign_jurisdiction = f'{region.name}, {country.name}' if region else country.name
+ # get template and fill in parts
+ template = Path(f'{current_app.config.get("TEMPLATE_PATH")}/CONT-IN-{status}.html').read_text()
+ filled_template = substitute_template_parts(template)
+ jnja_template = Template(filled_template, autoescape=True)
+
+ # render template with vars
html_out = jnja_template.render(
business=business,
filing=filing_data,
@@ -161,9 +186,13 @@ def process(email_info: dict, token: str) -> dict: # pylint: disable=too-many-l
email_header=filing_name.upper(),
filing_type=filing_type,
numbered_description=numbered_description,
- foreign_jurisdiction=foreign_jurisdiction
+ foreign_jurisdiction=foreign_jurisdiction,
+ latest_review_comment=latest_review_comment
)
+ # decode newlines to
for html output
+ html_out = html_out.replace('\\n', '
')
+
# get attachments
pdfs = _get_pdfs(status,
token,
@@ -179,10 +208,14 @@ def process(email_info: dict, token: str) -> dict: # pylint: disable=too-many-l
# assign subject
legal_name = business.get('legalName', None)
- if status == Filing.Status.PAID.value:
- subject = 'Confirmation of Filing from the Business Registry'
+ if status in [Filing.Status.APPROVED.value, Filing.Status.REJECTED.value]:
+ subject = 'Results of your Filing from the Business Registry'
+ elif status == Filing.Status.CHANGE_REQUESTED.value:
+ subject = 'Change Requested from the Business Registry'
elif status == Filing.Status.COMPLETED.value:
subject = 'Continuation Documents from the Business Registry'
+ elif status in [Filing.Status.PAID.value, 'RESUBMITTED']:
+ subject = 'Confirmation of Filing from the Business Registry'
subject = f'{legal_name} - {subject}' if legal_name else subject
diff --git a/queue_services/entity-emailer/src/entity_emailer/email_templates/CONT-IN-APPROVED.html b/queue_services/entity-emailer/src/entity_emailer/email_templates/CONT-IN-APPROVED.html
new file mode 100644
index 000000000..22469b085
--- /dev/null
+++ b/queue_services/entity-emailer/src/entity_emailer/email_templates/CONT-IN-APPROVED.html
@@ -0,0 +1,67 @@
+
+
+
+ [[header.html]]
+
+
+
+
+
+
+ Your Continuation Authorization is approved. + + [[20px.html]] + [[divider.html]] + [[20px.html]] + + + + +
The following document is attached to this email: +
|
+
+ [[header.html]]
+
+
+
+
+
+
+ Your Continuation Authorization is not yet approved. Follow + the steps below to modify and resubmit your application. + + [[20px.html]] + [[divider.html]] + [[20px.html]] + + + + +Follow these steps to complete your application: +
{{ latest_review_comment }}+ + [[20px.html]] + [[divider.html]] + [[20px.html]] + + + [[continuation-application-details.html]] + + + [[24px.html]] + [[footer.html]] + |
+
+ [[header.html]]
+
+
+
+
+
+
+ Your Continuation Authorization is rejected and a refund request + has been submitted. The refund will be applied to your original payment method. Refunds + are usually processed within 10-14 business days. + + [[20px.html]] + [[divider.html]] + [[20px.html]] + + + + +
{{ latest_review_comment }}+ The following document is attached to this email: +
|
+
+ [[header.html]]
+
+
+
+
+
+
+ BC Registries will review your Continuation Authorization documents and contact you + with the results within 2 business days. + + [[20px.html]] + [[divider.html]] + [[20px.html]] + + + [[continuation-application-details.html]] + + [[20px.html]] + [[divider.html]] + [[20px.html]] + + + + +The following document id attached to this email: +
+ Once your authorization has been approved, your business will be registered and you will + receive the following outputs: + +
|
+