Send an email when campaign is refunded.

This commit is contained in:
Brian Simpson
2013-08-10 17:29:40 -04:00
parent d1dbfb270c
commit a4263a6991
4 changed files with 14 additions and 0 deletions

View File

@@ -268,6 +268,10 @@ def finished_promo(thing):
return _promo_email(thing, Email.Kind.FINISHED_PROMO)
def refunded_promo(thing):
return _promo_email(thing, Email.Kind.REFUNDED_CAMPAIGN)
def send_html_email(to_addr, from_addr, subject, html, subtype="html"):
from r2.lib.filters import _force_utf8
msg = MIMEText(_force_utf8(html), subtype)

View File

@@ -838,6 +838,7 @@ def refund_campaign(link, camp, billable_amount):
camp.refund_amount = refund_amount
camp._commit()
unset_underdelivered_campaigns(camp)
emailer.refunded_promo(link)
PromoTuple = namedtuple('PromoTuple', ['link', 'weight', 'campaign'])

View File

@@ -303,6 +303,7 @@ class Email(object):
"GOLDMAIL",
"PASSWORD_CHANGE",
"EMAIL_CHANGE",
"REFUNDED_PROMO",
)
subjects = {
@@ -324,6 +325,7 @@ class Email(object):
Kind.GOLDMAIL : _("[reddit] reddit gold activation link"),
Kind.PASSWORD_CHANGE : _("[reddit] your password has been changed"),
Kind.EMAIL_CHANGE : _("[reddit] your email address has been changed"),
Kind.REFUNDED_PROMO: _("[reddit] your campaign didn't get enough impressions")
}
def __init__(self, user, thing, email, from_name, date, ip, banned_ip,

View File

@@ -108,6 +108,13 @@ Thank you again for advertising on reddit, we hope you'll come back and do busin
http://www.reddit.com/r/selfserve
We're hoping to create a place for you to exchange tips and tricks for getting the most out of your sponsored links, as well as to provide support for new users.
%elif thing.kind == Email.Kind.REFUNDED_PROMO:
We're sorry, but we weren't able to deliver as many impressions as you paid for.
${edit_url}
We're working to improve the systems to predict our pageview inventory so this doesn't happen again. You have been refunded the unspent portion of your budget. If you have any questions or concerns please reply to this email.
%endif
Thank you,