comable_core 0.3.4 → 0.4.0

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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/comable/application_helper.rb +17 -10
  3. data/app/models/comable/ability.rb +1 -1
  4. data/app/models/comable/address.rb +2 -2
  5. data/app/models/comable/order/associations.rb +22 -0
  6. data/app/models/comable/order/callbacks.rb +43 -0
  7. data/app/models/comable/order/scopes.rb +17 -0
  8. data/app/models/comable/order/validations.rb +39 -0
  9. data/app/models/comable/order.rb +63 -72
  10. data/app/models/comable/order_item/csvable.rb +32 -0
  11. data/app/models/comable/{order_detail.rb → order_item.rb} +19 -10
  12. data/app/models/comable/payment.rb +82 -0
  13. data/app/models/comable/payment_method.rb +1 -0
  14. data/app/models/comable/product/csvable.rb +20 -0
  15. data/app/models/comable/product.rb +2 -7
  16. data/app/models/comable/shipment.rb +79 -0
  17. data/app/models/comable/stock/csvable.rb +26 -0
  18. data/app/models/comable/stock.rb +2 -17
  19. data/app/models/comable/tracker.rb +17 -0
  20. data/app/models/comable/{customer.rb → user.rb} +11 -23
  21. data/app/models/concerns/comable/checkout.rb +35 -36
  22. data/app/models/concerns/comable/importable.rb +67 -0
  23. data/app/views/comable/order_mailer/complete.text.erb +9 -8
  24. data/config/initializers/comma.rb +8 -0
  25. data/config/locales/en.yml +105 -14
  26. data/config/locales/ja.yml +92 -19
  27. data/db/migrate/{20140120032559_create_comable_customers.rb → 20140120032559_create_comable_users.rb} +6 -6
  28. data/db/migrate/20140723175431_create_comable_orders.rb +2 -4
  29. data/db/migrate/{20140723175810_create_comable_order_details.rb → 20140723175810_create_comable_order_items.rb} +3 -3
  30. data/db/migrate/20140817194104_create_comable_payment_methods.rb +1 -0
  31. data/db/migrate/20141024025526_create_comable_addresses.rb +1 -1
  32. data/db/migrate/20150423095210_create_comable_shipments.rb +12 -0
  33. data/db/migrate/20150511171940_create_comable_payments.rb +11 -0
  34. data/db/migrate/20150513185230_create_comable_trackers.rb +12 -0
  35. data/db/seeds/comable/{customers.rb → users.rb} +3 -3
  36. data/lib/comable/core/configuration.rb +7 -1
  37. data/lib/comable/core/engine.rb +0 -25
  38. data/lib/comable/payment_provider/base.rb +16 -0
  39. data/lib/comable_core.rb +6 -1
  40. data/lib/comma_extractor_extentions.rb +31 -0
  41. data/lib/generators/comable/install/templates/config/initializers/comable.rb +16 -1
  42. metadata +79 -8
  43. data/lib/comable/errors.rb +0 -4
@@ -83,7 +83,7 @@ en:
83
83
  dear: *honorific
84
84
  introductions: |-
85
85
  Thank you for shopping with %{store_name}.
86
- Your order details:
86
+ Your order items:
87
87
  outroductions: |-
88
88
  We hope to see you again soon.
89
89
  %{store_name}
@@ -129,26 +129,41 @@ en:
129
129
  add_sub_image: 'Add a sub image'
130
130
  sign_in: 'Login'
131
131
  sign_out: 'Logout'
132
+ export_to_csv: 'Export to CSV'
133
+ export_to_excel: 'Export to Excel'
134
+ import: 'Import from file...'
135
+ unknown_file_type: 'Unknown file type: %{filename}'
136
+ is_not_exists: 'is not exists.'
137
+ ship: 'Ship'
138
+ help: 'Help'
139
+ tracker_code_help_introduction: |-
140
+ You can embed a Tracking ID, Order Information and many others by using a special symbol to Tracking code.
141
+ For example, you can embed Total Price of the order by writing <code>{{order.total_price}}</code>.
142
+ It will outputs as <code>1500</code> on the actual page.
143
+ tracker_code_help_additional: '<code>order.order_items</code> is Array. And you can retrieve the following information from each element.'
144
+ list_of_usable_variables: 'Available variables are as follows.'
145
+ mote_infomation_for_syntax: 'For more information about the syntax please refer to the following page:'
132
146
  nav:
