Class: EventProcessors::EmployeePayrollDisbursementEventProcessor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reference_event:) ⇒ EmployeePayrollDisbursementEventProcessor

Returns a new instance of EmployeePayrollDisbursementEventProcessor.



5
6
7
# File 'app/notifications/event_processors/employee_payroll_disbursement_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/employee_payroll_disbursement_event_processor.rb', line 3

def reference_event
  @reference_event
end

Instance Method Details

#processObject



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

def process
  transaction_header_id = reference_event.data['transaction_header_id']
  transaction_header = PayrollTransactionHeader.find(transaction_header_id)

  employee = reference_event.reference

  EmployeePayrollDisbursementMailer.notification(
    transaction_header: transaction_header,
    employee: employee
  ).deliver_now
end