Class: Edi::Commercehub::Orchestrator

Inherits:
BaseOrchestrator show all
Defined in:
app/services/edi/commercehub/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, #confirm_outbound_processing?, #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_price_flow, #execute_product_data_flow, execute_product_data_flow, #ignore_back_orders, #initialize, orchestrator_for_customer_id, orchestrators, #pending_discontinue_lifetime, #price_message_enabled?, #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

.partnersObject



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
# File 'app/services/edi/commercehub/orchestrator.rb', line 37

def self.partners
  {
    commercehub_costco_ca: {
      active: true,
      partner: :commercehub_costco_ca,
      customer_id: 1_174_743,
      ch_partner_id: 'costco',
      ch_partner_name: 'Costco',
      ch_vendor_id: 'warmyours',
      vendor_warehouse_id: 'CA-ON-01',
      transporter: :sftp,
      transporter_profile: :commercehub_ca_sftp,
      order_message_remote_path: '/outgoing/orders/costco',
      order_message_file_pattern: /\.neworders\z/,
      fa_message_remote_path: '/incoming/fa/costco',
      confirm_message_remote_path: '/incoming/confirms/costco',
      ignore_back_orders: true,
      remit_message_remote_path: '/outgoing/payment/costco',
      remit_message_file_pattern: /\.remit\z/,
      inventory_message_remote_path: '/incoming/inventory/costco',
      packing_slip_remote_path: '/outgoing/packingslips/costco',
      packing_slip_file_pattern: /\.pdf\z/,
      packing_slip_reader_type: PackingSlipReaderCostcoCa,
      support_contact: 'Commercehub: 8444824357x2, customersupport@commercehub.com',
      # costco/inventory.xsd declares warehouseBreakout without minOccurs, i.e.
      # required. A nil mapping here silently omitted it from every Costco product.
      warehouse_id: { 'CA-ON-01': 'WarmlyYours-CA' }
    },
    # commercehub_walmart_ca: {
    #   active: true,
    #   partner: :commercehub_walmart_ca,
    #   customer_id: 177_354,
    #   ch_partner_id: 'walmartca',
    #   ch_vendor_id: 'warmyours',
    #   transporter: :sftp,
    #   transporter_profile: :commercehub_ca_sftp,
    #   inventory_message_remote_path: '/incoming/inventory/walmartca',
    #   support_contact: 'Commercehub: 8444824357x2, customersupport@commercehub.com',
    #   warehouse_id: nil
    # },
    commercehub_thd_ca: {
      active: true,
      partner: :commercehub_thd_ca,
      customer_id: 10_358,
      ch_partner_id: 'thdca',
      ch_partner_name: 'The Home Depot CA',
      ch_vendor_id: 'warmyours',
      transporter: :sftp,
      transporter_profile: :commercehub_us_sftp,
      order_message_remote_path: '/outgoing/orders/thdca',
      order_message_file_pattern: /\.neworders\z/,
      fa_message_remote_path: '/incoming/fa/thdca',
      ignore_back_orders: true,
      confirm_message_remote_path: '/incoming/confirms/thdca',
      invoice_message_remote_path: '/incoming/invoice/thdca',
      inventory_message_remote_path: '/incoming/inventory/thdca',
      invoice_remit_id: '25020920',
      warehouse_id: { 'CA-ON-01': 'WarmlyYours-CA', 'US-IL-01': 'WarmlyYours-US' },
      packing_slip_remote_path: '/outgoing/packingslips/thdca',
      packing_slip_file_pattern: /\.pdf\z/,
      packing_slip_reader_type: PackingSlipReaderThdCa,
      support_contact: 'Commercehub: 8444824357x2, customersupport@commercehub.com'
    },
    commercehub_thd_us: {
      active: true,
      partner: :commercehub_thd_us,
      customer_id: 138_753,
      ch_partner_id: 'thehomedepot',
      ch_partner_name: 'The Home Depot',
      ch_vendor_id: 'warmyours',
      transporter: :sftp,
      transporter_profile: :commercehub_us_sftp,
      order_message_remote_path: '/outgoing/orders/thehomedepot',
      order_message_file_pattern: /\.neworders\z/,
      fa_message_remote_path: '/incoming/fa/thehomedepot',
      confirm_message_remote_path: '/incoming/confirms/thehomedepot',
      ignore_back_orders: true,
      invoice_message_remote_path: '/incoming/invoice/thehomedepot',
      inventory_message_remote_path: '/incoming/inventory/thehomedepot',
      invoice_remit_id: '077203',
      remit_message_remote_path: '/outgoing/payment/thehomedepot',
      remit_message_file_pattern: /\.remit\z/,
      remit_message_processor_active: true,
      warehouse_id: { 'CA-ON-01': 'WarmlyYours-CA', 'US-IL-01': 'WarmlyYours-US' },
      packing_slip_remote_path: '/outgoing/packingslips/thehomedepot',
      packing_slip_file_pattern: /\.pdf\z/,
      packing_slip_reader_type: PackingSlipReaderThdUs,
      support_contact: 'Commercehub: 8444824357x2, customersupport@commercehub.com'
    },
    # RONA inc. (Canada) — Rona.ca, Reno Depot, and the retired Lowes.ca
    # banner. `ch_partner_id` moved to `rona` in Oct 2024 when the Lowe's
    # Canada chain was absorbed; the key followed in Aug 2026.
    #
    # The `lowesca` remote paths are NOT ours to rename: they are
    # CommerceHub's own SFTP directories.
    commercehub_rona_ca: {
      active: true,
      partner: :commercehub_rona_ca,
      customer_id: { lowes: CustomerConstants::LOWES_CA_ID, reno: CustomerConstants::RENO_CA_ID, rona: CustomerConstants::RONA_CA_ID },
      ch_partner_id: 'rona',
      ch_partner_name: 'RONA',
      ch_vendor_id: 'warmlyyoursca',
      transporter: :sftp,
      transporter_profile: :commercehub_ca_sftp,
      order_message_remote_path: '/outgoing/orders/lowesca',
      order_message_file_pattern: /\.neworders\z/,
      fa_message_remote_path: '/incoming/fa/lowesca',
      confirm_message_remote_path: '/incoming/confirms/lowesca',
      invoice_message_remote_path: '/incoming/invoice/lowesca',
      invoice_remit_id: '550153',
      ignore_back_orders: true,
      remit_message_remote_path: '/outgoing/payment/lowesca',
      remit_message_file_pattern: /\.remit\z/,
      remit_message_processor_active: true,
      inventory_message_remote_path: '/incoming/inventory/lowesca',
      packing_slip_remote_path: '/outgoing/packingslips/lowesca',
      packing_slip_file_pattern: /\.pdf\z/,
      packing_slip_reader_type: PackingSlipReaderRonaCa,
      support_contact: 'Commercehub: 8444824357x2, customersupport@commercehub.com',
      warehouse_id: { 'CA-ON-01': 'WarmlyYours-CA' },
      tax_exempt_number: '861387777; 861387777 RT 0001'
    }
  }
