diff --git a/lms/djangoapps/shoppingcart/models.py b/lms/djangoapps/shoppingcart/models.py index 5d8cdaa0cb..8615616c60 100644 --- a/lms/djangoapps/shoppingcart/models.py +++ b/lms/djangoapps/shoppingcart/models.py @@ -338,7 +338,7 @@ class Order(models.Model): 'email_from_address', settings.PAYMENT_SUPPORT_EMAIL ) - # send a unique email for each recipient, don't put all email addresses in a single email + # Send a unique email for each recipient. Don't put all email addresses in a single email. for recipient in recipient_list: message = render_to_string( 'emails/business_order_confirmation_email.txt' if is_order_type_business else 'emails/order_confirmation_email.txt', @@ -365,8 +365,7 @@ class Order(models.Model): to=[recipient[1]] ) - # only the business order is HTML formatted - # the single seat is simple text + # Only the business order is HTML formatted. A single seat order confirmation is plain text. if is_order_type_business: email.content_subtype = "html" @@ -653,7 +652,7 @@ class OrderItem(TimeStampedModel): """ Individual instructions for this order item. - Currently, only used for e-mails. + Currently, only used for emails. """ return '' @@ -1364,11 +1363,28 @@ class CertificateItem(OrderItem): @property def additional_instruction_text(self): - return _("Note - you have up to 2 weeks into the course to unenroll from the Verified Certificate option " - "and receive a full refund. To receive your refund, contact {billing_email}. " - "Please include your order number in your e-mail. " - "Please do NOT include your credit card information.").format( - billing_email=settings.PAYMENT_SUPPORT_EMAIL) + refund_reminder = _( + "You have up to two weeks into the course to unenroll from the Verified Certificate option " + "and receive a full refund. To receive your refund, contact {billing_email}. " + "Please include your order number in your email. " + "Please do NOT include your credit card information." + ).format(billing_email=settings.PAYMENT_SUPPORT_EMAIL) + + if settings.FEATURES.get('SEPARATE_VERIFICATION_FROM_PAYMENT'): + domain = microsite.get_value('SITE_NAME', settings.SITE_NAME) + path = reverse('verify_student_verify_later', args=[unicode(self.course_id)]) + verification_url = "http://{domain}{path}".format(domain=domain, path=path) + + verification_reminder = _( + "If you haven't verified your identity yet, please start the verification process ({verification_url})." + ).format(verification_url=verification_url) + + return "{verification_reminder} {refund_reminder}".format( + verification_reminder=verification_reminder, + refund_reminder=refund_reminder + ) + else: + return refund_reminder @classmethod def verified_certificates_count(cls, course_id, status): diff --git a/lms/djangoapps/shoppingcart/tests/test_models.py b/lms/djangoapps/shoppingcart/tests/test_models.py index 4718d25e81..a46a7127bd 100644 --- a/lms/djangoapps/shoppingcart/tests/test_models.py +++ b/lms/djangoapps/shoppingcart/tests/test_models.py @@ -268,6 +268,16 @@ class OrderTest(ModuleStoreTestCase): context={'Google Analytics': {'clientId': None}} ) + @patch.dict(settings.FEATURES, {'SEPARATE_VERIFICATION_FROM_PAYMENT': True}) + def test_payment_separate_from_verification_email(self): + cart = Order.get_cart_for_user(user=self.user) + item = CertificateItem.add_to_order(cart, self.course_key, self.cost, 'honor') + cart.purchase() + + self.assertEquals(len(mail.outbox), 1) + # Verify that the verification reminder appears in the sent email. + self.assertIn(item.additional_instruction_text, mail.outbox[0].body) + def test_purchase_item_failure(self): # once again, we're testing against the specific implementation of # CertificateItem diff --git a/lms/templates/emails/order_confirmation_email.txt b/lms/templates/emails/order_confirmation_email.txt index 0648cf0c70..17e19f6e57 100644 --- a/lms/templates/emails/order_confirmation_email.txt +++ b/lms/templates/emails/order_confirmation_email.txt @@ -1,29 +1,31 @@ <%! from django.utils.translation import ugettext as _ %> -${_("Hi {name}").format(name=order.user.profile.name)} +${_("Hi {name},").format(name=order.user.profile.name)} + +${_("Your payment was successful. You will see the charge below on your next credit or debit card statement under the company name {merchant_name}.").format(merchant_name=settings.CC_MERCHANT_NAME)} -${_("Your payment was successful. You will see the charge below on your next credit or debit card statement.")} -${_("The charge will show up on your statement under the company name {merchant_name}.").format(merchant_name=settings.CC_MERCHANT_NAME)} % if marketing_link('FAQ'): ${_("If you have billing questions, please read the FAQ ({faq_url}) or contact {billing_email}.").format(billing_email=payment_support_email, faq_url=marketing_link('FAQ'))} % else: ${_("If you have billing questions, please contact {billing_email}.").format(billing_email=payment_support_email)} % endif -${_("Warm regards,")} +${_("Thank you,")} + % if payment_email_signature: ${payment_email_signature} % else: ${_("The {platform_name} Team").format(platform_name=platform_name)} -%endif +% endif + ${_("Your order number is: {order_number}").format(order_number=order.id)} ${_("The items in your order are:")} ${_("Quantity - Description - Price")} -%for order_item in order_items: +% for order_item in order_items: ${order_item.qty} - ${order_item.line_desc} - ${currency_symbol}${order_item.line_cost} -%endfor +% endfor ${_("Total billed to credit/debit card: {currency_symbol}{total_cost}").format(total_cost=order.total_cost, currency_symbol=currency_symbol)} @@ -36,6 +38,6 @@ ${order.bill_to_city}, ${order.bill_to_state} ${order.bill_to_postalcode} ${order.bill_to_country.upper()} % endif -%for order_item in order_items: - ${order_item.additional_instruction_text} -%endfor +% for order_item in order_items: +${order_item.additional_instruction_text} +% endfor