diff options
Diffstat (limited to 'billing/app/controllers/payments_controller.rb')
-rw-r--r-- | billing/app/controllers/payments_controller.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/billing/app/controllers/payments_controller.rb b/billing/app/controllers/payments_controller.rb index 97e0353..99b7af8 100644 --- a/billing/app/controllers/payments_controller.rb +++ b/billing/app/controllers/payments_controller.rb @@ -1,4 +1,4 @@ -class PaymentsController < ApplicationController +class PaymentsController < BillingBaseController before_filter :authorize, :only => [:index] def new @@ -28,17 +28,18 @@ class PaymentsController < ApplicationController def fetch_transparent_redirect if current_user if @customer = Customer.find_by_user_id(current_user.id) - @braintree_data = Braintree::Customer.find(@customer.braintree_customer_id) - @default_cc = @customer.default_credit_card(@braintree_data) + @customer.with_braintree_data! braintree_customer_id = @customer.braintree_customer_id + @default_cc = @customer.default_credit_card else # TODO: this requires user to add self to vault before making payment. Is that desired functionality? redirect_to new_customer_path, :notice => 'Before making payment, please add your customer data' end end - @tr_data = Braintree::TransparentRedirect.transaction_data(:redirect_url => confirm_payment_url, - :transaction => {:type => "sale", :customer_id => braintree_customer_id, :options => {:submit_for_settlement => true } }) + # TODO: What is this supposed to do if braintree_customer_id was not set yet? + @tr_data = Braintree::TransparentRedirect.transaction_data redirect_url: confirm_payment_url, + transaction: { type: "sale", customer_id: braintree_customer_id, options: {submit_for_settlement: true } } end end |