diff --git a/api/src/pcapi/core/bookings/api.py b/api/src/pcapi/core/bookings/api.py index 894083c6efa..605c0663de5 100644 --- a/api/src/pcapi/core/bookings/api.py +++ b/api/src/pcapi/core/bookings/api.py @@ -670,7 +670,8 @@ def cancel_booking_by_beneficiary(user: User, booking: Booking) -> None: def cancel_booking_by_offerer(booking: Booking) -> None: validation.check_booking_can_be_cancelled(booking) _cancel_booking(booking, BookingCancellationReasons.OFFERER, raise_if_error=True) - push_notification_job.send_cancel_booking_notification.delay([booking.id]) + if not FeatureToggle.WIP_DISABLE_NOTIFICATION_CANCEL_BOOKING.is_active(): + push_notification_job.send_cancel_booking_notification.delay([booking.id]) user_emails_job.send_booking_cancellation_emails_to_user_and_offerer_job.delay(booking.id) diff --git a/api/src/pcapi/core/offers/api.py b/api/src/pcapi/core/offers/api.py index 026cd427b0f..d43dca02fe0 100644 --- a/api/src/pcapi/core/offers/api.py +++ b/api/src/pcapi/core/offers/api.py @@ -944,7 +944,8 @@ def _delete_stock(stock: models.Stock, author_id: int | None = None, user_connec transactional_mails.send_booking_cancellation_by_pro_to_beneficiary_email(booking) transactional_mails.send_booking_cancellation_confirmation_by_pro_email(cancelled_bookings) - push_notification_job.send_cancel_booking_notification.delay([booking.id for booking in cancelled_bookings]) + if not FeatureToggle.WIP_DISABLE_NOTIFICATION_CANCEL_BOOKING.is_active(): + push_notification_job.send_cancel_booking_notification.delay([booking.id for booking in cancelled_bookings]) search.async_index_offer_ids( [stock.offerId], reason=search.IndexationReason.STOCK_DELETION, diff --git a/api/src/pcapi/models/feature.py b/api/src/pcapi/models/feature.py index c98694d5791..1d828f55639 100644 --- a/api/src/pcapi/models/feature.py +++ b/api/src/pcapi/models/feature.py @@ -123,6 +123,7 @@ class FeatureToggle(enum.Enum): WIP_ENABLE_NEW_COLLECTIVE_OFFERS_AND_BOOKINGS_STRUCTURE = ( "Activer la nouvelle structure des offres et réservations collectives" ) + WIP_DISABLE_NOTIFICATION_CANCEL_BOOKING = "test" def is_active(self) -> bool: if flask.has_request_context(): @@ -187,6 +188,7 @@ def nameKey(self) -> str: FeatureToggle.WIP_USE_OFFERER_ADDRESS_AS_DATA_SOURCE, FeatureToggle.WIP_SPLIT_OFFER, FeatureToggle.WIP_SUGGESTED_SUBCATEGORIES, + FeatureToggle.WIP_DISABLE_NOTIFICATION_CANCEL_BOOKING # Please keep alphabetic order )