mirror of
https://github.com/GSA/notifications-api.git
synced 2026-07-24 01:49:42 -04:00
Merge branch 'master' of https://github.com/alphagov/notifications-api
This commit is contained in:
@@ -117,9 +117,13 @@ def register_blueprint(application):
|
||||
ses_callback_blueprint.before_request(requires_no_auth)
|
||||
application.register_blueprint(ses_callback_blueprint)
|
||||
|
||||
sms_callback_blueprint.before_request(restrict_ip_sms)
|
||||
# delivery receipts
|
||||
# TODO: make sure research mode can still trigger sms callbacks, then re-enable this
|
||||
# sms_callback_blueprint.before_request(restrict_ip_sms)
|
||||
sms_callback_blueprint.before_request(requires_no_auth)
|
||||
application.register_blueprint(sms_callback_blueprint)
|
||||
|
||||
# inbound sms
|
||||
receive_notifications_blueprint.before_request(restrict_ip_sms)
|
||||
application.register_blueprint(receive_notifications_blueprint)
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ from app.models import (
|
||||
BRANDING_ORG_BANNER,
|
||||
BRANDING_GOVUK,
|
||||
EMAIL_TYPE,
|
||||
NOTIFICATION_CREATED,
|
||||
NOTIFICATION_TECHNICAL_FAILURE,
|
||||
NOTIFICATION_SENT,
|
||||
NOTIFICATION_SENDING
|
||||
@@ -55,7 +56,16 @@ def send_sms_to_provider(notification):
|
||||
if service.research_mode or notification.key_type == KEY_TYPE_TEST:
|
||||
notification.billable_units = 0
|
||||
update_notification(notification, provider)
|
||||
send_sms_response(provider.get_name(), str(notification.id), notification.to)
|
||||
try:
|
||||
send_sms_response(provider.get_name(), str(notification.id), notification.to)
|
||||
except:
|
||||
# when we retry, we only do anything if the notification is in created - it's currently in sending,
|
||||
# so set it back so that we actually attempt the callback again
|
||||
notification.sent_at = None
|
||||
notification.sent_by = None
|
||||
notification.status = NOTIFICATION_CREATED
|
||||
dao_update_notification(notification)
|
||||
raise
|
||||
else:
|
||||
try:
|
||||
provider.send_sms(
|
||||
|
||||
Reference in New Issue
Block a user