effective_orders 3.2.3 → 4.0.0beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. checksums.yaml +5 -5
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +11 -99
  4. data/app/assets/stylesheets/effective_orders.scss +1 -0
  5. data/app/assets/stylesheets/effective_orders/_cart.scss +4 -0
  6. data/app/assets/stylesheets/effective_orders/_order.scss +6 -2
  7. data/app/controllers/admin/orders_controller.rb +17 -17
  8. data/app/controllers/effective/carts_controller.rb +4 -2
  9. data/app/controllers/effective/orders_controller.rb +50 -105
  10. data/app/controllers/effective/providers/cheque.rb +1 -1
  11. data/app/controllers/effective/providers/moneris.rb +17 -23
  12. data/app/controllers/effective/providers/stripe.rb +2 -37
  13. data/app/datatables/effective_customers_datatable.rb +1 -5
  14. data/app/datatables/effective_order_items_datatable.rb +10 -10
  15. data/app/datatables/effective_orders_datatable.rb +23 -46
  16. data/app/helpers/effective_carts_helper.rb +5 -25
  17. data/app/helpers/effective_orders_helper.rb +29 -61
  18. data/app/helpers/effective_paypal_helper.rb +10 -8
  19. data/app/helpers/effective_stripe_helper.rb +2 -33
  20. data/app/models/concerns/acts_as_purchasable.rb +26 -37
  21. data/app/models/concerns/acts_as_subscribable.rb +1 -1
  22. data/app/models/effective/cart.rb +4 -5
  23. data/app/models/effective/customer.rb +1 -4
  24. data/app/models/effective/order.rb +132 -163
  25. data/app/models/effective/order_item.rb +2 -21
  26. data/app/models/{effective → validators/effective}/sold_out_validator.rb +0 -0
  27. data/app/views/admin/customers/index.html.haml +1 -4
  28. data/app/views/admin/order_items/index.html.haml +1 -4
  29. data/app/views/admin/orders/_actions.html.haml +18 -9
  30. data/app/views/admin/orders/_form.html.haml +12 -14
  31. data/app/views/admin/orders/_form_note_internal.html.haml +2 -2
  32. data/app/views/admin/orders/_order_actions.html.haml +8 -5
  33. data/app/views/admin/orders/_order_item_fields.html.haml +9 -8
  34. data/app/views/admin/orders/checkout.html.haml +3 -0
  35. data/app/views/admin/orders/edit.html.haml +3 -1
  36. data/app/views/admin/orders/new.html.haml +2 -1
  37. data/app/views/admin/orders/show.html.haml +2 -5
  38. data/app/views/effective/carts/_cart.html.haml +1 -1
  39. data/app/views/effective/carts/_cart_actions.html.haml +3 -4
  40. data/app/views/effective/carts/show.html.haml +4 -4
  41. data/app/views/effective/orders/_checkout_actions.html.haml +3 -0
  42. data/app/views/effective/orders/_checkout_step1.html.haml +20 -27
  43. data/app/views/effective/orders/_checkout_step2.html.haml +26 -30
  44. data/app/views/effective/orders/_order.html.haml +1 -2
  45. data/app/views/effective/orders/_order_actions.html.haml +14 -6
  46. data/app/views/effective/orders/_order_header.html.haml +2 -2
  47. data/app/views/effective/orders/_order_note_fields.html.haml +6 -4
  48. data/app/views/effective/orders/_order_notes.html.haml +15 -0
  49. data/app/views/effective/orders/_order_payment_details.html.haml +1 -1
  50. data/app/views/effective/orders/_order_shipping.html.haml +6 -6
  51. data/app/views/effective/orders/_order_terms_and_conditions_fields.html.haml +5 -6
  52. data/app/views/effective/orders/_order_user_fields.html.haml +5 -11
  53. data/app/views/effective/orders/_orders_table.html.haml +2 -6
  54. data/app/views/effective/orders/index.html.haml +2 -1
  55. data/app/views/effective/orders/mark_as_paid/_form.html.haml +8 -14
  56. data/app/views/effective/orders/moneris/_form.html.haml +43 -4
  57. data/app/views/effective/orders/pretend/_form.html.haml +1 -3
  58. data/app/views/effective/orders/refund/_form.html.haml +8 -12
  59. data/app/views/effective/orders/show.html.haml +2 -2
  60. data/app/views/effective/orders/stripe/_form.html.haml +4 -4
  61. data/app/views/effective/orders_mailer/payment_request_to_buyer.html.haml +1 -1
  62. data/app/views/effective/orders_mailer/pending_order_invoice_to_buyer.html.haml +1 -1
  63. data/config/effective_orders.rb +116 -182
  64. data/config/routes.rb +16 -27
  65. data/db/migrate/01_create_effective_orders.rb.erb +6 -5
  66. data/lib/effective_orders.rb +72 -76
  67. data/lib/effective_orders/engine.rb +8 -80
  68. data/lib/effective_orders/version.rb +1 -1
  69. data/lib/generators/templates/effective_orders_mailer_preview.rb +4 -4
  70. metadata +26 -38
  71. data/Rakefile +0 -21
  72. data/app/assets/config/effective_orders_manifest.js +0 -3
  73. data/app/assets/images/effective_orders/stripe_connect.png +0 -0
  74. data/app/controllers/effective/providers/app_checkout.rb +0 -38
  75. data/app/controllers/effective/providers/ccbill.rb +0 -34
  76. data/app/controllers/effective/providers/stripe_connect.rb +0 -47
  77. data/app/helpers/effective_ccbill_helper.rb +0 -25
  78. data/app/models/effective/providers/ccbill_postback.rb +0 -85
  79. data/app/models/effective/providers/moneris_charge.rb +0 -115
  80. data/app/views/effective/orders/_order_note.html.haml +0 -5
  81. data/app/views/effective/orders/_order_note_to_buyer.html.haml +0 -9
  82. data/app/views/effective/orders/app_checkout/_form.html.haml +0 -2
  83. data/app/views/effective/orders/ccbill/_form.html.haml +0 -24
  84. data/app/views/effective/orders/my_purchases.html.haml +0 -3
  85. data/app/views/effective/orders/my_sales.html.haml +0 -25
  86. data/app/views/effective/orders_mailer/order_receipt_to_seller.html.haml +0 -25
  87. data/lib/effective_orders/app_checkout_service.rb +0 -26
