         @sendSuccess(res, @subscribers)
 
   getSubscriptions: (req, res) ->
+    # console.log 'subscription_handler getSubscriptions'
     # Returns a list of active subscriptions
     # TODO: does not track sponsored subs, only basic
     # TODO: does not return free subs

      stripe.invoices.list options, (err, invoices) =>
        return done(err) if err
        for invoice in invoices.data
          continue unless invoice.paid
          continue unless invoice.subscription
          continue unless invoice.total > 0
          continue unless invoice.lines?.data?[0]?.plan?.id is 'basic'
          subID = invoice.subscription
          invoiceDate = new Date(invoice.date * 1000)
          if subID of @subMap
            @subMap[subID].first = invoiceDate
          else
            @subMap[subID] =
              first: invoiceDate
              last: invoiceDate
              customerID: invoice.customer
        if invoices.has_more
          # console.log 'Fetching more invoices', Object.keys(@subMap).length
          return processInvoices(invoices.data[invoices.data.length - 1].id, done)
        else
          return done()

    processInvoices null, (err) =>
      return @sendDatabaseError(res, err) if err
      @subs = []
      for subID of @subMap
        sub =
          start: @subMap[subID].first
          subID: subID
          customerID: @subMap[subID].customerID
        sub.cancel = @subMap[subID].cancel if @subMap[subID].cancel
        oneMonthAgo = new Date()
        oneMonthAgo.setUTCMonth(oneMonthAgo.getUTCMonth() - 1)
        if @subMap[subID].last < oneMonthAgo
          sub.end = new Date(@subMap[subID].last)
          sub.end.setUTCMonth(sub.end.getUTCMonth() + 1)
        @subs.push sub
      @sendSuccess(res, @subs)

  subscribeUser: (req, user, done) ->
    if (not req.user) or req.user.isAnonymous() or user.isAnonymous()

      @sendSuccess(res, @cancellations)

  getSubscribers: (req, res) ->
    # console.log 'subscription_handler getSubscribers'
    return @sendForbiddenError(res) unless req.user and req.user.isAdmin()

    maxReturnCount = req.body.maxCount or 20
