diff options
author | Azul <azul@leap.se> | 2013-07-02 17:14:32 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2013-07-17 10:47:14 +0200 |
commit | 1e4245907ca17d1d6afbeca82b25c35c970ba499 (patch) | |
tree | 432d9012731d2f35b704541f1fd976aaef2ae92f /billing/app/controllers | |
parent | 968448cea22364f1fd423cedc54cf6d8a0f2e09e (diff) |
billing: functional test for payments controller
Diffstat (limited to 'billing/app/controllers')
-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 |