Class: EventProcessors::InvoiceSentViaEdiEventProcessor

Inherits:
Object
  • Object
show all
Defined in:
app/notifications/event_processors/invoice_sent_via_edi_event_processor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reference_event:) ⇒ InvoiceSentViaEdiEventProcessor

Returns a new instance of InvoiceSentViaEdiEventProcessor.



5
6
7
# File 'app/notifications/event_processors/invoice_sent_via_edi_event_processor.rb', line 5

def initialize(reference_event:)
  @reference_event = reference_event
end

Instance Attribute Details

#reference_eventObject (readonly)

Returns the value of attribute reference_event.



3
4
5
# File 'app/notifications/event_processors/invoice_sent_via_edi_event_processor.rb', line 3

def reference_event
  @reference_event
end

Instance Method Details

#processObject



9
10
11
12
13
14
15
16
17
# File 'app/notifications/event_processors/invoice_sent_via_edi_event_processor.rb', line 9

def process
  edi_invoice = EdiInvoice.find(reference_event.reference_id)
  edi_partner = EdiPartner.find(reference_event.data['edi_partner_id'])

  InvoiceSentViaEdiMailer.notification(
    edi_invoice: edi_invoice,
    edi_partner: edi_partner
  ).deliver_now
end