Class: Edi::Walmart::ListingMessageFeedProcessor

Inherits:
BaseEdiService show all
Defined in:
app/services/edi/walmart/listing_message_feed_processor.rb

Constant Summary

Constants included from AddressAbbreviator

AddressAbbreviator::MAX_LENGTH

Instance Attribute Summary

Attributes inherited from BaseEdiService

#orchestrator

Instance Method Summary collapse

Methods inherited from BaseEdiService

#duplicate_po_already_notified?, #initialize, #mark_duplicate_po_as_notified, #report_order_creation_issues, #safe_process_edi_communication_log

Methods included from AddressAbbreviator

#abbreviate_street, #collect_street_originals, #record_address_abbreviation_notes

Methods inherited from BaseService

#initialize, #log_debug, #log_error, #log_info, #log_warning, #logger, #options, #tagged_logger

Constructor Details

This class inherits a constructor from Edi::BaseEdiService

Instance Method Details

#process(catalog_items: nil, states: nil, operation: :update) ⇒ Object

Generates item feed payloads for Walmart Marketplace
See: https://developer.walmart.com/us-marketplace/docs/feeds-overview

Feed types:

  • MP_ITEM: Item setup and update (Item Spec 5.0)
  • MP_MAINTENANCE: Item maintenance (price, inventory, etc.)
  • RETIRE_ITEM: Retire items

Item Spec 5.0 structure (required by August 31, 2025):
{
"MPItemFeedHeader": {
"locale": "en",
"sellingChannel": "marketplace",
"version": "5.0"
},
"MPItem": [
{
"Item": {
"sku": "SKU123",
"productIdentifiers": { ... },
"productName": "...",
"brand": "...",
"category": "...",
"shortDescription": "...",
"mainImageUrl": "...",
... category-specific attributes ...
}
}
]
}



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'app/services/edi/walmart/listing_message_feed_processor.rb', line 36

def process(catalog_items: nil, states: nil, operation: :update)
  logger.info "[Walmart ListingFeedProcessor] Creating #{operation} feed for partner #{orchestrator.partner}"

  catalog_items ||= load_catalog_items(states: states)
  return :empty_set unless catalog_items.any?

  ecl = nil
  EdiCommunicationLog.transaction do
    data_json = build_feed_json(catalog_items, operation: operation)
    ecl = EdiCommunicationLog.create_outbound_file_from_data(
      data: data_json,
      data_type: 'json',
      file_extension: 'json',
      partner: orchestrator.partner,
      category: 'listing_feed',
      resources: catalog_items,
      file_info: {
        operation: operation,
        items_count: catalog_items.size
      }
    )
  end
  ecl
end

#process_retire(catalog_items: nil) ⇒ Object

Process items for retirement



62
63
64
# File 'app/services/edi/walmart/listing_message_feed_processor.rb', line 62

def process_retire(catalog_items: nil)
  process(catalog_items: catalog_items, operation: :retire)
end