Module: Freemium::ManualBilling::ClassMethods

Defined in:
lib/freemium/manual_billing.rb

Instance Method Summary collapse

Instance Method Details

#run_billingObject

the process you should run periodically



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/freemium/manual_billing.rb', line 49

def run_billing
  # charge all billable subscriptions
  @transactions = find_billable.collect{|b| b.charge!}
  # actually expire any subscriptions whose time has come
  expire

  # send the activity report
  Freemium.mailer.deliver_admin_report(
    @transactions # Add in transactions
  ) if Freemium.admin_report_recipients && !@transactions.empty?

  @transactions
end