Class: Edi::InvoiceCreatedHandler

Inherits:
ApplicationJob show all
Includes:
RailsEventStore::AsyncHandler
Defined in:
app/subscribers/edi/invoice_created_handler.rb

Instance Method Summary collapse

Instance Method Details

#perform(event) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'app/subscribers/edi/invoice_created_handler.rb', line 7

def perform(event)
  invoice = Invoice.find_by(id: event.data[:invoice_id])
  return unless invoice

  Edi::InvoiceEventProcessor.new.process_creation(invoice,
    skip_if_exists: event.data[:skip_edi_if_exists])
rescue StandardError => e
  ErrorReporting.error(e)
  raise
end