From f3a42a1ba882d4a7898ef59ec27b8902c29429f1 Mon Sep 17 00:00:00 2001 From: Rohit Paul Kuruvilla Date: Fri, 10 Apr 2015 13:41:50 +0530 Subject: [PATCH] Send email on successful bitcoin payin --- emails/coinbase_success.spt | 9 +++++++++ www/callbacks/coinbase.spt | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 emails/coinbase_success.spt diff --git a/emails/coinbase_success.spt b/emails/coinbase_success.spt new file mode 100644 index 0000000000..254a88e0f6 --- /dev/null +++ b/emails/coinbase_success.spt @@ -0,0 +1,9 @@ +{{ _("Your Bitcoin payin was successful!") }} + +[---] text/html +{{ _("Your Bitcoin payment for {0} succeeded. Thanks for using Gratipay!", + format_currency(amount, 'USD')) }} + +[---] text/plain +{{ _("Your Bitcoin payment for {0} succeeded. Thanks for using Gratipay!", + format_currency(amount, 'USD')) }} diff --git a/www/callbacks/coinbase.spt b/www/callbacks/coinbase.spt index 5e16c48ce8..42e8c7859c 100644 --- a/www/callbacks/coinbase.spt +++ b/www/callbacks/coinbase.spt @@ -34,6 +34,7 @@ if order: status = order['status'] + # We're ignoring mispayments/expired orders here. if status == 'completed': assert order['total_native']['currency_iso'] == 'USD' assert order['total_payout']['currency_iso'] == 'USD' @@ -41,6 +42,10 @@ if order: fee = int(order['total_native']['cents']) * D('0.01') - amount record_exchange(website.db, route, amount, fee, participant, 'succeeded') - # TODO - handle mispayments + participant.queue_email( + 'coinbase_success', + amount=amount + ) + [---] text/plain