Skip to content

Commit

Permalink
fix: Fix du nom et prénom dans la synchronisation des contacts avec B…
Browse files Browse the repository at this point in the history
…revo (#1311)
  • Loading branch information
madjid-asa authored Jun 28, 2024
1 parent af22ef4 commit e7c1ef5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lemarche/utils/apis/api_brevo.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def create_contact(user, list_id: int):
email=user.email,
list_ids=[list_id],
attributes={
"NOM": user.first_name,
"PRENOM": user.last_name,
"NOM": user.last_name,
"PRENOM": user.first_name,
"DATE_INSCRIPTION": user.created_at,
"TYPE_ORGANISATION": user.buyer_kind_detail,
"NOM_ENTREPRISE": user.company_name,
Expand All @@ -62,6 +62,17 @@ def create_contact(user, list_id: int):
logger.error(f"Exception when calling Brevo->ContactsApi->create_contact: {e}")


def update_contact(user_identifier: str, attributes_to_update: dict):
api_client = get_api_client()
api_instance = sib_api_v3_sdk.ContactsApi(api_client)
update_contact = sib_api_v3_sdk.UpdateContact(attributes=attributes_to_update)
try:
api_response = api_instance.update_contact(identifier=user_identifier, update_contact=update_contact)
logger.info(f"Success Brevo->ContactsApi->update_contact: {api_response}")
except ApiException as e:
logger.error(f"Exception when calling Brevo->ContactsApi->update_contact: {e}")


def remove_contact_from_list(user, list_id: int):
api_client = get_api_client()
api_instance = sib_api_v3_sdk.ContactsApi(api_client)
Expand Down

0 comments on commit e7c1ef5

Please sign in to comment.