end

Instance Method Details

#acknowledge_message_enabled?Boolean

Returns:

  • (Boolean)


236
237
238
# File 'app/services/edi/commercehub/orchestrator.rb', line 236

def acknowledge_message_enabled?
  try(:acknowledge_message_remote_path).present?
end

#acknowledge_message_senderObject



240
241
242
243
244
# File 'app/services/edi/commercehub/orchestrator.rb', line 240

def acknowledge_message_sender
  return Edi::NullProcessor.new(self, :confirm_message_sender, options) unless acknowledge_message_enabled?

  AcknowledgeMessageSender.new(self, options)
end

#confirm_message_enabled?Boolean

Returns:

  • (Boolean)


226
227
228
# File 'app/services/edi/commercehub/orchestrator.rb', line 226

def confirm_message_enabled?
  try(:confirm_message_remote_path).present?
end

#confirm_message_processorObject



230
231
232
233
234
# File 'app/services/edi/commercehub/orchestrator.rb', line 230

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

  ConfirmMessageProcessor.new(self, options)
end

#confirm_message_senderObject



246
247
248
249
250
# File 'app/services/edi/commercehub/orchestrator.rb', line 246

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

  ConfirmMessageSender.new(self, options)
end

#execute_inventory_flowObject



342
343
344
345
346
347
# File 'app/services/edi/commercehub/orchestrator.rb', line 342

def execute_inventory_flow
  return unless active

  inventory_message_processor.process
  inventory_message_sender.process
end

#execute_order_flowObject



318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'app/services/edi/commercehub/orchestrator.rb', line 318

def execute_order_flow
  return unless active

  order_message_retriever.process
  sleep(1)
  packing_slip_retriever.process
  sleep(1)
  order_message_processor.process
  fa_message_sender.process
  sleep(5)
  packing_slip_processor.process
  sleep(1)
  acknowledge_message_sender.process
  confirm_message_sender.process
  sleep(1)
  invoice_message_sender.process
  sleep(1)
  remit_message_retriever.process
  sleep(1)
  remit_message_processor.process
  sleep(1)
  return_notification_message_sender.process
end

#fa_message_enabled?Boolean

Returns:

  • (Boolean)


210
211
212
# File 'app/services/edi/commercehub/orchestrator.rb', line 210

def fa_message_enabled?
  try(:fa_message_remote_path).present?
end

#fa_message_processorObject



214
215
216
217
218
# File 'app/services/edi/commercehub/orchestrator.rb', line 214

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



220
221
222
223
224
# File 'app/services/edi/commercehub/orchestrator.rb', line 220

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)


272
273
274
# File 'app/services/edi/commercehub/orchestrator.rb', line 272

def inventory_message_enabled?
  try(:inventory_message_remote_path).present?
end

#inventory_message_processorObject



276
277
278
279
280
# File 'app/services/edi/commercehub/orchestrator.rb', line 276

def inventory_message_processor
  return Edi::NullProcessor.new(self, :inventory_message_processor, options) unless inventory_message_enabled?

  InventoryMessageProcessor.new(self, options)
end

#inventory_message_senderObject