133
147
  dashboard: 'Dashboard'
134
148
  order: 'Orders'
135
149
  product: 'Products'
136
150
  stock: 'Stocks'
137
151
  category: 'Categories'
138
- customer: 'Users'
152
+ user: 'Users'
139
153
  general_settings: 'General settings'
140
154
  store: 'Store'
141
155
  shipment_method: 'Shipment methods'
142
156
  payment_method: 'Payment methods'
157
+ tracker: 'Tracker'
143
158
  products:
144
159
  detail: 'Product details'
145
160
  orders:
146
161
  detail: 'Order details'
147
162
  cart: 'Cart infomation'
148
- customer: 'User details'
163
+ user: 'User details'
149
164
  shipment: 'Shipment fee'
150
165
  payment: 'Payment charge'
151
- customers:
166
+ users:
152
167
  detail: 'User details'
153
168
  edit: 'Editing user'
154
169
  new_orders: 'Recently orders (%{count})'
@@ -180,14 +195,35 @@ en:
180
195
  shipment: 'Shipment method'
181
196
  payment: 'Payment method'
182
197
  confirm: 'Order confirmed'
183
- complete: 'Order placed'
198
+ completed: 'Order placed'
199
+ canceled: 'Canceled'
200
+ resumed: 'Resumed'
201
+ events:
202
+ cancel: 'Cancel'
203
+ resume: 'Resume'
204
+ comable/payment:
205
+ state:
206
+ states:
207
+ pending: 'Pending'
208
+ ready: 'Authorized'
209
+ completed: 'Completed'
210
+ canceled: 'Canceled'
211
+ resumed: 'Resumed'
212
+ comable/shipment:
213
+ state:
214
+ states:
215
+ pending: 'Pending'
216
+ ready: 'Ready'
217
+ completed: 'Completed'
218
+ canceled: 'Canceled'
219
+ resumed: 'Resumed'
184
220
 
185
221
  models:
186
222
  comable/order: 'Orders'
187
- comable/order_details: 'Order details'
223
+ comable/order_items: 'Order items'
188
224
 
189
225
  attributes:
190
- comable/customer:
226
+ comable/user:
191
227
  id: 'ID'
192
228
  email: 'Email address'
193
229
  password: 'Password'
@@ -198,28 +234,46 @@ en:
198
234
  bill_full_name: 'Full name of the billing address'
199
235
  orders: 'Orders'
200
236
  role: 'Role'
237
+ sign_in_count: 'Sign in count'
238
+ current_sign_in_at: 'Current sign in at'
239
+ last_sign_in_at: 'Last sign in at'
240
+ current_sign_in_ip: 'Current sign in ip'
241
+ last_sign_in_ip: 'Last sign in ip'
201
242
  comable/order:
243
+ id: 'ID'
202
244
  code: 'Order number'
203
245
  email: 'Email address'
204
246
  bill_address: 'Billing address'
205
247
  ship_address: 'Shipping address'
206
248
  payment_method: 'Payment method'
207
249
  shipment_method: 'Shipment method'
250
+ payment_fee: 'Payment fee'
208
251
  shipment_fee: 'Shipment fee'
209
252
  item_total_price: 'Item total'
210
253
  total_price: 'Total'
211
- order_details: 'Order details'
212
- completed_at: 'Comleted at'
254
+ order_items: 'Order items'
255
+ completed_at: 'Completed at'
213
256
  state: 'State'
214
257
  bill_address: 'Billing address'
215
258
  ship_address: 'Shipping adress'
216
259
  bill_full_name: 'Full name of the billing address'
217
- order_details: 'Order details'
218
- comable/order_detail: &comable_order_detail
260
+ order_items: 'Order items'
261
+ user_id: 'User ID'
262
+ guest_token: 'Guest token'
263
+ payment_state: 'Payment state'
264
+ shipment_state: 'Shipment state'
265
+ comable/order_item: &comable_order_item
219
266
  quantity: *quantity
