summaryrefslogtreecommitdiff
path: root/engines/billing/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'engines/billing/app/controllers')
-rw-r--r--engines/billing/app/controllers/billing_admin_controller.rb3
-rw-r--r--engines/billing/app/controllers/billing_base_controller.rb3
-rw-r--r--engines/billing/app/controllers/credit_card_info_controller.rb35
-rw-r--r--engines/billing/app/controllers/customer_controller.rb19
-rw-r--r--engines/billing/app/controllers/subscriptors.rb9
5 files changed, 6 insertions, 63 deletions
diff --git a/engines/billing/app/controllers/billing_admin_controller.rb b/engines/billing/app/controllers/billing_admin_controller.rb
index e11d4ee..23740d6 100644
--- a/engines/billing/app/controllers/billing_admin_controller.rb
+++ b/engines/billing/app/controllers/billing_admin_controller.rb
@@ -1,6 +1,9 @@
class BillingAdminController < BillingBaseController
before_filter :require_admin
+ #not sure if this controller is still needed. Admin can easly acess
+ #braintree's dashboard and check subscriptions. Don't know if everything
+ #should be 'self contained' in web_app""
def show
br_atleast_90_days = Braintree::Subscription.search do |search|
diff --git a/engines/billing/app/controllers/billing_base_controller.rb b/engines/billing/app/controllers/billing_base_controller.rb
index 0453677..c343938 100644
--- a/engines/billing/app/controllers/billing_base_controller.rb
+++ b/engines/billing/app/controllers/billing_base_controller.rb
@@ -13,6 +13,9 @@ class BillingBaseController < ApplicationController
elsif params[:id]
@user = User.find(params[:id])
else
+ #not sure if this is still needed. Donations work with either customer or
+ #anonymous_user. Subscriptions work with customer. Customer belongs to
+ #user.
# TODO
# hacky, what are cases where @user hasn't yet been set? certainly some cases with subscriptions and payments
@user = current_user
diff --git a/engines/billing/app/controllers/credit_card_info_controller.rb b/engines/billing/app/controllers/credit_card_info_controller.rb
deleted file mode 100644
index fbaa6f1..0000000
--- a/engines/billing/app/controllers/credit_card_info_controller.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-class CreditCardInfoController < ApplicationController
- before_filter :require_login, :set_user
-
- def edit
- @credit_card = Braintree::CreditCard.find(params[:id])
- customer = Customer.find_by_user_id(@user.id)
- if customer and customer.braintree_customer_id == @credit_card.customer_id
- @tr_data = Braintree::TransparentRedirect.
- update_credit_card_data(:redirect_url => confirm_credit_card_info_url,
- :payment_method_token => @credit_card.token)
- else
- access_denied
- end
-
- end
-
- def confirm
- @result = Braintree::TransparentRedirect.confirm(request.query_string)
- if @result.success?
- render :action => "confirm"
- else
- @credit_card = Braintree::CreditCard.find(@result.params[:payment_method_token])
- render :action => "edit"
- end
- end
-
-
- private
-
- def set_user
- # this assumes anybody, even an admin, will not access for another user.
- @user = current_user
- end
-
-end
diff --git a/engines/billing/app/controllers/customer_controller.rb b/engines/billing/app/controllers/customer_controller.rb
deleted file mode 100644
index 3a82ff7..0000000
--- a/engines/billing/app/controllers/customer_controller.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-class CustomerController < BillingBaseController
- before_filter :require_login
-
- def new
- if current_user.braintree_customer_id
- Braintree::Customer.find current_user.braintree_customer_id
- else
- customer = Braintree::Customer.create(payment_method_nonce: params[:payment_method_nonce]).customer
- current_user.update_attributes braintree_customer_id: customer.id
- customer
- end
- end
-
- def show
- if current_user.braintree_customer_id
- Braintree::Customer.find current_user.braintree_customer_id
- end
- end
-end
diff --git a/engines/billing/app/controllers/subscriptors.rb b/engines/billing/app/controllers/subscriptors.rb
deleted file mode 100644
index 2e80e69..0000000
--- a/engines/billing/app/controllers/subscriptors.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-def braintree_customer
- if current_user.braintree_customer_id
- Braintree::Customer.find current_user.braintree_customer_id
- else
- customer = Braintree::Customer.create(payment_method_nonce: params[:payment_method_nonce]).customer
- current_user.update_attributes braintree_customer_id: customer.id
- customer
- end
-end