diff options
author | jessib <jessib@leap.se> | 2013-04-01 11:35:10 -0700 |
---|---|---|
committer | Azul <azul@leap.se> | 2013-07-17 10:47:12 +0200 |
commit | bee5c4a93f6bf664609673d7e703476f15147fe3 (patch) | |
tree | ff57a2267399dc22636eb2e328de7a56d4d123ae /billing/app/controllers/payments_controller.rb | |
parent | c436fce774573d090ab77617dbf55b25b2da4ea2 (diff) |
Some tweaks to optimize number of requests to braintree API.
Diffstat (limited to 'billing/app/controllers/payments_controller.rb')
-rw-r--r-- | billing/app/controllers/payments_controller.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/billing/app/controllers/payments_controller.rb b/billing/app/controllers/payments_controller.rb index 965e417..41b7b3e 100644 --- a/billing/app/controllers/payments_controller.rb +++ b/billing/app/controllers/payments_controller.rb @@ -3,7 +3,7 @@ class PaymentsController < ApplicationController if current_user if @customer = Customer.find_by_user_id(current_user.id) @braintree_data = Braintree::Customer.find(@customer.braintree_customer_id) - @default_cc = @braintree_data.credit_cards.find { |cc| cc.default? } + @default_cc = @customer.default_credit_card(@braintree_data) @tr_data = transparent_redirect(@customer.braintree_customer_id) else redirect_to new_customer_path |