         targetType  : this
         as          : 'linked subscription'
 
-  @fetchUserSubscriptions = secure ({ connection:{ delegate }}, callback) ->
+  @fetchUserSubscriptions = secure ({ connection:{ delegate } }, callback) ->
     delegate.fetchPaymentMethods (err, paymentMethods) =>
       return callback err  if err
       subscriptions = {}


    queue = [
      =>
        newPlan.checkQuota {@usage}, (err) -> queue.next err
      ->
        newPlan.subscribe paymentMethodId, subOptions, (err, newSub) ->
          return callback err  if err

          else
            @upgrade transitionOptions, callback

  debitPack: ({ tag, multiplyFactor }, callback) ->
    multiplyFactor ?= 1
    JPaymentPack = require './pack'
    JPaymentPack.one tags: $in: [tag], {}, (err, pack) =>
      return callback err  if err
      return callback new KodingError 'pack not found'  unless pack
      @debit { pack, multiplyFactor }, callback

  creditPack: ({ tag, multiplyFactor }, callback) ->
    multiplyFactor ?= 1
    multiplyFactor *= -1
    @debitPack { tag, multiplyFactor }, callback

  @createFreeSubscription = (account, callback) ->
    JPaymentPlan = require './plan'
    JPaymentPlan.one tags: 'nosync', (err, plan) ->
      return \
        if err then callback err
        else if not plan then callback new KodingError 'nosync plan not found'

      { planCode, quantities, tags } = plan
      freePlanSubscription = new JPaymentSubscription
        planCode   : planCode
        quantity   : 1
        status     : 'active'
        feeAmount  : 0
        quantities : quantities
        tags       : tags
