diff --git a/rowers/braintreestuff.py b/rowers/braintreestuff.py index 57ab9185..37ebd44d 100644 --- a/rowers/braintreestuff.py +++ b/rowers/braintreestuff.py @@ -55,10 +55,11 @@ from rowers.models import Rower,PaidPlan, CoachingGroup from rowers.utils import ProcessorCustomerError def process_webhook(notification): + print(notification.kind,notification.subscription.id) if notification.kind == 'subscription_charged_successfully': subscription_id = notification.subscription.id rs = Rower.objects.filter(subscription_id=subscription_id) - if rs.count == 0: + if rs.count() == 0: return 0 else: r = rs[0] @@ -293,6 +294,8 @@ def create_subscription(rower,data): "payment_method_nonce": nonce_from_the_client }) + + if result.is_success: payment_method_token = result.payment_method.token else: @@ -304,7 +307,6 @@ def create_subscription(rower,data): # "merchant_account_id": BRAINTREE_MERCHANT_ACCOUNT_ID, }) - if result.is_success: yesterday = (timezone.now()-datetime.timedelta(days=1)).date() rower.paidplan = plan