passing tests now
This commit is contained in:
@@ -28,6 +28,7 @@ from rowers.tasks import (
|
||||
)
|
||||
|
||||
from rowers import credits
|
||||
from rowers.utils import dologging
|
||||
|
||||
import pandas as pd
|
||||
|
||||
@@ -70,6 +71,19 @@ def process_webhook(notification):
|
||||
except TypeError:
|
||||
f.write(timestamp+'\n')
|
||||
if notification.kind == 'subscription_charged_successfully':
|
||||
subscription = notification.subscription
|
||||
rs = Rower.objects.filter(subscription_id=subscription.id)
|
||||
if rs.count() == 0:
|
||||
dologging('braintreewebhooks.log','Could not find rowers with subscription ID {id}'.format(
|
||||
id=subscription.id
|
||||
))
|
||||
else:
|
||||
r = rs[0]
|
||||
transactions = subscription.transactions
|
||||
if transactions:
|
||||
amount = int(transactions[0].amount)
|
||||
eurocredits = credits.upgrade(amount,r)
|
||||
eurocredits = credits.upgrade(amount,r)
|
||||
return send_invoice(notification.subscription)
|
||||
if notification.kind == 'subscription_canceled':
|
||||
subscription = notification.subscription
|
||||
|
||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
@@ -214,7 +214,7 @@ def purchase_checkouts_view(request):
|
||||
return HttpResponseRedirect(reverse('rower_select_instantplan'))
|
||||
|
||||
amount, success = braintreestuff.make_payment(r,data)
|
||||
diff = plan.price - amount
|
||||
diff = plan.price - int(amount)
|
||||
|
||||
eurocredits = credits.withdraw(diff,r)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user