Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion queue_services/business-emailer/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "business-emailer"
version = "0.1.2"
version = "0.1.3"
description = "This module is the service worker for sending emails about entity related events."
authors = ["Hrvoje Fekete <hrvoje.fekete@mindpoweredtech.com>"]
license = "BSD-3-Clause"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_recipients(option: str, filing_json: dict, token: str | None = None, fil
recipients = ""
filing_type = filing_type if filing_type else "incorporationApplication"
if filing_json["filing"].get(filing_type):
recipients = filing_json["filing"][filing_type]["contactPoint"]["email"]
recipients = filing_json["filing"][filing_type].get("contactPoint", {}).get("email", "")
if option in [Filing.Status.PAID.value, "bn"] and \
filing_json["filing"]["header"]["name"] == filing_type:
parties = filing_json["filing"][filing_type].get("parties")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from flask import current_app
from jinja2 import Environment, FileSystemLoader

from business_emailer.email_processors import get_filing_document, get_filing_info
from business_emailer.email_processors import get_filing_document, get_filing_info, get_recipient_from_auth
from business_model.models import Business, CorpType, Filing


Expand Down Expand Up @@ -172,7 +172,10 @@ def process(email_info: dict, token: str) -> dict: # pylint: disable=too-many-l
# get recipients
recipients = []

recipients.append(filing_data["contactPoint"]["email"])
if contact_email := filing_data.get("contactPoint", {}).get("email"):
recipients.append(contact_email)
else:
recipients.append(get_recipient_from_auth(identifier, token))

Comment on lines +175 to 179
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new fallback to get_recipient_from_auth() when contactPoint.email is absent changes recipient selection logic, but the existing restoration processor tests only cover the contactPoint-present case. Add a unit test that removes contactPoint (or its email) from the restoration filing JSON and asserts recipients are pulled from Auth (mocking get_recipient_from_auth/requests accordingly).

Copilot uses AI. Check for mistakes.
for party in filing_data["parties"]:
for role in party["roles"]:
Expand Down
Loading