data/config/routes.rb CHANGED
@@ -1,46 +1,30 @@
1
- Rails.application.routes.draw do
2
- unless EffectiveOrders.skip_mount_engine
3
- mount EffectiveOrders::Engine => '/', as: 'effective_orders'
4
- end
5
- end
6
-
7
1
  EffectiveOrders::Engine.routes.draw do
8
- scope module: 'effective' do
9
-
2
+ scope :module => 'effective' do
10
3
  resources :orders, except: [:destroy] do
11
4
  member do
12
5
  get :purchased
13
6
  get :declined
14
7
  get :send_buyer_receipt
15
8
 
16
- post :app_checkout if EffectiveOrders.app_checkout_enabled
17
- post :free if EffectiveOrders.allow_free_orders
18
- post :mark_as_paid if EffectiveOrders.mark_as_paid_enabled
19
- post :pay_by_cheque if EffectiveOrders.cheque_enabled
20
- post :pretend if EffectiveOrders.allow_pretend_purchase_in_production && Rails.env.production?
21
- post :pretend if EffectiveOrders.allow_pretend_purchase_in_development && !Rails.env.production?
22
- post :refund if EffectiveOrders.allow_refunds
9
+ post :free if EffectiveOrders.free?
10
+ post :mark_as_paid if EffectiveOrders.mark_as_paid?
11
+ post :pay_by_cheque if EffectiveOrders.cheque?
12
+ post :pretend if EffectiveOrders.pretend?
13
+ post :refund if EffectiveOrders.refunds?
23
14
  end
24
15
 
25
16
  collection do
26
- get :my_purchases
27
17
  post :bulk_send_buyer_receipt
28
18
 
29
- if EffectiveOrders.stripe_connect_enabled
30
- get :stripe_connect_redirect_uri # oAuth2
31
- get :my_sales
32
- end
33
-
34
- post :ccbill_postback if EffectiveOrders.ccbill_enabled
35
- post :moneris_postback if EffectiveOrders.moneris_enabled
36
- post :paypal_postback if EffectiveOrders.paypal_enabled
37
- post :stripe_charge if EffectiveOrders.stripe_enabled
19
+ post :moneris_postback if EffectiveOrders.moneris?
20
+ post :paypal_postback if EffectiveOrders.paypal?
21
+ post :stripe_charge if EffectiveOrders.stripe?
38
22
  end
39
23
  end
40
24
 
41
25
  post 'orders/:id', to: 'orders#update'
42
26
 
