20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'app/my_lib/duplicate_booking_checker.rb', line 20
def multiple_bookings_allowed?(user, reservation)
booking_channel = reservation.booking_channel
return true if booking_channel&.vendor_skips_payment_check_for_multiple_bookings?(booking_channel&.name)
return true if payment_handled_by_vendor?(booking_channel) && params[:vendor_payment].present?
last_reservation = find_last_reservation(user, reservation)
return true if last_reservation.blank?
return true if last_reservation.private_channel? || last_reservation.corporate_order?
return true if last_reservation.vendor_payment.present?
return true if last_reservation.prepayment_percent > 0 || last_reservation.paid_amount.positive?
return true if conditions_met_for_reservation_from_different_restaurant?(last_reservation, reservation)
return true if conditions_met_for_reservation_from_same_restaurant?(last_reservation, reservation)
@duplicate_error_message = I18n.t('reservation.duplicated')
false
end
|