workarea-orderbot 1.0.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.
- checksums.yaml +7 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
- data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.github/workflows/ci.yml +58 -0
- data/.gitignore +23 -0
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +58 -0
- data/Gemfile +17 -0
- data/LICENSE +52 -0
- data/README.md +100 -0
- data/Rakefile +59 -0
- data/app/assets/images/workarea/admin/orderbot/.keep +0 -0
- data/app/assets/images/workarea/storefront/orderbot/.keep +0 -0
- data/app/assets/javascripts/workarea/admin/orderbot/.keep +0 -0
- data/app/assets/javascripts/workarea/storefront/orderbot/.keep +0 -0
- data/app/assets/stylesheets/workarea/admin/orderbot/.keep +0 -0
- data/app/assets/stylesheets/workarea/storefront/orderbot/.keep +0 -0
- data/app/controllers/.keep +0 -0
- data/app/helpers/.keep +0 -0
- data/app/mailers/.keep +0 -0
- data/app/models/workarea/order.decorator +19 -0
- data/app/models/workarea/orderbot/import_log.rb +19 -0
- data/app/models/workarea/orderbot/pricing_import_data.rb +13 -0
- data/app/models/workarea/orderbot/product_import_data.rb +32 -0
- data/app/models/workarea/user.decorator +7 -0
- data/app/services/workarea/orderbot/child_product.rb +108 -0
- data/app/services/workarea/orderbot/filters.rb +33 -0
- data/app/services/workarea/orderbot/order.rb +146 -0
- data/app/services/workarea/orderbot/order/item.rb +69 -0
- data/app/services/workarea/orderbot/order/tender/credit_card.rb +43 -0
- data/app/services/workarea/orderbot/order/tender/general.rb +32 -0
- data/app/services/workarea/orderbot/order/tender/gift_card.rb +32 -0
- data/app/services/workarea/orderbot/order/tender/store_credit.rb +32 -0
- data/app/services/workarea/orderbot/parent_product.rb +87 -0
- data/app/views/.keep +0 -0
- data/app/workers/workarea/orderbot/fulfillment/import_fulfillments.rb +37 -0
- data/app/workers/workarea/orderbot/fulfillment_importer.rb +50 -0
- data/app/workers/workarea/orderbot/inventory/import_inventory.rb +50 -0
- data/app/workers/workarea/orderbot/inventory_importer.rb +57 -0
- data/app/workers/workarea/orderbot/pricing/import_pricing.rb +42 -0
- data/app/workers/workarea/orderbot/pricing_importer.rb +70 -0
- data/app/workers/workarea/orderbot/product/import_child_products.rb +24 -0
- data/app/workers/workarea/orderbot/product/import_parent_products.rb +32 -0
- data/app/workers/workarea/orderbot/product_importer.rb +72 -0
- data/app/workers/workarea/orderbot/save_order.rb +38 -0
- data/bin/rails +25 -0
- data/config/initializers/configurations.rb +60 -0
- data/config/initializers/scheduled_jobs.rb +28 -0
- data/config/initializers/workarea.rb +16 -0
- data/config/routes.rb +2 -0
- data/lib/workarea/orderbot.rb +43 -0
- data/lib/workarea/orderbot/authentication.rb +41 -0
- data/lib/workarea/orderbot/bogus_gateway.rb +629 -0
- data/lib/workarea/orderbot/engine.rb +10 -0
- data/lib/workarea/orderbot/gateway.rb +102 -0
- data/lib/workarea/orderbot/response.rb +29 -0
- data/lib/workarea/orderbot/version.rb +5 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +3 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +14 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +2 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +15 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +25 -0
- data/test/dummy/bin/update +25 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/config/application.rb +34 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +52 -0
- data/test/dummy/config/environments/production.rb +83 -0
- data/test/dummy/config/environments/test.rb +45 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/test/dummy/config/initializers/assets.rb +12 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/content_security_policy.rb +25 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/workarea.rb +5 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +9 -0
- data/test/dummy/config/locales/en.yml +33 -0
- data/test/dummy/config/puma.rb +34 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/db/seeds.rb +2 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/services/workarea/orderbot/order_test.rb +151 -0
- data/test/services/workarea/orderbot/product/child_product_test.rb +255 -0
- data/test/services/workarea/orderbot/product/parent_product_test.rb +106 -0
- data/test/teaspoon_env.rb +6 -0
- data/test/test_helper.rb +10 -0
- data/test/workers/workarea/orderbot/fulfillment/import_fulfillments_test.rb +41 -0
- data/test/workers/workarea/orderbot/fulfillment_importer_test.rb +29 -0
- data/test/workers/workarea/orderbot/inventory/import_inventory_test.rb +49 -0
- data/test/workers/workarea/orderbot/inventory_importer_test.rb +21 -0
- data/test/workers/workarea/orderbot/pricing/import_pricing_test.rb +61 -0
- data/test/workers/workarea/orderbot/pricing_importer_test.rb +29 -0
- data/test/workers/workarea/orderbot/product_importer_test.rb +23 -0
- data/test/workers/workarea/orderbot/save_order_test.rb +41 -0
- data/workarea-orderbot.gemspec +20 -0
- metadata +172 -0
|
@@ -0,0 +1,629 @@
|
|
|
1
|
+
module Workarea
|
|
2
|
+
module Orderbot
|
|
3
|
+
class BogusGateway
|
|
4
|
+
def initialize(options = {})
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def get_products(attrs = {})
|
|
8
|
+
if attrs[:response_model] == 'CustomField' && attrs[:sku] == 'backordersku'
|
|
9
|
+
Response.new(response(get_backordered_products_custom_field_response))
|
|
10
|
+
elsif attrs[:response_model] == 'CustomField'
|
|
11
|
+
Response.new(response(get_products_custom_field_response))
|
|
12
|
+
else
|
|
13
|
+
Response.new(response(get_products_response))
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get_inventory(attrs = {})
|
|
18
|
+
Response.new(response(get_inventory_response))
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def get_pricing(attrs = {})
|
|
22
|
+
Response.new(response(get_pricing_response))
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def create_order(attrs = {})
|
|
26
|
+
if attrs.first[:reference_order_id] == "error"
|
|
27
|
+
Response.new(response(create_error_order_response, 400))
|
|
28
|
+
elsif attrs.first[:reference_order_id] == "failure"
|
|
29
|
+
Response.new(response(create_order_save_failure_response, 200))
|
|
30
|
+
else
|
|
31
|
+
Response.new(response(create_order_response))
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def get_fulfillments(attrs = {})
|
|
36
|
+
Response.new(response(get_fulfillments_response))
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def response(body, status = 200)
|
|
42
|
+
response = Faraday.new do |builder|
|
|
43
|
+
builder.adapter :test do |stub|
|
|
44
|
+
stub.get("/orders/createorder") { |env| [ status, {}, body.to_json ] }
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
response.get("/orders/createorder")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def get_products_custom_field_response
|
|
51
|
+
[
|
|
52
|
+
{
|
|
53
|
+
product_id: 123456,
|
|
54
|
+
custom_fields: [
|
|
55
|
+
{
|
|
56
|
+
name: "Product Batch",
|
|
57
|
+
value: "123"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "Dye Type",
|
|
61
|
+
value: "abc"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "Grade",
|
|
65
|
+
value: "F minus"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "MFG Color",
|
|
69
|
+
value: "baby boi blue"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "backorderable",
|
|
73
|
+
value: false
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def get_backordered_products_custom_field_response
|
|
81
|
+
[
|
|
82
|
+
{
|
|
83
|
+
product_id: 123456,
|
|
84
|
+
custom_fields: [
|
|
85
|
+
{
|
|
86
|
+
name: "backorderable",
|
|
87
|
+
value: true
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def get_products_response
|
|
95
|
+
[
|
|
96
|
+
{
|
|
97
|
+
category: "Electronics",
|
|
98
|
+
group: "Phone",
|
|
99
|
+
product_id: 3212905,
|
|
100
|
+
sku: "APP0008",
|
|
101
|
+
name: "iPhone 6M Pink Soft",
|
|
102
|
+
has_children: false,
|
|
103
|
+
parent_id: 2548672,
|
|
104
|
+
parent_sku: "APP0001",
|
|
105
|
+
measurement_unit: "Each",
|
|
106
|
+
taxable: true,
|
|
107
|
+
gst_only: false,
|
|
108
|
+
first_variable: {
|
|
109
|
+
group: "Colour",
|
|
110
|
+
type: "Phone",
|
|
111
|
+
value: "Pink"
|
|
112
|
+
},
|
|
113
|
+
second_variable: {
|
|
114
|
+
group: "Texture",
|
|
115
|
+
type: "Density",
|
|
116
|
+
value: "Soft"
|
|
117
|
+
},
|
|
118
|
+
description: "",
|
|
119
|
+
other_important_info: "",
|
|
120
|
+
upc: "",
|
|
121
|
+
active: true,
|
|
122
|
+
reference_product: nil,
|
|
123
|
+
base_price: 600,
|
|
124
|
+
order_in_multiples: 1,
|
|
125
|
+
shipping_weight: 2,
|
|
126
|
+
shipping_weight_measurement_unit: "Oz",
|
|
127
|
+
apply_shipping_fee: true,
|
|
128
|
+
location: "",
|
|
129
|
+
maximum_commission_rate: 0,
|
|
130
|
+
export_hts: "",
|
|
131
|
+
country: nil,
|
|
132
|
+
descriptive_title: "",
|
|
133
|
+
csr_description: "",
|
|
134
|
+
meta_keywords: "",
|
|
135
|
+
workarea_info: {
|
|
136
|
+
template: "",
|
|
137
|
+
purchase_start_date: nil,
|
|
138
|
+
purchase_end_date: nil
|
|
139
|
+
},
|
|
140
|
+
shopify_info: {
|
|
141
|
+
published_scope: "none",
|
|
142
|
+
inventory_management: false
|
|
143
|
+
},
|
|
144
|
+
shipping_length: nil,
|
|
145
|
+
shipping_height: nil,
|
|
146
|
+
shipping_width: nil,
|
|
147
|
+
digital: false,
|
|
148
|
+
created_on: "2018-07-04T13:53:12.133",
|
|
149
|
+
updated_on: 1.day.ago
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
category: "Electronics",
|
|
153
|
+
group: "Phone",
|
|
154
|
+
product_id: 3212904,
|
|
155
|
+
sku: "APP0009",
|
|
156
|
+
name: "iPhone 6M Pink HD",
|
|
157
|
+
has_children: false,
|
|
158
|
+
parent_id: 2548672,
|
|
159
|
+
parent_sku: "APP0001",
|
|
160
|
+
measurement_unit: "Each",
|
|
161
|
+
taxable: true,
|
|
162
|
+
gst_only: false,
|
|
163
|
+
first_variable: {
|
|
164
|
+
group: "Colour",
|
|
165
|
+
type: "Phone",
|
|
166
|
+
value: "Pink"
|
|
167
|
+
},
|
|
168
|
+
second_variable: {
|
|
169
|
+
group: "Texture",
|
|
170
|
+
type: "Density",
|
|
171
|
+
value: "Hard"
|
|
172
|
+
},
|
|
173
|
+
description: "",
|
|
174
|
+
other_important_info: "",
|
|
175
|
+
upc: "",
|
|
176
|
+
active: true,
|
|
177
|
+
reference_product: nil,
|
|
178
|
+
base_price: 600,
|
|
179
|
+
order_in_multiples: 1,
|
|
180
|
+
shipping_weight: 2,
|
|
181
|
+
shipping_weight_measurement_unit: "Oz",
|
|
182
|
+
apply_shipping_fee: true,
|
|
183
|
+
location: "",
|
|
184
|
+
maximum_commission_rate: 0,
|
|
185
|
+
export_hts: "",
|
|
186
|
+
country: nil,
|
|
187
|
+
descriptive_title: "",
|
|
188
|
+
csr_description: "",
|
|
189
|
+
meta_keywords: "",
|
|
190
|
+
workarea_info: {
|
|
191
|
+
template: "",
|
|
192
|
+
purchase_start_date: nil,
|
|
193
|
+
purchase_end_date: nil
|
|
194
|
+
},
|
|
195
|
+
shopify_info: {
|
|
196
|
+
published_scope: "none",
|
|
197
|
+
inventory_management: false
|
|
198
|
+
},
|
|
199
|
+
shipping_length: nil,
|
|
200
|
+
shipping_height: nil,
|
|
201
|
+
shipping_width: nil,
|
|
202
|
+
digital: false,
|
|
203
|
+
created_on: "2018-07-04T13:53:11.803",
|
|
204
|
+
updated_on: 1.day.ago
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
category: "Electronics",
|
|
208
|
+
group: "Phone",
|
|
209
|
+
product_id: 2855051,
|
|
210
|
+
sku: "APP0011",
|
|
211
|
+
name: "iPhone 6M Blue Soft",
|
|
212
|
+
has_children: false,
|
|
213
|
+
parent_id: 2548672,
|
|
214
|
+
parent_sku: "APP0001",
|
|
215
|
+
measurement_unit: "Each",
|
|
216
|
+
taxable: true,
|
|
217
|
+
gst_only: false,
|
|
218
|
+
first_variable: {
|
|
219
|
+
group: "Colour",
|
|
220
|
+
type: "Phone",
|
|
221
|
+
value: "Blue"
|
|
222
|
+
},
|
|
223
|
+
second_variable: {
|
|
224
|
+
group: "Texture",
|
|
225
|
+
type: "Density",
|
|
226
|
+
value: "Soft"
|
|
227
|
+
},
|
|
228
|
+
description: "",
|
|
229
|
+
other_important_info: "",
|
|
230
|
+
upc: "",
|
|
231
|
+
active: true,
|
|
232
|
+
reference_product: nil,
|
|
233
|
+
base_price: 600,
|
|
234
|
+
order_in_multiples: 1,
|
|
235
|
+
shipping_weight: 2,
|
|
236
|
+
shipping_weight_measurement_unit: "Oz",
|
|
237
|
+
apply_shipping_fee: true,
|
|
238
|
+
location: "",
|
|
239
|
+
maximum_commission_rate: 0,
|
|
240
|
+
export_hts: "",
|
|
241
|
+
country: nil,
|
|
242
|
+
descriptive_title: "",
|
|
243
|
+
csr_description: "",
|
|
244
|
+
meta_keywords: "",
|
|
245
|
+
workarea_info: {
|
|
246
|
+
template: "",
|
|
247
|
+
purchase_start_date: nil,
|
|
248
|
+
purchase_end_date: nil
|
|
249
|
+
},
|
|
250
|
+
shopify_info: {
|
|
251
|
+
published_scope: "none",
|
|
252
|
+
inventory_management: false
|
|
253
|
+
},
|
|
254
|
+
shipping_length: nil,
|
|
255
|
+
shipping_height: nil,
|
|
256
|
+
shipping_width: nil,
|
|
257
|
+
digital: false,
|
|
258
|
+
created_on: "2017-08-03T16:44:52.04",
|
|
259
|
+
updated_on: 1.day.ago
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
category: "Electronics",
|
|
263
|
+
group: "Phone",
|
|
264
|
+
product_id: 2550254,
|
|
265
|
+
sku: "NK0001",
|
|
266
|
+
name: "Nokia 150",
|
|
267
|
+
has_children: true,
|
|
268
|
+
parent_id: 0,
|
|
269
|
+
parent_sku: nil,
|
|
270
|
+
measurement_unit: "Each",
|
|
271
|
+
taxable: true,
|
|
272
|
+
gst_only: false,
|
|
273
|
+
first_variable: {
|
|
274
|
+
group: nil,
|
|
275
|
+
type: nil,
|
|
276
|
+
value: nil
|
|
277
|
+
},
|
|
278
|
+
second_variable: {
|
|
279
|
+
group: nil,
|
|
280
|
+
type: nil,
|
|
281
|
+
value: nil
|
|
282
|
+
},
|
|
283
|
+
description: "",
|
|
284
|
+
other_important_info: "",
|
|
285
|
+
upc: "NK001001",
|
|
286
|
+
active: true,
|
|
287
|
+
reference_product: nil,
|
|
288
|
+
base_price: 650,
|
|
289
|
+
order_in_multiples: 1,
|
|
290
|
+
shipping_weight: 1,
|
|
291
|
+
shipping_weight_measurement_unit: "Lbs",
|
|
292
|
+
apply_shipping_fee: true,
|
|
293
|
+
location: "",
|
|
294
|
+
maximum_commission_rate: 8,
|
|
295
|
+
export_hts: "",
|
|
296
|
+
country: nil,
|
|
297
|
+
descriptive_title: "",
|
|
298
|
+
csr_description: "",
|
|
299
|
+
meta_keywords: "",
|
|
300
|
+
workarea_info: {
|
|
301
|
+
template: "",
|
|
302
|
+
purchase_start_date: nil,
|
|
303
|
+
purchase_end_date: nil
|
|
304
|
+
},
|
|
305
|
+
shopify_info: {
|
|
306
|
+
published_scope: "none",
|
|
307
|
+
inventory_management: nil
|
|
308
|
+
},
|
|
309
|
+
shipping_length: nil,
|
|
310
|
+
shipping_height: nil,
|
|
311
|
+
shipping_width: nil,
|
|
312
|
+
digital: false,
|
|
313
|
+
created_on: "2016-12-23T10:36:16.637",
|
|
314
|
+
updated_on: 1.day.ago
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
category: "Electronics",
|
|
318
|
+
group: "Phone",
|
|
319
|
+
product_id: 2548672,
|
|
320
|
+
sku: "APP0001",
|
|
321
|
+
name: "iPhone 6M",
|
|
322
|
+
has_children: true,
|
|
323
|
+
parent_id: 0,
|
|
324
|
+
parent_sku: nil,
|
|
325
|
+
measurement_unit: "Each",
|
|
326
|
+
taxable: true,
|
|
327
|
+
gst_only: false,
|
|
328
|
+
first_variable: {
|
|
329
|
+
group: nil,
|
|
330
|
+
type: nil,
|
|
331
|
+
value: nil
|
|
332
|
+
},
|
|
333
|
+
second_variable: {
|
|
334
|
+
group: nil,
|
|
335
|
+
type: nil,
|
|
336
|
+
value: nil
|
|
337
|
+
},
|
|
338
|
+
description: "",
|
|
339
|
+
other_important_info: "",
|
|
340
|
+
upc: "APP001001",
|
|
341
|
+
active: true,
|
|
342
|
+
reference_product: nil,
|
|
343
|
+
base_price: 600,
|
|
344
|
+
order_in_multiples: 1,
|
|
345
|
+
shipping_weight: 2,
|
|
346
|
+
shipping_weight_measurement_unit: "Oz",
|
|
347
|
+
apply_shipping_fee: true,
|
|
348
|
+
location: "",
|
|
349
|
+
maximum_commission_rate: nil,
|
|
350
|
+
export_hts: "",
|
|
351
|
+
country: nil,
|
|
352
|
+
descriptive_title: "",
|
|
353
|
+
csr_description: "",
|
|
354
|
+
meta_keywords: "",
|
|
355
|
+
workarea_info: {
|
|
356
|
+
template: "",
|
|
357
|
+
purchase_start_date: nil,
|
|
358
|
+
purchase_end_date: nil
|
|
359
|
+
},
|
|
360
|
+
shopify_info: {
|
|
361
|
+
published_scope: "none",
|
|
362
|
+
inventory_management: nil
|
|
363
|
+
},
|
|
364
|
+
shipping_length: nil,
|
|
365
|
+
shipping_height: nil,
|
|
366
|
+
shipping_width: nil,
|
|
367
|
+
digital: false,
|
|
368
|
+
created_on: "2016-12-21T15:13:30.213",
|
|
369
|
+
updated_on: 1.day.ago
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
category: "Electronics",
|
|
373
|
+
group: "Phone",
|
|
374
|
+
product_id: 3212905,
|
|
375
|
+
sku: "APP0008",
|
|
376
|
+
name: "iPhone 6M Pink Soft",
|
|
377
|
+
has_children: false,
|
|
378
|
+
parent_id: 2548672,
|
|
379
|
+
parent_sku: "APP0001",
|
|
380
|
+
measurement_unit: "Each",
|
|
381
|
+
taxable: true,
|
|
382
|
+
gst_only: false,
|
|
383
|
+
first_variable: {
|
|
384
|
+
group: "Colour",
|
|
385
|
+
type: "Phone",
|
|
386
|
+
value: "Pink"
|
|
387
|
+
},
|
|
388
|
+
second_variable: {
|
|
389
|
+
group: "Texture",
|
|
390
|
+
type: "Density",
|
|
391
|
+
value: "Soft"
|
|
392
|
+
},
|
|
393
|
+
description: "",
|
|
394
|
+
other_important_info: "",
|
|
395
|
+
upc: "",
|
|
396
|
+
active: true,
|
|
397
|
+
reference_product: nil,
|
|
398
|
+
base_price: 600,
|
|
399
|
+
order_in_multiples: 1,
|
|
400
|
+
shipping_weight: 2,
|
|
401
|
+
shipping_weight_measurement_unit: "Oz",
|
|
402
|
+
apply_shipping_fee: true,
|
|
403
|
+
location: "",
|
|
404
|
+
maximum_commission_rate: 0,
|
|
405
|
+
export_hts: "",
|
|
406
|
+
country: nil,
|
|
407
|
+
descriptive_title: "",
|
|
408
|
+
csr_description: "",
|
|
409
|
+
meta_keywords: "",
|
|
410
|
+
workarea_info: {
|
|
411
|
+
template: "",
|
|
412
|
+
purchase_start_date: nil,
|
|
413
|
+
purchase_end_date: nil
|
|
414
|
+
},
|
|
415
|
+
shopify_info: {
|
|
416
|
+
published_scope: "none",
|
|
417
|
+
inventory_management: false
|
|
418
|
+
},
|
|
419
|
+
shipping_length: nil,
|
|
420
|
+
shipping_height: nil,
|
|
421
|
+
shipping_width: nil,
|
|
422
|
+
digital: false,
|
|
423
|
+
created_on: "2018-07-04T13:53:12.133",
|
|
424
|
+
updated_on: 1.day.ago
|
|
425
|
+
}
|
|
426
|
+
]
|
|
427
|
+
end
|
|
428
|
+
|
|
429
|
+
def get_inventory_response
|
|
430
|
+
[
|
|
431
|
+
{
|
|
432
|
+
distribution_center_id: 454,
|
|
433
|
+
product_id: 2742840,
|
|
434
|
+
sku: "1111",
|
|
435
|
+
quantity_on_hand: 100.0,
|
|
436
|
+
updated_on: 5.minutes.ago
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
distribution_center_id: 454,
|
|
440
|
+
product_id: 2742840,
|
|
441
|
+
sku: "2222",
|
|
442
|
+
quantity_on_hand: 200.0,
|
|
443
|
+
updated_on: 5.minutes.ago
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
distribution_center_id: 454,
|
|
447
|
+
product_id: 2742840,
|
|
448
|
+
sku: "3333",
|
|
449
|
+
quantity_on_hand: 300.0,
|
|
450
|
+
updated_on: 5.minutes.ago
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
distribution_center_id: 454,
|
|
454
|
+
product_id: 2742840,
|
|
455
|
+
sku: "4444",
|
|
456
|
+
quantity_on_hand: 400.0,
|
|
457
|
+
updated_on: 5.minutes.ago
|
|
458
|
+
}
|
|
459
|
+
]
|
|
460
|
+
end
|
|
461
|
+
|
|
462
|
+
def create_order_response
|
|
463
|
+
[
|
|
464
|
+
{
|
|
465
|
+
order_id: 1000,
|
|
466
|
+
reference_id: "1234",
|
|
467
|
+
orderbot_status_code: "success",
|
|
468
|
+
messages: [ "The ship confirmation was processed successfully" ]
|
|
469
|
+
}
|
|
470
|
+
]
|
|
471
|
+
end
|
|
472
|
+
|
|
473
|
+
def create_error_order_response
|
|
474
|
+
{
|
|
475
|
+
errors: {
|
|
476
|
+
distributionCenterId: [ "The DistributionCenterId field is required." ]
|
|
477
|
+
},
|
|
478
|
+
title: "One or more validation errors occurred.",
|
|
479
|
+
status: 400,
|
|
480
|
+
traceId: "0HLRMSI1H2BKA:00000001"
|
|
481
|
+
}
|
|
482
|
+
end
|
|
483
|
+
|
|
484
|
+
def create_order_save_failure_response
|
|
485
|
+
[
|
|
486
|
+
{
|
|
487
|
+
order_id: 0,
|
|
488
|
+
reference_id: "1234",
|
|
489
|
+
orderbot_status_code: "failure",
|
|
490
|
+
messages: [ "order failed to save" ]
|
|
491
|
+
}
|
|
492
|
+
]
|
|
493
|
+
end
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
def get_pricing_response
|
|
497
|
+
[
|
|
498
|
+
{
|
|
499
|
+
effective_date: nil,
|
|
500
|
+
name: "CAN-REWARDS",
|
|
501
|
+
order_guide_id: 1,
|
|
502
|
+
sales_channel_id: 286,
|
|
503
|
+
version_id: 3187,
|
|
504
|
+
products: [
|
|
505
|
+
{
|
|
506
|
+
force_schedule: nil,
|
|
507
|
+
last_updated_on: 5.minutes.ago,
|
|
508
|
+
original_price: 15.0,
|
|
509
|
+
price: 15.0,
|
|
510
|
+
product_id: 3592532,
|
|
511
|
+
sales_end_on: nil,
|
|
512
|
+
sales_start_on: nil,
|
|
513
|
+
sku: "SAMEPRICE1"
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
force_schedule: nil,
|
|
517
|
+
last_updated_on: 5.minutes.ago,
|
|
518
|
+
original_price: nil,
|
|
519
|
+
price: 20.0,
|
|
520
|
+
product_id: 3592539,
|
|
521
|
+
sales_end_on: nil,
|
|
522
|
+
sales_start_on: nil,
|
|
523
|
+
sku: "REGULAR1"
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
force_schedule: nil,
|
|
527
|
+
last_updated_on: 5.minutes.ago,
|
|
528
|
+
original_price: 45.0,
|
|
529
|
+
price: 30.0,
|
|
530
|
+
product_id: 3592535,
|
|
531
|
+
sales_end_on: nil,
|
|
532
|
+
sales_start_on: nil,
|
|
533
|
+
sku: "SALE1"
|
|
534
|
+
}
|
|
535
|
+
]
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
effective_date: nil,
|
|
539
|
+
name: "UK-Shopify",
|
|
540
|
+
order_guide_id: 2,
|
|
541
|
+
sales_channel_id: 286,
|
|
542
|
+
version_id: 3177,
|
|
543
|
+
products: [
|
|
544
|
+
{
|
|
545
|
+
force_schedule: nil,
|
|
546
|
+
last_updated_on: 5.minutes.ago,
|
|
547
|
+
original_price: nil,
|
|
548
|
+
price: 570.0,
|
|
549
|
+
product_id: 2548678,
|
|
550
|
+
sales_end_on: nil,
|
|
551
|
+
sales_start_on: nil,
|
|
552
|
+
sku: "APP0006"
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
force_schedule: nil,
|
|
556
|
+
last_updated_on: 5.minutes.ago,
|
|
557
|
+
original_price: nil,
|
|
558
|
+
price: 570.0,
|
|
559
|
+
product_id: 2855050,
|
|
560
|
+
sales_end_on: nil,
|
|
561
|
+
sales_start_on: nil,
|
|
562
|
+
sku: "APP0010"
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
force_schedule: nil,
|
|
566
|
+
last_updated_on: 5.minutes.ago,
|
|
567
|
+
original_price: nil,
|
|
568
|
+
price: 237.5,
|
|
569
|
+
product_id: 3081908,
|
|
570
|
+
sales_end_on: nil,
|
|
571
|
+
sales_start_on: nil,
|
|
572
|
+
sku: "AMP0101"
|
|
573
|
+
}
|
|
574
|
+
]
|
|
575
|
+
}
|
|
576
|
+
]
|
|
577
|
+
end
|
|
578
|
+
|
|
579
|
+
def get_fulfillments_response
|
|
580
|
+
[
|
|
581
|
+
{
|
|
582
|
+
order_id: "111111111",
|
|
583
|
+
reference_id: "1234",
|
|
584
|
+
purchase_order: "00984",
|
|
585
|
+
ship_date: 5.minutes.ago,
|
|
586
|
+
carrier_service_type: "USPS Priority",
|
|
587
|
+
ship_code: "FED",
|
|
588
|
+
packages: [
|
|
589
|
+
{
|
|
590
|
+
package_id: "3003216",
|
|
591
|
+
tracking_number: "1Z999AA10123456784",
|
|
592
|
+
items: [
|
|
593
|
+
{
|
|
594
|
+
package_item_id: "3003216",
|
|
595
|
+
product_id: "3003217",
|
|
596
|
+
sku: "SKU",
|
|
597
|
+
quantity: "2"
|
|
598
|
+
}
|
|
599
|
+
]
|
|
600
|
+
}
|
|
601
|
+
]
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
order_id: "99999999",
|
|
605
|
+
reference_id: "4567",
|
|
606
|
+
purchase_order: "00984",
|
|
607
|
+
ship_date: 5.minutes.ago,
|
|
608
|
+
carrier_service_type: "USPS Priority",
|
|
609
|
+
ship_code: "FED",
|
|
610
|
+
packages: [
|
|
611
|
+
{
|
|
612
|
+
package_id: "3003216",
|
|
613
|
+
tracking_number: "1Z999AA10123456784",
|
|
614
|
+
items: [
|
|
615
|
+
{
|
|
616
|
+
package_item_id: "3003216",
|
|
617
|
+
product_id: "3003217",
|
|
618
|
+
sku: "SKU",
|
|
619
|
+
quantity: "1"
|
|
620
|
+
}
|
|
621
|
+
]
|
|
622
|
+
}
|
|
623
|
+
]
|
|
624
|
+
}
|
|
625
|
+
]
|
|
626
|
+
end
|
|
627
|
+
end
|
|
628
|
+
end
|
|
629
|
+
end
|