diff options
Diffstat (limited to 'billing/app/controllers')
-rw-r--r-- | billing/app/controllers/customers_controller.rb | 6 | ||||
-rw-r--r-- | billing/app/controllers/payments_controller.rb | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/billing/app/controllers/customers_controller.rb b/billing/app/controllers/customers_controller.rb index b0184af..2532334 100644 --- a/billing/app/controllers/customers_controller.rb +++ b/billing/app/controllers/customers_controller.rb @@ -5,12 +5,6 @@ class CustomersController < BillingBaseController def show @active_subscription = @customer.subscriptions(@braintree_data) - # UGLY Braintree::ResourceCollection to array. - # might want method - @transactions = [] - @braintree_data.transactions.each do |transaction| - @transactions << transaction - end end def new diff --git a/billing/app/controllers/payments_controller.rb b/billing/app/controllers/payments_controller.rb index 49a0c8a..89fdeb0 100644 --- a/billing/app/controllers/payments_controller.rb +++ b/billing/app/controllers/payments_controller.rb @@ -1,4 +1,6 @@ class PaymentsController < ApplicationController + before_filter :authorize, :only => [:index] + def new if current_user if @customer = Customer.find_by_user_id(current_user.id) @@ -25,6 +27,12 @@ class PaymentsController < ApplicationController end end + def index + customer = Customer.find_by_user_id(current_user.id) + braintree_data = Braintree::Customer.find(customer.braintree_customer_id) + @transactions = braintree_data.transactions + end + protected def transparent_redirect(braintree_customer_id = nil) |