220
267
  price: *price
221
268
  product: 'Product'
222
269
  subtotal_price: 'Subtotal'
270
+ name: 'Product name'
271
+ code: 'SKU code'
272
+ sku_h_choice_name: 'SKU Horizontal item name'
273
+ sku_v_choice_name: 'SKU Vertical item name'
274
+ sku_h_choice_name: 'SKU Horizontal choice name'
275
+ sku_v_choice_name: 'SKU Vertical choice name'
276
+ order: 'Order'
223
277
  comable/address: &comable_address
224
278
  full_name: 'Full name'
225
279
  family_name: 'Last name'
@@ -230,6 +284,7 @@ en:
230
284
  detail: 'Detail'
231
285
  phone_number: 'Phone number'
232
286
  comable/product:
287
+ id: 'ID'
233
288
  code: 'Code'
234
289
  name: 'Name'
235
290
  price: 'Price'
@@ -238,10 +293,13 @@ en:
238
293
  sku_h_item_name: 'SKU Horizontal item name'
239
294
  sku_v_item_name: 'SKU Vertical item name'
240
295
  comable/stock:
296
+ id: 'ID'
241
297
  code: 'SKU Code'
242
298
  quantity: 'Quantity'
243
299
  sku_h_choice_name: 'SKU Horizontal choice name'
244
300
  sku_v_choice_name: 'SKU Vertical choice name'
301
+ product: 'Product'
302
+ product_code: 'Product code'
245
303
  comable/store:
246
304
  name: 'Name'
247
305
  meta_keywords: 'Meta keywords'
@@ -256,20 +314,46 @@ en:
256
314
  comable/payment_method:
257
315
  name: 'Name'
258
316
  payment_provider: 'Oayment provider'
317
+ fee: 'Fee'
259
318
  enable_price: 'Enable price range'
260
- comable/order/order_details:
261
- <<: *comable_order_detail
319
+ comable/tracker:
320
+ activate_flag: 'Activated'
321
+ name: 'Name'
322
+ tracker_id: 'Tracker ID'
323
+ code: 'Code'
324
+ place: 'Place'
325
+ comable/order/order_items:
326
+ <<: *comable_order_item
262
327
  comable/order/bill_address:
263
328
  <<: *comable_address
264
329
  comable/order/ship_address:
265
330
  <<: *comable_address
331
+ comable/payment:
332
+ id: 'ID'
333
+ order_id: 'Order ID'
334
+ payment_method_id: 'Payment method ID'
335
+ fee: 'Fee'
336
+ state: 'Status'
337
+ completed_at: 'Completed at'
338
+ comable/shipment:
339
+ id: 'ID'
340
+ order_id: 'Order ID'
341
+ shipment_method_id: 'Shipment method ID'
342
+ fee: 'Fee'
343
+ state: 'Status'
344
+ tracking_number: 'Tracking number'
345
+ completed_at: 'Completed at'
266
346
 
267
347
  enumerize:
268
- comable/customer:
348
+ comable/user:
269
349
  role:
270
350
  customer: 'Customer'
271
351
  reporter: 'Reporter'
272
352
  admin: 'Administrator'
353
+ comable/tracker:
354
+ place:
355
+ everywhere: 'Everywhere'
356
+ checkout: 'Checkout'
273
357
 
274
358
  views:
275
359
  pagination:
@@ -278,3 +362,10 @@ en:
278
362
  next: "Next &rsaquo;"
279
363
  previous: "&lsaquo; Previous"
280
364
  truncate: "&hellip;"
365
+
366
+ ransack:
367
+ predicates:
368
+ gteq: 'Greater than or equal to'
369
+ lteq: 'Less than or equal to'
370
+ eq_any_splitted: 'Exact match'
371
+ cont_any_splitted: 'Partial match'
@@ -109,7 +109,7 @@ ja:
109
109
  note: 'NOTE:'
110
110
  results: 件
111
111
  times: 回
112
- more: もっと見る
112
+ more: その他
113
113
  access_denied: アクセス権がありません
