diff options
Diffstat (limited to 'billing/app')
-rw-r--r-- | billing/app/controllers/customer_controller.rb | 2 | ||||
-rw-r--r-- | billing/app/helpers/billing_helper.rb | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/billing/app/controllers/customer_controller.rb b/billing/app/controllers/customer_controller.rb index c6cabe6..14ea8a7 100644 --- a/billing/app/controllers/customer_controller.rb +++ b/billing/app/controllers/customer_controller.rb @@ -4,7 +4,7 @@ class CustomerController < BillingBaseController customer.with_braintree_data! @default_cc = customer.default_credit_card #TODO not actually right way @active_subscription = customer.subscriptions - @transactions = Braintree::Customer.find(customer.braintree_customer_id).transactions #TODO not actually right way + @transactions = customer.braintree_customer.transactions end def new diff --git a/billing/app/helpers/billing_helper.rb b/billing/app/helpers/billing_helper.rb index f91d9c9..7ec9285 100644 --- a/billing/app/helpers/billing_helper.rb +++ b/billing/app/helpers/billing_helper.rb @@ -9,4 +9,12 @@ module BillingHelper form_for object, options, &block end + def show_or_new_customer_link(user) + if (customer = Customer.find_by_user_id(user.id)) and customer.has_payment_info? + show_customer_path(user) + else + new_customer_path + end + end + end |