Class: Edi::MiraklSeller::Orchestrator

Inherits:
BaseOrchestrator show all
Defined in:
app/services/edi/mirakl_seller/orchestrator.rb

Overview

Service object: orchestrator.

Constant Summary

Constants inherited from BaseOrchestrator

BaseOrchestrator::DEFAULT_PENDING_DISCONTINUE_LIFETIME, BaseOrchestrator::ORCHESTRATORS, BaseOrchestrator::RECOMMENDED_EXECUTE_FLOW_EVERY_X_HOUR

Instance Attribute Summary

Attributes inherited from BaseOrchestrator

#config, #logger, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseOrchestrator

all_orchestrators_class, build, build_customer_id_to_partner_key_map, cached_build, cached_orchestrators, catalog_id_to_pending_discontinue_lifetime, catalog_ids_edi_enabled, #customer, #customer_catalog, customer_id_to_partner_key_map, #customer_ids, customer_ids_edi_enabled, customer_ids_with_invoice_message_enabled, #customers, execute_discontinue_flow, execute_flow, execute_inventory_flow, execute_listing_message_feed_flow, execute_order_flow, execute_price_flow, execute_product_data_flow, #ignore_back_orders, #initialize, orchestrator_for_customer_id, orchestrators, #pending_discontinue_lifetime, #product_data_enabled?, #should_execute_flow?, #should_execute_order_flow?, #should_execute_product_data_flow?, #test_mode?

Constructor Details

This class inherits a constructor from Edi::BaseOrchestrator

Class Method Details

.execute_mirakl_result_processorObject



417
418
419
420
421
422
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 417

def self.execute_mirakl_result_processor
  orchestrators.each do |o|
    ProductImportMessageProcessor.new(o).process
    PriceImportMessageProcessor.new(o).process
  end
end

.partnersObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 6