114
114
  order_count: 注文数
115
115
  new_orders: 新規受注
@@ -129,26 +129,41 @@ ja:
129
129
  add_sub_image: サブ画像を追加
130
130
  sign_in: ログイン
131
131
  sign_out: ログアウト
132
+ export_to_csv: 'CSV形式でエクスポート'
133
+ export_to_excel: 'Excel形式でエクスポート'
134
+ import: 'ファイルからインポート...'
135
+ unknown_file_type: '対応していないファイル形式です: %{filename}'
136
+ is_not_exists: 'が存在しません。'
137
+ ship: '発送'
138
+ help: 'ヘルプ'
139
+ tracker_code_help_introduction: |-
140
+ トラッキングコードには、特殊な記号を使うことでトラッキングIDや注文情報を埋め込むことができます。
141
+ たとえば <code>{{ order.total_price }}</code> のように書くと注文の合計金額を埋め込むことができます。
142
+ 実際の画面ではこれが <code>1500</code> のように出力されます。
143
+ tracker_code_help_additional: '<code>order.order_items</code> は配列で、各要素から次の情報を取り出すことができます。'
144
+ list_of_usable_variables: '利用可能な変数は次の通りです。'
145
+ mote_infomation_for_syntax: '構文についての詳しい情報は次のページをご覧ください:'
132
146
  nav:
133
147
  dashboard: ダッシュボード
134
148
  order: 注文管理
135
149
  product: 商品管理
136
150
  stock: 在庫管理
137
151
  category: カテゴリ
138
- customer: ユーザー
152
+ user: ユーザー
139
153
  general_settings: 一般設定
140
154
  store: ストア設定
141
- shipment_method: 配送管理
155
+ shipment_method: 発送管理
142
156
  payment_method: 決済管理
157
+ tracker: トラッキング情報
143
158
  products:
144
159
  detail: 商品詳細
145
160
  orders:
146
161
  detail: 注文明細
147
162
  cart: カート情報
148
- customer: ユーザー詳細
163
+ user: ユーザー詳細
149
164
  shipment: 送料
150
165
  payment: 支払手数料
151
- customers:
166
+ users:
152
167
  detail: ユーザー詳細
153
168
  edit: 編集
154
169
  new_orders: '最新の注文 (%{count}件)'
@@ -177,17 +192,38 @@ ja:
177
192
  cart: カート
178
193
  orderer: 請求先住所の選択
179
194
  delivery: 配送先住所の選択
180
- shipment: 配送方法の選択
195
+ shipment: 発送方法の選択
181
196
  payment: 決済方法の選択
182
197
  confirm: 注文内容を確認
183
- complete: 注文完了
198
+ completed: '注文完了'
199
+ canceled: 'キャンセル'
200
+ resumed: '再開'
201
+ events:
202
+ cancel: 'キャンセル'
203
+ resume: '再開'
204
+ comable/payment:
205
+ state:
206
+ states:
207
+ pending: '準備中'
208
+ ready: 'オーソリ完了'
209
+ completed: '決済完了'
210
+ canceled: 'キャンセル'
211
+ resumed: '再開'
212
+ comable/shipment:
213
+ state:
214
+ states:
215
+ pending: '準備中'
216
+ ready: '準備完了'
217
+ completed: '発送完了'
218
+ canceled: 'キャンセル'
219
+ resumed: '再開'
184
220
 
185
221
  models:
186
222
  comable/order: ご注文
187
- comable/order_details: ご注文明細
223
+ comable/order_items: ご注文明細
188
224
 
189
225
  attributes:
190
- comable/customer:
226
+ comable/user:
191
227
  id: ID
192
228
  email: メールアドレス
193
229
  password: パスワード
@@ -211,24 +247,33 @@ ja:
211
247
  ship_address: お届け先
212
248
  payment_method: お支払い方法
213
249
  shipment_method: 発送方法
250
+ payment_fee: '支払い手数料'
214
251
  shipment_fee: 送料
215
252
  item_total_price: 商品合計
216
253
  total_price: 合計
217
- order_details: 商品
254
+ order_items: 商品
218
255
  completed_at: 注文日時
