Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
add email simplate for failed charges
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco committed Apr 8, 2015
1 parent 5c4ce22 commit 4633085
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
30 changes: 30 additions & 0 deletions emails/charge_failed.spt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{ ngettext("Your payment failed!", "Your payments failed!", ntippees) }}

[---] text/html
{{ ngettext(
"We tried to charge your credit card {0} today, to fund your weekly payment to {1}, but it failed.",
"We tried to charge your credit card {0} today, to fund your weekly payments to {1}, but it failed.",
format_currency(exchange.amount, 'USD'),
top_tippee.username if ntippees == 1 else ngettext('{0} and {n} other', '{0} and {n} others', ntippees - 1, top_tippee.username)
) }}

{{ _("The error message we received from our payment processor is:") }}<pre>

{{ exchange.note }}
</pre>

<a href="{{ participant.profile_url+'routes/credit-card.html' }}" style="{{ button_style }}">{{ _("Fix your credit card") }}</a>

[---] text/plain
{{ ngettext(
"We tried to charge your credit card {0} today, to fund your weekly payment to {1}, but it failed.",
"We tried to charge your credit card {0} today, to fund your weekly payments to {1}, but it failed.",
format_currency(exchange.amount, 'USD'),
top_tippee.username if ntippees == 1 else ngettext('{0} and {n} other', '{0} and {n} others', ntippees - 1, top_tippee.username)
) }}

{{ _("The error message we received from our payment processor is:") }}

{{ exchange.note }}

{{ _("Follow this link to fix your credit card:") }} {{ participant.profile_url+'routes/credit-card.html' }}
2 changes: 1 addition & 1 deletion emails/verification.spt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
('<b><a href="https://gratipay.com/{0}">{0}</a></b>'|safe).format(username)) }}
<br>
<br>
<a href="{{ link }}" style="color: #fff; text-decoration:none; display:inline-block; padding: 0 15px; background: #396; font: normal 14px/40px Arial, sans-serif; white-space: nowrap; border-radius: 3px">{{ _("Yes, proceed!") }}</a>
<a href="{{ link }}" style="{{ button_style }}">{{ _("Yes, proceed!") }}</a>

[---] text/plain
{{ _("We've received a request to connect {0} to the {1} account on Gratipay. Sound familiar?",
Expand Down
5 changes: 5 additions & 0 deletions gratipay/models/participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,11 @@ def remove_email(self, address):

def send_email(self, spt_name, **context):
context['username'] = self.username
context['button_style'] = (
"color: #fff; text-decoration:none; display:inline-block; "
"padding: 0 15px; background: #396; white-space: nowrap; "
"font: normal 14px/40px Arial, sans-serif; border-radius: 3px"
)
context.setdefault('include_unsubscribe', True)
email = context.setdefault('email', self.email_address)
langs = i18n.parse_accept_lang(self.email_lang or 'en')
Expand Down

0 comments on commit 4633085

Please sign in to comment.