def self.partners
  mirakl_leroymerlin_api_host = Heatwave::Configuration.fetch(:mirakl_leroymerlin_api, :api_host)
  Heatwave::Configuration.fetch(:mirakl_leroymerlin_api, :api_key)
  mirakl_castorama_api_host = Heatwave::Configuration.fetch(:mirakl_castorama_api, :api_host)
  Heatwave::Configuration.fetch(:mirakl_castorama_api, :api_key)
  mirakl_bricodepot_es_api_host = Heatwave::Configuration.fetch(:mirakl_bricodepot_es_api, :api_host)
  Heatwave::Configuration.fetch(:mirakl_bricodepot_es_api, :api_key)
  mirakl_bricodepot_pt_api_host = Heatwave::Configuration.fetch(:mirakl_bricodepot_pt_api, :api_host)
  Heatwave::Configuration.fetch(:mirakl_bricodepot_pt_api, :api_key)
  mirakl_bricomarche_api_host = Heatwave::Configuration.fetch(:mirakl_bricomarche_api, :api_host)
  Heatwave::Configuration.fetch(:mirakl_bricomarche_api, :api_key)
  mirakl_leclerc_api_host = Heatwave::Configuration.fetch(:mirakl_leclerc_api, :api_host)
  Heatwave::Configuration.fetch(:mirakl_leclerc_api, :api_key)
  mirakl_maxeda_api_host = Heatwave::Configuration.fetch(:mirakl_maxeda_api, :api_host)
  Heatwave::Configuration.fetch(:mirakl_maxeda_api, :api_key)
  mirakl_bestbuy_ca_api_host = Heatwave::Configuration.fetch(:mirakl_bestbuy_ca_api, :api_host)
  Heatwave::Configuration.fetch(:mirakl_bestbuy_ca_api, :api_key)
  mirakl_bestbuy_outlet_ca_api_host = Heatwave::Configuration.fetch(:mirakl_bestbuy_outlet_ca_api, :api_host)
  Heatwave::Configuration.fetch(:mirakl_bestbuy_outlet_ca_api, :api_key)

  {
    leroymerlin_adeo: {
      active: true,
      partner: :leroymerlin_adeo,
      customer_id: { 'Groupe ADEO / Leroy Merlin France': 21_631_999,
                    'Groupe ADEO / Leroy Merlin Spain': 22_444_117,
                    'Groupe ADEO / Leroy Merlin Portugal': 22_444_128,
                    'Groupe ADEO / Leroy Merlin Italy': 22_473_614 },
      catalog_ids: { '001': 155, '002': 228, '003': 229, '005': 262 }, # 001: france, 002: spain, 003: portugal, 004: italy
      main_catalog_id: 155,
      orchestrator_keys: %w[leroymerlin_fr leroymerlin_es leroymerlin_pt leroymerlin_it],
      image_locales: %i[fr es pt it],
      value_pre_filter: { 'Yes' => 'LOV_000001', 'No' => 'LOV_000002' },
      offer_id: 'ean',
      transporter: :mirakl,
      transporter_profile: :mirakl_leroymerlin_api,
      error_product_identifier: 'shop_sku',
      product_id_type: 'EAN',
      product_data_remote_path: "#{mirakl_leroymerlin_api_host}/api/products/imports",
      product_import_message_remote_path: "#{mirakl_leroymerlin_api_host}/api/products/imports",
      price_import_message_remote_path: "#{mirakl_leroymerlin_api_host}/api/offers/imports",
      price_advice_remote_path: "#{mirakl_leroymerlin_api_host}/api/offers/imports",
      order_message_remote_path: "#{mirakl_leroymerlin_api_host}/api/orders?order_state_codes=WAITING_ACCEPTANCE,SHIPPING",
      fa_message_remote_path: "#{mirakl_leroymerlin_api_host}/api/orders/{order_id}/accept",
      tracking_advice_remote_path: "#{mirakl_leroymerlin_api_host}/api/orders/{order_id}/tracking",
      invoice_message_remote_path: "#{mirakl_leroymerlin_api_host}/api/orders/{order_id}/documents",
      validate_shipping_remote_path: "#{mirakl_leroymerlin_api_host}/api/orders/{order_id}/ship",
      failure_timeout_in_minutes: 10,
      max_process_attempts: 20,
      orders_require_acceptance: true,
      vat_breakdown_available: true,
      price_message_enabled: true,
      confirm_message_enabled: true,
      invoice_message_enabled: true,
      inventory_message_enabled: false,
      confirm_outbound_processing: true,
      fa_message_enabled: true,
      execute_price_flow_every_x_hour: 24,
      support_contact: 'sellersuccess@leroymerlin.fr'
    },
    castorama: {
      active: true,
      partner: :castorama,
      customer_id: { 'CASTORAMA FRANCE': 22_779_162 },
      catalog_ids: { '001': 263 },
      main_catalog_id: 263,
      orchestrator_keys: %w[castorama_fr],
      image_locales: %i[fr],
      value_pre_filter: { 'Yes' => 1, 'No' => 2 },
      offer_id: 'ean',
      transporter: :mirakl,
      transporter_profile: :mirakl_castorama_api,
      error_product_identifier: 'shop_sku',
      product_id_type: 'EAN',
      product_data_remote_path: "#{mirakl_castorama_api_host}/api/products/imports",
      product_import_message_remote_path: "#{mirakl_castorama_api_host}/api/products/imports",
      price_import_message_remote_path: "#{mirakl_castorama_api_host}/api/offers/imports",
      price_advice_remote_path: "#{mirakl_castorama_api_host}/api/offers/imports",
      order_message_remote_path: "#{mirakl_castorama_api_host}/api/orders?order_state_codes=SHIPPING",
      fa_message_remote_path: "#{mirakl_castorama_api_host}/api/orders/{order_id}/accept",
      tracking_advice_remote_path: "#{mirakl_castorama_api_host}/api/orders/{order_id}/tracking",
      invoice_message_remote_path: "#{mirakl_castorama_api_host}/api/orders/{order_id}/documents",
      validate_shipping_remote_path: "#{mirakl_castorama_api_host}/api/orders/{order_id}/ship",
      failure_timeout_in_minutes: 10,
      max_process_attempts: 20,
      orders_require_acceptance: false,
      vat_breakdown_available: false,
      price_message_enabled: true,
      confirm_message_enabled: true,
      invoice_message_enabled: true,
      inventory_message_enabled: true,
      confirm_outbound_processing: true,
      fa_message_enabled: true,
      execute_price_flow_every_x_hour: 24,
      support_contact: 'victor.bello@kingfisher.com'
    },
    bricodepot_es: {
      active: true,
      partner: :bricodepot_es,
      customer_id: { 'BRICODEPOT SPAIN': 22_818_476 },
      catalog_ids: { '001': 265 },
      main_catalog_id: 265,
      orchestrator_keys: %w[bricodepot_es],
      image_locales: %i[es],
      value_pre_filter: { 'Yes' => 1, 'No' => 0 },
      offer_id: 'ean',
      transporter: :mirakl,
      namespace: :bricodepot,
      transporter_profile: :mirakl_bricodepot_es_api,
      error_product_identifier: 'shop_sku',
      product_id_type: 'EAN',
      product_data_remote_path: "#{mirakl_bricodepot_es_api_host}/api/products/imports",
      product_import_message_remote_path: "#{mirakl_bricodepot_es_api_host}/api/products/imports",
      price_import_message_remote_path: "#{mirakl_bricodepot_es_api_host}/api/offers/imports",
      price_advice_remote_path: "#{mirakl_bricodepot_es_api_host}/api/offers/imports",
      order_message_remote_path: "#{mirakl_bricodepot_es_api_host}/api/orders?order_state_codes=WAITING_ACCEPTANCE,SHIPPING",
      fa_message_remote_path: "#{mirakl_bricodepot_es_api_host}/api/orders/{order_id}/accept",
      tracking_advice_remote_path: "#{mirakl_bricodepot_es_api_host}/api/orders/{order_id}/tracking",
      invoice_message_remote_path: "#{mirakl_bricodepot_es_api_host}/api/orders/{order_id}/documents",
      validate_shipping_remote_path: "#{mirakl_bricodepot_es_api_host}/api/orders/{order_id}/ship",
      failure_timeout_in_minutes: 10,
      max_process_attempts: 20,
      orders_require_acceptance: true,
      vat_breakdown_available: false,
      price_message_enabled: true,
      confirm_message_enabled: true,
      invoice_message_enabled: true,
      inventory_message_enabled: true,
      confirm_outbound_processing: true,
      fa_message_enabled: true,
      execute_price_flow_every_x_hour: 24,
      support_contact: 'Crisbell.AlcalaMontoya@bricodepot.com'
    },
    bricodepot_pt: {
      active: true,
      partner: :bricodepot_pt,
      customer_id: { 'BRICODEPOT PORTUGAL': 22_818_474 },
      catalog_ids: { '001': 264 },
      main_catalog_id: 264,
      orchestrator_keys: %w[bricodepot_pt],
      image_locales: %i[pt],
      value_pre_filter: { 'Yes' => 1, 'No' => 0 },
      offer_id: 'ean',
      transporter: :mirakl,
      namespace: :bricodepot,
      transporter_profile: :mirakl_bricodepot_pt_api,
      error_product_identifier: 'shop_sku',
      product_id_type: 'EAN',
      product_data_remote_path: "#{mirakl_bricodepot_pt_api_host}/api/products/imports",
      product_import_message_remote_path: "#{mirakl_bricodepot_pt_api_host}/api/products/imports",
      price_import_message_remote_path: "#{mirakl_bricodepot_pt_api_host}/api/offers/imports",
      price_advice_remote_path: "#{mirakl_bricodepot_pt_api_host}/api/offers/imports",
      order_message_remote_path: "#{mirakl_bricodepot_pt_api_host}/api/orders?order_state_codes=WAITING_ACCEPTANCE,SHIPPING",
      fa_message_remote_path: "#{mirakl_bricodepot_pt_api_host}/api/orders/{order_id}/accept",
      tracking_advice_remote_path: "#{mirakl_bricodepot_pt_api_host}/api/orders/{order_id}/tracking",
      invoice_message_remote_path: "#{mirakl_bricodepot_pt_api_host}/api/orders/{order_id}/documents",
      validate_shipping_remote_path: "#{mirakl_bricodepot_pt_api_host}/api/orders/{order_id}/ship",
      failure_timeout_in_minutes: 10,
      max_process_attempts: 20,
      orders_require_acceptance: true,
      vat_breakdown_available: false,
      price_message_enabled: true,
      confirm_message_enabled: true,
      invoice_message_enabled: true,
      inventory_message_enabled: true,
      confirm_outbound_processing: true,
      fa_message_enabled: true,
      execute_price_flow_every_x_hour: 24,
      support_contact: 'Crisbell.AlcalaMontoya@bricodepot.com'
    },
    bricomarche: {
      active: false,
      partner: :bricomarche,
      customer_id: { BRICOMARCHE: 22_841_508 },
      catalog_ids: { '001': 266 },
      main_catalog_id: 266,
      orchestrator_keys: %w[bricomarche_fr],
      image_locales: %i[fr],
      value_pre_filter: { 'Yes' => 'True', 'No' => 'False' },
      offer_id: 'ean',
      transporter: :mirakl,
      transporter_profile: :mirakl_bricomarche_api,
      error_product_identifier: 'shop_sku',
      product_id_type: 'EAN',
      product_data_remote_path: "#{mirakl_bricomarche_api_host}/api/products/imports",
      product_import_message_remote_path: "#{mirakl_bricomarche_api_host}/api/products/imports",
      price_import_message_remote_path: "#{mirakl_bricomarche_api_host}/api/offers/imports",
      price_advice_remote_path: "#{mirakl_bricomarche_api_host}/api/offers/imports",
      order_message_remote_path: "#{mirakl_bricomarche_api_host}/api/orders?order_state_codes=WAITING_ACCEPTANCE,SHIPPING",
      fa_message_remote_path: "#{mirakl_bricomarche_api_host}/api/orders/{order_id}/accept",
      tracking_advice_remote_path: "#{mirakl_bricomarche_api_host}/api/orders/{order_id}/tracking",
      invoice_message_remote_path: "#{mirakl_bricomarche_api_host}/api/orders/{order_id}/documents",
      validate_shipping_remote_path: "#{mirakl_bricomarche_api_host}/api/orders/{order_id}/ship",
      failure_timeout_in_minutes: 10,
      max_process_attempts: 20,
      orders_require_acceptance: true,
      vat_breakdown_available: false,
      price_message_enabled: true,
      confirm_message_enabled: true,
      invoice_message_enabled: true,
      inventory_message_enabled: true,
      confirm_outbound_processing: true,
      fa_message_enabled: true,
      execute_price_flow_every_x_hour: 24,
      support_contact: 'lauren.mariette@mousquetaires.com'
    },
    leclerc: {
      active: true,
      partner: :leclerc,
      customer_id: { LECLERC: 22_884_811 },
      catalog_ids: { '001': 269 },
      main_catalog_id: 269,
      orchestrator_keys: %w[leclerc_fr],
      image_locales: %i[fr],
      value_pre_filter: { 'Yes' => 'oui', 'No' => 'non' },
      offer_id: 'ean',
      transporter: :mirakl,
      transporter_profile: :mirakl_leclerc_api,
      error_product_identifier: 'shop_sku',
      product_id_type: 'SHOP_SKU',
      product_data_remote_path: "#{mirakl_leclerc_api_host}/api/products/imports",
      product_import_message_remote_path: "#{mirakl_leclerc_api_host}/api/products/imports",
      price_import_message_remote_path: "#{mirakl_leclerc_api_host}/api/offers/imports",
      price_advice_remote_path: "#{mirakl_leclerc_api_host}/api/offers/imports",
      order_message_remote_path: "#{mirakl_leclerc_api_host}/api/orders?order_state_codes=WAITING_ACCEPTANCE,SHIPPING",
      fa_message_remote_path: "#{mirakl_leclerc_api_host}/api/orders/{order_id}/accept",
      tracking_advice_remote_path: "#{mirakl_leclerc_api_host}/api/orders/{order_id}/tracking",
      invoice_message_remote_path: "#{mirakl_leclerc_api_host}/api/orders/{order_id}/documents",
      validate_shipping_remote_path: "#{mirakl_leclerc_api_host}/api/orders/{order_id}/ship",
      failure_timeout_in_minutes: 10,
      max_process_attempts: 20,
      orders_require_acceptance: true,
      vat_breakdown_available: false,
      price_message_enabled: true,
      confirm_message_enabled: true,
      invoice_message_enabled: true,
      inventory_message_enabled: true,
      confirm_outbound_processing: true,
      fa_message_enabled: true,
      execute_price_flow_every_x_hour: 24,
      support_contact: 'Tedwin.Liot@lcommerce.leclerc'
    },
    maxeda: {
      active: false,
      partner: :maxeda,
      customer_id: { 'MAXEDA GROUP': 22_884_826 },
      catalog_ids: { '001': 268 },
      main_catalog_id: 268,
      orchestrator_keys: %w[maxeda],
      image_locales: %i[fr nl],
      value_pre_filter: { 'Yes' => 'yesno_True', 'No' => 'yesno_False' },
      offer_id: 'sku',
      product_id_type: 'EAN',
      transporter: :mirakl,
      transporter_profile: :mirakl_maxeda_api,
      error_product_identifier: 'seller_product_id',
      product_data_remote_path: "#{mirakl_maxeda_api_host}/api/products/imports",
      product_import_message_remote_path: "#{mirakl_maxeda_api_host}/api/products/imports",
      price_import_message_remote_path: "#{mirakl_maxeda_api_host}/api/offers/imports",
      price_advice_remote_path: "#{mirakl_maxeda_api_host}/api/offers/imports",
      order_message_remote_path: "#{mirakl_maxeda_api_host}/api/orders?order_state_codes=SHIPPING",
      fa_message_remote_path: "#{mirakl_maxeda_api_host}/api/orders/{order_id}/accept",
      tracking_advice_remote_path: "#{mirakl_maxeda_api_host}/api/orders/{order_id}/tracking",
      invoice_message_remote_path: "#{mirakl_maxeda_api_host}/api/orders/{order_id}/documents",
      validate_shipping_remote_path: "#{mirakl_maxeda_api_host}/api/orders/{order_id}/ship",
      failure_timeout_in_minutes: 10,
      max_process_attempts: 20,
      orders_require_acceptance: false,
      vat_breakdown_available: false,
      price_message_enabled: true,
      confirm_message_enabled: true,
      invoice_message_enabled: true,
      inventory_message_enabled: true,
      confirm_outbound_processing: true,
      fa_message_enabled: true,
      execute_price_flow_every_x_hour: 24,
      support_contact: 'Sten.Lobles@diymaxeda.com'
    },
    # ────────────────────────────────────────────────────────────────────
    # North-American partners (CAD, no VAT). Live as of 2026-05-29:
    # offers match products by shop_sku, prices go out untaxed,
    # `manufacturer-warranty` is sent in days, and the offer feed mirrors
    # the product feed. The scheduled EDI flow workers iterate every partner
    # and self-gate on `active`, so `active: true` enrolls these in the
    # automatic product (daily 2:15a), offer/price (daily 12:30a, capped by
    # execute_price_flow_every_x_hour: 24), and order (every 15m) flows.
    # See doc/tasks/202605261800_BESTBUY_MIRAKL_INTEGRATION.md.
    # ────────────────────────────────────────────────────────────────────
    bestbuy_ca: {
      active: true,
      partner: :bestbuy_ca,
      customer_id: { 'Best Buy Canada Marketplace': 21_904_672 },
      catalog_ids: { '001': 158 },
      main_catalog_id: 158,
      orchestrator_keys: %w[bestbuy_ca],
      image_locales: %i[en fr],
      value_pre_filter: { 'Yes' => 'Yes', 'No' => 'No' }, # TODO: confirm Best Buy boolean shape
      # `offer_id: 'sku'` makes the offer's `<sku>` element use `item.sku`,
      # which matches the `shop_sku: item.sku` set by the BB presenter.
      # Misaligning the two values (which `offer_id: 'ean'` would do here)
      # makes Mirakl reject every offer with
      # "The product linked to the new offer is different from …".
      offer_id: 'sku',
      transporter: :mirakl,
      transporter_profile: :mirakl_bestbuy_ca_api,
      error_product_identifier: 'shop_sku',
      product_id_type: 'SHOP_SKU', # match offer→product by shop_sku (item.sku); EAN and UPC both 404'd despite the product showing synchronized

      product_data_remote_path: "#{mirakl_bestbuy_ca_api_host}/api/products/imports",
      product_import_message_remote_path: "#{mirakl_bestbuy_ca_api_host}/api/products/imports",
      price_import_message_remote_path: "#{mirakl_bestbuy_ca_api_host}/api/offers/imports",
      price_advice_remote_path: "#{mirakl_bestbuy_ca_api_host}/api/offers/imports",
      order_message_remote_path: "#{mirakl_bestbuy_ca_api_host}/api/orders?order_state_codes=SHIPPING",
      fa_message_remote_path: "#{mirakl_bestbuy_ca_api_host}/api/orders/{order_id}/accept",
      tracking_advice_remote_path: "#{mirakl_bestbuy_ca_api_host}/api/orders/{order_id}/tracking",
      invoice_message_remote_path: "#{mirakl_bestbuy_ca_api_host}/api/orders/{order_id}/documents",
      validate_shipping_remote_path: "#{mirakl_bestbuy_ca_api_host}/api/orders/{order_id}/ship",
      failure_timeout_in_minutes: 10,
      max_process_attempts: 20,
      orders_require_acceptance: false, # TODO: confirm
      vat_breakdown_available: false,   # CAD, no VAT — do NOT flip without rewriting tax handling in order_message_processor
      offer_additional_fields_enabled: false, # EU `vat-lm*` / `shipment-origin: NL` block doesn't apply to BB CA (CAD, no VAT)
      offer_manufacturer_warranty: true, # BB's mandatory offer field; we are the manufacturer, so the product's Warranty spec is the manufacturer warranty
      skip_unmapped_offer_items: true, # only offer products the product feed actually registers (presenter maps to a BB category) — excludes accessories etc.
      offer_state_code: 11,             # 11 = New (Mirakl LOV); marketplace ships only brand-new items
      price_message_enabled: true,
      confirm_message_enabled: true,
      invoice_message_enabled: false,
      inventory_message_enabled: false,
      confirm_outbound_processing: true,
      fa_message_enabled: false,
      execute_price_flow_every_x_hour: 24,
      support_contact: 'heatwaveteam@warmlyyours.com'
    },
    bestbuy_ca_outlet: {
      active: true,
      partner: :bestbuy_ca_outlet,
      customer_id: { 'Best Buy Canada Outlet Store': 22_910_421 },
      catalog_ids: { '001': 271 },
      main_catalog_id: 271,
      orchestrator_keys: %w[bestbuy_ca_outlet],
      image_locales: %i[en fr],
      value_pre_filter: { 'Yes' => 'Yes', 'No' => 'No' }, # TODO: confirm
      # See `bestbuy_ca` above — shop_sku alignment requires this be `'sku'`.
      offer_id: 'sku',
      transporter: :mirakl,
      transporter_profile: :mirakl_bestbuy_outlet_ca_api,
      error_product_identifier: 'shop_sku',
      product_id_type: 'SHOP_SKU', # match offer→product by shop_sku (item.sku); EAN and UPC both 404'd despite the product showing synchronized

      product_data_remote_path: "#{mirakl_bestbuy_outlet_ca_api_host}/api/products/imports",
      product_import_message_remote_path: "#{mirakl_bestbuy_outlet_ca_api_host}/api/products/imports",
      price_import_message_remote_path: "#{mirakl_bestbuy_outlet_ca_api_host}/api/offers/imports",
      price_advice_remote_path: "#{mirakl_bestbuy_outlet_ca_api_host}/api/offers/imports",
      order_message_remote_path: "#{mirakl_bestbuy_outlet_ca_api_host}/api/orders?order_state_codes=SHIPPING",
      fa_message_remote_path: "#{mirakl_bestbuy_outlet_ca_api_host}/api/orders/{order_id}/accept",
      tracking_advice_remote_path: "#{mirakl_bestbuy_outlet_ca_api_host}/api/orders/{order_id}/tracking",
      invoice_message_remote_path: "#{mirakl_bestbuy_outlet_ca_api_host}/api/orders/{order_id}/documents",
      validate_shipping_remote_path: "#{mirakl_bestbuy_outlet_ca_api_host}/api/orders/{order_id}/ship",
      failure_timeout_in_minutes: 10,
      max_process_attempts: 20,
      orders_require_acceptance: false, # TODO: confirm
      vat_breakdown_available: false,   # CAD, no VAT
      offer_additional_fields_enabled: false, # EU `vat-lm*` / `shipment-origin: NL` block doesn't apply to BB CA Outlet (CAD, no VAT)
      offer_manufacturer_warranty: true, # BB's mandatory offer field; we are the manufacturer, so the product's Warranty spec is the manufacturer warranty
      skip_unmapped_offer_items: true, # only offer products the product feed actually registers (presenter maps to a BB category) — excludes accessories etc.
      # Best Buy's offer-state LOV only exposes 11=New (verified via
      # GET /api/offers/states — total_count:1). Used/Open-Box grading is
      # carried on the product `_ProductCondition_*` attribute by the
      # Outlet ProductDataPresenter, NOT the offer state.
      offer_state_code: 11,
      price_message_enabled: true,
      confirm_message_enabled: true,
      invoice_message_enabled: false,
      inventory_message_enabled: false,
      confirm_outbound_processing: true,
      fa_message_enabled: false,
      execute_price_flow_every_x_hour: 24,
      support_contact: 'heatwaveteam@warmlyyours.com'
    }
  }
