From b6724b9d8db2d78b87aa4970e119b55e37326b45 Mon Sep 17 00:00:00 2001 From: Matt Lott Date: Thu, 9 Jul 2015 12:21:32 -0700 Subject: [PATCH] bug:Fix subscriptions API variable naming collision --- server/payments/subscription_handler.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/payments/subscription_handler.coffee b/server/payments/subscription_handler.coffee index ea9d8d14e..99e0cb5e4 100644 --- a/server/payments/subscription_handler.coffee +++ b/server/payments/subscription_handler.coffee @@ -14,6 +14,8 @@ User = require '../users/User' {getSponsoredSubsAmount} = require '../../app/core/utils' recipientCouponID = 'free' + +# TODO: rename this to avoid collisions with 'subscriptions' variables subscriptions = { basic: { gems: 3500 @@ -71,19 +73,19 @@ class SubscriptionHandler extends Handler getStripeSubscriptions: (req, res) -> # console.log 'subscription_handler getStripeSubscriptions' return @sendForbiddenError(res) unless req.user?.isAdmin() - subscriptions = [] + stripeSubscriptions = [] createGetSubFn = (customerID, subscriptionID) => (done) => stripe.customers.retrieveSubscription customerID, subscriptionID, (err, subscription) => # TODO: return error instead of ignore? - subscriptions.push(subscription) unless err + stripeSubscriptions.push(subscription) unless err done() tasks = [] for subscription in req.body.subscriptions tasks.push createGetSubFn(subscription.customerID, subscription.subscriptionID) async.parallel tasks, (err, results) => return @sendDatabaseError(res, err) if err - @sendSuccess(res, subscriptions) + @sendSuccess(res, stripeSubscriptions) getSubscribers: (req, res) -> # console.log 'subscription_handler getSubscribers'