Class: SevenRooms::ErrorMessages
- Inherits:
-
Object
- Object
- SevenRooms::ErrorMessages
- Defined in:
- app/services/seven_rooms/error_messages.rb
Constant Summary collapse
- DEFAULT_ERROR =
'Sorry, something went wrong'- SUPPLIER_ERROR =
'Supplier Error:'- UNAVAILABILITY_ERROR =
list of error messages from SevenRooms API
'No shift found for date and time'- BOOKING_LEAD_TIME_ERROR =
'No direct availability on this date.'- TOO_MANY_PEOPLE_ERROR =
'There are too many people trying to book. Please try again.'- NO_AVAILABILITY_ERROR =
'No availability on this date and time.'- INVALID_PHONE_NUMBER_ERROR =
'A phone number is required to book'- NOT_ALLOWED_MULTIPLE_BOOKINGS_ERROR =
'A reservation for this client already exists on this shift'- CANNOT_UPDATE_CANCELED_RESERVATION_ERROR =
'Sorry, you cannot modify the status of a CANCELED reservation in SevenRooms'- CANNOT_UPDATE_STATUS_ON_HUNGRYHUB_ERROR =
'Sorry, the status of this reservation can only be changed from the SevenRooms dashboard'- CANNOT_UPDATE_RESERVATION_AFTER_CANCELATION_TIME_ERROR =
'Reservation cannot be modified after the cancellation cut-off time'- REQUIRES_CREDIT_CARD_ERROR =
'This reservation requires a credit card, please include card_token or payment_instrument_token'- ERROR_MESSAGE_MAP =
map of error messages from SevenRooms API to HungryHub error messages
{ UNAVAILABILITY_ERROR => I18n.t('inventory.not_available'), BOOKING_LEAD_TIME_ERROR => I18n.t('inventory.not_available'), TOO_MANY_PEOPLE_ERROR => I18n.t('inventory.not_available'), NO_AVAILABILITY_ERROR => I18n.t('inventory.not_available'), INVALID_PHONE_NUMBER_ERROR => 'Your phone number is invalid, please open your profile page and update your phone number', NOT_ALLOWED_MULTIPLE_BOOKINGS_ERROR => I18n.t('reservation.duplicated'), CANNOT_UPDATE_RESERVATION_AFTER_CANCELATION_TIME_ERROR => CANNOT_UPDATE_RESERVATION_AFTER_CANCELATION_TIME_ERROR, REQUIRES_CREDIT_CARD_ERROR => I18n.t('inventory.not_available'), }.freeze
- KNOWN_ERRORS =
list of error messages from SevenRooms API that should not be logged
[ UNAVAILABILITY_ERROR, BOOKING_LEAD_TIME_ERROR, TOO_MANY_PEOPLE_ERROR, NO_AVAILABILITY_ERROR, ].freeze
- INVENTORY_ERRORS =
list of inventory errors
[UNAVAILABILITY_ERROR, BOOKING_LEAD_TIME_ERROR, TOO_MANY_PEOPLE_ERROR, NO_AVAILABILITY_ERROR].freeze
- CREDIT_CARD_ERRORS =
list of credit card related errors
[REQUIRES_CREDIT_CARD_ERROR, 'credit card'].freeze
Class Method Summary collapse
-
.error_message(actor, error) ⇒ String
Returns the error message based on the actor and error code.
Class Method Details
.error_message(actor, error) ⇒ String
Returns the error message based on the actor and error code.
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/services/seven_rooms/error_messages.rb', line 59 def self.(actor, error) return DEFAULT_ERROR if actor.blank? || error.blank? if actor.to_sym == :user ERROR_MESSAGE_MAP[error] || DEFAULT_ERROR else if ERROR_MESSAGE_MAP[error].present? return "#{SevenRooms::ErrorMessages::SUPPLIER_ERROR} #{ERROR_MESSAGE_MAP[error]}" end "#{SevenRooms::ErrorMessages::SUPPLIER_ERROR} #{error}" end end |