end

Instance Method Details

#confirm_message_enabled?Boolean

Returns:

  • (Boolean)


488
489
490
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 488

def confirm_message_enabled?
  confirm_message_enabled
end

#confirm_message_processorObject



472
473
474
475
476
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 472

def confirm_message_processor
  return Edi::NullProcessor.new(self, :fa_message_sender, options) unless confirm_message_enabled?

  ConfirmMessageProcessor.new(self, options)
end

#confirm_message_senderObject



478
479
480
481
482
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 478

def confirm_message_sender
  return Edi::NullProcessor.new(self, :fa_message_sender, options) unless confirm_message_enabled?

  ConfirmMessageSender.new(self, options)
end

#confirm_outbound_processing?Boolean

Returns:

  • (Boolean)


389
390
391
392
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 389

def confirm_outbound_processing?
  # Mirakl needs confirmation when sending data
  confirm_outbound_processing
end

#execute_inventory_flowObject



545
546
547
548
549
550
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 545

def execute_inventory_flow
  # return unless active

  # inventory_message_processor.process
  # inventory_message_sender.process
end

#execute_order_flowObject



533
534
535
536
537
538
539
540
541
542
543
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 533

def execute_order_flow
  return unless active

  order_message_retriever.process
  sleep(1)
  order_message_processor.process
  sleep(1)
  fa_message_sender.process
  sleep(1)
  confirm_message_sender.process
