summaryrefslogtreecommitdiff
path: root/engines/billing/config
diff options
context:
space:
mode:
authorazul <azul@riseup.net>2014-04-17 10:12:05 +0200
committerazul <azul@riseup.net>2014-04-17 10:12:05 +0200
commit3513ad74f950b113af1ba1e3d06bc6a55c48fde5 (patch)
treedb49ebd4428053d5c8d720275b77594a531a1ad1 /engines/billing/config
parentcb6442c344d6bdaf52c3878b2de2fcf4d85f2648 (diff)
parent3d3688647fab7049e5b531c45b85c1e46a1d528f (diff)
Merge pull request #146 from azul/refactor/engines
Refactor/engines
Diffstat (limited to 'engines/billing/config')
-rw-r--r--engines/billing/config/initializers/braintree.rb23
-rw-r--r--engines/billing/config/locales/en.yml11
-rw-r--r--engines/billing/config/routes.rb25
3 files changed, 59 insertions, 0 deletions
diff --git a/engines/billing/config/initializers/braintree.rb b/engines/billing/config/initializers/braintree.rb
new file mode 100644
index 0000000..3d87f4c
--- /dev/null
+++ b/engines/billing/config/initializers/braintree.rb
@@ -0,0 +1,23 @@
+#
+# set logger
+#
+if APP_CONFIG[:logfile].blank?
+ require 'syslog/logger'
+ Braintree::Configuration.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new('webapp'))
+else
+ Braintree::Configuration.logger = Logger.new('log/braintree.log')
+end
+
+#
+# You can set these per environment in config/config.yml:
+#
+# Environment must be one of: :development, :qa, :sandbox, :production
+#
+if billing = APP_CONFIG[:billing]
+ if braintree = billing[:braintree]
+ Braintree::Configuration.environment = braintree[:environment].downcase.to_sym
+ Braintree::Configuration.merchant_id = braintree[:merchant_id]
+ Braintree::Configuration.public_key = braintree[:public_key]
+ Braintree::Configuration.private_key = braintree[:private_key]
+ end
+end
diff --git a/engines/billing/config/locales/en.yml b/engines/billing/config/locales/en.yml
new file mode 100644
index 0000000..1300958
--- /dev/null
+++ b/engines/billing/config/locales/en.yml
@@ -0,0 +1,11 @@
+en:
+ create_new_customer: "Create a new Braintree Customer"
+ must_create_customer: "You must store a customer in braintree before subscribing to a plan"
+ subscribe: "Subscribe"
+ save_customer_info: "Save Customer Information"
+ donation_not_payment: "Note: This is a donation, and will not be applied towards your account."
+ no_relevant_subscription: "No subscription which is Active, Pending, or Past Due"
+ plan: "Plan"
+ description: "Description"
+ cost: "Cost"
+ free: "Free" \ No newline at end of file
diff --git a/engines/billing/config/routes.rb b/engines/billing/config/routes.rb
new file mode 100644
index 0000000..7263dff
--- /dev/null
+++ b/engines/billing/config/routes.rb
@@ -0,0 +1,25 @@
+Rails.application.routes.draw do
+
+ scope "(:locale)", :locale => MATCH_LOCALE do
+ match 'payments/new' => 'payments#new', :as => :new_payment
+ match 'payments/confirm' => 'payments#confirm', :as => :confirm_payment
+ resources :users do
+ resources :payments, :only => [:index]
+ resources :subscriptions, :only => [:index, :show, :destroy]
+ end
+
+ resources :customer, :only => [:new, :edit]
+ resources :credit_card_info, :only => [:edit]
+
+ match 'customer/confirm/' => 'customer#confirm', :as => :confirm_customer
+ match 'customer/show/:id' => 'customer#show', :as => :show_customer
+ match 'credit_card_info/confirm' => 'credit_card_info#confirm', :as => :confirm_credit_card_info
+
+ resources :subscriptions, :only => [:new, :create, :update] # index, show & destroy are within users path
+ match 'billing_admin' => 'billing_admin#show', :as => :billing_admin
+
+ #match 'transactions/:product_id/new' => 'transactions#new', :as => :new_transaction
+ #match 'transactions/confirm/:product_id' => 'transactions#confirm', :as => :confirm_transaction
+ end
+
+end