effective_orders 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +856 -0
  4. data/Rakefile +24 -0
  5. data/app/assets/images/effective_orders/stripe_connect.png +0 -0
  6. data/app/assets/javascripts/effective_orders/shipping_address_toggle.js.coffee +30 -0
  7. data/app/assets/javascripts/effective_orders/stripe_charges.js.coffee +26 -0
  8. data/app/assets/javascripts/effective_orders/stripe_subscriptions.js.coffee +28 -0
  9. data/app/assets/javascripts/effective_orders.js +2 -0
  10. data/app/assets/stylesheets/effective_orders/_order.scss +30 -0
  11. data/app/assets/stylesheets/effective_orders.css.scss +1 -0
  12. data/app/controllers/admin/customers_controller.rb +15 -0
  13. data/app/controllers/admin/orders_controller.rb +22 -0
  14. data/app/controllers/effective/carts_controller.rb +70 -0
  15. data/app/controllers/effective/orders_controller.rb +191 -0
  16. data/app/controllers/effective/providers/moneris.rb +94 -0
  17. data/app/controllers/effective/providers/paypal.rb +29 -0
  18. data/app/controllers/effective/providers/stripe.rb +125 -0
  19. data/app/controllers/effective/providers/stripe_connect.rb +47 -0
  20. data/app/controllers/effective/subscriptions_controller.rb +123 -0
  21. data/app/controllers/effective/webhooks_controller.rb +86 -0
  22. data/app/helpers/effective_carts_helper.rb +90 -0
  23. data/app/helpers/effective_orders_helper.rb +108 -0
  24. data/app/helpers/effective_paypal_helper.rb +37 -0
  25. data/app/helpers/effective_stripe_helper.rb +63 -0
  26. data/app/mailers/effective/orders_mailer.rb +64 -0
  27. data/app/models/concerns/acts_as_purchasable.rb +134 -0
  28. data/app/models/effective/access_denied.rb +17 -0
  29. data/app/models/effective/cart.rb +65 -0
  30. data/app/models/effective/cart_item.rb +40 -0
  31. data/app/models/effective/customer.rb +61 -0
  32. data/app/models/effective/datatables/customers.rb +45 -0
  33. data/app/models/effective/datatables/orders.rb +53 -0
  34. data/app/models/effective/order.rb +247 -0
  35. data/app/models/effective/order_item.rb +69 -0
  36. data/app/models/effective/stripe_charge.rb +35 -0
  37. data/app/models/effective/subscription.rb +95 -0
  38. data/app/models/inputs/price_field.rb +63 -0
  39. data/app/models/inputs/price_form_input.rb +7 -0
  40. data/app/models/inputs/price_formtastic_input.rb +9 -0
  41. data/app/models/inputs/price_input.rb +19 -0
  42. data/app/models/inputs/price_simple_form_input.rb +8 -0
  43. data/app/models/validators/effective/sold_out_validator.rb +7 -0
  44. data/app/views/active_admin/effective_orders/orders/_show.html.haml +70 -0
  45. data/app/views/admin/customers/_actions.html.haml +2 -0
  46. data/app/views/admin/customers/index.html.haml +10 -0
  47. data/app/views/admin/orders/index.html.haml +7 -0
  48. data/app/views/admin/orders/show.html.haml +11 -0
  49. data/app/views/effective/carts/_cart.html.haml +33 -0
  50. data/app/views/effective/carts/show.html.haml +18 -0
  51. data/app/views/effective/orders/_checkout_step_1.html.haml +39 -0
  52. data/app/views/effective/orders/_checkout_step_2.html.haml +18 -0
  53. data/app/views/effective/orders/_my_purchases.html.haml +15 -0
  54. data/app/views/effective/orders/_order.html.haml +4 -0
  55. data/app/views/effective/orders/_order_header.html.haml +21 -0
  56. data/app/views/effective/orders/_order_items.html.haml +39 -0
  57. data/app/views/effective/orders/_order_payment_details.html.haml +11 -0
  58. data/app/views/effective/orders/_order_shipping.html.haml +19 -0
  59. data/app/views/effective/orders/_order_user_fields.html.haml +10 -0
  60. data/app/views/effective/orders/checkout.html.haml +3 -0
  61. data/app/views/effective/orders/declined.html.haml +10 -0
  62. data/app/views/effective/orders/moneris/_form.html.haml +34 -0
  63. data/app/views/effective/orders/my_purchases.html.haml +6 -0
  64. data/app/views/effective/orders/my_sales.html.haml +28 -0
  65. data/app/views/effective/orders/new.html.haml +4 -0
  66. data/app/views/effective/orders/paypal/_form.html.haml +5 -0
  67. data/app/views/effective/orders/purchased.html.haml +10 -0
  68. data/app/views/effective/orders/show.html.haml +17 -0
  69. data/app/views/effective/orders/stripe/_form.html.haml +8 -0
  70. data/app/views/effective/orders/stripe/_subscription_fields.html.haml +7 -0
  71. data/app/views/effective/orders_mailer/order_receipt_to_admin.html.haml +8 -0
  72. data/app/views/effective/orders_mailer/order_receipt_to_buyer.html.haml +8 -0
  73. data/app/views/effective/orders_mailer/order_receipt_to_seller.html.haml +30 -0
  74. data/app/views/effective/subscriptions/index.html.haml +16 -0
  75. data/app/views/effective/subscriptions/new.html.haml +10 -0
  76. data/app/views/effective/subscriptions/show.html.haml +49 -0
  77. data/config/routes.rb +57 -0
  78. data/db/migrate/01_create_effective_orders.rb.erb +91 -0
  79. data/db/upgrade/02_upgrade_effective_orders_from03x.rb.erb +29 -0
  80. data/db/upgrade/upgrade_price_column_on_table.rb.erb +17 -0
  81. data/lib/effective_orders/engine.rb +52 -0
  82. data/lib/effective_orders/version.rb +3 -0
  83. data/lib/effective_orders.rb +76 -0
  84. data/lib/generators/effective_orders/install_generator.rb +38 -0
  85. data/lib/generators/effective_orders/upgrade_from03x_generator.rb +34 -0
  86. data/lib/generators/effective_orders/upgrade_price_column_generator.rb +34 -0
  87. data/lib/generators/templates/README +1 -0
  88. data/lib/generators/templates/effective_orders.rb +210 -0
  89. data/spec/controllers/carts_controller_spec.rb +143 -0
  90. data/spec/controllers/moneris_orders_controller_spec.rb +245 -0
  91. data/spec/controllers/orders_controller_spec.rb +418 -0
  92. data/spec/controllers/stripe_orders_controller_spec.rb +127 -0
  93. data/spec/controllers/webhooks_controller_spec.rb +79 -0
  94. data/spec/dummy/README.rdoc +8 -0
  95. data/spec/dummy/Rakefile +6 -0
  96. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  97. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  98. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  99. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  100. data/spec/dummy/app/models/product.rb +17 -0
  101. data/spec/dummy/app/models/product_with_float_price.rb +17 -0
  102. data/spec/dummy/app/models/user.rb +28 -0
  103. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  104. data/spec/dummy/bin/bundle +3 -0
  105. data/spec/dummy/bin/rails +4 -0
  106. data/spec/dummy/bin/rake +4 -0
  107. data/spec/dummy/config/application.rb +31 -0
  108. data/spec/dummy/config/boot.rb +5 -0
  109. data/spec/dummy/config/database.yml +25 -0
  110. data/spec/dummy/config/environment.rb +5 -0
  111. data/spec/dummy/config/environments/development.rb +37 -0
  112. data/spec/dummy/config/environments/production.rb +83 -0
  113. data/spec/dummy/config/environments/test.rb +39 -0
  114. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  115. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  116. data/spec/dummy/config/initializers/devise.rb +254 -0
  117. data/spec/dummy/config/initializers/effective_addresses.rb +15 -0
  118. data/spec/dummy/config/initializers/effective_orders.rb +22 -0
  119. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  120. data/spec/dummy/config/initializers/inflections.rb +16 -0
  121. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  122. data/spec/dummy/config/initializers/session_store.rb +3 -0
  123. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  124. data/spec/dummy/config/locales/en.yml +23 -0
  125. data/spec/dummy/config/routes.rb +3 -0
  126. data/spec/dummy/config/secrets.yml +22 -0
  127. data/spec/dummy/config.ru +4 -0
  128. data/spec/dummy/db/schema.rb +142 -0
  129. data/spec/dummy/db/test.sqlite3 +0 -0
  130. data/spec/dummy/log/development.log +487 -0
  131. data/spec/dummy/log/test.log +347 -0
  132. data/spec/dummy/public/404.html +67 -0
  133. data/spec/dummy/public/422.html +67 -0
  134. data/spec/dummy/public/500.html +66 -0
  135. data/spec/dummy/public/favicon.ico +0 -0
  136. data/spec/helpers/effective_orders_helper_spec.rb +21 -0
  137. data/spec/models/acts_as_purchasable_spec.rb +107 -0
  138. data/spec/models/customer_spec.rb +71 -0
  139. data/spec/models/factories_spec.rb +13 -0
  140. data/spec/models/order_item_spec.rb +35 -0
  141. data/spec/models/order_spec.rb +323 -0
  142. data/spec/models/stripe_charge_spec.rb +39 -0
  143. data/spec/models/subscription_spec.rb +103 -0
  144. data/spec/spec_helper.rb +44 -0
  145. data/spec/support/factories.rb +118 -0
  146. metadata +387 -0