282
283
284
285
286
# File 'app/services/edi/commercehub/orchestrator.rb', line 282

def inventory_message_sender
  return Edi::NullProcessor.new(self, :inventory_message_sender, options) unless inventory_message_enabled?

  InventoryMessageSender.new(self, options)
end

#invoice_message_enabled?Boolean

Returns:

  • (Boolean)


178
179
180
# File 'app/services/edi/commercehub/orchestrator.rb', line 178

def invoice_message_enabled?
  try(:invoice_remit_id).present? && try(:invoice_message_remote_path).present?
end

#invoice_message_processorObject



182
183
184
185
186
# File 'app/services/edi/commercehub/orchestrator.rb', line 182

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

  InvoiceMessageProcessor.new(self, options)
end

#invoice_message_senderObject



188
189
190
191
192
# File 'app/services/edi/commercehub/orchestrator.rb', line 188

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

  InvoiceMessageSender.new(self, options)
end

#order_message_enabled?Boolean

Returns:

  • (Boolean)


162
163
164
# File 'app/services/edi/commercehub/orchestrator.rb', line 162

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

#order_message_processorObject



172
173
174
175
176
# File 'app/services/edi/commercehub/orchestrator.rb', line 172

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



166
167
168
169
170
# File 'app/services/edi/commercehub/orchestrator.rb', line 166

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

  OrderMessageRetriever.new(self, options)
end

#packing_slip_enabled?Boolean

Returns:

  • (Boolean)


288
289
290
# File 'app/services/edi/commercehub/orchestrator.rb', line 288

def packing_slip_enabled?
  try(:packing_slip_remote_path).present? && try(:packing_slip_file_pattern).present?
end

#packing_slip_processorObject



298
299
300
301
302
# File 'app/services/edi/commercehub/orchestrator.rb', line 298

def packing_slip_processor
  return Edi::NullProcessor.new(self, :packing_slip_processor, options) unless packing_slip_enabled?

  PackingSlipProcessor.new(self, options)
end

#packing_slip_readerObject



308
309
310
311
312
# File 'app/services/edi/commercehub/orchestrator.rb', line 308

def packing_slip_reader
  return Edi::NullProcessor.new(self, :packing_slip_reader, options) unless packing_slip_reader_enabled?

  packing_slip_reader_type.new(self, options)
end

#packing_slip_reader_enabled?Boolean

Returns:

  • (Boolean)


304
305
306
# File 'app/services/edi/commercehub/orchestrator.rb', line 304

def packing_slip_reader_enabled?
  try(:packing_slip_reader_type).present?
end

#packing_slip_retrieverObject



292
293
294
295
296
# File 'app/services/edi/commercehub/orchestrator.rb', line 292

def packing_slip_retriever
  return Edi::NullProcessor.new(self, :packing_slip_retriever, options) unless packing_slip_enabled?

  PackingSlipRetriever.new(self, options)
end

#remit_message_enabled?Boolean

Returns:

  • (Boolean)


252
253
254
# File 'app/services/edi/commercehub/orchestrator.rb', line 252

def remit_message_enabled?
  try(:remit_message_remote_path).present? && try(:remit_message_file_pattern).present?
end

#remit_message_processorObject



266
267
268
269
270
# File 'app/services/edi/commercehub/orchestrator.rb', line 266

def remit_message_processor
  return Edi::NullProcessor.new(self, :remit_message_processor, options) unless remit_message_enabled?

  RemitMessageProcessor.new(self, options)
end

#remit_message_processor_enabled?Boolean

Returns:

  • (Boolean)


256
257
258
# File 'app/services/edi/commercehub/orchestrator.rb', line 256

def remit_message_processor_enabled?
  try(:remit_message_processor_active).present? && remit_message_processor_active == true
end

#remit_message_retrieverObject



260
261
262
263
264
# File 'app/services/edi/commercehub/orchestrator.rb', line 260

def remit_message_retriever
  return Edi::NullProcessor.new(self, :remit_message_retriever, options) unless remit_message_enabled?

  RemitMessageRetriever.new(self, options)
end

#return_notification_message_enabled?Boolean

Returns:

  • (Boolean)


194
195
196
# File 'app/services/edi/commercehub/orchestrator.rb', line 194

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

#return_notification_message_processorObject



198
199
200
201
202
# File 'app/services/edi/commercehub/orchestrator.rb', line 198

def return_notification_message_processor
  return Edi::NullProcessor.new(self, :return_notification_message_processor, options) unless return_notification_message_enabled?

  ReturnNotificationMessageProcessor.new(self, options)
end

#return_notification_message_senderObject



204
205
206
207
208
# File 'app/services/edi/commercehub/orchestrator.rb', line 204

def return_notification_message_sender
  return Edi::NullProcessor.new(self, :return_notification_message_sender, options) unless return_notification_message_enabled?

  ReturnNotificationMessageSender.new(self, options)
end

#ship_code_mapperObject



314
315
316
# File 'app/services/edi/commercehub/orchestrator.rb', line 314

def ship_code_mapper
  ShipCodeMapper.new(self)
end