summaryrefslogtreecommitdiff
path: root/billing/app/controllers/subscriptions_controller.rb
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2013-09-19 12:02:36 -0700
committerjessib <jessib@riseup.net>2013-09-19 12:02:36 -0700
commit890c9e170fc038eccb46eca3c1ddcf6f05eaa53f (patch)
tree2b1ab7c9e89f2aaae379938430f40e5b3babfbbf /billing/app/controllers/subscriptions_controller.rb
parent16b8966a0df0104390ce95e35f1bb17f173f8d4d (diff)
parent7398048b0fa261cd3178cb5309858eb845d01c77 (diff)
Merge pull request #84 from azul/test/billing-sessions0.2.3
Test/billing subscriptions
Diffstat (limited to 'billing/app/controllers/subscriptions_controller.rb')
-rw-r--r--billing/app/controllers/subscriptions_controller.rb3
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)