From 60b9bf4f995e904772b1f0d68f10293b8c7c3b0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9?= Date: Wed, 9 Oct 2024 11:02:58 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20tender=5Fid=20en=20param=20de=20la?= =?UTF-8?q?=20m=C3=A9thode=20'add=5Fto=5Fcontact=5Flist'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lemarche/utils/emails.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lemarche/utils/emails.py b/lemarche/utils/emails.py index 9c621da4f..3fa278fd5 100644 --- a/lemarche/utils/emails.py +++ b/lemarche/utils/emails.py @@ -54,7 +54,7 @@ def whitelist_recipient_list(recipient_list): return [email for email in recipient_list if (email and email.endswith("beta.gouv.fr"))] -def add_to_contact_list(user, type: str, source: str = user_constants.SOURCE_SIGNUP_FORM): +def add_to_contact_list(user, type: str, tender_id: int = None, source: str = user_constants.SOURCE_SIGNUP_FORM): """Add user to contactlist Args: @@ -65,7 +65,8 @@ def add_to_contact_list(user, type: str, source: str = user_constants.SOURCE_SIG if type == "signup": contact_list_id = api_mailjet.get_mailjet_cl_on_signup(user, source) if user.kind == user.KIND_BUYER: - api_brevo.create_contact(user=user, list_id=settings.BREVO_CL_SIGNUP_BUYER_ID) + tender_id = user.tenders.first().id if user.tenders.exists() else None + api_brevo.create_contact(user=user, list_id=settings.BREVO_CL_SIGNUP_BUYER_ID, tender_id=tender_id) elif user.kind == user.KIND_SIAE: api_brevo.create_contact(user=user, list_id=settings.BREVO_CL_SIGNUP_SIAE_ID) elif type == "buyer_search": @@ -74,6 +75,7 @@ def add_to_contact_list(user, type: str, source: str = user_constants.SOURCE_SIG elif type == "buyer_search_traiteur": contact_list_id = settings.MAILJET_NL_CL_BUYER_SEARCH_SIAE_TRAITEUR_LIST_ID elif type == "buyer_search_nettoyage": + print("buyer_search_nettoyage") contact_list_id = settings.MAILJET_NL_CL_BUYER_SEARCH_SIAE_NETTOYAGE_LIST_ID elif type == "buyer_download": contact_list_id = settings.MAILJET_NL_CL_BUYER_DOWNLOAD_SIAE_LIST_ID