Skip to content

Commit

Permalink
Remove the AppIO availability check from the sms sending logics
Browse files Browse the repository at this point in the history
  • Loading branch information
folix-01 committed Jan 23, 2024
1 parent 8effd61 commit 4dde6b2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def get_booking_folder_notification_flags(booking_folder):
}


# Obsolete. Earlier it was used to manage the different notification types cross logics.
class BookingNotificationSupervisorUtility:
"""Supervisor to allow/deny the specific
notification type according to business logic"""
Expand Down Expand Up @@ -45,18 +46,4 @@ def is_sms_message_allowed(self, booking):
if not booking.phone:
return False

# if user is potentially notificabable by App IO, do not send sms
if self.is_appio_message_allowed(booking):
# XXX: questo sarebbe dovuto essere nell'adapter per App IO, ma l'adapter
# richiede a suo volta un message_adapter ...
booking_type = booking.get_booking_type()
service_code = getattr(booking_type, "service_code", None)
fiscalcode = getattr(booking, "fiscalcode", None)
if (
fiscalcode
and service_code
and self.app_io_allowed_for(fiscalcode, service_code)
):
return False

return True
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,15 @@ def test_is_sms_message_allowed_negative(self):

# self.assertFalse(self.supervisor.is_sms_message_allowed(self.booking))

# Obsolete
# AppIO notification is allowed
self.supervisor.is_email_message_allowed = lambda booking: False
self.supervisor.is_appio_message_allowed = lambda booking: True
self.supervisor.app_io_allowed_for = lambda *_: True
self.folder_prenotazioni.notifications_sms_enabled = True
# XXX: booking_type needs to have a service_code
self.booking.get_booking_type().service_code = "SERVICE_CODE"
self.assertFalse(self.supervisor.is_sms_message_allowed(self.booking))
# self.supervisor.is_email_message_allowed = lambda booking: False
# self.supervisor.is_appio_message_allowed = lambda booking: True
# self.supervisor.app_io_allowed_for = lambda *_: True
# self.folder_prenotazioni.notifications_sms_enabled = True
# # XXX: booking_type needs to have a service_code
# self.booking.get_booking_type().service_code = "SERVICE_CODE"
# self.assertFalse(self.supervisor.is_sms_message_allowed(self.booking))

# No phone number was provided
self.supervisor.is_email_message_allowed = lambda booking: True
Expand Down

0 comments on commit 4dde6b2

Please sign in to comment.