Class: Edi::Walmart::OrderMessageRetriever

Inherits:
BaseEdiService show all
Defined in:
app/services/edi/walmart/order_message_retriever.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

#processObject

Retrieves orders from Walmart Marketplace API
See: https://developer.walmart.com/us-marketplace/docs/get-all-orders

Query parameters:

  • createdStartDate: Start date for filtering orders (ISO 8601)
  • createdEndDate: End date for filtering orders (optional)
  • status: Order status (Created, Acknowledged, Shipped, Cancelled)
  • limit: Max orders per request (default 200, max 200)
  • productInfo: Include product info (default true)
  • shipNodeType: SellerFulfilled or WFSFulfilled


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/services/edi/walmart/order_message_retriever.rb', line 15

def process
  # Build the query URL with appropriate filters
  # Fetch orders created after our go-live date and in Created/Acknowledged status
  start_date = [Date.parse(Edi::Walmart::Orchestrator::GOLIVE_DATE_STR), 7.days.ago.to_date].max
  
  query_params = {
    createdStartDate: start_date.iso8601,
    status: 'Created',
    limit: 200,
    productInfo: true,
    shipNodeType: 'SellerFulfilled'
  }
  
  query_string = URI.encode_www_form(query_params)
  remote_path = "#{orchestrator.order_message_remote_path}?#{query_string}"

  Edi::Walmart::OrderRetriever.new(options).process(
    transporter: orchestrator.transporter,
    transporter_profile: orchestrator.transporter_profile,
    data_type: 'json',
    orchestrator: orchestrator,
    remote_path: remote_path,
    partner: orchestrator.partner,
    category: :order_batch
  )
end