           expenses += parseInt sub.amount, 10
 
         callback null, expenses
+
+

          amount       : 0
          active       : yes
        }
        pay.save (err)->
          if err then return callback { message: 'Unable to save transaction to database.' }
          callback null, pay

      if data.chargeTo is 'group'
        @canChargeGroup group, account, data, (err)=>
          return callback err  if err
          @chargeGroup group, plan, data, (err, subscription)=>
            return callback err  if err
            charge subscription.uuid
      else
        @chargeUser account, plan, data, (err, subscription)=>
          return callback err  if err
          charge subscription.uuid


jraphical = require 'jraphical'
recurly   = require 'koding-payment'
KodingError = require '../../error'

module.exports = class JPaymentPayment extends jraphical.Module

  { secure, daisy, signature }      = require 'bongo'

  JUser                = require '../user'
  JGroup               = require '../group'
  JPaymentPlan         = require './index'
  JPaymentSubscription = require './subscription'
  { Relationship }       = require 'jraphical'

  @share()

