Module: NotificationWorkers::ReservationModules::UserMadePackageBookingAckTrue
- Included in:
- NotificationWorkers::Reservation
- Defined in:
- app/workers/notification_workers/reservation_modules/user_made_package_booking_ack_true.rb
Overview
typed: ignore frozen_string_literal: true
Instance Method Summary collapse
- #ack_has_offers_ask_to_give_rating_by_email(rules) ⇒ Object
- #ack_has_offers_notif_confirmed_by_email(rules) ⇒ Object
- #ack_has_offers_notif_confirmed_by_sms(rules) ⇒ Object
- #ack_has_offers_notif_last_minute_by_sms(rules) ⇒ Object
Instance Method Details
#ack_has_offers_ask_to_give_rating_by_email(rules) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'app/workers/notification_workers/reservation_modules/user_made_package_booking_ack_true.rb', line 62 def (rules) if allow_send_notif_to_user?(receivers: rules[:receiver]) return if reservation.email.blank? || reservation.dummy? report["#{__callee__}_for_user"] = safe_call do if reservation.id.blank? APMErrorHandler.report('Nil reservation id detected before enqueuing rating reservation worker') else Workers::Reservations::RatingReservationWorker.perform_at( reservation.reservation_time + Reservation::RATING_DELAY_TIME, reservation.id, ) end end end end |
#ack_has_offers_notif_confirmed_by_email(rules) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/workers/notification_workers/reservation_modules/user_made_package_booking_ack_true.rb', line 5 def ack_has_offers_notif_confirmed_by_email(rules) # Send to admin if rules[:receiver].include?('admin') report["#{__callee__}_for_admin"] = safe_call { StaffMailer.booking_confirm(reservation.id).deliver_later! } end # Send to owner if rules[:receiver].include?('owner') report["#{__callee__}_for_owner"] = safe_call do # there is a case where id is nil, so we use `deliver!` instead of `deliver_later!` # to track the error OwnerMailer.booking_confirmation(reservation.id).deliver! end end # Send to user if allow_send_notif_to_user?(receivers: rules[:receiver]) report["#{__callee__}_for_user"] = safe_call do UserMailer.booking_confirmation(reservation.id, reservation.user_id).deliver_later! end end end |
#ack_has_offers_notif_confirmed_by_sms(rules) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/workers/notification_workers/reservation_modules/user_made_package_booking_ack_true.rb', line 28 def ack_has_offers_notif_confirmed_by_sms(rules) # Send to owner if rules[:receiver].include?('owner') report["#{__callee__}_for_owner"] = safe_call do if reservation.service_type == :dine_in && reservation.kids.positive? sms_owner_notifier.send_confirmation_msg_with_kids elsif reservation.service_type == :dine_in && !reservation.kids.positive? sms_owner_notifier.send_confirmation_msg_without_kids elsif reservation.service_type == :delivery && reservation.is_order_now == false sms_owner_notifier.send_confirmation_msg_delivery_later elsif reservation.service_type == :delivery && reservation.is_order_now == true sms_owner_notifier.send_confirmation_msg_delivery_now else # reservation pickup sms_owner_notifier.send_confirmation_msg_pickup end # sms_owner_notifier.send_confirmation_msg_to_restaurant end end # Send to user if allow_send_notif_to_user?(receivers: rules[:receiver]) report["#{__callee__}_for_user"] = safe_call do # sms_user_notifier.send_confirmation_msg_to_user if reservation.service_type == :dine_in && reservation.kids.positive? sms_user_notifier.send_confirmation_msg_with_kids_to_user elsif reservation.service_type == :dine_in && !reservation.kids.positive? sms_user_notifier.send_confirmation_msg_without_kids_to_user else sms_user_notifier.send_confirmation_msg_delivery_to_user end end end end |
#ack_has_offers_notif_last_minute_by_sms(rules) ⇒ Object
79 80 81 82 83 84 85 86 |
# File 'app/workers/notification_workers/reservation_modules/user_made_package_booking_ack_true.rb', line 79 def ack_has_offers_notif_last_minute_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_last_minute_confirmation_to_user end end end |