Class: Edi::Walmart::DiscontinueFlowProcessor

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

Overview

Picks up Walmart Seller catalog items in pending_discontinue state
and retires them via the Walmart Marketplace DELETE /v3/items/sku API,
then transitions them to discontinued.

Walmart "Retire an item" API:
DELETE https://marketplace.walmartapis.com/v3/items/sku
See: https://developer.walmart.com/us-marketplace/reference/retireanitem

Follows the established orchestrator pattern:
Worker -> BaseOrchestrator.execute_flow -> Orchestrator -> Processor

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

#processObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/services/edi/walmart/discontinue_flow_processor.rb', line 16

def process
  catalog_items = load_pending_discontinue_items
  return :empty_set unless catalog_items.present?

  logger.info "Walmart DiscontinueFlowProcessor: Found #{catalog_items.size} pending_discontinue items for partner #{orchestrator.partner}"

  catalog_items.find_each do |catalog_item|
    ErrorReporting.scoped(catalog_item_id: catalog_item.id) do
      process_catalog_item(catalog_item)
    end
  end
end