219
256
  state: ステータス
220
257
  bill_address: 請求先住所
221
258
  ship_address: 配送先住所
222
259
  bill_full_name: 配送先氏名
223
- order_details: 注文明細
224
- customer_id: ユーザーID
260
+ order_items: 注文明細
261
+ user_id: ユーザーID
225
262
  guest_token: ゲストトークン
226
- shipment_tracking_number: 発送トラッキング番号
227
- comable/order_detail: &comable_order_detail
263
+ payment_state: '決済ステータス'
264
+ shipment_state: '配送ステータス'
265
+ comable/order_item: &comable_order_item
228
266
  quantity: *quantity
229
267
  price: *price
230
268
  product: 商品情報
231
269
  subtotal_price: 小計
270
+ name: 商品名
271
+ code: SKU商品コード
272
+ sku_h_item_name: SKU横軸項目名
273
+ sku_v_item_name: SKU縦軸項目名
274
+ sku_h_choice_name: SKU横軸選択肢名
275
+ sku_v_choice_name: SKU縦軸選択肢名
276
+ order: 注文
232
277
  comable/address: &comable_address
233
278
  full_name: お名前
234
279
  family_name: 姓
@@ -253,6 +298,8 @@ ja:
253
298
  quantity: 在庫
254
299
  sku_h_choice_name: SKU横軸選択肢名
255
300
  sku_v_choice_name: SKU縦軸選択肢名
301
+ product: 商品
302
+ product_code: 商品コード
256
303
  comable/store:
257
304
  name: ストア名
258
305
  meta_keywords: メタキーワード
@@ -260,27 +307,53 @@ ja:
260
307
  email_sender: 送信元メールアドレス
261
308
  email_activate_flag: メール送信を有効にする
262
309
  comable/shipment_method:
263
- name: 配送方法名
310
+ name: 発送方法名
264
311
  fee: 手数料
265
- activate_flag: この配送方法を有効にする
312
+ activate_flag: この発送方法を有効にする
266
313
  traking_url: トラッキングURL
267
314
  comable/payment_method:
268
315
  name: 決済方法名
269
316
  payment_provider: 決済プロバイダ
317
+ fee: '手数料'
270
318
  enable_price: 利用可能な価格範囲
271
- comable/order/order_details:
272
- <<: *comable_order_detail
319
+ comable/tracker:
320
+ activate_flag: 'このトラッキング情報を有効にする'
321
+ name: 'トラッキング名'
322
+ tracker_id: 'トラッキングID'
323
+ code: 'トラッキングコード'
324
+ place: '設置場所'
325
+ comable/order/order_items:
326
+ <<: *comable_order_item
273
327
  comable/order/bill_address:
274
328
  <<: *comable_address
275
329
  comable/order/ship_address:
276
330
  <<: *comable_address
331
+ comable/payment:
332
+ id: 'ID'
333
+ order_id: '注文ID'
334
+ payment_method_id: '決済方法ID'
335
+ fee: '手数料'
336
+ state: 'ステータス'
337
+ completed_at: '決済日時'
338
+ comable/shipment:
339
+ id: 'ID'
340
+ order_id: '注文ID'
341
+ shipment_method_id: '発送方法ID'
342
+ fee: '手数料'
343
+ state: 'ステータス'
344
+ tracking_number: 'トラッキング番号'
345
+ completed_at: '発送日時'
277
346
 
278
347
  enumerize:
279
- comable/customer:
348
+ comable/user:
280
349
  role:
281
350
  customer: 顧客
282
351
  reporter: 報告者
283
352
  admin: 管理者
353
+ comable/tracker:
354
+ place:
355
+ everywhere: 'すべて'
356
+ checkout: '注文完了画面'
284
357
 
285
358
  views:
286
359
  pagination:
@@ -1,6 +1,6 @@
1
- class CreateComableCustomers < ActiveRecord::Migration
1
+ class CreateComableUsers < ActiveRecord::Migration
2
2
  def change
3
- create_table :comable_customers do |t|
3
+ create_table :comable_users do |t|
4
4
  ## Database authenticatable
5
5
  t.string :email, null: false
