   # See https://docs.recurly.com/api/accounts for XML format
   #
 
-  accObj = (acc, billing) ->
+  createAccountObject = (acc, billing) ->
     firstName : acc.first_name[0]
     lastName  : acc.last_name[0]
     email     : acc.email[0]


      adjs = []
      for page in res
        adjs.push adjObj a  for a in page.adjustments?.adjustment

      callback null, adjs


      """

    put "subscriptions/#{data.uuid}", xml, (err, res)->
      callback err, unless err then createSubscriptionObject res.subscription

  @terminateSubscription: (accountCode, data, callback)->
    data.refund ?= 'none'

    put "subscriptions/#{data.uuid}/terminate?refund=#{data.refund}", '', (err, res)->
      callback err, unless err then createSubscriptionObject res.subscription

  @cancelSubscription: (accountCode, data, callback)->
    put "subscriptions/#{data.uuid}/cancel", '', (err, res)->
      callback err, unless err then createSubscriptionObject res.subscription

  @reactivateUserSubscription: (accountCode, data, callback)->
    put "subscriptions/#{data.uuid}/reactivate", '', (err, res)->
      callback err, unless err then createSubscriptionObject res.subscription

  #
  # TRANSACTIONS
  # See https://docs.recurly.com/api/transactions for documentation
  #

  createTransactionObject = (t)->
    trans =
      uuid       : t.uuid[0]
      status     : t.status[0]
