Skip to content

Commit

Permalink
Tenders: configure author super siaes email
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Jul 16, 2024
1 parent 9fb6b62 commit a609acd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 0 additions & 2 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,6 @@

INBOUND_EMAIL_IS_ACTIVATED = env.bool("INBOUND_EMAIL_IS_ACTIVATED", True)

BREVO_TENDERS_AUTHOR_SUPER_SIAES_TEMPLATE_ID = env.int("BREVO_TENDERS_AUTHOR_SUPER_SIAES_TEMPLATE_ID", 61)

BREVO_TENDERS_MIN_AMOUNT_TO_SEND = env.int("BREVO_TENDERS_MIN_AMOUNT_TO_SEND", 34998)

# Caching
Expand Down
10 changes: 5 additions & 5 deletions lemarche/www/tenders/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from lemarche.tenders.models import PartnerShareTender, Tender, TenderSiae
from lemarche.users.models import User
from lemarche.utils import constants
from lemarche.utils.apis import api_brevo, api_mailjet, api_slack
from lemarche.utils.apis import api_mailjet, api_slack
from lemarche.utils.data import date_to_string
from lemarche.utils.emails import send_mail_async, whitelist_recipient_list
from lemarche.utils.urls import get_domain_url, get_object_admin_url, get_object_share_url
Expand Down Expand Up @@ -668,9 +668,10 @@ def notify_admin_siae_wants_cocontracting(tender: Tender, siae: Siae):


def send_super_siaes_email_to_author(tender: Tender, top_siaes: list[Siae]):
email_template = TemplateTransactional.objects.get(code="TENDERS_AUTHOR_SUPER_SIAES")
recipient_list = whitelist_recipient_list([tender.author.email])
if recipient_list:
recipient_email = recipient_list[0] if recipient_list else ""
if len(recipient_list):
recipient_email = recipient_list[0]
recipient_name = tender.author.full_name

# Use transaction parameters of Brevo with loop for siaes, documentation :
Expand All @@ -694,8 +695,7 @@ def send_super_siaes_email_to_author(tender: Tender, top_siaes: list[Siae]):
}
)

api_brevo.send_transactional_email_with_template(
template_id=settings.BREVO_TENDERS_AUTHOR_SUPER_SIAES_TEMPLATE_ID,
email_template.send_transactional_email(
recipient_email=recipient_email,
recipient_name=recipient_name,
variables=variables,
Expand Down

0 comments on commit a609acd

Please sign in to comment.