43
- if EffectiveOrders.subscriptions_enabled
27
+ if EffectiveOrders.subscriptions?
44
28
  match 'customer/settings', to: 'customers#edit', as: :customer_settings, via: [:get]
45
29
  match 'customer/settings', to: 'customers#update', via: [:patch, :put]
46
30
  match 'webhooks/stripe', to: 'webhooks#stripe', via: [:post, :put]
@@ -56,9 +40,12 @@ EffectiveOrders::Engine.routes.draw do
56
40
 
57
41
  namespace :admin do
58
42
  resources :customers, only: [:index, :show]
43
+
59
44
  resources :orders do
60
45
  member do
61
46
  post :send_payment_request
47
+
48
+ get :checkout
62
49
  post :checkout
63
50
  patch :checkout
64
51
  end
@@ -66,12 +53,14 @@ EffectiveOrders::Engine.routes.draw do
66
53
  collection do
67
54
  post :bulk_send_payment_request
68
55
  end
69
-
70
56
  end
71
57
 
72
58
  post 'orders/:id', to: 'orders#update'
73
59
 
74
60
  resources :order_items, only: [:index]
75
61
  end
62
+ end
76
63
 
64
+ Rails.application.routes.draw do
65
+ mount EffectiveOrders::Engine => '/', as: 'effective_orders'
77
66
  end
@@ -2,13 +2,14 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  create_table <%= @orders_table_name %> do |t|
4
4
  t.integer :user_id
5
- t.string :purchase_state
5
+ t.string :state
6
6
  t.datetime :purchased_at
7
7
 
8
8
  t.text :note
9
9
  t.text :note_to_buyer
10
10
  t.text :note_internal
11
11
 
12
+ t.string :billing_name
12
13
  t.text :payment
13
14
 
14
15
  t.string :payment_provider
@@ -28,7 +29,6 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
28
29
 
29
30
  create_table <%= @order_items_table_name %> do |t|
30
31
  t.integer :order_id
31
- t.integer :seller_id
32
32
  t.string :purchasable_type
33
33
  t.integer :purchasable_id
34
34
 
@@ -77,8 +77,6 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
77
77
  t.string :stripe_subscription_id
78
78
  t.string :status
79
79
 
80
- t.string :stripe_connect_access_token
81
-
82
80
  t.integer :subscriptions_count, :default => 0
83
81
 
84
82
  t.timestamps
@@ -106,12 +104,15 @@ class CreateEffectiveOrders < ActiveRecord::Migration[4.2]
106
104
  add_index <%= @subscriptions_table_name %>, [:subscribable_type, :subscribable_id]
107
105
 
108
106
  create_table <%= @products_table_name %> do |t|
107
+ t.integer :purchased_order_id
108
+
109
109
  t.string :title
110
- t.integer :price, :default => 0
110
+ t.integer :price
111
111
  t.boolean :tax_exempt, :default => false
112
112
 
113
113
  t.timestamps
114
114
  end
115
+
115
116
  end
116
117
 
117
118
  def self.down
@@ -1,15 +1,14 @@
1
1
  require 'effective_addresses'
2
2
  require 'effective_orders/engine'
3
3
  require 'effective_orders/version'
4
- require 'effective_orders/app_checkout_service'
5
4
 
6
5
  module EffectiveOrders
7
- ABANDONED = 'abandoned'
8
- PURCHASED = 'purchased'
9
- DECLINED = 'declined'
10
- PENDING = 'pending'
6
+ PENDING = 'pending'.freeze
7
+ CONFIRMED = 'confirmed'.freeze
8
+ PURCHASED = 'purchased'.freeze
9
+ DECLINED = 'declined'.freeze
11
10
 
12
- PURCHASE_STATES = { nil => ABANDONED, PURCHASED => PURCHASED, DECLINED => DECLINED, PENDING => PENDING }
11
+ STATES = { PENDING => PENDING, CONFIRMED => CONFIRMED, PURCHASED => PURCHASED, DECLINED => DECLINED }
13
12
 
14
13
  # The following are all valid config keys
15
14
  mattr_accessor :orders_table_name
@@ -22,24 +21,19 @@ module EffectiveOrders
22
21
 
23
22
  mattr_accessor :authorization_method
24
23
 
25
- mattr_accessor :skip_mount_engine
26
- mattr_accessor :orders_collection_scope
27
-
28
- mattr_accessor :order_tax_rate_method
24
+ mattr_accessor :pretend_purchase_in_development_enabled
25
+ mattr_accessor :pretend_purchase_in_production_enabled
26
+ mattr_accessor :pretend_purchase_in_production_message
29
27
 
