Class: Edi::Amazon::DiscontinueFlowProcessor

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

Overview

Picks up Amazon Seller Central catalog items in pending_discontinue state
and sends SP-API DELETE requests to remove the listings, then transitions
them to discontinued.

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

Reuses the existing DeleteListingMessageProcessor + ListingMessageSender pair
for the actual API calls. This processor orchestrates the loop and handles
state transitions.

Constant Summary

Constants included from Edi::AddressAbbreviator

Edi::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 Edi::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/amazon/discontinue_flow_processor.rb', line 16

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

  logger.info "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