mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 10:06:08 -05:00
Merge branch 'master' of https://github.com/codecombat/codecombat
This commit is contained in:
commit
fb47efb4f7
1 changed files with 5 additions and 3 deletions
|
@ -14,6 +14,8 @@ User = require '../users/User'
|
||||||
{getSponsoredSubsAmount} = require '../../app/core/utils'
|
{getSponsoredSubsAmount} = require '../../app/core/utils'
|
||||||
|
|
||||||
recipientCouponID = 'free'
|
recipientCouponID = 'free'
|
||||||
|
|
||||||
|
# TODO: rename this to avoid collisions with 'subscriptions' variables
|
||||||
subscriptions = {
|
subscriptions = {
|
||||||
basic: {
|
basic: {
|
||||||
gems: 3500
|
gems: 3500
|
||||||
|
@ -71,19 +73,19 @@ class SubscriptionHandler extends Handler
|
||||||
getStripeSubscriptions: (req, res) ->
|
getStripeSubscriptions: (req, res) ->
|
||||||
# console.log 'subscription_handler getStripeSubscriptions'
|
# console.log 'subscription_handler getStripeSubscriptions'
|
||||||
return @sendForbiddenError(res) unless req.user?.isAdmin()
|
return @sendForbiddenError(res) unless req.user?.isAdmin()
|
||||||
subscriptions = []
|
stripeSubscriptions = []
|
||||||
createGetSubFn = (customerID, subscriptionID) =>
|
createGetSubFn = (customerID, subscriptionID) =>
|
||||||
(done) =>
|
(done) =>
|
||||||
stripe.customers.retrieveSubscription customerID, subscriptionID, (err, subscription) =>
|
stripe.customers.retrieveSubscription customerID, subscriptionID, (err, subscription) =>
|
||||||
# TODO: return error instead of ignore?
|
# TODO: return error instead of ignore?
|
||||||
subscriptions.push(subscription) unless err
|
stripeSubscriptions.push(subscription) unless err
|
||||||
done()
|
done()
|
||||||
tasks = []
|
tasks = []
|
||||||
for subscription in req.body.subscriptions
|
for subscription in req.body.subscriptions
|
||||||
tasks.push createGetSubFn(subscription.customerID, subscription.subscriptionID)
|
tasks.push createGetSubFn(subscription.customerID, subscription.subscriptionID)
|
||||||
async.parallel tasks, (err, results) =>
|
async.parallel tasks, (err, results) =>
|
||||||
return @sendDatabaseError(res, err) if err
|
return @sendDatabaseError(res, err) if err
|
||||||
@sendSuccess(res, subscriptions)
|
@sendSuccess(res, stripeSubscriptions)
|
||||||
|
|
||||||
getSubscribers: (req, res) ->
|
getSubscribers: (req, res) ->
|
||||||
# console.log 'subscription_handler getSubscribers'
|
# console.log 'subscription_handler getSubscribers'
|
||||||
|
|
Loading…
Reference in a new issue