30
28
  mattr_accessor :layout
31
- mattr_accessor :simple_form_options
32
- mattr_accessor :admin_simple_form_options
33
- mattr_accessor :show_order_history_button
34
-
35
- mattr_accessor :obfuscate_order_ids
29
+ mattr_accessor :mailer
36
30
 
37
- mattr_accessor :allow_pretend_purchase_in_development
38
- mattr_accessor :allow_pretend_purchase_in_production
39
- mattr_accessor :allow_pretend_purchase_in_production_message
31
+ mattr_accessor :orders_collection_scope
32
+ mattr_accessor :order_tax_rate_method
40
33
 
41
- mattr_accessor :require_billing_address
42
- mattr_accessor :require_shipping_address
34
+ mattr_accessor :obfuscate_order_ids
35
+ mattr_accessor :billing_address
36
+ mattr_accessor :shipping_address
43
37
  mattr_accessor :use_address_full_name
44
38
 
45
39
  mattr_accessor :collect_user_fields
@@ -53,35 +47,16 @@ module EffectiveOrders
53
47
  mattr_accessor :terms_and_conditions_label
54
48
 
55
49
  mattr_accessor :minimum_charge
56
- mattr_accessor :allow_free_orders
57
- mattr_accessor :allow_refunds
58
-
59
- mattr_accessor :app_checkout_enabled
60
- mattr_accessor :ccbill_enabled
61
- mattr_accessor :cheque_enabled
50
+ mattr_accessor :free_enabled
62
51
  mattr_accessor :mark_as_paid_enabled
63
- mattr_accessor :moneris_enabled
64
- mattr_accessor :paypal_enabled
52
+ mattr_accessor :refunds_enabled
65
53
 
66
- mattr_accessor :stripe_enabled
67
- mattr_accessor :stripe_connect_enabled
68
-
69
- mattr_accessor :subscriptions_enabled
70
-
71
- # application fee is required if stripe_connect_enabled is true
72
- mattr_accessor :stripe_connect_application_fee_method
73
-
74
- # These are hashes of configs
75
- mattr_accessor :app_checkout
76
- mattr_accessor :ccbill
54
+ # Payment processors. false or Hash
77
55
  mattr_accessor :cheque
78
- mattr_accessor :mailer
79
56
  mattr_accessor :moneris
80
57
  mattr_accessor :paypal
81
58
  mattr_accessor :stripe
82
- mattr_accessor :subscription
83
-
84
- mattr_accessor :deliver_method
59
+ mattr_accessor :subscriptions # Stripe subscriptions
85
60
 
86
61
  def self.setup
87
62
  yield self
@@ -114,49 +89,72 @@ module EffectiveOrders
114
89
  ]
115
90
  end
116
91
 
92
+ def self.cheque?
93
+ cheque.kind_of?(Hash)
94
+ end
95
+
96
+ def self.free?
97
+ free_enabled == true
98
+ end
99
+
100
+ def self.mark_as_paid?
101
+ mark_as_paid_enabled == true
102
+ end
103
+
104
+ def self.moneris?
105
+ moneris.kind_of?(Hash)
106
+ end
107
+
108
+ def self.paypal?
109
+ paypal.kind_of?(Hash)
110
+ end
111
+
112
+ def self.pretend?
113
+ (pretend_purchase_in_production_enabled && Rails.env.production?) || (pretend_purchase_in_development_enabled && !Rails.env.production?)
114
+ end
115
+
116
+ def self.refunds?
117
+ refunds_enabled == true
118
+ end
119
+
120
+ def self.stripe?
121
+ stripe.kind_of?(Hash)
122
+ end
123
+
124
+ def self.subscriptions?
125
+ subscriptions.kind_of?(Hash)
126
+ end
127
+
117
128
  def self.single_payment_processor?
118
- [
119
- moneris_enabled,
120
- paypal_enabled,
121
- stripe_enabled,
122
- cheque_enabled,
123
- ccbill_enabled,
124
- app_checkout_enabled
125
- ].select { |enabled| enabled }.length == 1
129
+ [cheque?, moneris?, paypal?, stripe?].select { |enabled| enabled }.length == 1
126
130
  end
127
131
 
128
132
  # The Effective::Order.payment_provider value must be in this collection
129
133
  def self.payment_providers
