Class: Edi::ShipConfirm

Inherits:
BaseService show all
Defined in:
app/services/edi/ship_confirm.rb

Instance Method Summary collapse

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 BaseService

Instance Method Details

#process(_options = {}) ⇒ Object

Take all edi deliveries pending ship confirm and push them to invoicing



6
7
8
9
10
# File 'app/services/edi/ship_confirm.rb', line 6

def process(_options = {})
  deliveries = Delivery.where(state: 'pending_ship_confirm').joins(:order).where("orders.edi_transaction_id IS NOT NULL and orders.edi_transaction_id <> ''")
  logger.info "#{deliveries.size} can be confirmed and invoiced"
  deliveries.pluck(:id).each { |del_id| DeliveryShipConfirmWorker.perform_async(delivery_id: del_id) }
end