Update email context

This commit is contained in:
Christian Cueni 2023-12-22 19:51:54 +01:00
parent df5fc71aca
commit 2bd6e02fa1
2 changed files with 34 additions and 5 deletions

View File

@ -89,6 +89,22 @@ class DatatransWebhookTestCase(APITestCase):
state=CheckoutState.ONGOING,
)
checkout_info = CheckoutInformation.objects.get(transaction_id=transaction_id)
checkout_info.first_name = "Max"
checkout_info.last_name = "Mustermann"
checkout_info.street = "Musterstrasse"
checkout_info.street_number = "1"
checkout_info.postal_code = "1234"
checkout_info.city = "Musterstadt"
checkout_info.country = "Schweiz"
checkout_info.company_name = "Musterfirma"
checkout_info.company_street = "Firmastrasse"
checkout_info.company_street_number = "2"
checkout_info.company_postal_code = "5678"
checkout_info.company_city = "Firmastadt"
checkout_info.company_country = "Schweiz"
checkout_info.save()
mock_is_signature_valid.return_value = True
# WHEN
@ -148,8 +164,14 @@ class DatatransWebhookTestCase(APITestCase):
template=EmailTemplate.WELCOME_MAIL_VV,
recipient_email=self.user.email,
template_data={
"course": "Versicherungsvermittler/-in (Deutsch)",
"course": "Versicherungsvermittler/-in VBV (Deutsch)",
"target_url": "https://my.vbv-afa.ch/",
"name": "Max Mustermann",
"private_street": "Musterstrasse 1",
"private_city": "1234 Musterstadt Schweiz",
"company_name": "Musterfirma",
"company_street": "Firmastrasse 2",
"company_city": "5678 Firmastadt Schweiz",
},
template_language=self.user.language,
fail_silently=ANY,

View File

@ -197,9 +197,9 @@ def update_checkout_state(checkout_info: CheckoutInformation, state: CheckoutSta
def send_vv_welcome_email(checkout_info: CheckoutInformation):
course_names = {
VV_DE_PRODUCT_SKU: "Versicherungsvermittler/-in (Deutsch)",
VV_FR_PRODUCT_SKU: "Intermédiaire dassurance (Français)",
VV_IT_PRODUCT_SKU: "Intermediario/a assicurativo/a (Italiano)",
VV_DE_PRODUCT_SKU: "Versicherungsvermittler/-in VBV (Deutsch)",
VV_FR_PRODUCT_SKU: "Intermédiaire dassurance AFA (Français)",
VV_IT_PRODUCT_SKU: "Intermediario/a assicurativo/a AFA (Italiano)",
}
send_email(
@ -208,8 +208,15 @@ def send_vv_welcome_email(checkout_info: CheckoutInformation):
template_data={
"course": course_names[checkout_info.product_sku],
"target_url": "https://my.vbv-afa.ch/",
"name": f"{checkout_info.first_name} {checkout_info.last_name}",
"private_street": f"{checkout_info.street} {checkout_info.street_number}",
"private_city": f"{checkout_info.postal_code} {checkout_info.city} {checkout_info.country}",
"company_name": checkout_info.company_name,
"company_street": f"{checkout_info.company_street} {checkout_info.company_street_number}",
"company_city": f"{checkout_info.company_postal_code} {checkout_info.company_city} {checkout_info.company_country}",
},
template_language=checkout_info.user.language,
# template_language=checkout_info.user.language,
template_language="de",
fail_silently=True,
)