end

#execute_price_flowObject



526
527
528
529
530
531
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 526

def execute_price_flow
  return unless active

  price_message_processor.process
  price_message_sender.process
end

#execute_product_data_flowObject



519
520
521
522
523
524
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 519

def execute_product_data_flow
  return unless active

  product_data_processor.process
  product_data_sender.process
end

#fa_message_enabled?Boolean

Returns:

  • (Boolean)


456
457
458
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 456

def fa_message_enabled?
  fa_message_enabled
end

#fa_message_processorObject



460
461
462
463
464
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 460

def fa_message_processor
  return Edi::NullProcessor.new(self, :fa_message_processor, options) unless fa_message_enabled?

  FaMessageProcessor.new(self, options)
end

#fa_message_senderObject



466
467
468
469
470
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 466

def fa_message_sender
  return Edi::NullProcessor.new(self, :fa_message_sender, options) unless fa_message_enabled?

  FaMessageSender.new(self, options)
end

#inventory_message_enabled?Boolean

Returns:

  • (Boolean)


394
395
396
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 394

def inventory_message_enabled?
  inventory_message_enabled
end

#inventory_message_processorObject



484
485
486
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 484

def inventory_message_processor
  Edi::NullProcessor.new(self, :inventory_message_processor, options)
end

#invoice_message_enabled?Boolean