130
- @payment_providers ||= [
131
- ('app_checkout' if app_checkout_enabled),
132
- ('ccbill' if ccbill_enabled),
133
- ('cheque' if cheque_enabled),
134
- ('free' if allow_free_orders),
135
- ('moneris' if moneris_enabled),
136
- ('paypal' if paypal_enabled),
137
- ('pretend' if (allow_pretend_purchase_in_production && Rails.env.production?) || (allow_pretend_purchase_in_development && !Rails.env.production?)),
138
- ('stripe' if stripe_enabled),
139
- ('stripe_connect' if stripe_connect_enabled)
134
+ [
135
+ ('cheque' if cheque?),
136
+ ('free' if free?),
137
+ ('moneris' if moneris?),
138
+ ('paypal' if paypal?),
139
+ ('pretend' if pretend?),
140
+ ('stripe' if stripe?),
141
+ ('credit card' if mark_as_paid?),
142
+ ('none' if mark_as_paid?),
143
+ ('other' if mark_as_paid?),
140
144
  ].compact
141
145
  end
142
146
 
143
- # One of these is used when Admin marks as paid
144
- def self.other_payment_providers
145
- ['credit card', 'none', 'other']
146
- end
147
-
148
147
  def self.can_skip_checkout_step1?
149
148
  return false if require_billing_address
150
149
  return false if require_shipping_address
151
150
  return false if collect_note
152
151
  return false if terms_and_conditions
153
152
  return false if collect_user_fields.present?
154
-
155
153
  true
156
154
  end
157
155
 
158
156
  def self.stripe_plans
159
- return {} unless (stripe_enabled && subscriptions_enabled)
157
+ return {} unless (stripe? && subscriptions?)
160
158
 
161
159
  @stripe_plans ||= (
162
160
  plans = Stripe::Plan.all.inject({}) do |h, plan|
@@ -184,14 +182,12 @@ module EffectiveOrders
184
182
  }; h
185
183
  end
186
184
 
187
- if subscription.kind_of?(Hash)
188
- plans['trial'] = {
189
- id: 'trial',
190
- amount: 0,
191
- name: (subscription[:trial_name] || 'Free Trial'),
192
- description: (subscription[:trial_description] || 'Free Trial')
193
- }
194
- end
185
+ plans['trial'] = {
186
+ id: 'trial',
187
+ amount: 0,
188
+ name: (subscriptions[:trial_name] || 'Free Trial'),
189
+ description: (subscriptions[:trial_description] || 'Free Trial')
190
+ }
195
191
 
196
192
  plans
197
193
  )
@@ -2,7 +2,7 @@ module EffectiveOrders
2
2
  class Engine < ::Rails::Engine
3
3
  engine_name 'effective_orders'
4
4
 
5
- #config.autoload_paths += Dir["#{config.root}/app/models/**/"]
5
+ config.autoload_paths += Dir["#{config.root}/app/models/**/"]
6
6
 
7
7
  # Include acts_as_addressable concern and allow any ActiveRecord object to call it
8
8
  initializer 'effective_orders.active_record' do |app|
@@ -18,97 +18,25 @@ module EffectiveOrders
18
18
  eval File.read("#{config.root}/config/effective_orders.rb")
19
19
  end
20
20
 
21
- initializer 'effective_orders.assets' do |app|
22
- app.config.assets.precompile += ['effective_orders_manifest.js', 'effective_orders/*']
23
- end
24
-
25
21
  # Set up mail delivering config option
26
22
  initializer 'effective_orders.mailer', after: :load_config_initializers do |app|
27
- deliver_method = Rails.gem_version >= Gem::Version.new('4.2') ? :deliver_now : :deliver
28
- EffectiveOrders.mailer[:deliver_method] ||= deliver_method
29
- end
30
-
31
- initializer 'effective_orders.moneris_config_validation', after: :load_config_initializers do
32
- if EffectiveOrders.moneris_enabled
33
- raise 'expected EffectiveOrders.moneris to be a Hash' unless EffectiveOrders.moneris.is_a?(Hash)
34
-
35
- missing = EffectiveOrders.moneris.select { |_, value| value.blank? }
36
- raise "Missing EffectiveOrders.moneris config values: #{missing.keys.join(', ')}" if missing.present?
37
- end
38
- end
39
-
40
- initializer 'effective_orders.paypal_config_validation', after: :load_config_initializers do
41
- if EffectiveOrders.paypal_enabled
42
- raise 'expected EffectiveOrders.paypal to be a Hash' unless EffectiveOrders.paypal.is_a?(Hash)
43
-
44
- missing = EffectiveOrders.paypal.select { |_, value| value.blank? }
45
- raise "Missing EffectiveOrders.paypal config values: #{missing.keys.join(', ')}" if missing.present?
46
- end
23
+ EffectiveOrders.mailer[:deliver_method] ||= (
24
+ (Rails.application.config.respond_to?(:active_job) && Rails.application.config.active_job.queue_adapter) ? :deliver_later : :deliver_now
25
+ )
47
26
  end
