Class: Edi::MiraklSeller::Orchestrator
- Inherits:
-
BaseOrchestrator
- Object
- BaseOrchestrator
- Edi::MiraklSeller::Orchestrator
- Defined in:
- app/services/edi/mirakl_seller/orchestrator.rb
Overview
Orchestrator for Mirakl marketplace seller integrations.
Defines per-partner configuration and wires together the processors,
senders, and retrievers that drive the product data, price, order,
fulfillment, and invoice EDI flows.
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
Class Method Summary collapse
-
.execute_mirakl_result_processor ⇒ void
Polls import results for all Mirakl seller orchestrators.
-
.partners ⇒ Hash{Symbol => Hash}
Returns the Mirakl seller partner configuration hash.
Instance Method Summary collapse
-
#confirm_message_enabled? ⇒ Boolean
Whether ship-confirm messages are enabled for this partner.
-
#confirm_message_processor ⇒ ConfirmMessageProcessor, Edi::NullProcessor
Builds the ship-confirm message processor, or a null processor when disabled.
-
#confirm_message_sender ⇒ ConfirmMessageSender, Edi::NullProcessor
Builds the ship-confirm message sender, or a null processor when disabled.
-
#confirm_outbound_processing? ⇒ Boolean
Whether outbound messages require explicit confirmation before sending.
-
#execute_inventory_flow ⇒ void
Executes the inventory flow for this partner (currently a no-op).
-
#execute_order_flow ⇒ void
Executes the order/fulfillment flow for this partner if active.
-
#execute_price_flow ⇒ Object?
Executes the price/offer flow for this partner if active.
-
#execute_product_data_flow ⇒ Symbol, ...
Executes the product data flow for this partner if active.
-
#fa_message_enabled? ⇒ Boolean
Whether order-acceptance (functional acknowledgement) messages are enabled.
-
#fa_message_processor ⇒ FaMessageProcessor, Edi::NullProcessor
Builds the FA message processor, or a null processor when disabled.
-
#fa_message_sender ⇒ FaMessageSender, Edi::NullProcessor
Builds the FA message sender, or a null processor when disabled.
-
#inventory_message_enabled? ⇒ Boolean
Whether inventory messages are enabled for this partner.
-
#inventory_message_processor ⇒ Edi::NullProcessor
Builds the inventory message processor (currently a no-op for Mirakl).
-
#invoice_message_enabled? ⇒ Boolean
Whether invoice messages are enabled for this partner.
-
#invoice_message_processor ⇒ InvoiceMessageProcessor, Edi::NullProcessor
Builds the invoice message processor, or a null processor when disabled.
-
#mirakl_result_enabled? ⇒ Boolean
Whether Mirakl import-result polling is configured.
-
#mirakl_result_processor(ecl) ⇒ Object?
Polls the Mirakl import result for the given ECL.
-
#order_message_enabled? ⇒ Boolean
Whether order retrieval is configured for this partner.
-
#order_message_processor ⇒ OrderMessageProcessor, Edi::NullProcessor
Builds the order message processor, or a null processor when disabled.
-
#order_message_retriever ⇒ OrderMessageRetriever, Edi::NullProcessor
Builds the order message retriever, or a null processor when disabled.
-
#price_message_enabled? ⇒ Boolean
Whether price/offer messages are enabled for this partner.
-
#price_message_processor ⇒ PriceMessageProcessor, Edi::NullProcessor
Builds the price message processor, or a null processor when disabled.
-
#price_message_sender ⇒ PriceMessageSender, Edi::NullProcessor
Builds the price message sender, or a null processor when disabled.
-
#product_data_configurator ⇒ ProductDataConfigurator
Builds the product data XML configurator for this partner.
-
#product_data_presenter(item) ⇒ BaseMiraklPresenter
Instantiates the per-partner product data presenter for an item.
-
#product_data_presenter_class ⇒ Class
Resolves the per-partner product data presenter class.
-
#product_data_processor ⇒ ProductDataProcessor
Builds the product data processor for this partner.
-
#product_data_sender ⇒ ProductDataSender
Builds the product data sender for this partner.
-
#return_notification_message_enabled? ⇒ Boolean
Whether return notification retrieval is configured for this partner.
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?, #supports_flow?, #test_mode?
Constructor Details
This class inherits a constructor from Edi::BaseOrchestrator
Class Method Details
.execute_mirakl_result_processor ⇒ void
This method returns an undefined value.
Polls import results for all Mirakl seller orchestrators.
451 452 453 454 455 456 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 451 def self.execute_mirakl_result_processor orchestrators.each do |o| ProductImportMessageProcessor.new(o).process PriceImportMessageProcessor.new(o).process end end |
.partners ⇒ Hash{Symbol => Hash}
Returns the Mirakl seller partner configuration hash.
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 388 389 390 391 392 393 394 395 396 397 398 399 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 18 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
Whether ship-confirm messages are enabled for this partner.
561 562 563 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 561 def end |
#confirm_message_processor ⇒ ConfirmMessageProcessor, Edi::NullProcessor
Builds the ship-confirm message processor, or a null processor when disabled.
536 537 538 539 540 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 536 def return Edi::NullProcessor.new(self, :fa_message_sender, ) unless ConfirmMessageProcessor.new(self, ) end |
#confirm_message_sender ⇒ ConfirmMessageSender, Edi::NullProcessor
Builds the ship-confirm message sender, or a null processor when disabled.
545 546 547 548 549 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 545 def return Edi::NullProcessor.new(self, :fa_message_sender, ) unless ConfirmMessageSender.new(self, ) end |
#confirm_outbound_processing? ⇒ Boolean
Whether outbound messages require explicit confirmation before sending.
404 405 406 407 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 404 def confirm_outbound_processing? # Mirakl needs confirmation when sending data confirm_outbound_processing end |
#execute_inventory_flow ⇒ void
This method returns an undefined value.
Executes the inventory flow for this partner (currently a no-op).
652 653 654 655 656 657 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 652 def execute_inventory_flow # return unless active # inventory_message_processor.process # inventory_message_sender.process end |
#execute_order_flow ⇒ void
This method returns an undefined value.
Executes the order/fulfillment flow for this partner if active.
637 638 639 640 641 642 643 644 645 646 647 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 637 def execute_order_flow return unless active .process sleep(1) .process sleep(1) .process sleep(1) .process end |
#execute_price_flow ⇒ Object?
Executes the price/offer flow for this partner if active.
627 628 629 630 631 632 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 627 def execute_price_flow return unless active .process .process end |
#execute_product_data_flow ⇒ Symbol, ...
Executes the product data flow for this partner if active.
614 615 616 617 618 619 620 621 622 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 614 def execute_product_data_flow return unless active sender = product_data_sender return :rate_limited unless sender.ready? ecl = product_data_processor.call sender.call([ecl]) end |
#fa_message_enabled? ⇒ Boolean
Whether order-acceptance (functional acknowledgement) messages are enabled.
511 512 513 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 511 def end |
#fa_message_processor ⇒ FaMessageProcessor, Edi::NullProcessor
Builds the FA message processor, or a null processor when disabled.
518 519 520 521 522 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 518 def return Edi::NullProcessor.new(self, :fa_message_processor, ) unless FaMessageProcessor.new(self, ) end |
#fa_message_sender ⇒ FaMessageSender, Edi::NullProcessor
Builds the FA message sender, or a null processor when disabled.
527 528 529 530 531 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 527 def return Edi::NullProcessor.new(self, :fa_message_sender, ) unless FaMessageSender.new(self, ) end |
#inventory_message_enabled? ⇒ Boolean
Whether inventory messages are enabled for this partner.
412 413 414 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 412 def end |
#inventory_message_processor ⇒ Edi::NullProcessor
Builds the inventory message processor (currently a no-op for Mirakl).
554 555 556 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 554 def Edi::NullProcessor.new(self, :inventory_message_processor, ) end |
#invoice_message_enabled? ⇒ Boolean
Whether invoice messages are enabled for this partner.
568 569 570 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 568 def end |
#invoice_message_processor ⇒ InvoiceMessageProcessor, Edi::NullProcessor
Builds the invoice message processor, or a null processor when disabled.
582 583 584 585 586 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 582 def return Edi::NullProcessor.new(self, :invoice_message_processor, ) unless InvoiceMessageProcessor.new(self, ) end |
#mirakl_result_enabled? ⇒ Boolean
Whether Mirakl import-result polling is configured.
433 434 435 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 433 def mirakl_result_enabled? try(:product_import_message_remote_path).present? || try(:price_import_message_remote_path).present? end |
#mirakl_result_processor(ecl) ⇒ Object?
Polls the Mirakl import result for the given ECL.
441 442 443 444 445 446 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 441 def mirakl_result_processor(ecl) return Edi::NullProcessor.new(self, :mirakl_result_processor, ) unless mirakl_result_enabled? ProductImportMessageProcessor.new(self, ).process(ecl) if ecl.category == 'product_data' PriceImportMessageProcessor.new(self, ).process(ecl) if ecl.category == 'price_advice' end |
#order_message_enabled? ⇒ Boolean
Whether order retrieval is configured for this partner.
486 487 488 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 486 def try(:order_message_remote_path).present? end |
#order_message_processor ⇒ OrderMessageProcessor, Edi::NullProcessor
Builds the order message processor, or a null processor when disabled.
502 503 504 505 506 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 502 def return Edi::NullProcessor.new(self, :order_message_processor, ) unless OrderMessageProcessor.new(self, ) end |
#order_message_retriever ⇒ OrderMessageRetriever, Edi::NullProcessor
Builds the order message retriever, or a null processor when disabled.
493 494 495 496 497 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 493 def return Edi::NullProcessor.new(self, :order_message_processor, ) unless OrderMessageRetriever.new(self, ) end |
#price_message_enabled? ⇒ Boolean
Whether price/offer messages are enabled for this partner.
461 462 463 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 461 def end |
#price_message_processor ⇒ PriceMessageProcessor, Edi::NullProcessor
Builds the price message processor, or a null processor when disabled.
477 478 479 480 481 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 477 def return Edi::NullProcessor.new(self, :price_message_processor, ) unless PriceMessageProcessor.new(self, ) end |
#price_message_sender ⇒ PriceMessageSender, Edi::NullProcessor
Builds the price message sender, or a null processor when disabled.
468 469 470 471 472 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 468 def return Edi::NullProcessor.new(self, :price_message_sender, ) unless PriceMessageSender.new(self, ) end |
#product_data_configurator ⇒ ProductDataConfigurator
Builds the product data XML configurator for this partner.
591 592 593 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 591 def product_data_configurator ProductDataConfigurator.new(self, ) end |
#product_data_presenter(item) ⇒ BaseMiraklPresenter
Instantiates the per-partner product data presenter for an item.
607 608 609 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 607 def product_data_presenter(item) product_data_presenter_class.new(item, image_locales: image_locales) end |
#product_data_presenter_class ⇒ Class
Resolves the per-partner product data presenter class.
598 599 600 601 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 598 def product_data_presenter_class namespace = (try(:namespace) || partner).to_s.camelize "Edi::MiraklSeller::#{namespace}::ProductDataPresenter".constantize end |
#product_data_processor ⇒ ProductDataProcessor
Builds the product data processor for this partner.
419 420 421 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 419 def product_data_processor ProductDataProcessor.new(self, ) end |
#product_data_sender ⇒ ProductDataSender
Builds the product data sender for this partner.
426 427 428 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 426 def product_data_sender ProductDataSender.new(self, ) end |
#return_notification_message_enabled? ⇒ Boolean
Whether return notification retrieval is configured for this partner.
575 576 577 |
# File 'app/services/edi/mirakl_seller/orchestrator.rb', line 575 def try(:return_notification_message_remote_path).present? end |