6
6
  t.string :role, null: false
@@ -36,9 +36,9 @@ class CreateComableCustomers < ActiveRecord::Migration
36
36
  t.references :ship_address
37
37
  end
38
38
 
39
- add_index :comable_customers, :email, unique: true
40
- add_index :comable_customers, :reset_password_token, unique: true
41
- # add_index :comable_customers, :confirmation_token, unique: true
42
- # add_index :comable_customers, :unlock_token, unique: true
39
+ add_index :comable_users, :email, unique: true
40
+ add_index :comable_users, :reset_password_token, unique: true
41
+ # add_index :comable_users, :confirmation_token, unique: true
42
+ # add_index :comable_users, :unlock_token, unique: true
43
43
  end
44
44
  end
@@ -1,14 +1,12 @@
1
1
  class CreateComableOrders < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :comable_orders do |t|
4
- t.references :customer
4
+ t.references :user
5
5
  t.string :guest_token
6
6
  t.string :code
7
7
  t.string :email
8
+ t.integer :payment_fee, null: false, default: 0
8
9
  t.integer :shipment_fee, null: false, default: 0
9
- t.string :shipment_tracking_number
10
- t.references :shipment_method
11
- t.references :payment_method
12
10
  t.integer :total_price
13
11
  t.references :bill_address
14
12
  t.references :ship_address
@@ -1,6 +1,6 @@
1
- class CreateComableOrderDetails < ActiveRecord::Migration
1
+ class CreateComableOrderItems < ActiveRecord::Migration
2
2
  def change
3
- create_table :comable_order_details do |t|
3
+ create_table :comable_order_items do |t|
4
4
  t.references :order, null: false
5
5
  t.references :stock, null: false
6
6
  t.string :name, null: false
@@ -13,6 +13,6 @@ class CreateComableOrderDetails < ActiveRecord::Migration
13
13
  t.integer :quantity, default: 1, null: false
14
14
  end
15
15
 
16
- add_index :comable_order_details, [:order_id, :stock_id], unique: true, name: :comable_order_details_idx_01
16
+ add_index :comable_order_items, [:order_id, :stock_id], unique: true, name: :comable_order_items_idx_01
17
17
  end
18
18
  end
@@ -4,6 +4,7 @@ class CreateComablePaymentMethods < ActiveRecord::Migration
4
4
  t.string :name, null: false
5
5
  t.string :payment_provider_type, null: false
6
6
  t.integer :payment_provider_kind, null: false
7
+ t.integer :fee, null: false
7
8
  t.integer :enable_price_from
8
9
  t.integer :enable_price_to
9
10
  end
@@ -1,7 +1,7 @@
1
1
  class CreateComableAddresses < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :comable_addresses do |t|
4
- t.references :customer
4
+ t.references :user
5
5
  t.string :family_name, null: false
6
6
  t.string :first_name, null: false
7
7
  t.string :zip_code, null: false, limit: 8
@@ -0,0 +1,12 @@
1
+ class CreateComableShipments < ActiveRecord::Migration
2
+ def change
3
+ create_table :comable_shipments do |t|
4
+ t.references :order, null: false
5
+ t.references :shipment_method, null: false
6
+ t.integer :fee, null: false
7
+ t.string :state, null: false
8
+ t.string :tracking_number
9
+ t.datetime :completed_at
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ class CreateComablePayments < ActiveRecord::Migration
2
+ def change
3
+ create_table :comable_payments do |t|
4
+ t.references :order, null: false
5
+ t.references :payment_method, null: false
6
+ t.integer :fee, null: false
7
+ t.string :state, null: false
8
+ t.datetime :completed_at
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ class CreateComableTrackers < ActiveRecord::Migration
2
+ def change
3
+ create_table :comable_trackers do |t|
4
+ # TODO: Rename the column: activate_flag => activated
5
+ t.boolean :activate_flag, null: false, default: true
6
+ t.string :name, null: false
7
+ t.string :tracker_id
8
+ t.text :code, null: false
9
+ t.string :place, null: false
10
+ end
11
+ end
12
+ end
@@ -34,17 +34,17 @@ def create_admin_user
34
34
  email = ask_admin_email