48
27
 
49
- initializer 'effective_orders.stripe_config_validation', after: :load_config_initializers do
50
- if EffectiveOrders.stripe_enabled
28
+ initializer 'effective_orders.stripe', after: :load_config_initializers do
29
+ if EffectiveOrders.stripe?
51
30
  begin
52
31
  require 'stripe'
32
+ ::Stripe.api_key = EffectiveOrders.stripe[:secret_key]
53
33
  rescue Exception
54
34
  raise "unable to load stripe. Plese add gem 'stripe' to your Gemfile and then 'bundle install'"
55
35
  end
56
-
57
- raise 'expected EffectiveOrders.stripe to be a Hash' unless EffectiveOrders.stripe.is_a?(Hash)
58
-
59
- missing = EffectiveOrders.stripe.select { |_, value| value.blank? }
60
- required = [:secret_key, :publishable_key, :currency, :site_title]
61
- required += [:connect_client_id] if EffectiveOrders.stripe_connect_enabled
62
-
63
- # perform an intersection operation between missing and required configs
64
- missing_required = missing.keys & required
65
- raise "Missing EffectiveOrders.stripe config values: #{missing_required.join(', ')}" if missing_required.present?
66
- end
67
- end
68
-
69
- initializer 'effective_orders.stripe_api_key', after: :load_config_initializers do |app|
70
- if EffectiveOrders.stripe_enabled
71
- ::Stripe.api_key = EffectiveOrders.stripe[:secret_key]
72
- end
73
- end
74
-
75
- initializer 'effective_orders.ccbill_config_validation', after: :load_config_initializers do
76
- if EffectiveOrders.ccbill_enabled
77
- raise 'expected EffectiveOrders.ccbill to be a Hash' unless EffectiveOrders.ccbill.is_a?(Hash)
78
-
79
- EffectiveOrders.ccbill[:form_period] ||= 365
80
-
81
- missing = EffectiveOrders.stripe.select { |_, value| value.blank? }
82
- required = [:client_accnum, :client_subacc, :form_name, :currency_code, :dynamic_pricing_salt]
83
-
84
- # perform an intersection operation between missing and required configs
85
- missing_required = missing.keys & required
86
- raise "Missing EffectiveOrders.ccbill config values: #{missing_required.join(', ')}" if missing_required.present?
87
- end
88
- end
89
-
90
- initializer 'effective_orders.app_checkout_config_validation', after: :load_config_initializers do
91
- if EffectiveOrders.app_checkout_enabled
92
- raise 'expected EffectiveOrders.app_checkout to be a Hash' unless EffectiveOrders.app_checkout.is_a?(Hash)
93
-
94
- missing = EffectiveOrders.app_checkout.select { |_, value| value.blank? }
95
- missing = missing | [:service] unless EffectiveOrders.app_checkout.has_key?(:service)
96
-
97
- raise "Missing effective_orders App Checkout configuration values: #{missing.keys.join(', ')}" if missing.present?
98
-
99
- unless EffectiveOrders.app_checkout[:service].respond_to?(:call)
100
- raise 'EffectiveOrders.app_checkout[:service] is not a compatible service object. Inherit from EffectiveOrders::AppCheckoutService or implement a similar API'
101
- end
102
- end
103
- end
104
-
105
- initializer 'effective_orders.cheque_config_validation', after: :load_config_initializers do
106
- if EffectiveOrders.cheque_enabled
107
- raise 'expected EffectiveOrders.cheque to be a Hash' unless EffectiveOrders.cheque.is_a?(Hash)
108
36
  end
109
37
  end
110
38
 
111
- initializer 'effective_orders.obfuscate_order_ids_validation' do
39
+ initializer 'effective_orders.obfuscate_order_ids' do
112
40
  if EffectiveOrders.obfuscate_order_ids
113
41
  begin
114
42
  require 'effective_obfuscation'