Module: NotificationWorkers::ReservationModules::UserMadePackageBookingAckFalse

Included in:
NotificationWorkers::Reservation
Defined in:
app/workers/notification_workers/reservation_modules/user_made_package_booking_ack_false.rb

Instance Method Summary collapse

Instance Method Details

#no_ack_notif_unconfirmed_by_email(rules) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/workers/notification_workers/reservation_modules/user_made_package_booking_ack_false.rb', line 7

def no_ack_notif_unconfirmed_by_email(rules)
  # Send to user
  if allow_send_notif_to_user?(receivers: rules[:receiver])
    report["#{__callee__}_to_user"] = safe_call do
      UserMailer.booking_pending(reservation.id).deliver_later!
    end
  end

  # Send to admin
  if rules[:receiver].include?('admin')
    report["#{__callee__}_to_admin"] = safe_call do
      StaffMailer.booking_pending(reservation.id).deliver_later!
    end
  end
end

#no_ack_notif_unconfirmed_by_sms(rules) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/workers/notification_workers/reservation_modules/user_made_package_booking_ack_false.rb', line 23

def no_ack_notif_unconfirmed_by_sms(rules)
  # Send to user
  if allow_send_notif_to_user?(receivers: rules[:receiver])
    report["#{__callee__}_to_user"] = safe_call do
      sms_user_notifier.send_pending_msg_to_user
    end
  end

  # Send to admin
  if rules[:receiver].include?('admin')
    report["#{__callee__}_to_admin"] = safe_call do
      NotificationService::Sms.new(phones: AdminSetting.hotline_for_no_ack, reservation: reservation).
        send_pending_msg_to_hh
    end
  end

  # Send to owner
  if rules[:receiver].include?('owner')
    report["#{__callee__}_to_owner"] = safe_call do
      sms_owner_notifier.send_pending_msg_to_restaurant
    end
  end
end