35
35
  password = ask_admin_password
36
36
 
37
- if Comable::Customer.where(email: email).exists?
37
+ if Comable::User.where(email: email).exists?
38
38
  puts "WARNING: The email address has already existed: #{email}"
39
39
  else
40
- Comable::Customer.with_role(:admin).new do |obj|
40
+ Comable::User.with_role(:admin).new do |obj|
41
41
  obj.email = email
42
42
  obj.password = password
43
43
  end.save!
44
44
  end
45
45
  end
46
46
 
47
- if Comable::Customer.with_role(:admin).exists?
47
+ if Comable::User.with_role(:admin).exists?
48
48
  puts 'Admin user has already been previously created.'
49
49
  else
50
50
  create_admin_user
@@ -3,7 +3,7 @@ module Comable
3
3
  module Configuration
4
4
  mattr_accessor :devise_strategies
5
5
  @@devise_strategies = {
6
- customer: [:database_authenticatable, :registerable, :recoverable, :rememberable, :trackable]
6
+ user: [:database_authenticatable, :registerable, :recoverable, :rememberable, :trackable]
7
7
  }
8
8
 
9
9
  mattr_accessor :products_per_page
@@ -11,6 +11,12 @@ module Comable
11
11
 
12
12
  mattr_accessor :orders_per_page
13
13
  @@orders_per_page = 5
14
+
15
+ mattr_accessor :export_xlsx_header_style
16
+ @@export_xlsx_header_style = { bg_color: '00000000', fg_color: 'ffffffff', alignment: { horizontal: :center }, bold: true }
17
+
18
+ mattr_accessor :export_xlsx_style
19
+ @@export_xlsx_style = nil
14
20
  end
15
21
  end
16
22
  end
@@ -37,31 +37,6 @@ module Comable
37
37
  end
38
38
  end
39
39
 
40
- initializer 'comable.devise.helpers' do
41
- module DeviseHelperPrepender
42
- def define_helpers(mapping)
43
- super.tap do
44
- return if mapping.name.to_sym != :customer
45
- define_comable_helper
46
- end
47
- end
48
-
49
- private
50
-
51
- def define_comable_helper
52
- class_eval <<-METHODS, __FILE__, __LINE__ + 1
53
- alias_method :devise_current_customer, :current_customer
54
- def current_customer
55
- resource = current_admin_customer || devise_current_customer || Comable::Customer.new
56
- resource.with_cookies(cookies)
57
- end
58
- METHODS
59
- end
60
- end
61
-
62
- Devise::Controllers::Helpers.singleton_class.send(:prepend, DeviseHelperPrepender)
63
- end
64
-
65
40
  initializer 'comable.devise.warden.manager' do
66
41
  Warden::Manager.after_set_user except: :fetch do |record, warden, options|
67
42
  if record.respond_to?(:after_set_user) && warden.authenticated?(options[:scope])
@@ -14,6 +14,22 @@ module Comable
14
14
  please_implement_method
15
15
  end
16
16
 
17
+ def authorize!
18
+ true
19
+ end
20
+
21
+ def complete!
22
+ true
23
+ end
24
+
25
+ def cancel!
26
+ true
27
+ end
28
+
29
+ def resume!
30
+ true
31
+ end
32
+
17
33
  private
18
34
 
19
35
  def please_implement_method
data/lib/comable_core.rb CHANGED
@@ -5,15 +5,20 @@ require 'ancestry'
5
5
  require 'acts_as_list'
6
6
  require 'carrierwave'
7
7
  require 'cancancan'
8
+ require 'comma'
9
+ require 'axlsx_rails'
10
+ require 'roo'
11
+ require 'liquid'
8
12
 
9
13
  require 'comable/core/configuration'
10
14
  require 'comable/core/engine'
11
15
 
12
- require 'comable/errors'
13
16
  require 'comable/payment_provider'
14
17
  require 'comable/state_machine_patch'
15
18
  require 'comable/deprecator'
16
19
 
20
+ require 'comma_extractor_extentions'
21
+
17
22
  module Comable
18
23
  class << self
19
24
  def setup(&_)