Skip to content

Commit

Permalink
24225 debug emaler (#1644)
Browse files Browse the repository at this point in the history
  • Loading branch information
kzdev420 authored Dec 28, 2024
1 parent 35dc6d1 commit c187fbf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,12 @@ def email_report(email_info: SimpleCloudEvent):
recipients = ','.join(recipient_emails)
template_path = current_app.config.get('REPORT_TEMPLATE_PATH')
email_template = Path(f'{template_path}/rejected.md').read_text()
structured_log(request, "DEBUG", f"NR_notification: {nr_model}")
if nr_model['stateCd'] in [State.APPROVED, State.CONDITIONAL]:
instruction_group = ReportResource._get_instruction_group(nr_model['entity_type_cd'], nr_model["request_action_cd"])
legal_type = nr_model['entity_type_cd']
request_action = nr_model["request_action_cd"]
corpNum = nr_model["corpNum"]
instruction_group = ReportResource._get_instruction_group(legal_type, request_action, corpNum)
file_name=''
if nr_model['consentFlag'] in ['Y', 'R']:
file_name = 'conditional'
Expand All @@ -112,6 +116,7 @@ def email_report(email_info: SimpleCloudEvent):

email_template = Path(f'{template_path}/{file_name}.md').read_text()

structured_log(request, "DEBUG", f"NR_notification: {file_name}")
email_body = _build_email_body(email_template, nr_model, recipient_emails[0], recipient_phones[0])

email = {
Expand Down
1 change: 1 addition & 0 deletions services/emailer/src/namex_emailer/resources/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def process_email(email_msg: SimpleCloudEvent): # pylint: disable=too-many-bran

def send_email(email: dict, token: str):
"""Send the email"""
structured_log(request, "INFO", f"Send Email: {email}")
return requests.post(
f'{current_app.config.get("NOTIFY_API_URL", "")}',
json=email,
Expand Down
2 changes: 1 addition & 1 deletion services/emailer/src/namex_emailer/services/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ def query_nr_number(identifier: str):
def get_magic_link(nr_number, email, phone):
"""Return a magic link."""
auth_web_url = current_app.config.get("AUTH_WEB_URL")
return f'{auth_web_url}incorporateNow/?nr={nr_number}&email={email}&phone={phone}'
return f'{auth_web_url}incorporateNow?nr={nr_number}&email={email}&phone={phone}'

0 comments on commit c187fbf

Please sign in to comment.