Returns:

  • (Boolean)


492
493
494
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 492

def invoice_message_enabled?
  invoice_message_enabled
end

#invoice_message_processorObject



500
501
502
503
504
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 500

def invoice_message_processor
  return Edi::NullProcessor.new(self, :invoice_message_processor, options) unless invoice_message_enabled?

  InvoiceMessageProcessor.new(self, options)
end

#mirakl_result_enabled?Boolean

Returns:

  • (Boolean)


406
407
408
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 406

def mirakl_result_enabled?
  try(:product_import_message_remote_path).present? || try(:price_import_message_remote_path).present?
end

#mirakl_result_processor(ecl) ⇒ Object



410
411
412
413
414
415
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 410

def mirakl_result_processor(ecl)
  return Edi::NullProcessor.new(self, :mirakl_result_processor, options) unless mirakl_result_enabled?

  ProductImportMessageProcessor.new(self, options).process(ecl) if ecl.category == 'product_data'
  PriceImportMessageProcessor.new(self, options).process(ecl) if ecl.category == 'price_advice'
end

#order_message_enabled?Boolean

Returns:

  • (Boolean)


440
441
442
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 440

def order_message_enabled?
  try(:order_message_remote_path).present?
end

#order_message_processorObject



450
451
452
453
454
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 450

