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

Commit

Permalink
Check for event type, not order status
Browse files Browse the repository at this point in the history
This prevents mispayments (after an order is complete) from modifying
one's balance.
  • Loading branch information
rohitpaulk committed Apr 13, 2015
1 parent d134d4d commit fefe657
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion tests/py/test_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ def test_coinbase_success_callback(self, re):
body = json.dumps({
"order": {
"id": "10N9LK1Q",
"status": "completed",
"event": {
"type": "completed"
},
"total_native": {
"cents": 100,
"currency_iso": "USD"
Expand Down
2 changes: 1 addition & 1 deletion www/callbacks/coinbase.spt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if order:
if not isinstance(route, ExchangeRoute):
route = ExchangeRoute.insert(participant, 'coinbase-payin', order['id'])

status = order['status']
status = order['event']['type']

# We're ignoring mispayments/expired orders here.
if status == 'completed':
Expand Down

0 comments on commit fefe657

Please sign in to comment.