diff options
author | Azul <azul@leap.se> | 2013-09-18 12:03:41 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2013-09-18 12:03:41 +0200 |
commit | 18a00ade1a88887b9a99c72ed2054fa2012ae2dc (patch) | |
tree | 4b898e5819d48139705eebb7e2ffea6ce83b46b4 /billing/app/controllers/subscriptions_controller.rb | |
parent | d9c088fb288783f6afca441d870003c0f288a532 (diff) |
test subscription owner via credit card not transactions
There might not have been any transactions. Fixes the functional test
Diffstat (limited to 'billing/app/controllers/subscriptions_controller.rb')
-rw-r--r-- | billing/app/controllers/subscriptions_controller.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/billing/app/controllers/subscriptions_controller.rb b/billing/app/controllers/subscriptions_controller.rb index 4b1851a..7689f35 100644 --- a/billing/app/controllers/subscriptions_controller.rb +++ b/billing/app/controllers/subscriptions_controller.rb @@ -31,7 +31,8 @@ class SubscriptionsController < BillingBaseController def fetch_subscription @subscription = Braintree::Subscription.find params[:id] - @subscription_customer_id = @subscription.transactions.first.customer_details.id #all of subscriptions transactions should have same customer + @credit_card = Braintree::CreditCard.find @subscription.payment_method_token + @subscription_customer_id = @credit_card.customer_id current_user_customer = Customer.find_by_user_id(current_user.id) access_denied unless admin? or (current_user_customer and current_user_customer.braintree_customer_id == @subscription_customer_id) |