From a00470d0c046774edc94ef01ef9bc590e8d58ac9 Mon Sep 17 00:00:00 2001 From: jessib Date: Tue, 7 May 2013 11:32:11 -0700 Subject: Display 3 most recent transactions on a customer's page, with a link to all of their transactions. --- billing/app/controllers/payments_controller.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'billing/app/controllers/payments_controller.rb') 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) -- cgit v1.2.3