Module: NotificationWorkers::ReservationModules::BookingConfirmation

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

Overview

Confirm or Reject Non Instant booking

Instance Method Summary collapse

Instance Method Details

#no_ack_has_offers_notif_rejected_by_email(rules) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/workers/notification_workers/reservation_modules/booking_confirmation.rb', line 14

def no_ack_has_offers_notif_rejected_by_email(rules)
  # Send to admin
  if rules[:receiver].include?('admin')
    report["#{__callee__}_to_admin"] = safe_call do
      subject = "#{reservation.restaurant.name_en} has rejected #{reservation.id} pending confirmation"
      message = "
Customer name : #{reservation.name}
</br>
Phone: #{reservation.phone}
</br>
Booking time: #{reservation.reservation_time}
</br>
Party size : #{reservation.adult} Adult + #{reservation.kids} Kids"

      # Get account manager email if available
       = reservation.restaurant&.user&.email
      receivers = [SUPPORT_EMAIL, MERCHANT_EMAIL, RAVI_EMAIL, SUPPORT_EMAIL_SLACK]
      receivers <<  if .present?

      StaffMailer.
        notify_error_staff(subject, message, { receivers: receivers }).
        deliver_later
    end
  end
end

#no_ack_has_offers_notif_rejected_by_sms(rules) ⇒ Object



5
6
7
8
9
10
11
12
# File 'app/workers/notification_workers/reservation_modules/booking_confirmation.rb', line 5

def no_ack_has_offers_notif_rejected_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_rejection_msg_to_user
    end
  end
end