def order_message_processor
  return Edi::NullProcessor.new(self, :order_message_processor, options) unless order_message_enabled?

  OrderMessageProcessor.new(self, options)
end

#order_message_retrieverObject



444
445
446
447
448
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 444

def order_message_retriever
  return Edi::NullProcessor.new(self, :order_message_processor, options) unless order_message_enabled?

  OrderMessageRetriever.new(self, options)
end

#price_message_enabled?Boolean

Returns:

  • (Boolean)


424
425
426
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 424

def price_message_enabled?
  price_message_enabled
end

#price_message_processorObject



434
435
436
437
438
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 434

def price_message_processor
  return Edi::NullProcessor.new(self, :price_message_processor, options) unless price_message_enabled?

  PriceMessageProcessor.new(self, options)
end

#price_message_senderObject



428
429
430
431
432
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 428

def price_message_sender
  return Edi::NullProcessor.new(self, :price_message_sender, options) unless price_message_enabled?

  PriceMessageSender.new(self, options)
end

#product_data_configuratorObject



506
507
508
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 506

def product_data_configurator
  ProductDataConfigurator.new(self, options)
end

#product_data_presenter(item) ⇒ Object



515
516
517
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 515

def product_data_presenter(item)
  product_data_presenter_class.new(item, image_locales: image_locales)
end

#product_data_presenter_classObject



510
511
512
513
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 510

def product_data_presenter_class
  namespace = (try(:namespace) || partner).to_s.camelize
  "Edi::MiraklSeller::#{namespace}::ProductDataPresenter".constantize
end

#product_data_processorObject



398
399
400
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 398

def product_data_processor
  ProductDataProcessor.new(self, options)
end

#product_data_senderObject



402
403
404
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 402

def product_data_sender
  ProductDataSender.new(self, options)
end

#return_notification_message_enabled?Boolean

Returns:

  • (Boolean)


496
497
498
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 496

def return_notification_message_enabled?
  try(:return_notification_message_remote_path).present?
end