diff options
author | azul <azul@riseup.net> | 2013-10-18 00:18:03 -0700 |
---|---|---|
committer | azul <azul@riseup.net> | 2013-10-18 00:18:03 -0700 |
commit | 221532448ba4c435427ad2b5b3eca729b352c354 (patch) | |
tree | 1caa069380cb075155e97755d3d94d1274b4a9ea /billing/app/controllers/billing_admin_controller.rb | |
parent | bf3b59e6807c8e4789b97232c7416093b07cccdf (diff) | |
parent | 92cb054d53aaac6864a6a805d9cdd3919f4a38bc (diff) |
Merge pull request #98 from jessib/feature/billing-past-due-subscriptions
Feature/billing past due subscriptions
Diffstat (limited to 'billing/app/controllers/billing_admin_controller.rb')
-rw-r--r-- | billing/app/controllers/billing_admin_controller.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/billing/app/controllers/billing_admin_controller.rb b/billing/app/controllers/billing_admin_controller.rb new file mode 100644 index 0000000..cd6149f --- /dev/null +++ b/billing/app/controllers/billing_admin_controller.rb @@ -0,0 +1,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 |