summaryrefslogtreecommitdiff
path: root/billing/app/controllers/billing_admin_controller.rb
blob: cd6149fdc8fda2feef6f3d2fe13a6e14a982c32b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class BillingAdminController < BillingBaseController
  before_filter :authorize_admin

  def show

    br_atleast_90_days = Braintree::Subscription.search do |search|
      search.days_past_due >= 90
    end
    @past_due_atleast_90_days = braintree_resource_collection_to_array(br_atleast_90_days)

    br_all_past_due = Braintree::Subscription.search do |search|
      search.status.is Braintree::Subscription::Status::PastDue
      #cannot search by balance.
    end
    @all_past_due = braintree_resource_collection_to_array(br_all_past_due)

  end

  private

  def braintree_resource_collection_to_array(braintree_resource_collection)
    array = []
    braintree_resource_collection.each do |object|
      array << object
    end
    array
  end

end