diff options
author | jessib <jessib@riseup.net> | 2013-09-19 12:07:25 -0700 |
---|---|---|
committer | jessib <jessib@riseup.net> | 2013-09-19 12:07:25 -0700 |
commit | 3a2e64c75f67af89ffd78dbf80dd947896d85d22 (patch) | |
tree | ea17ee32d763bb875e4814b09ed1f443c112980c /billing/app/controllers/subscriptions_controller.rb | |
parent | e8a2db42813dc3f5d1ebb95eb896455d7a922505 (diff) | |
parent | 890c9e170fc038eccb46eca3c1ddcf6f05eaa53f (diff) |
Merge branch 'develop' into feature/only_lower_case_aliases
Diffstat (limited to 'billing/app/controllers/subscriptions_controller.rb')
-rw-r--r-- | billing/app/controllers/subscriptions_controller.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/billing/app/controllers/subscriptions_controller.rb b/billing/app/controllers/subscriptions_controller.rb index 4047847..7689f35 100644 --- a/billing/app/controllers/subscriptions_controller.rb +++ b/billing/app/controllers/subscriptions_controller.rb @@ -3,7 +3,7 @@ class SubscriptionsController < BillingBaseController before_filter :fetch_subscription, :only => [:show, :destroy] before_filter :confirm_no_active_subscription, :only => [:new, :create] # for now, admins cannot create or destroy subscriptions for others: - before_filter :confirm_self, :only => [:destroy, :new, :create] + before_filter :confirm_self, :only => [:new, :create] def new # don't show link to subscribe if they are already subscribed? @@ -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) |