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

Commit

Permalink
Send email on successful bitcoin payin
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitpaulk committed Apr 10, 2015
1 parent 4a3a837 commit c8a18f1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions emails/coinbase_success.spt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{ _("Your Bitcoin payin was successful!") }}

[---] text/html
{{ _("Your coinbase payment for {0} succeeded. Thanks for using Gratipay!",
format_currency(amount, 'USD')) }}

[---] text/plain
{{ _("Your coinbase payment for {0} succeeded. Thanks for using Gratipay!",
format_currency(amount, 'USD')) }}
7 changes: 6 additions & 1 deletion www/callbacks/coinbase.spt
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@ 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'
amount = int(order['total_payout']['cents']) * D('0.01')
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

0 comments on commit c8a18f1

Please sign in to comment.