From 4dde6b2d86bb6d437539d7f14748b6d3eda22202 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 23 Jan 2024 12:27:33 +0100 Subject: [PATCH] Remove the AppIO availability check from the sms sending logics --- .../booking_folder/notifications/__init__.py | 15 +-------------- .../tests/test_notification_supervisor_utility.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/redturtle/prenotazioni/behaviors/booking_folder/notifications/__init__.py b/src/redturtle/prenotazioni/behaviors/booking_folder/notifications/__init__.py index 4d1ab474..0afa71fd 100644 --- a/src/redturtle/prenotazioni/behaviors/booking_folder/notifications/__init__.py +++ b/src/redturtle/prenotazioni/behaviors/booking_folder/notifications/__init__.py @@ -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""" @@ -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 diff --git a/src/redturtle/prenotazioni/tests/test_notification_supervisor_utility.py b/src/redturtle/prenotazioni/tests/test_notification_supervisor_utility.py index b76524f3..1f0425e1 100644 --- a/src/redturtle/prenotazioni/tests/test_notification_supervisor_utility.py +++ b/src/redturtle/prenotazioni/tests/test_notification_supervisor_utility.py @@ -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