diff options
author | jessib <jessib@riseup.net> | 2013-10-17 13:58:54 -0700 |
---|---|---|
committer | jessib <jessib@riseup.net> | 2013-10-17 13:58:54 -0700 |
commit | 92cb054d53aaac6864a6a805d9cdd3919f4a38bc (patch) | |
tree | 5751471169043c1b1867d9640551ae5cd2c8380e /billing/app/controllers/billing_admin_controller.rb | |
parent | a6f32017f5c7802798f10e2f4041037fb5684def (diff) |
Some cleanup of code to deal with past due subscriptions.
Diffstat (limited to 'billing/app/controllers/billing_admin_controller.rb')
-rw-r--r-- | billing/app/controllers/billing_admin_controller.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/billing/app/controllers/billing_admin_controller.rb b/billing/app/controllers/billing_admin_controller.rb index 419a937..cd6149f 100644 --- a/billing/app/controllers/billing_admin_controller.rb +++ b/billing/app/controllers/billing_admin_controller.rb @@ -2,14 +2,28 @@ class BillingAdminController < BillingBaseController before_filter :authorize_admin def show - @past_due_atleast_90_days = Braintree::Subscription.search do |search| + + 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) - @all_past_due = Braintree::Subscription.search do |search| + 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 |