@@ -0,0 +1,17 @@
1
+ class Product < ActiveRecord::Base
2
+ acts_as_purchasable
3
+
4
+ structure do
5
+ price :integer, :default => 0
6
+ title :string
7
+ tax_exempt :boolean
8
+
9
+ timestamps
10
+ end
11
+
12
+ after_purchase do |order, order_item|
13
+ end
14
+
15
+ after_decline do |order, order_item|
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ class ProductWithFloatPrice < ActiveRecord::Base
2
+ acts_as_purchasable
3
+
4
+ structure do
5
+ price :decimal, :default => 0.0
6
+ title :string
7
+ tax_exempt :boolean
8
+
9
+ timestamps
10
+ end
11
+
12
+ after_purchase do |order, order_item|
13
+ end
14
+
15
+ after_decline do |order, order_item|
16
+ end
17
+ end
@@ -0,0 +1,28 @@
1
+ class User < ActiveRecord::Base
2
+ devise :database_authenticatable, :registerable, :rememberable, :recoverable, :trackable, :validatable, :authentication_keys => [:email]
3
+
4
+ acts_as_addressable :billing, :shipping
5
+
6
+ attr_accessor :first_name, :last_name
7
+
8
+ structure do
9
+ # Devise attributes
10
+ encrypted_password :string, :validates => [:presence]
11
+ reset_password_token :string
12
+ reset_password_sent_at :datetime
13
+ remember_created_at :datetime
14
+ confirmation_sent_at :datetime
15
+ confirmed_at :datetime
16
+ confirmation_token :string
17
+ unconfirmed_email :string
18
+ sign_in_count :integer, :default => 0
19
+ current_sign_in_at :datetime
20
+ last_sign_in_at :datetime
21
+ current_sign_in_ip :string
22
+ last_sign_in_ip :string
23
+
24
+ email :string
25
+
26
+ timestamps
27
+ end
28
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,31 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require(*Rails.groups)
6
+ require 'devise'
7
+ require 'haml'
8
+ require 'effective_addresses'
9
+ require "effective_orders"
10
+
11
+ module Dummy
12
+ class Application < Rails::Application
13
+ # Settings in config/environments/* take precedence over those specified here.
14
+ # Application configuration should go into files in config/initializers
15
+ # -- all .rb files in that directory are automatically loaded.
16
+
17
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
18
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
19
+ # config.time_zone = 'Central Time (US & Canada)'
20
+
21
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
22
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
23
+ # config.i18n.default_locale = :de
24
+
25
+ config.generators do |g|
26
+ g.template_engine :haml
27
+ end
28
+
29
+ end
30
+ end
31
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ development:
13
+ <<: *default
14
+ database: db/development.sqlite3
15
+
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
19
+ test:
20
+ <<: *default
21
+ database: db/test.sqlite3
22
+
23
+ production:
24
+ <<: *default
25
+ database: db/production.sqlite3
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,37 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+ # Raise an error on page load if there are pending migrations.
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+
30
+ # Adds additional error checking when serving assets at runtime.
31
+ # Checks for improperly declared sprockets dependencies.
32
+ # Raises helpful error messages.
33
+ config.assets.raise_runtime_errors = true
34
+
35
+ # Raises error for missing translations
36
+ # config.action_view.raise_on_missing_translations = true
37
+ end
@@ -0,0 +1,83 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # Code is not reloaded between requests.
5
+ config.cache_classes = true
6
+
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both threaded web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
14
+ config.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
16
+
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
+ # config.action_dispatch.rack_cache = true
21
+
22
+ # Disable Rails's static asset server (Apache or nginx will already do this).
23
+ config.serve_static_assets = false
24
+
25
+ # Compress JavaScripts and CSS.
26
+ config.assets.js_compressor = :uglifier
27
+ # config.assets.css_compressor = :sass
28
+
29
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
30
+ config.assets.compile = false
31
+
32
+ # Generate digests for assets URLs.
33
+ config.assets.digest = true
34
+
35
+ # Version of your assets, change this if you want to expire all your assets.
36
+ config.assets.version = '1.0'
37
+
38
+ # Specifies the header that your server uses for sending files.
39
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
+
42
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
+ # config.force_ssl = true
44
+
45
+ # Set to :debug to see everything in the log.
46
+ config.log_level = :info
47
+
48
+ # Prepend all log lines with the following tags.
49
+ # config.log_tags = [ :subdomain, :uuid ]
50
+
51
+ # Use a different logger for distributed setups.
52
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
+
54
+ # Use a different cache store in production.
55
+ # config.cache_store = :mem_cache_store
56
+
57
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
+ # config.action_controller.asset_host = "http://assets.example.com"
59
+
60
+ # Precompile additional assets.
61
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
+ # config.assets.precompile += %w( search.js )
63
+
64
+ # Ignore bad email addresses and do not raise email delivery errors.
65
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
+ # config.action_mailer.raise_delivery_errors = false
67
+
68
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
+ # the I18n.default_locale when a translation cannot be found).
70
+ config.i18n.fallbacks = true
71
+
72
+ # Send deprecation notices to registered listeners.
73
+ config.active_support.deprecation = :notify
74
+
75
+ # Disable automatic flushing of the log to improve performance.
76
+ # config.autoflush_log = false
77
+
78
+ # Use default logging formatter so that PID and timestamp are not suppressed.
79
+ config.log_formatter = ::Logger::Formatter.new
80
+
81
+ # Do not dump schema after migrations.
82
+ config.active_record.dump_schema_after_migration = false
83
+ end
@@ -0,0 +1,39 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
14
+
15
+ # Configure static asset server for tests with Cache-Control for performance.
16
+ config.serve_static_assets = true
17
+ config.static_cache_control = 'public, max-age=3600'
18
+
19
+ # Show full error reports and disable caching.
20
+ config.consider_all_requests_local = true
21
+ config.action_controller.perform_caching = false
22
+
23
+ # Raise exceptions instead of rendering exception templates.
24
+ config.action_dispatch.show_exceptions = false
25
+
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
28
+
29
+ # Tell Action Mailer not to deliver emails to the real world.
30
+ # The :test delivery method accumulates sent emails in the
31
+ # ActionMailer::Base.deliveries array.
32
+ config.action_mailer.delivery_method = :test
33
+
34
+ # Print deprecation notices to the stderr.
35
+ config.active_support.deprecation = :stderr
36
+
37
+ # Raises error for missing translations
38
+ # config.action_view.raise_on_missing_translations = true
39
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,254 @@
1
+ require 'devise'
2
+ # Use this hook to configure devise mailer, warden hooks and so forth.
3
+ # Many of these configuration options can be set straight in your model.
4
+ Devise.setup do |config|
5
+ # The secret key used by Devise. Devise uses this key to generate
6
+ # random tokens. Changing this key will render invalid all existing
7
+ # confirmation, reset password and unlock tokens in the database.
8
+ config.secret_key = 'e2daa993b70d0a5b780a7689f307784d47871a76f1ffbbbefb3f32a141b56ddc36bc6fe82c475d33aaac2dda91a07732b490328442f2c7a149bbd5a1511efc30'
9
+
10
+ # ==> Mailer Configuration
11
+ # Configure the e-mail address which will be shown in Devise::Mailer,
12
+ # note that it will be overwritten if you use your own mailer class
13
+ # with default "from" parameter.
14
+ config.mailer_sender = 'noreply@student-energy.com'
15
+
16
+ # Configure the class responsible to send e-mails.
17
+ # config.mailer = 'Devise::Mailer'
18
+
19
+ # ==> ORM configuration
20
+ # Load and configure the ORM. Supports :active_record (default) and
21
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
22
+ # available as additional gems.
23
+ require 'devise/orm/active_record'
24
+
25
+ # ==> Configuration for any authentication mechanism
26
+ # Configure which keys are used when authenticating a user. The default is
27
+ # just :email. You can configure it to use [:username, :subdomain], so for
28
+ # authenticating a user, both parameters are required. Remember that those
29
+ # parameters are used only when authenticating and not when retrieving from
30
+ # session. If you need permissions, you should implement that in a before filter.
31
+ # You can also supply a hash where the value is a boolean determining whether
32
+ # or not authentication should be aborted when the value is not present.
33
+ # config.authentication_keys = [ :email ]
34
+
35
+ # Configure parameters from the request object used for authentication. Each entry
36
+ # given should be a request method and it will automatically be passed to the
37
+ # find_for_authentication method and considered in your model lookup. For instance,
38
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
39
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
40
+ # config.request_keys = []
41
+
42
+ # Configure which authentication keys should be case-insensitive.
43
+ # These keys will be downcased upon creating or modifying a user and when used
44
+ # to authenticate or find a user. Default is :email.
45
+ config.case_insensitive_keys = [ :email ]
46
+
47
+ # Configure which authentication keys should have whitespace stripped.
48
+ # These keys will have whitespace before and after removed upon creating or
49
+ # modifying a user and when used to authenticate or find a user. Default is :email.
50
+ config.strip_whitespace_keys = [ :email ]
51
+
52
+ # Tell if authentication through request.params is enabled. True by default.
53
+ # It can be set to an array that will enable params authentication only for the
54
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
55
+ # enable it only for database (email + password) authentication.
56
+ # config.params_authenticatable = true
57
+
58
+ # Tell if authentication through HTTP Auth is enabled. False by default.
59
+ # It can be set to an array that will enable http authentication only for the
60
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
61
+ # enable it only for database authentication. The supported strategies are:
62
+ # :database = Support basic authentication with authentication key + password
63
+ # config.http_authenticatable = false
64
+
65
+ # If http headers should be returned for AJAX requests. True by default.
66
+ # config.http_authenticatable_on_xhr = true
67
+
68
+ # The realm used in Http Basic Authentication. 'Application' by default.
69
+ # config.http_authentication_realm = 'Application'
70
+
71
+ # It will change confirmation, password recovery and other workflows
72
+ # to behave the same regardless if the e-mail provided was right or wrong.
73
+ # Does not affect registerable.
74
+ # config.paranoid = true
75
+
76
+ # By default Devise will store the user in session. You can skip storage for
77
+ # particular strategies by setting this option.
78
+ # Notice that if you are skipping storage for all authentication paths, you
79
+ # may want to disable generating routes to Devise's sessions controller by
80
+ # passing :skip => :sessions to `devise_for` in your config/routes.rb
81
+ config.skip_session_storage = [:http_auth]
82
+
83
+ # By default, Devise cleans up the CSRF token on authentication to
84
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
85
+ # requests for sign in and sign up, you need to get a new CSRF token
86
+ # from the server. You can disable this option at your own risk.
87
+ # config.clean_up_csrf_token_on_authentication = true
88
+
89
+ # ==> Configuration for :database_authenticatable
90
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
91
+ # using other encryptors, it sets how many times you want the password re-encrypted.
92
+ #
93
+ # Limiting the stretches to just one in testing will increase the performance of
94
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
95
+ # a value less than 10 in other environments.
96
+ config.stretches = Rails.env.test? ? 1 : 10
97
+
98
+ # Setup a pepper to generate the encrypted password.
99
+ # config.pepper = '3e7aca2abd16f8786a4ffd678b7f9cb659b0835c5934f053324f35a83739e7eb09a7eca6ea2c65f7393680c1c467e077daa9d1a0dd66cdc83596bf43fd8eee26'
100
+
101
+ # ==> Configuration for :confirmable
102
+ # A period that the user is allowed to access the website even without
103
+ # confirming his account. For instance, if set to 2.days, the user will be
104
+ # able to access the website for two days without confirming his account,
105
+ # access will be blocked just in the third day. Default is 0.days, meaning
106
+ # the user cannot access the website without confirming his account.
107
+ # config.allow_unconfirmed_access_for = 2.days
108
+
109
+ # A period that the user is allowed to confirm their account before their
110
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
111
+ # their account within 3 days after the mail was sent, but on the fourth day
112
+ # their account can't be confirmed with the token any more.
113
+ # Default is nil, meaning there is no restriction on how long a user can take
114
+ # before confirming their account.
115
+ # config.confirm_within = 3.days
116
+
117
+ # If true, requires any email changes to be confirmed (exactly the same way as
118
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
119
+ # db field (see migrations). Until confirmed new email is stored in
120
+ # unconfirmed email column, and copied to email column on successful confirmation.
121
+ config.reconfirmable = true
122
+
123
+ # Defines which key will be used when confirming an account
124
+ # config.confirmation_keys = [ :email ]
125
+
126
+ # ==> Configuration for :rememberable
127
+ # The time the user will be remembered without asking for credentials again.
128
+ # config.remember_for = 2.weeks
129
+
130
+ # If true, extends the user's remember period when remembered via cookie.
131
+ # config.extend_remember_period = false
132
+
133
+ # Options to be passed to the created cookie. For instance, you can set
134
+ # :secure => true in order to force SSL only cookies.
135
+ # config.rememberable_options = {}
136
+
137
+ # ==> Configuration for :validatable
138
+ # Range for password length. Default is 8..128.
139
+ config.password_length = 8..128
140
+
141
+ # Email regex used to validate email formats. It simply asserts that
142
+ # one (and only one) @ exists in the given string. This is mainly
143
+ # to give user feedback and not to assert the e-mail validity.
144
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
145
+
146
+ # ==> Configuration for :timeoutable
147
+ # The time you want to timeout the user session without activity. After this
148
+ # time the user will be asked for credentials again. Default is 30 minutes.
149
+ # config.timeout_in = 30.minutes
150
+
151
+ # If true, expires auth token on session timeout.
152
+ # config.expire_auth_token_on_timeout = false
153
+
154
+ # ==> Configuration for :lockable
155
+ # Defines which strategy will be used to lock an account.
156
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
157
+ # :none = No lock strategy. You should handle locking by yourself.
158
+ # config.lock_strategy = :failed_attempts
159
+
160
+ # Defines which key will be used when locking and unlocking an account
161
+ # config.unlock_keys = [ :email ]
162
+
163
+ # Defines which strategy will be used to unlock an account.
164
+ # :email = Sends an unlock link to the user email
165
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
166
+ # :both = Enables both strategies
167
+ # :none = No unlock strategy. You should handle unlocking by yourself.
168
+ # config.unlock_strategy = :both
169
+
170
+ # Number of authentication tries before locking an account if lock_strategy
171
+ # is failed attempts.
172
+ # config.maximum_attempts = 20
173
+
174
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
175
+ # config.unlock_in = 1.hour
176
+
177
+ # Warn on the last attempt before the account is locked.
178
+ # config.last_attempt_warning = false
179
+
180
+ # ==> Configuration for :recoverable
181
+ #
182
+ # Defines which key will be used when recovering the password for an account
183
+ # config.reset_password_keys = [ :email ]
184
+
185
+ # Time interval you can reset your password with a reset password key.
186
+ # Don't put a too small interval or your users won't have the time to
187
+ # change their passwords.
188
+ config.reset_password_within = 6.hours
189
+
190
+ # ==> Configuration for :encryptable
191
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
192
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
193
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
194
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
195
+ # REST_AUTH_SITE_KEY to pepper).
196
+ #
197
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
198
+ # config.encryptor = :sha512
199
+
200
+ # ==> Scopes configuration
201
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
202
+ # "users/sessions/new". It's turned off by default because it's slower if you
203
+ # are using only default views.
204
+ # config.scoped_views = false
205
+
206
+ # Configure the default scope given to Warden. By default it's the first
207
+ # devise role declared in your routes (usually :user).
208
+ # config.default_scope = :user
209
+
210
+ # Set this configuration to false if you want /users/sign_out to sign out
211
+ # only the current scope. By default, Devise signs out all scopes.
212
+ # config.sign_out_all_scopes = true
213
+
214
+ # ==> Navigation configuration
215
+ # Lists the formats that should be treated as navigational. Formats like
216
+ # :html, should redirect to the sign in page when the user does not have
217
+ # access, but formats like :xml or :json, should return 401.
218
+ #
219
+ # If you have any extra navigational formats, like :iphone or :mobile, you
220
+ # should add them to the navigational formats lists.
221
+ #
222
+ # The "*/*" below is required to match Internet Explorer requests.
223
+ # config.navigational_formats = ['*/*', :html]
224
+
225
+ # The default HTTP method used to sign out a resource. Default is :delete.
226
+ config.sign_out_via = :delete
227
+
228
+ # ==> OmniAuth
229
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
230
+ # up on your models and hooks.
231
+
232
+ # ==> Warden configuration
233
+ # If you want to use other strategies, that are not supported by Devise, or
234
+ # change the failure app, you can configure them inside the config.warden block.
235
+ #
236
+ # config.warden do |manager|
237
+ # manager.intercept_401 = false
238
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
239
+ # end
240
+
241
+ # ==> Mountable engine configurations
242
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
243
+ # is mountable, there are some extra configurations to be taken into account.
244
+ # The following options are available, assuming the engine is mounted as:
245
+ #
246
+ # mount MyEngine, at: '/my_engine'
247
+ #
248
+ # The router that invoked `devise_for`, in the example above, would be:
249
+ # config.router_name = :my_engine
250
+ #
251
+ # When using omniauth, Devise cannot automatically set Omniauth path,
252
+ # so you need to do it manually. For the users scope, it would be:
253
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
254
+ end
@@ -0,0 +1,15 @@
1
+ EffectiveAddresses.setup do |config|
2
+ # Database table name to store addresses in. Default is :addresses
3
+ config.addresses_table_name = :addresses
4
+
5
+ # Display Full Name on Address forms, and validate presence by default
6
+ # (can be overridden on a per address basis)
7
+ config.use_full_name = true
8
+
9
+ # Country codes to display in country_select dropdowns.
10
+ config.country_codes = :all #
11
+ config.country_codes_priority = ['US', 'CA'] # Leave empty array for no priority countries
12
+
13
+ # Or you can be more selective...
14
+ #config.country_codes = ['US', 'CA']
15
+ end
@@ -0,0 +1,22 @@
1
+ # EffectiveOrders Rails Engine
2
+
3
+ EffectiveOrders.setup do |config|
4
+ # Authorization Method
5
+ config.authorization_method = Proc.new { |controller, action, resource| true } # Allow anyone do anything, Can stub this if testing
6
+
7
+ config.require_billing_address = true
8
+ config.require_shipping_address = true
9
+
10
+ config.stripe_enabled = true
11
+ config.stripe_subscriptions_enabled = true
12
+
13
+ config.collect_user_fields = [:first_name, :last_name]
14
+
15
+ config.minimum_charge = 50
16
+ config.allow_free_orders = true
17
+
18
+ config.moneris_enabled = true
19
+ config.paypal_enabled = true
20
+
21
+ config.silence_deprecation_warnings = true
22
+ end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf