summaryrefslogtreecommitdiff
path: root/billing/app/controllers
diff options
context:
space:
mode:
authorjessib <jessib@leap.se>2013-05-07 11:32:11 -0700
committerAzul <azul@leap.se>2013-07-17 10:47:13 +0200
commita00470d0c046774edc94ef01ef9bc590e8d58ac9 (patch)
tree6745c8edb80ae2bec3ae3896ce806368dccada9d /billing/app/controllers
parent62b32320f38627dad870c7b3157576c48674c42b (diff)
Display 3 most recent transactions on a customer's page, with a link to all of their transactions.
Diffstat (limited to 'billing/app/controllers')
-rw-r--r--billing/app/controllers/customers_controller.rb6
-rw-r--r--billing/app/controllers/payments_controller.rb8
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)