Class: Edi::Walmart::ConfirmMessageProcessor
- Inherits:
-
BaseEdiService
- Object
- BaseService
- BaseEdiService
- Edi::Walmart::ConfirmMessageProcessor
- Defined in:
- app/services/edi/walmart/confirm_message_processor.rb
Constant Summary
Constants included from AddressAbbreviator
AddressAbbreviator::MAX_LENGTH
Instance Attribute Summary
Attributes inherited from BaseEdiService
Instance Method Summary collapse
-
#acknowledge_order(order) ⇒ Object
Builds ship confirmation messages for Walmart orders See: https://developer.walmart.com/us-marketplace/docs/shipping-orders.
- #auto_cancel_order(order, order_hash, reason_code, _bad_vendor_skus = nil, _bad_merchant_skus = nil) ⇒ Object
- #back_order(order) ⇒ Object
- #cancel_order(order) ⇒ Object
- #confirm_invoice(invoice) ⇒ Object
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, #process, #tagged_logger
Constructor Details
This class inherits a constructor from Edi::BaseEdiService
Instance Method Details
#acknowledge_order(order) ⇒ Object
Builds ship confirmation messages for Walmart orders
See: https://developer.walmart.com/us-marketplace/docs/shipping-orders
The shipping update endpoint is: POST /v3/orders/purchaseOrderId/shipping
Request body structure:
{
"orderShipment": {
"orderLines": {
"orderLine": [
{
"lineNumber": "1",
"orderLineStatuses": {
"orderLineStatus": [
{
"status": "Shipped",
"statusQuantity": { "unitOfMeasurement": "EACH", "amount": "1" },
"trackingInfo": {
"shipDateTime": "2024-01-16T10:00:00.000Z",
"carrierName": { "carrier": "FedEx" },
"methodCode": "Standard",
"trackingNumber": "123456789",
"trackingURL": "https://..."
}
}
]
}
}
]
}
}
}
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 |
# File 'app/services/edi/walmart/confirm_message_processor.rb', line 38 def acknowledge_order(order) # Skip if an active (non-voided) early-purchased label exists AND a ship # confirm has already been successfully sent for it. If the early label was # voided (e.g., packing change), a new label is purchased through the normal # flow and we DO need to send a fresh confirm here. if order.has_early_purchased_label? && order.edi_communication_logs.where(category: 'order_confirm', state: 'processed').exists? logger.info "[Walmart ConfirmProcessor] Skipping ship confirm for order #{order.reference_number} — early label confirm already sent" return end delivery = order.deliveries.first return unless delivery # Accept both Heatwave-labeled (label_complete) and manually-labeled (manually_complete) # shipments. Unlike Amazon (where Veeqo handles manual ship confirms), Walmart has no # external system to send ship confirmations for manual shipments — we must always send them. shipments = get_appropriate_shipments(order, delivery) return if shipments.empty? shipments.map do |shipment| = (order, shipment) create_confirmation_ecl(, order) end end |
#auto_cancel_order(order, order_hash, reason_code, _bad_vendor_skus = nil, _bad_merchant_skus = nil) ⇒ Object
74 75 76 77 |
# File 'app/services/edi/walmart/confirm_message_processor.rb', line 74 def auto_cancel_order(order, order_hash, reason_code, _bad_vendor_skus = nil, _bad_merchant_skus = nil) = (order, order_hash, reason_code) create_cancellation_ecl(, order) end |
#back_order(order) ⇒ Object
64 65 66 67 |
# File 'app/services/edi/walmart/confirm_message_processor.rb', line 64 def back_order(order) # Not yet implemented for Walmart logger.info "[Walmart ConfirmProcessor] back_order not implemented for order #{order.reference_number}" end |
#cancel_order(order) ⇒ Object
69 70 71 72 |
# File 'app/services/edi/walmart/confirm_message_processor.rb', line 69 def cancel_order(order) = (order) create_cancellation_ecl(, order) end |
#confirm_invoice(invoice) ⇒ Object
79 80 81 82 |
# File 'app/services/edi/walmart/confirm_message_processor.rb', line 79 def confirm_invoice(invoice) # Walmart doesn't require invoice confirmation logger.info "[Walmart ConfirmProcessor] confirm_invoice not applicable" end |