5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/interactors/spree_cm_commissioner/import_csv_template_downloader.rb', line 5
def call
= case import_type
when 'new_order'
= %w[order_channel variant_sku quantity email]
+ SpreeCmCommissioner::Guest.csv_importable_columns.map(&:to_s)
when 'existing_order'
= %w[order_number guest_id]
+ SpreeCmCommissioner::Guest.csv_importable_columns.map(&:to_s)
else
raise ArgumentError, 'Invalid import type'
end
filename = 'import_order_csv_template.csv'
filepath = Rails.root.join('tmp', filename)
CSV.open(filepath, 'w') do |csv|
csv <<
end
context.filename = filename
context.filepath = filepath
end
|