Class: VendorsService::UpdateMemoService

Inherits:
BaseOperationService show all
Includes:
DefaultErrorContainer, MoneyRails::ActionViewExtension
Defined in:
app/services/vendors_service/update_memo_service.rb

Instance Attribute Summary collapse

Attributes inherited from BaseOperationService

#outcome

Instance Method Summary collapse

Methods included from DefaultErrorContainer

#error, #error_message_simple, #merge_errors

Methods inherited from BaseOperationService

#success?

Constructor Details

#initialize(reservation = nil) ⇒ UpdateMemoService

Returns a new instance of UpdateMemoService.



7
8
9
# File 'app/services/vendors_service/update_memo_service.rb', line 7

def initialize(reservation = nil)
  @reservation = reservation
end

Instance Attribute Details

#reservationObject (readonly)

Returns the value of attribute reservation.



5
6
7
# File 'app/services/vendors_service/update_memo_service.rb', line 5

def reservation
  @reservation
end

Instance Method Details

#executeObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/services/vendors_service/update_memo_service.rb', line 11

def execute
  BUSINESS_LOGGER.set_business_context(reservation_id: reservation&.id)
  BUSINESS_LOGGER.info("#{self.class}: execute called")

  if reservation.nil?
    BUSINESS_LOGGER.error("#{self.class}: reservation is nil")
    return ''
  end

  update_tablecheck_memo if reservation.by_tablecheck?
  update_sevenrooms_notes if reservation.by_seven_rooms?
  update_bistrochat_memo if reservation.by_bistrochat?
  update_mymenu_memo if reservation.by_mymenu?
  update_weeloy_memo if reservation.by_weeloy?
rescue StandardError => e
  error_message = "#{self.class}: #{e.message}"
  BUSINESS_LOGGER.error(error_message, error: e)
  APMErrorHandler.report(error_message, reservation_id: reservation&.id, error: e)
end